Exemplo n.º 1
0
 ///<summary>Get this configuration set from a specific config file</summary>
 public static ConfigData Open(string path)
 {
     if (instance == null)
     {
         if (path.EndsWith(".config", StringComparison.InvariantCultureIgnoreCase))
             spath = path.Remove(path.Length - 7);
         else
             spath = path;
         Configuration config = ConfigurationManager.OpenExeConfiguration(spath);
         if (config.Sections["ConfigData"] == null)
         {
             instance = new ConfigData();
             config.Sections.Add("ConfigData", instance);
             config.Save(ConfigurationSaveMode.Modified);
         }
         else
             instance = (ConfigData)config.Sections["ConfigData"];
     }
     return instance;
 }
Exemplo n.º 2
0
 ///<summary>Create a full copy of the current properties</summary>
 public ConfigData Copy()
 {
     ConfigData copy = new ConfigData();
     copy._configs = (XmlDocument)this._configs.Clone();
     return copy;
 }