public static Settings Load() { Settings settings = new Settings(); if (!Directory.Exists(Path.GetDirectoryName(ConfigFile))) { Directory.CreateDirectory(Path.GetDirectoryName(ConfigFile)); } if (File.Exists(ConfigFile)) { XmlSerializer mySerializer = new XmlSerializer(typeof(Settings)); FileStream myFileStream = new FileStream(ConfigFile, FileMode.Open); settings = (Settings)mySerializer.Deserialize(myFileStream); myFileStream.Close(); } else { settings.Save(); } return settings; }
public SettingsForm() { InitializeComponent(); Settings = new Settings(); }