コード例 #1
0
        public void LoadSettings()
        {
            Settings = new CSettings();
            if (!File.Exists(SettingsFileName))
            {
                return;
            }
            XmlSerializer xs = null;
            FileStream    fs = null;

            try
            {
                xs       = new XmlSerializer(typeof(CSettings));
                fs       = new FileStream(SettingsFileName, FileMode.Open);
                Settings = (CSettings)xs.Deserialize(fs);
            }
            catch (Exception e)
            {
                LogError(e.Message);
                Settings = new CSettings();
            }
            finally
            {
                if (fs != null)
                {
                    fs.Close();
                }
            }
        }
コード例 #2
0
 public void LoadSettings()
 {
     Settings = new CSettings();
     if (!File.Exists(SettingsFileName)) return;
     XmlSerializer xs = null;
     FileStream fs = null;
     try
     {
         xs = new XmlSerializer(typeof(CSettings));
         fs = new FileStream(SettingsFileName, FileMode.Open);
         Settings = (CSettings)xs.Deserialize(fs);
     }
     catch (Exception e)
     {
         LogError(e.Message);
         Settings = new CSettings();
     }
     finally
     {
         if (fs != null) fs.Close();
     }
 }