コード例 #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ConfigurationFile"/> class.
        /// </summary>
        internal ConfigurationFile(string configFilePath)
        {
            m_culture = CultureInfo.InvariantCulture;

            // Do not run the save operation on a background thread since the application may be
            // performing the save as a final step during shutdown and the save operation must
            // complete, incomplete saves can cause a zero length config file to be created.
            m_saveOperation = new LongSynchronizedOperation(ExecuteConfigurationSave)
            {
                IsBackground = false
            };

            m_configuration = GetConfiguration(configFilePath);

            if (m_configuration.HasFile && File.Exists(m_configuration.FilePath))
            {
                ValidateConfigurationFile(m_configuration.FilePath);
            }
            else
            {
                CreateConfigurationFile(m_configuration.FilePath);
            }

            m_configuration     = GetConfiguration(configFilePath);
            m_userConfiguration = new UserConfigurationFile();
        }
コード例 #2
0
        /// <summary>
        /// Restores all the default settings for <see cref="SettingScope.User"/> scoped settings.
        /// </summary>
        public void RestoreDefaultUserSettings()
        {
            if ((object)m_userConfiguration != null)
            {
                string fileName = m_userConfiguration.FileName;

                if (File.Exists(fileName))
                {
                    File.Delete(fileName);
                }

                m_userConfiguration = new UserConfigurationFile();
            }
        }
コード例 #3
0
 /// <summary>
 /// Reloads the current configuration settings from the configuration file that the <see cref="ConfigurationFile"/> represents.
 /// </summary>
 public void Reload()
 {
     m_configuration     = GetConfiguration(m_configuration.FilePath);
     m_userConfiguration = new UserConfigurationFile();
 }
コード例 #4
0
ファイル: ConfigurationFile.cs プロジェクト: avs009/gsf
        /// <summary>
        /// Initializes a new instance of the <see cref="ConfigurationFile"/> class.
        /// </summary>        
        internal ConfigurationFile(string configFilePath)
        {
            m_configuration = GetConfiguration(configFilePath);
            if (m_configuration.HasFile)
                ValidateConfigurationFile(m_configuration.FilePath);
            else
                CreateConfigurationFile(m_configuration.FilePath);

            m_configuration = GetConfiguration(configFilePath);
            m_userConfiguration = new UserConfigurationFile();
        }
コード例 #5
0
        /// <summary>
        /// Restores all the default settings for <see cref="SettingScope.User"/> scoped settings.
        /// </summary>
        public void RestoreDefaultUserSettings()
        {
            if ((object)m_userConfiguration != null)
            {
                string fileName = m_userConfiguration.FileName;

                if (File.Exists(fileName))
                    File.Delete(fileName);

                m_userConfiguration = new UserConfigurationFile();
            }
        }
コード例 #6
0
 /// <summary>
 /// Reloads the current configuration settings from the configuration file that the <see cref="ConfigurationFile"/> represents.
 /// </summary>
 public void Reload()
 {
     m_configuration = GetConfiguration(m_configuration.FilePath);
     m_userConfiguration = new UserConfigurationFile();
 }
コード例 #7
0
        /// <summary>
        /// Initializes a new instance of the <see cref="ConfigurationFile"/> class.
        /// </summary>        
        internal ConfigurationFile(string configFilePath)
        {
            m_culture = CultureInfo.InvariantCulture;

            // Do not run the save operation on a background thread since the application may be
            // performing the save as a final step during shutdown and the save operation must
            // complete, incomplete saves can cause a zero length config file to be created.
            m_saveOperation = new LongSynchronizedOperation(ExecuteConfigurationSave)
            {
                IsBackground = false
            };

            m_configuration = GetConfiguration(configFilePath);

            if (m_configuration.HasFile && File.Exists(m_configuration.FilePath))
                ValidateConfigurationFile(m_configuration.FilePath);
            else
                CreateConfigurationFile(m_configuration.FilePath);

            m_configuration = GetConfiguration(configFilePath);
            m_userConfiguration = new UserConfigurationFile();
        }
コード例 #8
0
ファイル: ConfigurationFile.cs プロジェクト: avs009/gsf
        /// <summary>
        /// Initializes a new instance of the <see cref="ConfigurationFile"/> class.
        /// </summary>        
        internal ConfigurationFile(string configFilePath)
        {
            m_culture = CultureInfo.InvariantCulture;
            m_queuedConfigurationSavePending = new object();
            m_configurationSaveComplete = new AutoResetEvent(true);

            m_configuration = GetConfiguration(configFilePath);

            if (m_configuration.HasFile)
                ValidateConfigurationFile(m_configuration.FilePath);
            else
                CreateConfigurationFile(m_configuration.FilePath);

            m_configuration = GetConfiguration(configFilePath);
            m_userConfiguration = new UserConfigurationFile();
        }