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(); }
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"); }
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); }
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(); }
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"); }