RPS.Config.getPersistantBool C# (CSharp) Method

getPersistantBool() public method

public getPersistantBool ( string key ) : bool
key string
return bool
        public bool getPersistantBool(string key)
        {
            if (!this.persistant.ContainsKey(key)) throw new KeyNotFoundException(key);
            if (this.persistant[key].GetType() == typeof(bool)) {
                return (bool)this.persistant[key];
            }
            switch (Convert.ToString(this.persistant[key])) {
                case "True": case "true": case "1":
                    return true;
                break;
                case "False": case "false": case "0":
                    return false;
                break;
            }
            throw new Exception("Can't cast keys '" + key + "' value " + this.persistant[key] + key + " to boolean");
        }