// ********************************************************************** public static void LoadUserConfig(string fn) { try { using (Stream fs = File.OpenRead(fn)) { XmlSerializer xs = new XmlSerializer(typeof(UserSettings35)); u = (UserSettings35)xs.Deserialize(fs); } Reinit(); } catch (Exception e) { if (!(u == null && e is FileNotFoundException)) { PredictFXChartsMain.ShowMessage("Ошибка загрузки конфигурационного файла:\n" + e.Message + "\nИспользованы исходные настройки."); } if (u == null) { u = new UserSettings35(); Reinit(); } } }
// ********************************************************************** // * User config methods * // ********************************************************************** public static void SaveUserConfig(string fn) { try { using (Stream fs = new FileStream(fn, FileMode.Create, FileAccess.Write, FileShare.Read)) { XmlSerializer xs = new XmlSerializer(typeof(UserSettings35)); xs.Serialize(fs, u); } } catch (Exception e) { PredictFXChartsMain.ShowMessage("Ошибка сохранения конфигурационного файла:\n" + e.Message); } }