public static SettingEntries Load() { SettingEntries settings = new SettingEntries(); if (!File.Exists(Constants.SettingsFile)) { return(settings); } XmlSerializer serial = new XmlSerializer(settings.GetType()); settings = (SettingEntries)serial.Deserialize(new StreamReader(Constants.SettingsFile)); return(settings); }
public static bool Write(SettingEntries settings) { bool result = false; try { XmlSerializer serial = new XmlSerializer(settings.GetType()); serial.Serialize(new StreamWriter(Constants.SettingsFile), settings); result = true; } catch (IOException) { // TODO log or whatever } catch (Exception) { // TODO: Same } return(result); }