예제 #1
0
        /// <summary>
        /// Load all program's settings
        /// </summary>
        public static void LoadSettings()
        {
            FileStream    fXMLSettingsFile;
            SettingsCover s  = new SettingsCover();
            SoapFormatter sf = new SoapFormatter();

            if (!File.Exists(Application.StartupPath + @"\Settings.xml"))
            {
                fXMLSettingsFile = new FileStream(Application.StartupPath + @"\Settings.xml", FileMode.Create, FileAccess.Write);

                sf.Serialize(fXMLSettingsFile, s);
                fXMLSettingsFile.Close();
            }

            fXMLSettingsFile = new FileStream(Application.StartupPath + @"\Settings.xml", FileMode.Open, FileAccess.Read);
            s = (SettingsCover)sf.Deserialize(fXMLSettingsFile);

            s.UpdateGlobalSettings(true);
        }
예제 #2
0
        /// <summary>
        /// Saves program's settings to XML file
        /// </summary>
        public static void SaveSettings()
        {
            try
            {
                FileStream    fXMLSettingsFile;
                SettingsCover s = new SettingsCover();
                s.UpdateGlobalSettings(false);

                fXMLSettingsFile = new FileStream(Application.StartupPath + @"\Settings.xml", FileMode.Create, FileAccess.Write);


                SoapFormatter sf = new SoapFormatter();
                sf.Serialize(fXMLSettingsFile, s);
                fXMLSettingsFile.Close();
                _bSettingSaved = true;
            }
            catch
            {
                _bSettingSaved = false;
            }
        }