Exemplo n.º 1
0
        private void newSurvivor(object sender, EventArgs e)
        {
            NewSurvivor newSurvivor = new NewSurvivor();

            newSurvivor.ShowDialog();
            if (!newSurvivor.Confirm)
            {
                return;
            }
            curSurv = new Survivor(newSurvivor.NewName, newSurvivor.IsBoy);
            redrawScreen();
        }
Exemplo n.º 2
0
        private void loadSurvivor(object sender, EventArgs e)
        {
            LoadSurvivor loadSurvivor = new LoadSurvivor();

            loadSurvivor.ShowDialog();
            if (!loadSurvivor.Confirm)
            {
                return;
            }
            curSurv = Survivor.LoadSurvivor(loadSurvivor.LoadName);
            if (curSurv == null)
            {
                MessageBox.Show("Failed Loading.");
                return;
            }
            redrawScreen();
            MessageBox.Show("Successfuly Loaded");
        }
Exemplo n.º 3
0
        static public Survivor LoadSurvivor(string surName)
        {
            string fileName = surName + ".lantern";

            if (string.IsNullOrEmpty(fileName))
            {
                return(null);
            }

            Survivor objectOut = null;

            try
            {
                string attributeXml = string.Empty;

                XmlDocument xmlDocument = new XmlDocument();
                xmlDocument.Load(fileName);
                string xmlString = xmlDocument.OuterXml;

                using (StringReader read = new StringReader(xmlString))
                {
                    Type outType = typeof(Survivor);

                    XmlSerializer serializer = new XmlSerializer(outType);
                    using (XmlReader reader = new XmlTextReader(read))
                    {
                        objectOut = (Survivor)serializer.Deserialize(reader);
                        reader.Close();
                    }

                    read.Close();
                }
            }
            catch (Exception ex)
            {
            }
            return(objectOut);
        }
Exemplo n.º 4
0
 private void newSurvivor(object sender, EventArgs e)
 {
     NewSurvivor newSurvivor = new NewSurvivor();
     newSurvivor.ShowDialog();
     if (!newSurvivor.Confirm) return;
     curSurv = new Survivor(newSurvivor.NewName, newSurvivor.IsBoy);
     redrawScreen();
 }
Exemplo n.º 5
0
 private void loadSurvivor(object sender, EventArgs e)
 {
     LoadSurvivor loadSurvivor = new LoadSurvivor();
     loadSurvivor.ShowDialog();
     if (!loadSurvivor.Confirm) return;
     curSurv = Survivor.LoadSurvivor(loadSurvivor.LoadName);
     if (curSurv == null)
     {
         MessageBox.Show("Failed Loading.");
         return;
     }
     redrawScreen();
     MessageBox.Show("Successfuly Loaded");
 }