示例#1
0
    public int toInt()
    {
        if (null != obj && obj.GetType() == typeof(string))
        {
            return(int.Parse(obj.ToString()));
        }

        return(JSONTools.ReadInt(obj));
    }
示例#2
0
    public static int ReadInt(Dictionary <string, object> inDict, string inIntName, int inDefaultValue = DefaultInt)
    {
        int returnVal = inDefaultValue;

        if (inDict.ContainsKey(inIntName) == true)
        {
            returnVal = JSONTools.ReadInt(inDict[inIntName]);
        }

        return(returnVal);
    }
示例#3
0
    public static bool ReadIntList(Dictionary <string, object> inDict, string inVariableName, ref List <int> refValue)
    {
        if (inDict.ContainsKey(inVariableName) == true)
        {
            if (refValue == null)
            {
                refValue = new List <int>();
            }

            IList tempList = inDict[inVariableName] as IList;
            for (int itemIdx = 0; itemIdx < tempList.Count; itemIdx++)
            {
                int readValue = JSONTools.ReadInt(tempList[itemIdx]);
                refValue.Add(readValue);
            }
            return(true);
        }

        return(false);
    }