protected static object ParseValue(char[] json, ref int index, ref bool success) { switch (JsonParser.LookAhead(json, index)) { case 1: return(JsonParser.ParseObject(json, ref index, ref success)); case 3: return(JsonParser.ParseArray(json, ref index, ref success)); case 7: return(JsonParser.ParseString(json, ref index, ref success)); case 8: return(JsonParser.ParseNumber(json, ref index, ref success)); case 9: JsonParser.NextToken(json, ref index); return(true); case 10: JsonParser.NextToken(json, ref index); return(false); case 11: JsonParser.NextToken(json, ref index); return(null); } success = false; return(null); }
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); }
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); }