Example #1
0
        private void Load(string configName)
        {
            if (!File.Exists(configName))
            {
                throw new ConfigurationException($"Configuration file not found: {configName}");
            }

            _filename = configName;
            _doc      = new XmlDocument();
            _doc.Load(configName);
            _section = new AppConfigSection(this, _doc.DocumentElement);
        }
Example #2
0
 public AppConfig()
 {
     if (File.Exists("app.config"))
     {
         Load("app.config");
     }
     else
     {
         _filename = "app.config";
         _doc      = new XmlDocument();
         var root = _doc.CreateElement("configuration");
         _doc.AppendChild(root);
         _section = new AppConfigSection(this, _doc.DocumentElement);
     }
 }