public static void Set(String option, bool Enable) { if (m_options.ContainsKey(option)) { m_options[option] = Enable; } else { m_options.Add(option, Enable); } Save(); }
public static OptionDictionary Parse(String xDocString) { XmlDocument xDoc = new XmlDocument(); xDoc.LoadXml(xDocString); OptionDictionary options = new OptionDictionary(); XPathNavigator nav = xDoc.CreateNavigator(); XPathNodeIterator iter = nav.Select("root/item"); while (iter.MoveNext()) { String key = iter.Current.GetAttribute("key", ""); bool value = bool.Parse(iter.Current.GetAttribute("value", "")); if (!options.ContainsKey(key)) //ignoring duplicates { options.Add(key, value); } } return(options); }