Beispiel #1
0
    public string                                  GetString(string Key, string Default = "")
    {
        cLineValue pLineValue = null;

        if ((pLineValue = GetLineValue(Key)) != null)
        {
            if (pLineValue.Type() == ( byte )LineValueType.SINGLE)
            {
                return(pLineValue.GetValue().ToString());
            }
        }
        return(Default);
    }
Beispiel #2
0
    public float                                   GetFloat(string Key, float Default = 0.0f)
    {
        cLineValue pLineValue = null;

        if ((pLineValue = GetLineValue(Key)) != null)
        {
            if (pLineValue.Type() == ( byte )LineValueType.SINGLE)
            {
                return(pLineValue.GetValue().ToFloat());
            }
        }
        return(Default);
    }
Beispiel #3
0
    public int                                             GetInt(string Key, int Default = 0)
    {
        cLineValue pLineValue = null;

        if ((pLineValue = GetLineValue(Key)) != null)
        {
            if (pLineValue.Type() == ( byte )LineValueType.SINGLE)
            {
                return(pLineValue.GetValue().ToInteger());
            }
        }
        return(Default);
    }
Beispiel #4
0
    public bool                                    GetBool(string Key, bool Default = false)
    {
        cLineValue pLineValue = null;

        if ((pLineValue = GetLineValue(Key)) != null)
        {
            if (pLineValue.Type() == ( byte )LineValueType.SINGLE)
            {
                return(pLineValue.GetValue().ToBool());
            }
        }
        return(Default);
    }
Beispiel #5
0
    public bool                                    bGetString(string Key, out string Out, string Default = "")
    {
        cLineValue pLineValue = null;

        if ((pLineValue = GetLineValue(Key)) != null)
        {
            if (pLineValue.Type() == ( byte )LineValueType.SINGLE)
            {
                Out = pLineValue.GetValue().ToString();
                return(true);
            }
        }

        Out = Default;
        return(false);
    }
Beispiel #6
0
    public bool                                    bGetFloat(string Key, out float Out, float Default = 0.0f)
    {
        cLineValue pLineValue = null;

        if ((pLineValue = GetLineValue(Key)) != null)
        {
            if (pLineValue.Type() == ( byte )LineValueType.SINGLE)
            {
                Out = pLineValue.GetValue().ToFloat();
                return(true);
            }
        }

        Out = Default;
        return(false);
    }
Beispiel #7
0
    public bool                                    bGetInt(string Key, out int Out, int Default = 0)
    {
        cLineValue pLineValue = null;

        if ((pLineValue = GetLineValue(Key)) != null)
        {
            if (pLineValue.Type() == ( byte )LineValueType.SINGLE)
            {
                Out = pLineValue.GetValue().ToInteger();
                return(true);
            }
        }

        Out = Default;
        return(false);
    }
Beispiel #8
0
    public bool                                    bGetBool(string Key, out bool Out, bool Default = false)
    {
        cLineValue pLineValue = null;

        if ((pLineValue = GetLineValue(Key)) != null)
        {
            if (pLineValue.Type() == ( byte )LineValueType.SINGLE)
            {
                Out = pLineValue.GetValue().ToBool();
                return(true);
            }
        }

        Out = Default;
        return(false);
    }
Beispiel #9
0
    // Return the type of a value assigned to a key, or -1
    public int                                             KeyType(string Key)
    {
        if (vSection.Count < 1)
        {
            return(-1);
        }

        cLineValue pLineValue = null; cValue Value = null;

        if ((pLineValue = GetLineValue(Key)) != null)
        {
            int iType = pLineValue.Type();
            switch (iType)
            {
            case ( byte )LineValueType.SINGLE: {
                if ((Value = pLineValue.GetValue()) != null)
                {
                    return(Value.Type());
                }
                Debug.LogError("cSection::KeyType:WARNING! In section " + sName + " a key has no value but designed as SINGLE !!!");
                break;
            }

            case ( byte )LineValueType.MULTI: {
                if ((pLineValue.GetMultiValue() != null))
                {
                    return(iType);
                }
                Debug.LogError("cSection::KeyType:WARNING! In section " + sName + " a key has no value but designed as MULTI !!!");
                break;
            }
            }
        }

        return(-1);
    }