private static IDictionary <object, object> ParseObject(char[] json, ref int index, ref bool success) { // IDictionary<string, object> dictionary = new JsonObject(); IDictionary <object, object> dictionary = new Dictionary <object, object>(); SimpleJsonTool.NextToken(json, ref index); bool flag = false; IDictionary <object, object> result; while (!flag) { int num = SimpleJsonTool.LookAhead(json, index); if (num != 0) { if (num == 6) { SimpleJsonTool.NextToken(json, ref index); } else { if (num == 2) { SimpleJsonTool.NextToken(json, ref index); result = dictionary; return(result); } //string key = SimpleJsonTool.ParseString(json, ref index, ref success); object key = SimpleJsonTool.ParseValue(json, ref index, ref success); if (!success) { success = false; result = null; return(result); } num = SimpleJsonTool.NextToken(json, ref index); if (num != 5) { success = false; result = null; return(result); } object value = SimpleJsonTool.ParseValue(json, ref index, ref success); if (!success) { success = false; result = null; return(result); } dictionary[key] = value; } continue; } success = false; result = null; return(result); } result = dictionary; return(result); }
private static object ParseValue(char[] json, ref int index, ref bool success) { object result; switch (SimpleJsonTool.LookAhead(json, index)) { case 1: result = SimpleJsonTool.ParseObject(json, ref index, ref success); return(result); case 3: result = SimpleJsonTool.ParseArray(json, ref index, ref success); return(result); case 7: result = SimpleJsonTool.ParseString(json, ref index, ref success); return(result); case 8: result = SimpleJsonTool.ParseNumber(json, ref index, ref success); return(result); case 9: SimpleJsonTool.NextToken(json, ref index); result = true; return(result); case 10: SimpleJsonTool.NextToken(json, ref index); result = false; return(result); case 11: SimpleJsonTool.NextToken(json, ref index); result = null; return(result); } success = false; result = null; return(result); }
private static JsonArray ParseArray(char[] json, ref int index, ref bool success) { JsonArray jsonArray = new JsonArray(); SimpleJsonTool.NextToken(json, ref index); bool flag = false; JsonArray result; while (!flag) { int num = SimpleJsonTool.LookAhead(json, index); if (num != 0) { if (num == 6) { SimpleJsonTool.NextToken(json, ref index); } else { if (num == 4) { SimpleJsonTool.NextToken(json, ref index); break; } object item = SimpleJsonTool.ParseValue(json, ref index, ref success); if (!success) { result = null; return(result); } jsonArray.Add(item); } continue; } success = false; result = null; return(result); } result = jsonArray; return(result); }