public bool Load() { TextReader textReader = null; bool ok = true; try{ XmlSerializer deserializer = new XmlSerializer(typeof(EmailSettings)); textReader = new StreamReader (SettingsFileName); Object obj = deserializer.Deserialize (textReader); var loadSettings = (EmailSettings)obj; textReader.Close (); UserSettings = loadSettings.UserSettings; } catch(Exception e) { Console.WriteLine(e.Message); ok = false; } if(textReader!= null) textReader.Close(); return ok; }
public EmailSettings() { SettingsFileName = "EmailSettings.xml"; UserSettings = new UserSettings(); }