private void SetValue(SettingsPropertyValue propertyValue) { XmlNode targetNode = IsGlobal(propertyValue.Property) ? GlobalSettingsNode : LocalSettingsNode; XmlNode settingNode = targetNode.SelectSingleNode(string.Format("setting[@name='{0}']", propertyValue.Name)); if (settingNode != null) { settingNode.InnerText = propertyValue.SerializedValue.ToString(); } else { settingNode = RootDocument.CreateElement("setting"); XmlAttribute nameAttribute = RootDocument.CreateAttribute("name"); nameAttribute.Value = propertyValue.Name; settingNode.Attributes.Append(nameAttribute); settingNode.InnerText = propertyValue.SerializedValue.ToString(); targetNode.AppendChild(settingNode); } }
private XmlNode GetSettingsNode(string name) { XmlNode settingsNode = RootNode.SelectSingleNode(name); if (settingsNode == null) { settingsNode = RootDocument.CreateElement(name); RootNode.AppendChild(settingsNode); } return(settingsNode); }