Esempio n. 1
0
        public void Load()
        {
            XmlSerializer SerializerObj = new XmlSerializer(typeof(MyAppSettings));
            string        filename      = GetSettingsFilename();

            if (File.Exists(filename))
            {
                try
                {
                    // Create a new file stream for reading the XML file
                    FileStream ReadFileStream = new FileStream(filename, FileMode.Open, FileAccess.Read, FileShare.Read);

                    // Load the object saved above by using the Deserialize function
                    _settings = (MyAppSettings)SerializerObj.Deserialize(ReadFileStream);

                    // Cleanup
                    ReadFileStream.Close();
                }
                catch (Exception)
                {
                }
            }
        }
Esempio n. 2
0
 public MySettings()
 {
     _settings = new MyAppSettings();
 }