Beispiel #1
0
        public string GetValue(string name, string defaultValue)
        {
            var valuePath = getValuePath(name);

            if (XMLUtil.NodeExists(root, valuePath) == false)
            {
                return(defaultValue);
            }
            else
            {
                return(XMLUtil.GetNodeValue(root, valuePath));
            }
        }
Beispiel #2
0
        public string GetValue(string name)
        {
            var valuePath = getValuePath(name);

            if (XMLUtil.NodeExists(root, valuePath) == false)
            {
                valuePath = getValuePath("Util_" + name);
                if (XMLUtil.NodeExists(root, valuePath) == false)
                {
                    return(string.Empty);
                }
            }
            return(XMLUtil.GetNodeValue(root, valuePath));
        }
Beispiel #3
0
        public System.Drawing.Color GetValue(string name, System.Drawing.Color defaultColor)
        {
            var valuePath = getValuePath(name);

            if (XMLUtil.NodeExists(root, valuePath) == false)
            {
                return(defaultColor);
            }
            else
            {
                var val = XMLUtil.GetNodeValue(root, valuePath);

                int i;
                if (string.IsNullOrEmpty(val) || int.TryParse(val, out i) == false)
                {
                    return(defaultColor);
                }
                else
                {
                    return(System.Drawing.Color.FromArgb(i));
                }
            }
        }
Beispiel #4
0
        public int GetValueInt(string name, int defaultValue)
        {
            var i = defaultValue;

            var valuePath = getValuePath(name);

            if (XMLUtil.NodeExists(root, valuePath) == false)
            {
                valuePath = getValuePath("Util_" + name);
                if (XMLUtil.NodeExists(root, valuePath) == false)
                {
                    return(defaultValue);
                }
            }

            var r = XMLUtil.GetNodeValue(root, valuePath);

            if (string.IsNullOrEmpty(r) || int.TryParse(r, out i) == false)
            {
                i = defaultValue;
            }
            return(i);
        }
Beispiel #5
0
        public bool GetValueBool(string name, bool defaultValue)
        {
            var valuePath = getValuePath(name);

            if (XMLUtil.NodeExists(root, valuePath) == false)
            {
                valuePath = getValuePath("Util_" + name);
                if (XMLUtil.NodeExists(root, valuePath) == false)
                {
                    return(defaultValue);
                }
            }
            var  v = XMLUtil.GetNodeValue(root, valuePath);
            bool bret;

            if (string.IsNullOrEmpty(v) || bool.TryParse(v, out bret) == false)
            {
                return(defaultValue);
            }
            else
            {
                return(bret);
            }
        }
Beispiel #6
0
        public string GetDefaultSettingValue(string name)
        {
            var valuePath = getValuePath(name);

            return(XMLUtil.GetNodeValue(defaultroot, valuePath));
        }