Exemplo n.º 1
0
        // **********************************************************************

        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();
                }
            }
        }
Exemplo n.º 2
0
        // **********************************************************************
        // *                             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);
        }