Пример #1
0
        public bool Set(string name, object val)
        {
            string s = Conversions.ToString(val);

            if (Get(name) == s)
            {
                return(false);
            }
            if (Options[name].Type == "text")
            {
                Set(name, s);
            }
            else if (Options[name].Type.StartsWith("choice:"))
            {
                Set(name, s);
            }
            else if (Options[name].Type.StartsWith("path_file"))
            {
                Set(name, s);
            }
            else if (Options[name].Type == "bool")
            {
                Set(name, Conversions.ToBool(s).ToString(CultureInfo.InvariantCulture));
            }
            else if (Options[name].Type == "int")
            {
                Set(name, Conversions.ToInt32(s).ToString(CultureInfo.InvariantCulture));
            }
            else if (Options[name].Type == "float")
            {
                Set(name, Conversions.ToFloat(s).ToString(CultureInfo.InvariantCulture));
            }
            return(true);
        }
Пример #2
0
        public static bool XmlGetAttributeBool(XmlNode node, string name, bool def)
        {
            XmlNode nodeAttr = node.Attributes[name];

            if (nodeAttr == null)
            {
                return(def);
            }
            else
            {
                return(Conversions.ToBool(nodeAttr.Value));
            }
        }
Пример #3
0
 public bool GetBool(string name)
 {
     return(Conversions.ToBool(Get(name)));
 }