/// <summary> /// Registers an individual section configurator and add it to the internal collection /// </summary> /// <param name="nodeConfig">The section configurator to register.</param> public void RegisterSectionRewire(INodeConfigRewireBase nodeConfig) { if (nodeConfig == null) { throw new ArgumentNullException("nodeConfig"); } this.sectionConfigurators.Add(nodeConfig.GetType().GetHashCode(), nodeConfig); }
/// <summary> /// creates a new xml node corresponding to a new section /// </summary> /// <param name="nodeConfig">the configuration info of the new section</param> /// <returns>the corresponding xml node</returns> public IXPathNavigable CreateNewSection(INodeConfigRewireBase nodeConfig) { if (nodeConfig == null) { throw new ArgumentNullException("nodeConfig"); } XmlNode newConfigNode = this.xmlConfigRoot.CreateNode(XmlNodeType.Element, nodeConfig.ConfigSectionName, null); return(newConfigNode); }
/// <summary> /// Calls an individual configurator to rewire itself /// </summary> /// <param name="node">The configurator.</param> private void RewireIndividualSection(INodeConfigRewireBase node) { XmlNode firstParent = this.xmlConfigRoot.SelectSingleNode(this.rootConfigNode).SelectSingleNode(this.configParents[node.ConfigParent]); XmlNode oldConfig = firstParent.SelectSingleNode(node.ConfigSectionName); XmlNode newConfig = (XmlNode)node.RewireConfig(oldConfig, true); XPathNavigator nav = firstParent.CreateNavigator(); if (oldConfig == null) { nav.AppendChild(newConfig.CreateNavigator()); } else { firstParent.ReplaceChild(newConfig, oldConfig); } }
/// <summary> /// creates a new xml node corresponding to a new section /// </summary> /// <param name="nodeConfig">the configuration info of the new section</param> /// <returns>the corresponding xml node</returns> public IXPathNavigable CreateNewSection(INodeConfigRewireBase nodeConfig) { if (nodeConfig == null) { throw new ArgumentNullException("nodeConfig"); } XmlNode newConfigNode = this.xmlConfigRoot.CreateNode(XmlNodeType.Element, nodeConfig.ConfigSectionName, null); return newConfigNode; }