Ejemplo n.º 1
0
 private static object JsonDecode(string json, ref bool success)
 {
     success = true;
     if (json != null)
     {
         char[] json2 = json.ToCharArray();
         int    num   = 0;
         return(JsonParser.ParseValue(json2, ref num, ref success));
     }
     return(null);
 }
Ejemplo n.º 2
0
        private static object JsonDecode(string json, ref bool success)
        {
            success = true;
            if (json == null)
            {
                return((object)null);
            }
            char[] charArray = json.ToCharArray();
            int    index     = 0;

            return(JsonParser.ParseValue(charArray, ref index, ref success));
        }
Ejemplo n.º 3
0
        protected static Dictionary <string, object> ParseObject(char[] json, ref int index, ref bool success)
        {
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            JsonParser.NextToken(json, ref index);
            bool flag = false;

            while (!flag)
            {
                int num = JsonParser.LookAhead(json, index);
                if (num == 0)
                {
                    success = false;
                    return(null);
                }
                if (num == 6)
                {
                    JsonParser.NextToken(json, ref index);
                }
                else
                {
                    if (num == 2)
                    {
                        JsonParser.NextToken(json, ref index);
                        return(dictionary);
                    }
                    string key = JsonParser.ParseString(json, ref index, ref success);
                    if (!success)
                    {
                        success = false;
                        return(null);
                    }
                    num = JsonParser.NextToken(json, ref index);
                    if (num != 5)
                    {
                        success = false;
                        return(null);
                    }
                    object value = JsonParser.ParseValue(json, ref index, ref success);
                    if (!success)
                    {
                        success = false;
                        return(null);
                    }
                    dictionary[key] = value;
                }
            }
            return(dictionary);
        }
Ejemplo n.º 4
0
        protected static Dictionary <string, object> ParseObject(char[] json, ref int index, ref bool success)
        {
            Dictionary <string, object> dictionary = new Dictionary <string, object>();

            JsonParser.NextToken(json, ref index);
            bool flag = false;

            while (!flag)
            {
                switch (JsonParser.LookAhead(json, index))
                {
                case 0:
                    success = false;
                    return((Dictionary <string, object>)null);

                case 2:
                    JsonParser.NextToken(json, ref index);
                    return(dictionary);

                case 6:
                    JsonParser.NextToken(json, ref index);
                    continue;

                default:
                    string index1 = JsonParser.ParseString(json, ref index, ref success);
                    if (!success)
                    {
                        success = false;
                        return((Dictionary <string, object>)null);
                    }
                    if (JsonParser.NextToken(json, ref index) != 5)
                    {
                        success = false;
                        return((Dictionary <string, object>)null);
                    }
                    object obj = JsonParser.ParseValue(json, ref index, ref success);
                    if (!success)
                    {
                        success = false;
                        return((Dictionary <string, object>)null);
                    }
                    dictionary[index1] = obj;
                    continue;
                }
            }
            return(dictionary);
        }
Ejemplo n.º 5
0
        protected static ArrayList ParseArray(char[] json, ref int index, ref bool success)
        {
            ArrayList arrayList = new ArrayList();

            JsonParser.NextToken(json, ref index);
            bool flag = false;

            while (!flag)
            {
                int num = JsonParser.LookAhead(json, index);
                if (num == 0)
                {
                    success = false;
                    return(null);
                }
                if (num == 6)
                {
                    JsonParser.NextToken(json, ref index);
                }
                else
                {
                    if (num == 4)
                    {
                        JsonParser.NextToken(json, ref index);
                        break;
                    }
                    object value = JsonParser.ParseValue(json, ref index, ref success);
                    if (!success)
                    {
                        return(null);
                    }
                    arrayList.Add(value);
                }
            }
            return(arrayList);
        }
Ejemplo n.º 6
0
        protected static ArrayList ParseArray(char[] json, ref int index, ref bool success)
        {
            ArrayList arrayList = new ArrayList();

            JsonParser.NextToken(json, ref index);
            bool flag = false;

            while (!flag)
            {
                switch (JsonParser.LookAhead(json, index))
                {
                case 0:
                    success = false;
                    return((ArrayList)null);

                case 4:
                    JsonParser.NextToken(json, ref index);
                    goto label_9;

                case 6:
                    JsonParser.NextToken(json, ref index);
                    continue;

                default:
                    object obj = JsonParser.ParseValue(json, ref index, ref success);
                    if (!success)
                    {
                        return((ArrayList)null);
                    }
                    arrayList.Add(obj);
                    continue;
                }
            }
label_9:
            return(arrayList);
        }