Inheritance: IInternalConfigSystem
Beispiel #1
0
        /// <summary>
        /// Initialize explicitly the configuration manager with the specified file.
        /// </summary>
        /// <param name="exePath"></param>
        public static void Initialize(string exePath)
        {
            if (string.IsNullOrEmpty(exePath))
            {
                throw new ArgumentException("A valid path must be supplied", "exePath");
            }
            if (!Path.IsPathRooted(exePath))
            {
                exePath = Path.GetFullPath(exePath);
            }
            if (!File.Exists(exePath))
            {
                Exception cause = new ArgumentException("The specified path does not exist.", "exePath");
                throw new ConfigurationErrorsException("Error Initializing the configuration system:", cause);
            }

            if (!exePath.EndsWith(".config"))
            {
                exePath += ".config";
            }

            ConfigurationSystem = new ClientConfigurationSystem(exePath);
        }
Beispiel #2
0
 /// <summary>
 /// Reset the configuration manager to its original state prior to Initialize().
 /// </summary>
 public static void Reset()
 {
     ConfigurationSystem = new ClientConfigurationSystem();
 }