Exemplo n.º 1
0
        public static JArray Load(JsonReader reader)
        {
            if ((reader.JsonToken_0 == JsonToken.None) && !reader.Read())
            {
                throw JsonReaderException.smethod_1(reader, "Error reading JArray from JsonReader.");
            }
            while (reader.JsonToken_0 == JsonToken.Comment)
            {
                reader.Read();
            }
            if (reader.JsonToken_0 != JsonToken.StartArray)
            {
                throw JsonReaderException.smethod_1(reader, "Error reading JArray from JsonReader. Current JsonReader item is not an array: {0}".smethod_0(CultureInfo.InvariantCulture, reader.JsonToken_0));
            }
            JArray array = new JArray();

            array.method_0(reader as IJsonLineInfo);
            array.method_10(reader);
            return(array);
        }
Exemplo n.º 2
0
        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;
        }