// ********************************************************************** 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(); } } }
// ********************************************************************** // * Constructor * // ********************************************************************** static cfg() { // ------------------------------------------------------------ Version ver = Assembly.GetExecutingAssembly().GetName().Version; FullProgName = ProgName + " " + ver.Major.ToString() + "." + ver.Minor.ToString(); // ------------------------------------------------------------ ExecFile = Assembly.GetExecutingAssembly().Location; string fs = ExecFile.Remove(ExecFile.LastIndexOf('.') + 1); UserCfgFile = fs + UserCfgFileExt; StatCfgFile = fs + "sc"; // ------------------------------------------------------------ BaseCulture = (CultureInfo)CultureInfo.CurrentCulture.Clone(); BaseCulture.NumberFormat.NumberDecimalDigits = 0; PriceFormat = (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone(); // ------------------------------------------------------------ #if DEBUG u = new UserSettings35(); Reinit(); #endif // ------------------------------------------------------------ }
// ********************************************************************** // * Clone() * // ********************************************************************** public UserSettings35 Clone() { UserSettings35 u = (UserSettings35)MemberwiseClone(); return(u); }