private IEnumerable StringifyAsync(int depth, StringBuilder builder, bool pretty = false) { int num = depth; depth = num + 1; if (num <= 100) { if (JSONObject.printWatch.Elapsed.TotalSeconds > 0.00800000037997961) { JSONObject.printWatch.Reset(); yield return((object)null); JSONObject.printWatch.Start(); } switch (this.type) { case Type.BAKED: builder.Append(this.str); break; case Type.STRING: builder.AppendFormat("\"{0}\"", this.str); break; case Type.NUMBER: if (this.useInt) { builder.Append(this.i.ToString()); } else if (float.IsInfinity(this.n)) { builder.Append("\"INFINITY\""); } else if (float.IsNegativeInfinity(this.n)) { builder.Append("\"NEGINFINITY\""); } else if (float.IsNaN(this.n)) { builder.Append("\"NaN\""); } else { builder.Append(this.n.ToString()); } break; case Type.OBJECT: builder.Append("{"); if (this.list.Count > 0) { if (pretty) { builder.Append("\n"); } for (int i = 0; i < this.list.Count; i++) { string arg = this.keys[i]; JSONObject jSONObject = this.list[i]; if ((bool)jSONObject) { if (pretty) { for (int m = 0; m < depth; m++) { builder.Append("\t"); } } builder.AppendFormat("\"{0}\":", arg); foreach (IEnumerable item in jSONObject.StringifyAsync(depth, builder, pretty)) { yield return((object)item); } builder.Append(","); if (pretty) { builder.Append("\n"); } } } if (pretty) { builder.Length -= 2; } else { builder.Length--; } } if (pretty && this.list.Count > 0) { builder.Append("\n"); for (int n = 0; n < depth - 1; n++) { builder.Append("\t"); } } builder.Append("}"); break; case Type.ARRAY: builder.Append("["); if (this.list.Count > 0) { if (pretty) { builder.Append("\n"); } for (int i = 0; i < this.list.Count; i++) { if ((bool)this.list[i]) { if (pretty) { for (int k = 0; k < depth; k++) { builder.Append("\t"); } } foreach (IEnumerable item2 in this.list[i].StringifyAsync(depth, builder, pretty)) { yield return((object)item2); } builder.Append(","); if (pretty) { builder.Append("\n"); } } } if (pretty) { builder.Length -= 2; } else { builder.Length--; } } if (pretty && this.list.Count > 0) { builder.Append("\n"); for (int l = 0; l < depth - 1; l++) { builder.Append("\t"); } } builder.Append("]"); break; case Type.BOOL: if (this.b) { builder.Append("true"); } else { builder.Append("false"); } break; case Type.NULL: builder.Append("null"); break; } } }