Exemplo n.º 1
0
        /// <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);
        }
Exemplo n.º 2
0
        /// <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);
        }
Exemplo n.º 3
0
        /// <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);
            }
        }
Exemplo n.º 4
0
        /// <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);
            }
        }
Exemplo n.º 5
0
        /// <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);
        }
Exemplo n.º 6
0
        /// <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;
        }