public void AddSetting(XmlSettingsItem value) { if (this.Items == null) { this.Items = new Dictionary <string, XmlSettingsItem>(); } if (this.Items.ContainsKey(value.Key)) { this.Items.Remove(value.Key); } this.Items.Add(value.Key, value); }
public string GetString(string key, string defaultValue) { if (this.Values == null) { return(defaultValue); } else if (!this.Values.ContainsKey(key)) { return(defaultValue); } XmlSettingsItem item = this.Values[key] as XmlSettingsItem; return(item != null ? item.Value : defaultValue); }
public XmlSettingsItem(XmlElement node) { XmlSettingsItem subitem; this.Key = node.GetAttribute("key"); this.Value = node.GetAttribute("value"); if (node.SelectNodes("Value").Count > 0) { this.Items = new Dictionary <string, XmlSettingsItem>(); foreach (XmlNode xnode in node.SelectNodes("Value")) { subitem = new XmlSettingsItem((XmlElement)xnode); this.Items.Add(subitem.Key, subitem); } } }
public void AddSetting(string key, bool value) { XmlSettingsItem item = new XmlSettingsItem(key, value ? "1" : "0"); AddSetting(item); }
public void AddSetting(string key, long value) { XmlSettingsItem item = new XmlSettingsItem(key, value.ToString()); AddSetting(item); }