AccidentalFish.ApplicationSupport.Powershell.ConfigAppliers.CsdefConfigurationApplier.ApplyConfigSetting C# (CSharp) Method

ApplyConfigSetting() private method

private ApplyConfigSetting ( System.Xml.Linq.XElement configurationSettings, string key ) : void
configurationSettings System.Xml.Linq.XElement
key string
return void
        private void ApplyConfigSetting(XElement configurationSettings, string key)
        {
            XNamespace ns = CsdefNamespace;
            XmlNamespaceManager namespaceManager = new XmlNamespaceManager(new NameTable());
            namespaceManager.AddNamespace("csdef", CsdefNamespace);
            string xpath = String.Format("csdef:Setting[@name='{0}']", key);
            XElement appSetting = configurationSettings.XPathSelectElement(xpath, namespaceManager);
            if (appSetting == null)
            {
                appSetting = new XElement(ns + "Setting", new XAttribute("name", key));
                configurationSettings.Add(appSetting);
            }
        }
    }