Esempio n. 1
0
        public void GetLocaSettings(string myConfigFileName)
        {
            if (!File.Exists(myConfigFileName))
            {
                return;
            }

            XmlSerializer mySerializer = new XmlSerializer(typeof(GlobalLocalSettingsSource));

            //XmlSerializer mySerializer4 = new XmlSerializer(typeof(GlobalLocalSettingsSource));

            using (StreamReader myXmlReader = new StreamReader(myConfigFileName))
            {
                try
                {
                    GlobalLocalSettingsSource dbConfigClass = (GlobalLocalSettingsSource)mySerializer.Deserialize(myXmlReader);
                    //GlobalLocalSettingsSource globalLocalSettingsSource = (GlobalLocalSettingsSource)mySerializer4.Deserialize(myXmlReader);

                    GlobalLocalSettings = dbConfigClass;
                }
                catch (Exception e)
                {
                    MessageBox.Show("Ошибка при загрузке конфигурации программы\n" + e.ToString());
                }
            }
        }
Esempio n. 2
0
        public void GetLocaSettings(string myConfigFileName)
        {
            if (!File.Exists(myConfigFileName))
            {
                return;
            }

            XmlSerializer mySerializer = new XmlSerializer(typeof(GlobalLocalSettingsSource));

            //XmlSerializer mySerializer4 = new XmlSerializer(typeof(GlobalLocalSettingsSource));

            using (StreamReader myXmlReader = new StreamReader(myConfigFileName))
            {
                try
                {
                    GlobalLocalSettingsSource dbConfigClass = (GlobalLocalSettingsSource)mySerializer.Deserialize(myXmlReader);
                    //GlobalLocalSettingsSource globalLocalSettingsSource = (GlobalLocalSettingsSource)mySerializer4.Deserialize(myXmlReader);

                    GlobalLocalSettings = dbConfigClass;


                    ConnectionDbString = "User=SYSDBA; Password=masterkey; " +
                                         "DataBase=" + GlobalLocalSettings.DbAlias + "; " +
                                         "Server=" + GlobalLocalSettings.DbServerName + "; " +
                                         "Dialect=3; Charset=UTF8";
                }
                catch (Exception e)
                {
                    MessageBox.Show("Ошибка при загрузке конфигурации программы\n" + e.ToString());
                    ConnectionDbString = null;
                }
            }
        }