Example #1
0
        protected static object parseValue(char[] json, ref int index, ref bool success)
        {
            switch (MUJson.lookAhead(json, index))
            {
            case 1:
                return(MUJson.parseObject(json, ref index));

            case 3:
                return(MUJson.parseArray(json, ref index));

            case 7:
                return(MUJson.parseString(json, ref index));

            case 8:
                return(MUJson.parseNumber(json, ref index));

            case 9:
                MUJson.nextToken(json, ref index);
                return(bool.Parse("TRUE"));

            case 10:
                MUJson.nextToken(json, ref index);
                return(bool.Parse("FALSE"));

            case 11:
                MUJson.nextToken(json, ref index);
                return(null);
            }
            success = false;
            return(null);
        }
Example #2
0
        protected static Hashtable parseObject(char[] json, ref int index)
        {
            Hashtable hashtable = new Hashtable();

            MUJson.nextToken(json, ref index);
            bool flag = false;

            while (!flag)
            {
                int num = MUJson.lookAhead(json, index);
                if (num == 0)
                {
                    return(null);
                }
                if (num == 6)
                {
                    MUJson.nextToken(json, ref index);
                }
                else
                {
                    if (num == 2)
                    {
                        MUJson.nextToken(json, ref index);
                        return(hashtable);
                    }
                    string text = MUJson.parseString(json, ref index);
                    if (text == null)
                    {
                        return(null);
                    }
                    num = MUJson.nextToken(json, ref index);
                    if (num != 5)
                    {
                        return(null);
                    }
                    bool   flag2 = true;
                    object value = MUJson.parseValue(json, ref index, ref flag2);
                    if (!flag2)
                    {
                        return(null);
                    }
                    hashtable[text] = value;
                }
            }
            return(hashtable);
        }