Пример #1
0
        /// <summary>
        /// Read a boolean setting.
        /// </summary>
        public static bool getBool(string key, bool def)
        {
            string defString = def.ToString();
            string valString = "";
            bool   value     = false;

            valString = PrefIO.getString(key, defString);

            if (valString.ToLower() == "true")
            {
                value = true;
            }

            return(value);
        }
Пример #2
0
        /// <summary>
        /// Read a float setting.
        /// </summary>
        public static float getFloat(string key, float def)
        {
            string defString = def.ToString();
            string valString = "";
            float  value     = 0;

            valString = PrefIO.getString(key, defString);

            try
            {
                value = (float)UtilsLang.toDouble(valString);
            }
            catch
            {
                value = def;
            }

            return(value);
        }
Пример #3
0
        /// <summary>
        /// Read an integer setting.
        /// </summary>
        public static int getInt(string key, int def)
        {
            string defString = def.ToString();
            string valString = "";
            int    value     = 0;

            valString = PrefIO.getString(key, defString);

            try
            {
                value = Int32.Parse(valString);
            }
            catch
            {
                value = def;
            }

            return(value);
        }