private static JProperty ReadProperty([Nullable(1)] JsonReader r, JsonLoadSettings settings, IJsonLineInfo lineInfo, [Nullable(1)] JContainer parent) { DuplicatePropertyNameHandling duplicatePropertyNameHandling = (settings != null) ? settings.DuplicatePropertyNameHandling : DuplicatePropertyNameHandling.Replace; JObject jobject = (JObject)parent; string text = r.Value.ToString(); JProperty jproperty = jobject.Property(text, StringComparison.Ordinal); if (jproperty != null) { if (duplicatePropertyNameHandling == DuplicatePropertyNameHandling.Ignore) { return(null); } if (duplicatePropertyNameHandling == DuplicatePropertyNameHandling.Error) { throw JsonReaderException.Create(r, "Property with the name '{0}' already exists in the current JSON object.".FormatWith(CultureInfo.InvariantCulture, text)); } } JProperty jproperty2 = new JProperty(text); jproperty2.SetLineInfo(lineInfo, settings); if (jproperty == null) { parent.Add(jproperty2); } else { jproperty.Replace(jproperty2); } return(jproperty2); }
internal void ReadContentFrom(JsonReader r) { ValidationUtils.ArgumentNotNull(r, "r"); IJsonLineInfo lineInfo = r as IJsonLineInfo; JContainer jContainer = this; while (true) { if (jContainer is JProperty && ((JProperty)jContainer).Value != null) { if (jContainer == this) { break; } jContainer = jContainer.Parent; } switch (r.TokenType) { case JsonToken.None: goto IL_242; case JsonToken.StartObject: { JObject jObject = new JObject(); jObject.SetLineInfo(lineInfo); jContainer.Add(jObject); jContainer = jObject; goto IL_242; } case JsonToken.StartArray: { JArray jArray = new JArray(); jArray.SetLineInfo(lineInfo); jContainer.Add(jArray); jContainer = jArray; goto IL_242; } case JsonToken.StartConstructor: { JConstructor jConstructor = new JConstructor(r.Value.ToString()); jConstructor.SetLineInfo(jConstructor); jContainer.Add(jConstructor); jContainer = jConstructor; goto IL_242; } case JsonToken.PropertyName: { string name = r.Value.ToString(); JProperty jProperty = new JProperty(name); jProperty.SetLineInfo(lineInfo); JObject jObject2 = (JObject)jContainer; JProperty jProperty2 = jObject2.Property(name); if (jProperty2 == null) { jContainer.Add(jProperty); } else { jProperty2.Replace(jProperty); } jContainer = jProperty; goto IL_242; } case JsonToken.Comment: { JValue jValue = JValue.CreateComment(r.Value.ToString()); jValue.SetLineInfo(lineInfo); jContainer.Add(jValue); goto IL_242; } case JsonToken.Integer: case JsonToken.Float: case JsonToken.String: case JsonToken.Boolean: case JsonToken.Date: case JsonToken.Bytes: { JValue jValue = new JValue(r.Value); jValue.SetLineInfo(lineInfo); jContainer.Add(jValue); goto IL_242; } case JsonToken.Null: { JValue jValue = new JValue(null, JTokenType.Null); jValue.SetLineInfo(lineInfo); jContainer.Add(jValue); goto IL_242; } case JsonToken.Undefined: { JValue jValue = new JValue(null, JTokenType.Undefined); jValue.SetLineInfo(lineInfo); jContainer.Add(jValue); goto IL_242; } case JsonToken.EndObject: if (jContainer == this) { return; } jContainer = jContainer.Parent; goto IL_242; case JsonToken.EndArray: if (jContainer == this) { return; } jContainer = jContainer.Parent; goto IL_242; case JsonToken.EndConstructor: if (jContainer == this) { return; } jContainer = jContainer.Parent; goto IL_242; } goto Block_4; IL_242: if (!r.Read()) { return; } } return; Block_4: throw new InvalidOperationException("The JsonReader should not be on a token of type {0}.".FormatWith(CultureInfo.get_InvariantCulture(), new object[] { r.TokenType })); }
internal void ReadContentFrom(JsonReader r) { ValidationUtils.ArgumentNotNull(r, "r"); IJsonLineInfo lineInfo = r as IJsonLineInfo; JContainer parent = this; do { if (parent is JProperty && ((JProperty)parent).Value != null) { if (parent == this) { return; } parent = parent.Parent; } switch (r.TokenType) { case JsonToken.None: // new reader. move to actual content break; case JsonToken.StartArray: JArray a = new JArray(); a.SetLineInfo(lineInfo); parent.Add(a); parent = a; break; case JsonToken.EndArray: if (parent == this) { return; } parent = parent.Parent; break; case JsonToken.StartObject: JObject o = new JObject(); o.SetLineInfo(lineInfo); parent.Add(o); parent = o; break; case JsonToken.EndObject: if (parent == this) { return; } parent = parent.Parent; break; case JsonToken.StartConstructor: JConstructor constructor = new JConstructor(r.Value.ToString()); constructor.SetLineInfo(constructor); parent.Add(constructor); parent = constructor; break; case JsonToken.EndConstructor: if (parent == this) { return; } parent = parent.Parent; break; case JsonToken.String: case JsonToken.Integer: case JsonToken.Float: case JsonToken.Date: case JsonToken.Boolean: case JsonToken.Bytes: JValue v = new JValue(r.Value); v.SetLineInfo(lineInfo); parent.Add(v); break; case JsonToken.Comment: v = JValue.CreateComment(r.Value.ToString()); v.SetLineInfo(lineInfo); parent.Add(v); break; case JsonToken.Null: v = new JValue(null, JTokenType.Null); v.SetLineInfo(lineInfo); parent.Add(v); break; case JsonToken.Undefined: v = new JValue(null, JTokenType.Undefined); v.SetLineInfo(lineInfo); parent.Add(v); break; case JsonToken.PropertyName: string propertyName = r.Value.ToString(); JProperty property = new JProperty(propertyName); property.SetLineInfo(lineInfo); JObject parentObject = (JObject)parent; // handle multiple properties with the same name in JSON JProperty existingPropertyWithName = parentObject.Property(propertyName); if (existingPropertyWithName == null) { parent.Add(property); } else { existingPropertyWithName.Replace(property); } parent = property; break; default: throw new InvalidOperationException("The JsonReader should not be on a token of type {0}.".FormatWith(CultureInfo.InvariantCulture, r.TokenType)); } }while (r.Read()); }
public void ReplaceJPropertyWithJPropertyWithSameName() { JProperty p1 = new JProperty("Test1", 1); JProperty p2 = new JProperty("Test2", "Two"); JObject o = new JObject(p1, p2); IList l = o; Assert.AreEqual(p1, l[0]); Assert.AreEqual(p2, l[1]); JProperty p3 = new JProperty("Test1", "III"); p1.Replace(p3); Assert.AreEqual(null, p1.Parent); Assert.AreEqual(l, p3.Parent); Assert.AreEqual(p3, l[0]); Assert.AreEqual(p2, l[1]); Assert.AreEqual(2, l.Count); Assert.AreEqual(2, o.Properties().Count()); JProperty p4 = new JProperty("Test4", "IV"); p2.Replace(p4); Assert.AreEqual(null, p2.Parent); Assert.AreEqual(l, p4.Parent); Assert.AreEqual(p3, l[0]); Assert.AreEqual(p4, l[1]); }
internal void method_11(JsonReader jsonReader_0) { JValue value2; JProperty property; Class203.smethod_2(jsonReader_0, "r"); IJsonLineInfo info = jsonReader_0 as IJsonLineInfo; JContainer parent = this; goto Label_0204; Label_01D8: if (!jsonReader_0.Read()) { return; } Label_0204: if ((parent is JProperty) && (((JProperty)parent).Value != null)) { if (parent == this) { return; } parent = parent.Parent; } switch (jsonReader_0.JsonToken_0) { case JsonToken.None: goto Label_01D8; case JsonToken.StartObject: { JObject content = new JObject(); content.method_0(info); parent.Add(content); parent = content; goto Label_01D8; } case JsonToken.StartArray: { JArray array = new JArray(); array.method_0(info); parent.Add(array); parent = array; goto Label_01D8; } case JsonToken.StartConstructor: { JConstructor constructor = new JConstructor(jsonReader_0.Object_0.ToString()); constructor.method_0(constructor); parent.Add(constructor); parent = constructor; goto Label_01D8; } case JsonToken.PropertyName: { string name = jsonReader_0.Object_0.ToString(); property = new JProperty(name); property.method_0(info); JProperty property2 = ((JObject)parent).Property(name); if (property2 != null) { property2.Replace(property); break; } parent.Add(property); break; } case JsonToken.Comment: value2 = JValue.CreateComment(jsonReader_0.Object_0.ToString()); value2.method_0(info); parent.Add(value2); goto Label_01D8; case JsonToken.Integer: case JsonToken.Float: case JsonToken.String: case JsonToken.Boolean: case JsonToken.Date: case JsonToken.Bytes: value2 = new JValue(jsonReader_0.Object_0); value2.method_0(info); parent.Add(value2); goto Label_01D8; case JsonToken.Null: value2 = new JValue(null, JTokenType.Null); value2.method_0(info); parent.Add(value2); goto Label_01D8; case JsonToken.Undefined: value2 = new JValue(null, JTokenType.Undefined); value2.method_0(info); parent.Add(value2); goto Label_01D8; case JsonToken.EndObject: if (parent != this) { parent = parent.Parent; goto Label_01D8; } return; case JsonToken.EndArray: if (parent != this) { parent = parent.Parent; goto Label_01D8; } return; case JsonToken.EndConstructor: if (parent != this) { parent = parent.Parent; goto Label_01D8; } return; default: throw new InvalidOperationException("The JsonReader should not be on a token of type {0}.".smethod_0(CultureInfo.InvariantCulture, jsonReader_0.JsonToken_0)); } parent = property; goto Label_01D8; }
internal void ReadContentFrom(JsonReader r, JsonLoadSettings settings) { ValidationUtils.ArgumentNotNull(r, nameof(r)); IJsonLineInfo lineInfo = r as IJsonLineInfo; JContainer parent = this; do { if ((parent as JProperty)?.Value != null) { if (parent == this) { return; } parent = parent.Parent; } switch (r.TokenType) { case JsonToken.None: // new reader. move to actual content break; case JsonToken.StartArray: JArray a = new JArray(); a.SetLineInfo(lineInfo, settings); parent.Add(a); parent = a; break; case JsonToken.EndArray: if (parent == this) { return; } parent = parent.Parent; break; case JsonToken.StartObject: JObject o = new JObject(); o.SetLineInfo(lineInfo, settings); parent.Add(o); parent = o; break; case JsonToken.EndObject: if (parent == this) { return; } parent = parent.Parent; break; case JsonToken.StartConstructor: JConstructor constructor = new JConstructor(r.Value.ToString()); constructor.SetLineInfo(lineInfo, settings); parent.Add(constructor); parent = constructor; break; case JsonToken.EndConstructor: if (parent == this) { return; } parent = parent.Parent; break; case JsonToken.String: case JsonToken.Integer: case JsonToken.Float: case JsonToken.Date: case JsonToken.Boolean: case JsonToken.Bytes: JValue v = new JValue(r.Value); v.SetLineInfo(lineInfo, settings); parent.Add(v); break; case JsonToken.Comment: if (settings != null && settings.CommentHandling == CommentHandling.Load) { v = JValue.CreateComment(r.Value.ToString()); v.SetLineInfo(lineInfo, settings); parent.Add(v); } break; case JsonToken.Null: v = JValue.CreateNull(); v.SetLineInfo(lineInfo, settings); parent.Add(v); break; case JsonToken.Undefined: v = JValue.CreateUndefined(); v.SetLineInfo(lineInfo, settings); parent.Add(v); break; case JsonToken.PropertyName: string propertyName = r.Value.ToString(); JProperty property = new JProperty(propertyName); property.SetLineInfo(lineInfo, settings); JObject parentObject = (JObject)parent; // handle multiple properties with the same name in JSON JProperty existingPropertyWithName = parentObject.Property(propertyName); if (existingPropertyWithName == null) { parent.Add(property); } else { existingPropertyWithName.Replace(property); } parent = property; break; case JsonToken.SmallDec: case JsonToken.PercentValV2: try { v = new JValue(r.Value); v.SetLineInfo(lineInfo, settings); parent.Add(v); break; } catch (Exception ex) { System.Console.WriteLine("Exception called from JContainer->ReadContentFrom of type " + ex.ToString()); throw; } throw new InvalidOperationException("The JsonReader should not be on a token of type {0}.".FormatWith(CultureInfo.InvariantCulture, r.TokenType)); default: throw new InvalidOperationException("The JsonReader should not be on a token of type {0}.".FormatWith(CultureInfo.InvariantCulture, r.TokenType)); } } while (r.Read()); }
private async Task ReadContentFromAsync(JsonReader reader, JsonLoadSettings settings, CancellationToken cancellationToken = default) { IJsonLineInfo lineInfo = reader as IJsonLineInfo; JContainer parent = this; do { if (parent is JProperty p && p.Value != null) { if (parent == this) { return; } parent = parent.Parent; } switch (reader.TokenType) { case JsonToken.None: // new reader. move to actual content break; case JsonToken.StartArray: JArray a = new JArray(); a.SetLineInfo(lineInfo, settings); parent.Add(a); parent = a; break; case JsonToken.EndArray: if (parent == this) { return; } parent = parent.Parent; break; case JsonToken.StartObject: JObject o = new JObject(); o.SetLineInfo(lineInfo, settings); parent.Add(o); parent = o; break; case JsonToken.EndObject: if (parent == this) { return; } parent = parent.Parent; break; case JsonToken.StartConstructor: JConstructor constructor = new JConstructor(reader.Value.ToString()); constructor.SetLineInfo(lineInfo, settings); parent.Add(constructor); parent = constructor; break; case JsonToken.EndConstructor: if (parent == this) { return; } parent = parent.Parent; break; case JsonToken.String: case JsonToken.Integer: case JsonToken.Float: case JsonToken.Date: case JsonToken.Boolean: case JsonToken.Bytes: JValue v = new JValue(reader.Value); v.SetLineInfo(lineInfo, settings); parent.Add(v); break; case JsonToken.Comment: if (settings != null && settings.CommentHandling == CommentHandling.Load) { v = JValue.CreateComment(reader.Value.ToString()); v.SetLineInfo(lineInfo, settings); parent.Add(v); } break; case JsonToken.Null: v = JValue.CreateNull(); v.SetLineInfo(lineInfo, settings); parent.Add(v); break; case JsonToken.Undefined: v = JValue.CreateUndefined(); v.SetLineInfo(lineInfo, settings); parent.Add(v); break; case JsonToken.PropertyName: string propertyName = reader.Value.ToString(); JProperty property = new JProperty(propertyName); property.SetLineInfo(lineInfo, settings); JObject parentObject = (JObject)parent; // handle multiple properties with the same name in JSON JProperty existingPropertyWithName = parentObject.Property(propertyName); if (existingPropertyWithName == null) { parent.Add(property); } else { existingPropertyWithName.Replace(property); } parent = property; break; default: throw new InvalidOperationException("The JsonReader should not be on a token of type {0}.".FormatWith(CultureInfo.InvariantCulture, reader.TokenType)); } } while (await reader.ReadAsync(cancellationToken).ConfigureAwait(false)); }
internal void ReadContentFrom(JsonReader r, JsonLoadSettings settings) { JValue jValue; bool value; ValidationUtils.ArgumentNotNull(r, "r"); IJsonLineInfo jsonLineInfo = r as IJsonLineInfo; JContainer parent = this; do { JProperty jProperty = parent as JProperty; if (jProperty != null) { value = jProperty.Value; } else { value = false; } if (value) { if (parent == this) { return; } parent = parent.Parent; } switch (r.TokenType) { case JsonToken.None: { continue; } case JsonToken.StartObject: { JObject jObjects = new JObject(); jObjects.SetLineInfo(jsonLineInfo, settings); parent.Add(jObjects); parent = jObjects; continue; } case JsonToken.StartArray: { JArray jArrays = new JArray(); jArrays.SetLineInfo(jsonLineInfo, settings); parent.Add(jArrays); parent = jArrays; continue; } case JsonToken.StartConstructor: { JConstructor jConstructor = new JConstructor(r.Value.ToString()); jConstructor.SetLineInfo(jsonLineInfo, settings); parent.Add(jConstructor); parent = jConstructor; continue; } case JsonToken.PropertyName: { string str = r.Value.ToString(); JProperty jProperty1 = new JProperty(str); jProperty1.SetLineInfo(jsonLineInfo, settings); JProperty jProperty2 = ((JObject)parent).Property(str); if (jProperty2 != null) { jProperty2.Replace(jProperty1); } else { parent.Add(jProperty1); } parent = jProperty1; continue; } case JsonToken.Comment: { if (settings == null || settings.CommentHandling != CommentHandling.Load) { continue; } jValue = JValue.CreateComment(r.Value.ToString()); jValue.SetLineInfo(jsonLineInfo, settings); parent.Add(jValue); continue; } case JsonToken.Raw: { throw new InvalidOperationException("The JsonReader should not be on a token of type {0}.".FormatWith(CultureInfo.InvariantCulture, r.TokenType)); } case JsonToken.Integer: case JsonToken.Float: case JsonToken.String: case JsonToken.Boolean: case JsonToken.Date: case JsonToken.Bytes: { jValue = new JValue(r.Value); jValue.SetLineInfo(jsonLineInfo, settings); parent.Add(jValue); continue; } case JsonToken.Null: { jValue = JValue.CreateNull(); jValue.SetLineInfo(jsonLineInfo, settings); parent.Add(jValue); continue; } case JsonToken.Undefined: { jValue = JValue.CreateUndefined(); jValue.SetLineInfo(jsonLineInfo, settings); parent.Add(jValue); continue; } case JsonToken.EndObject: { if (parent == this) { return; } parent = parent.Parent; continue; } case JsonToken.EndArray: { if (parent == this) { return; } parent = parent.Parent; continue; } case JsonToken.EndConstructor: { if (parent == this) { return; } parent = parent.Parent; continue; } default: { throw new InvalidOperationException("The JsonReader should not be on a token of type {0}.".FormatWith(CultureInfo.InvariantCulture, r.TokenType)); } } }while (r.Read()); }
internal void ReadContentFrom(JsonReader r) { ValidationUtils.ArgumentNotNull((object)r, "r"); IJsonLineInfo lineInfo = r as IJsonLineInfo; JContainer jcontainer = this; do { if (jcontainer is JProperty && ((JProperty)jcontainer).Value != null) { if (jcontainer == this) { break; } jcontainer = jcontainer.Parent; } switch (r.TokenType) { case JsonToken.None: continue; case JsonToken.StartObject: JObject jobject = new JObject(); jobject.SetLineInfo(lineInfo); jcontainer.Add((object)jobject); jcontainer = (JContainer)jobject; goto case 0; case JsonToken.StartArray: JArray jarray = new JArray(); jarray.SetLineInfo(lineInfo); jcontainer.Add((object)jarray); jcontainer = (JContainer)jarray; goto case 0; case JsonToken.StartConstructor: JConstructor jconstructor = new JConstructor(r.Value.ToString()); jconstructor.SetLineInfo((IJsonLineInfo)jconstructor); jcontainer.Add((object)jconstructor); jcontainer = (JContainer)jconstructor; goto case 0; case JsonToken.PropertyName: string name = r.Value.ToString(); JProperty jproperty1 = new JProperty(name); jproperty1.SetLineInfo(lineInfo); JProperty jproperty2 = ((JObject)jcontainer).Property(name); if (jproperty2 == null) { jcontainer.Add((object)jproperty1); } else { jproperty2.Replace((JToken)jproperty1); } jcontainer = (JContainer)jproperty1; goto case 0; case JsonToken.Comment: JValue comment = JValue.CreateComment(r.Value.ToString()); comment.SetLineInfo(lineInfo); jcontainer.Add((object)comment); goto case 0; case JsonToken.Integer: case JsonToken.Float: case JsonToken.String: case JsonToken.Boolean: case JsonToken.Date: case JsonToken.Bytes: JValue jvalue1 = new JValue(r.Value); jvalue1.SetLineInfo(lineInfo); jcontainer.Add((object)jvalue1); goto case 0; case JsonToken.Null: JValue jvalue2 = new JValue((object)null, JTokenType.Null); jvalue2.SetLineInfo(lineInfo); jcontainer.Add((object)jvalue2); goto case 0; case JsonToken.Undefined: JValue jvalue3 = new JValue((object)null, JTokenType.Undefined); jvalue3.SetLineInfo(lineInfo); jcontainer.Add((object)jvalue3); goto case 0; case JsonToken.EndObject: if (jcontainer == this) { return; } jcontainer = jcontainer.Parent; goto case 0; case JsonToken.EndArray: if (jcontainer == this) { return; } jcontainer = jcontainer.Parent; goto case 0; case JsonToken.EndConstructor: if (jcontainer == this) { return; } jcontainer = jcontainer.Parent; goto case 0; default: throw new InvalidOperationException(StringUtils.FormatWith("The JsonReader should not be on a token of type {0}.", (IFormatProvider)CultureInfo.InvariantCulture, (object)r.TokenType)); } }while (r.Read()); }
internal void ReadContentFrom(JsonReader r) { JValue jValue; object[] tokenType; CultureInfo invariantCulture; ValidationUtils.ArgumentNotNull(r, "r"); IJsonLineInfo jsonLineInfo = r as IJsonLineInfo; JContainer parent = this; do { if (parent is JProperty && ((JProperty)parent).Value != null) { if (parent == this) { return; } parent = parent.Parent; } switch (r.TokenType) { case JsonToken.None: { continue; } case JsonToken.StartObject: { JObject jObjects = new JObject(); jObjects.SetLineInfo(jsonLineInfo); parent.Add(jObjects); parent = jObjects; continue; } case JsonToken.StartArray: { JArray jArrays = new JArray(); jArrays.SetLineInfo(jsonLineInfo); parent.Add(jArrays); parent = jArrays; continue; } case JsonToken.StartConstructor: { JConstructor jConstructor = new JConstructor(r.Value.ToString()); jConstructor.SetLineInfo(jConstructor); parent.Add(jConstructor); parent = jConstructor; continue; } case JsonToken.PropertyName: { string str = r.Value.ToString(); JProperty jProperty = new JProperty(str); jProperty.SetLineInfo(jsonLineInfo); JProperty jProperty1 = ((JObject)parent).Property(str); if (jProperty1 != null) { jProperty1.Replace(jProperty); } else { parent.Add(jProperty); } parent = jProperty; continue; } case JsonToken.Comment: { jValue = JValue.CreateComment(r.Value.ToString()); jValue.SetLineInfo(jsonLineInfo); parent.Add(jValue); continue; } case JsonToken.Raw: { invariantCulture = CultureInfo.InvariantCulture; tokenType = new object[] { r.TokenType }; throw new InvalidOperationException("The JsonReader should not be on a token of type {0}.".FormatWith(invariantCulture, tokenType)); } case JsonToken.Integer: case JsonToken.Float: case JsonToken.String: case JsonToken.Boolean: case JsonToken.Date: case JsonToken.Bytes: { jValue = new JValue(r.Value); jValue.SetLineInfo(jsonLineInfo); parent.Add(jValue); continue; } case JsonToken.Null: { jValue = new JValue(null, JTokenType.Null); jValue.SetLineInfo(jsonLineInfo); parent.Add(jValue); continue; } case JsonToken.Undefined: { jValue = new JValue(null, JTokenType.Undefined); jValue.SetLineInfo(jsonLineInfo); parent.Add(jValue); continue; } case JsonToken.EndObject: { if (parent == this) { return; } parent = parent.Parent; continue; } case JsonToken.EndArray: { if (parent == this) { return; } parent = parent.Parent; continue; } case JsonToken.EndConstructor: { if (parent == this) { return; } parent = parent.Parent; continue; } default: { invariantCulture = CultureInfo.InvariantCulture; tokenType = new object[] { r.TokenType }; throw new InvalidOperationException("The JsonReader should not be on a token of type {0}.".FormatWith(invariantCulture, tokenType)); } } }while (r.Read()); }
internal void ReadContentFrom(JsonReader r, JsonLoadSettings settings) { JProperty property1; JValue value2; JProperty property; ValidationUtils.ArgumentNotNull(r, "r"); IJsonLineInfo lineInfo = r as IJsonLineInfo; JContainer parent = this; Label_0014: property1 = parent as JProperty; if (property1 == null) { } if (null.Value != null) { if (parent == this) { return; } parent = parent.Parent; } switch (r.TokenType) { case JsonToken.None: goto Label_0247; case JsonToken.StartObject: { JObject content = new JObject(); content.SetLineInfo(lineInfo, settings); parent.Add(content); parent = content; goto Label_0247; } case JsonToken.StartArray: { JArray content = new JArray(); content.SetLineInfo(lineInfo, settings); parent.Add(content); parent = content; goto Label_0247; } case JsonToken.StartConstructor: { JConstructor content = new JConstructor(r.Value.ToString()); content.SetLineInfo(lineInfo, settings); parent.Add(content); parent = content; goto Label_0247; } case JsonToken.PropertyName: { string name = r.Value.ToString(); property = new JProperty(name); property.SetLineInfo(lineInfo, settings); JProperty property2 = ((JObject)parent).Property(name); if (property2 != null) { property2.Replace(property); break; } parent.Add(property); break; } case JsonToken.Comment: if ((settings != null) && (settings.CommentHandling == CommentHandling.Load)) { value2 = JValue.CreateComment(r.Value.ToString()); value2.SetLineInfo(lineInfo, settings); parent.Add(value2); } goto Label_0247; case JsonToken.Integer: case JsonToken.Float: case JsonToken.String: case JsonToken.Boolean: case JsonToken.Date: case JsonToken.Bytes: value2 = new JValue(r.Value); value2.SetLineInfo(lineInfo, settings); parent.Add(value2); goto Label_0247; case JsonToken.Null: value2 = JValue.CreateNull(); value2.SetLineInfo(lineInfo, settings); parent.Add(value2); goto Label_0247; case JsonToken.Undefined: value2 = JValue.CreateUndefined(); value2.SetLineInfo(lineInfo, settings); parent.Add(value2); goto Label_0247; case JsonToken.EndObject: if (parent != this) { parent = parent.Parent; goto Label_0247; } return; case JsonToken.EndArray: if (parent != this) { parent = parent.Parent; goto Label_0247; } return; case JsonToken.EndConstructor: if (parent != this) { parent = parent.Parent; goto Label_0247; } return; default: throw new InvalidOperationException("The JsonReader should not be on a token of type {0}.".FormatWith(CultureInfo.InvariantCulture, r.TokenType)); } parent = property; Label_0247: if (r.Read()) { goto Label_0014; } }