/// <summary> /// Loads all keys for a config. /// </summary> private void LoadKeys(XmlNode rootNode, ConfigBase config) { var 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); } } }
/// <summary> /// Loads all keys for a config. /// </summary> private void LoadKeys(XmlNode node, ConfigBase config) { foreach (XmlNode child in node.ChildNodes) { if (child.NodeType == XmlNodeType.Element && child.Name == "Key") { config.Add(child.Attributes["Name"].Value, child.Attributes["Value"].Value); } } }
/// <summary> /// Loads a collection class. /// </summary> private void LoadCollection(string name, NameValueCollection collection) { var config = new ConfigBase(name, this); if (collection == null) { throw new ArgumentException("Section was not found"); } for (var i = 0; i < collection.Count; i++) { config.Add(collection.Keys[i], collection[i]); } Configs.Add(config); }
/// <summary> /// Loads a collection class. /// </summary> private void LoadCollection(string name, NameValueCollection collection) { var config = new ConfigBase(name, this); if(collection == null) throw new ArgumentException("Section was not found"); for(var i = 0; i < collection.Count; i++) { config.Add(collection.Keys[i], collection[i]); } Configs.Add(config); }
/// <summary> /// Loads all keys for a config. /// </summary> private void LoadKeys(XmlNode rootNode, ConfigBase config) { var 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); } } }
/// <summary> /// Loads all keys for a config. /// </summary> private void LoadKeys(XmlNode node, ConfigBase config) { foreach(XmlNode child in node.ChildNodes) { if(child.NodeType == XmlNodeType.Element && child.Name == "Key") { config.Add(child.Attributes["Name"].Value, child.Attributes["Value"].Value); } } }