예제 #1
0
        /// <summary>
        /// Loads all keys for a config.
        /// </summary>
        private void LoadKeys(XmlNode rootNode, ConfigBase config)
        {
            XmlNode section = GetChildElement(rootNode, config.Name);

            foreach (XmlNode node in section.ChildNodes)
            {
                if (node.NodeType == XmlNodeType.Element &&
                    node.Name == "add")
                {
                    config.Add(node.Attributes["key"].Value,
                               node.Attributes["value"].Value);
                }
            }
        }
예제 #2
0
        /// <summary>
        /// Loads a collection class.
        /// </summary>
        private void LoadCollection(string name, NameValueCollection collection)
        {
            ConfigBase config = new ConfigBase(name, this);

            if (collection == null)
            {
                throw new ArgumentException("Section was not found");
            }

            if (collection != null)
            {
                for (int i = 0; i < collection.Count; i++)
                {
                    config.Add(collection.Keys[i], collection[i]);
                }

                this.Configs.Add(config);
            }
        }