コード例 #1
0
        public void LoadSettingsFromFile()
        {
            FileStream fs;
            try
            {
                fs = new FileStream(settingsFilePath, FileMode.Open);
            }
            catch (System.IO.FileNotFoundException)
            {
                return;
            }
            catch (System.IO.DirectoryNotFoundException)
            {
                return;
            }

            XmlSerializer ser = new XmlSerializer(typeof(Settings));
            singleton = (Settings)ser.Deserialize(fs);

            fs.Flush();
            fs.Close();
            fs.Dispose();
        }
コード例 #2
0
 public static Settings GetInstance()
 {
     if(singleton == null)
     {
         singleton = new Settings();
     }
     return singleton;
 }