Пример #1
0
        /// <summary>
        /// Loads settings from XML file.
        /// </summary>
        public void Load()
        {
            if (!File.Exists(this.settingsFullFilename))
            {
                // If configuration file doesn't exists then it is created with default values.
                this.Save();
            }

            var        serializer = new XmlSerializer(typeof(ConsoleSettings));
            TextReader reader     = new StreamReader(this.settingsFullFilename);

            try
            {
                this.Settings = serializer.Deserialize(reader) as ConsoleSettings;
            }
            finally
            {
                reader.Close();
            }
        }
        /// <summary>
        /// Loads settings from XML file.
        /// </summary>
        public void Load()
        {
            if (!File.Exists(this.settingsFullFilename))
            {
                // If configuration file doesn't exists then it is created with default values.
                this.Save();
            }

            var serializer = new XmlSerializer(typeof(ConsoleSettings));
            TextReader reader = new StreamReader(this.settingsFullFilename);
            try
            {
                this.Settings = serializer.Deserialize(reader) as ConsoleSettings;
            }
            finally
            {
                reader.Close();
            }
        }