// Token: 0x06000278 RID: 632 RVA: 0x0000B08C File Offset: 0x0000928C public static JSONNode Parse(string aJSON) { Stack <JSONNode> stack = new Stack <JSONNode>(); JSONNode jsonnode = null; int i = 0; StringBuilder stringBuilder = new StringBuilder(); string text = ""; bool flag = false; bool flag2 = false; while (i < aJSON.Length) { char c = aJSON[i]; if (c <= ',') { if (c <= ' ') { switch (c) { case '\t': break; case '\n': case '\r': goto IL_33E; case '\v': case '\f': goto IL_330; default: if (c != ' ') { goto IL_330; } break; } if (flag) { stringBuilder.Append(aJSON[i]); } } else if (c != '"') { if (c != ',') { goto IL_330; } if (flag) { stringBuilder.Append(aJSON[i]); } else { if (stringBuilder.Length > 0 || flag2) { JSONNode.ParseElement(jsonnode, stringBuilder.ToString(), text, flag2); } text = ""; stringBuilder.Length = 0; flag2 = false; } } else { flag = !flag; flag2 = (flag2 || flag); } } else { if (c <= ']') { if (c != ':') { switch (c) { case '[': if (flag) { stringBuilder.Append(aJSON[i]); goto IL_33E; } stack.Push(new JSONArray()); if (jsonnode != null) { jsonnode.Add(text, stack.Peek()); } text = ""; stringBuilder.Length = 0; jsonnode = stack.Peek(); goto IL_33E; case '\\': i++; if (flag) { char c2 = aJSON[i]; if (c2 <= 'f') { if (c2 == 'b') { stringBuilder.Append('\b'); goto IL_33E; } if (c2 == 'f') { stringBuilder.Append('\f'); goto IL_33E; } } else { if (c2 == 'n') { stringBuilder.Append('\n'); goto IL_33E; } switch (c2) { case 'r': stringBuilder.Append('\r'); goto IL_33E; case 't': stringBuilder.Append('\t'); goto IL_33E; case 'u': { string s = aJSON.Substring(i + 1, 4); stringBuilder.Append((char)int.Parse(s, NumberStyles.AllowHexSpecifier)); i += 4; goto IL_33E; } } } stringBuilder.Append(c2); goto IL_33E; } goto IL_33E; case ']': break; default: goto IL_330; } } else { if (flag) { stringBuilder.Append(aJSON[i]); goto IL_33E; } text = stringBuilder.ToString(); stringBuilder.Length = 0; flag2 = false; goto IL_33E; } } else if (c != '{') { if (c != '}') { goto IL_330; } } else { if (flag) { stringBuilder.Append(aJSON[i]); goto IL_33E; } stack.Push(new JSONObject()); if (jsonnode != null) { jsonnode.Add(text, stack.Peek()); } text = ""; stringBuilder.Length = 0; jsonnode = stack.Peek(); goto IL_33E; } if (flag) { stringBuilder.Append(aJSON[i]); } else { if (stack.Count == 0) { throw new Exception("JSON Parse: Too many closing brackets"); } stack.Pop(); if (stringBuilder.Length > 0 || flag2) { JSONNode.ParseElement(jsonnode, stringBuilder.ToString(), text, flag2); flag2 = false; } text = ""; stringBuilder.Length = 0; if (stack.Count > 0) { jsonnode = stack.Peek(); } } } IL_33E: i++; continue; IL_330: stringBuilder.Append(aJSON[i]); goto IL_33E; } if (flag) { throw new Exception("JSON Parse: Quotation marks seems to be messed up."); } return(jsonnode); }