示例#1
0
        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);
        }
示例#2
0
 public static bool IsEnabled(String option)
 {
     return(m_options.ContainsKey(option) && m_options[option]);
 }