Exemplo n.º 1
0
        /// <include file='ConfigCollection.xml' path='//Method[@name="AddName"]/docs/*' />
        public IConfig Add(string name)
        {
            ConfigBase result = null;

            if (this[name] == null) {
                result = new ConfigBase (name, owner);
                configList.Add (result);
                OnConfigAdded (new ConfigEventArgs (result));
            } else {
                throw new ArgumentException ("An IConfig of that name already exists");
            }

            return result;
        }
Exemplo n.º 2
0
        /// <summary>
        /// Merges the IniDocument into the Configs when the document is 
        /// reloaded.  
        /// </summary>
        private void MergeDocumentIntoConfigs()
        {
            // Remove all missing configs first
            RemoveConfigs ();

            IniSection section = null;
            for (int i = 0; i < iniDocument.Sections.Count; i++)
            {
                section = iniDocument.Sections[i];

                IConfig config = this.Configs[section.Name];
                if (config == null) {
                    // The section is new so add it
                    config = new ConfigBase (section.Name, this);
                    this.Configs.Add (config);
                }
                RemoveConfigKeys (config);
            }
        }