Beispiel #1
0
        // **********************************************************************

        public static void LoadStaticConfig()
        {
            if (File.Exists(StatCfgFile))
            {
                try
                {
                    using (Stream fs = File.OpenRead(StatCfgFile))
                    {
                        XmlSerializer xs = new XmlSerializer(typeof(StatSettings));
                        s = (StatSettings)xs.Deserialize(fs);
                    }
                }
                catch (Exception e)
                {
                    // Program.ShowMessage("Ошибка загрузки файла \'" + StatCfgFile + "\':\n"
                    //   + e.Message + "\n\nУдалите его или создайте вновь.", MessageBoxImage.Exclamation);

                    s = new StatSettings();
                }
            }
            else
            {
                s = new StatSettings();
            }
        }
Beispiel #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";

            AsmPath      = fs.Remove(fs.LastIndexOf('\\') + 1);
            TradeLogFile = fs + "trades." + TradeLogFileExt;

            // ------------------------------------------------------------

            BaseCulture = (CultureInfo)CultureInfo.CurrentCulture.Clone();
            BaseCulture.NumberFormat.NumberDecimalDigits = 0;

            PriceFormat = (NumberFormatInfo)NumberFormatInfo.CurrentInfo.Clone();

            // ------------------------------------------------------------

#if DEBUG
            s = new StatSettings();
            u = new UserSettings35();
            Reinit();
#endif

            // ------------------------------------------------------------
        }