Пример #1
0
 internal static IEnumerable<U> smethod_0<T, U>(this IEnumerable<T> ienumerable_0, object object_0) where T: JToken
 {
     Class203.smethod_2(ienumerable_0, "source");
     this.ienumerator_0 = ienumerable_0.GetEnumerator();
 Label_00FB:
     while (this.ienumerator_0.MoveNext())
     {
         this.jtoken_0 = this.ienumerator_0.Current;
         if (object_0 == null)
         {
             if (this.jtoken_0 is JValue)
             {
                 goto Label_0115;
             }
             this.ienumerator_1 = this.jtoken_0.Children().GetEnumerator();
             while (this.ienumerator_1.MoveNext())
             {
                 this.jtoken_1 = this.ienumerator_1.Current;
                 yield return this.jtoken_1.smethod_2<JToken, U>();
             }
             this.method_1();
             continue;
         }
         this.jtoken_2 = this.jtoken_0[object_0];
         if (this.jtoken_2 != null)
         {
             yield return this.jtoken_2.smethod_2<JToken, U>();
             continue;
         }
     }
     this.method_0();
 Label_0115:
     yield return ((JValue) this.jtoken_0).smethod_2<JValue, U>();
     goto Label_00FB;
 }
Пример #2
0
 public void WriteRegex(string pattern, string options)
 {
     Class203.smethod_2(pattern, "pattern");
     base.method_0();
     base.method_11(JsonToken.Undefined);
     this.method_23(new Class76(pattern, options));
 }
Пример #3
0
 protected Class135(JsonSerializer serializer)
 {
     Class203.smethod_2(serializer, "serializer");
     this.jsonSerializer_0 = serializer;
     this.itraceWriter_0   = serializer.ITraceWriter_0;
     this.bool_0           = base.GetType() == typeof(Class137);
 }
Пример #4
0
 public JsonSchema Generate(Type type, JsonSchemaResolver resolver, bool rootSchemaNullable)
 {
     Class203.smethod_2(type, "type");
     Class203.smethod_2(resolver, "resolver");
     this.jsonSchemaResolver_0 = resolver;
     return(this.method_5(type, !rootSchemaNullable ? Required.Always : Required.Default, false));
 }
Пример #5
0
 public Class133(Type type, JsonSchema schema)
 {
     Class203.smethod_2(type, "type");
     Class203.smethod_2(schema, "schema");
     this.Type_0       = type;
     this.JsonSchema_0 = schema;
 }
Пример #6
0
 public Class88(string expression)
 {
     Class203.smethod_2(expression, "expression");
     this.string_0 = expression;
     this.List_0   = new List <object>();
     this.method_0();
 }
Пример #7
0
        internal bool method_6(IDynamicMetaObjectProvider idynamicMetaObjectProvider_0, string string_0, object object_0)
        {
            Class203.smethod_2(idynamicMetaObjectProvider_0, "dynamicProvider");
            CallSite <Func <CallSite, object, object, object> > site = this.class178_1.method_0(string_0);

            return(!object.ReferenceEquals(site.Target(site, idynamicMetaObjectProvider_0, object_0), Class161.object_0));
        }
Пример #8
0
        private T method_0 <T>(object object_0)
        {
            Class203.smethod_2(object_0, "value");
            JValue value2 = (JValue)object_0;

            return((T)System.Convert.ChangeType(value2.Value, typeof(T), CultureInfo.InvariantCulture));
        }
Пример #9
0
 public JProperty(string name, object content)
 {
     this.list_0 = new List <JToken>();
     Class203.smethod_2(name, "name");
     this.string_0 = name;
     this.Value    = base.method_4(content) ? new JArray(content) : base.method_9(content);
 }
Пример #10
0
        public static JsonSchema Parse(string json, JsonSchemaResolver resolver)
        {
            Class203.smethod_2(json, "json");
            JsonReader reader = new JsonTextReader(new StringReader(json));

            return(Read(reader, resolver));
        }
Пример #11
0
 internal JContainer(JContainer other) : this()
 {
     Class203.smethod_2(other, "c");
     foreach (JToken token in (IEnumerable <JToken>)other)
     {
         this.Add(token);
     }
 }
Пример #12
0
 public BsonReader(BinaryReader reader, bool readRootValueAsArray, DateTimeKind dateTimeKindHandling)
 {
     Class203.smethod_2(reader, "reader");
     this.binaryReader_0 = reader;
     this.list_1         = new List <Class69>();
     this.bool_2         = readRootValueAsArray;
     this.dateTimeKind_0 = dateTimeKindHandling;
 }
Пример #13
0
 public BsonReader(Stream stream, bool readRootValueAsArray, DateTimeKind dateTimeKindHandling)
 {
     Class203.smethod_2(stream, "stream");
     this.binaryReader_0 = new BinaryReader(stream);
     this.list_1         = new List <Class69>();
     this.bool_2         = readRootValueAsArray;
     this.dateTimeKind_0 = dateTimeKindHandling;
 }
Пример #14
0
        public static JsonSchema Read(JsonReader reader, JsonSchemaResolver resolver)
        {
            Class203.smethod_2(reader, "reader");
            Class203.smethod_2(resolver, "resolver");
            Class130 class2 = new Class130(resolver);

            return(class2.method_2(reader));
        }
Пример #15
0
 public object Convert(object value, TypeCode typeCode)
 {
     Class203.smethod_2(value, "value");
     if (value is JValue)
     {
         value = ((JValue)value).Value;
     }
     return(System.Convert.ChangeType(value, typeCode, CultureInfo.InvariantCulture));
 }
Пример #16
0
 public BsonObjectId(byte[] value)
 {
     Class203.smethod_2(value, "value");
     if (value.Length != 12)
     {
         throw new ArgumentException("An ObjectId must be 12 bytes", "value");
     }
     this.Value = value;
 }
Пример #17
0
 public static IJEnumerable<JProperty> Properties(this IEnumerable<JObject> source)
 {
     Class203.smethod_2(source, "source");
     if (func_0 == null)
     {
         func_0 = new Func<JObject, IEnumerable<JProperty>>(Extensions.smethod_5);
     }
     return source.SelectMany<JObject, JProperty>(func_0).AsJEnumerable<JProperty>();
 }
Пример #18
0
 public static U Value<T, U>(this IEnumerable<T> value) where T: JToken
 {
     Class203.smethod_2(value, "source");
     JToken token = value as JToken;
     if (token == null)
     {
         throw new ArgumentException("Source value must be a JToken.");
     }
     return token.smethod_2<JToken, U>();
 }
Пример #19
0
        public object Convert(object value, Type type)
        {
            Class203.smethod_2(value, "value");
            JToken token = value as JToken;

            if (token == null)
            {
                throw new ArgumentException("Value is not a JToken.", "value");
            }
            return(this.jsonSerializer_0.Deserialize(token.CreateReader(), type));
        }
Пример #20
0
 public void WriteObjectId(byte[] value)
 {
     Class203.smethod_2(value, "value");
     if (value.Length != 12)
     {
         throw JsonWriterException.smethod_1(this, "An object id must be 12 bytes", null);
     }
     base.method_0();
     base.method_11(JsonToken.Undefined);
     this.method_22(value, Enum11.Oid);
 }
Пример #21
0
        public static object DeserializeObject(string value, Type type, JsonSerializerSettings settings)
        {
            Class203.smethod_2(value, "value");
            StringReader   reader     = new StringReader(value);
            JsonSerializer serializer = JsonSerializer.CreateDefault(settings);

            if (!serializer.method_0())
            {
                serializer.Boolean_0 = true;
            }
            return(serializer.Deserialize(new JsonTextReader(reader), type));
        }
Пример #22
0
        internal bool method_5(IDynamicMetaObjectProvider idynamicMetaObjectProvider_0, string string_0, out object object_0)
        {
            Class203.smethod_2(idynamicMetaObjectProvider_0, "dynamicProvider");
            CallSite <Func <CallSite, object, object> > site = this.class178_0.method_0(string_0);
            object objA = site.Target(site, idynamicMetaObjectProvider_0);

            if (!object.ReferenceEquals(objA, Class161.object_0))
            {
                object_0 = objA;
                return(true);
            }
            object_0 = null;
            return(false);
        }
Пример #23
0
 internal static IEnumerable<U> smethod_1<T, U>(this IEnumerable<T> ienumerable_0) where T: JToken
 {
     Class203.smethod_2(ienumerable_0, "source");
     this.ienumerator_0 = ienumerable_0.GetEnumerator();
     while (true)
     {
         if (!this.ienumerator_0.MoveNext())
         {
             this.method_0();
         }
         this.gparam_1 = this.ienumerator_0.Current;
         yield return this.gparam_1.smethod_2<JToken, U>();
     }
 }
Пример #24
0
 public static void Validate(this JToken source, JsonSchema schema, ValidationEventHandler validationEventHandler)
 {
     Class203.smethod_2(source, "source");
     Class203.smethod_2(schema, "schema");
     using (JsonValidatingReader reader = new JsonValidatingReader(source.CreateReader()))
     {
         reader.Schema = schema;
         if (validationEventHandler != null)
         {
             reader.ValidationEventHandler += validationEventHandler;
         }
         while (reader.Read())
         {
         }
     }
 }
Пример #25
0
        public static JObject Load(JsonReader reader)
        {
            Class203.smethod_2(reader, "reader");
            if ((reader.JsonToken_0 == JsonToken.None) && !reader.Read())
            {
                throw JsonReaderException.smethod_1(reader, "Error reading JObject from JsonReader.");
            }
            while (reader.JsonToken_0 == JsonToken.Comment)
            {
                reader.Read();
            }
            if (reader.JsonToken_0 != JsonToken.StartObject)
            {
                throw JsonReaderException.smethod_1(reader, "Error reading JObject from JsonReader. Current JsonReader item is not an object: {0}".smethod_0(CultureInfo.InvariantCulture, reader.JsonToken_0));
            }
            JObject obj2 = new JObject();

            obj2.method_0(reader as IJsonLineInfo);
            obj2.method_10(reader);
            return(obj2);
        }
Пример #26
0
 internal JsonContract(Type underlyingType)
 {
     Class203.smethod_2(underlyingType, "underlyingType");
     this.UnderlyingType = underlyingType;
     this.bool_2         = underlyingType.smethod_9();
     this.bool_5         = !underlyingType.smethod_3() && !underlyingType.smethod_10();
     this.bool_0         = Class194.smethod_9(underlyingType);
     this.type_0         = (!this.bool_0 || !Class194.smethod_10(underlyingType)) ? underlyingType : Nullable.GetUnderlyingType(underlyingType);
     this.CreatedType    = this.type_0;
     this.bool_1         = Class181.smethod_3(this.type_0);
     this.bool_3         = this.type_0.smethod_7();
     if (this.type_0 == typeof(byte[]))
     {
         this.enum14_0 = Enum14.ReadAsBytes;
     }
     else if (this.type_0 == typeof(int))
     {
         this.enum14_0 = Enum14.ReadAsInt32;
     }
     else if (this.type_0 == typeof(decimal))
     {
         this.enum14_0 = Enum14.ReadAsDecimal;
     }
     else if (this.type_0 == typeof(string))
     {
         this.enum14_0 = Enum14.ReadAsString;
     }
     else if (this.type_0 == typeof(DateTime))
     {
         this.enum14_0 = Enum14.ReadAsDateTime;
     }
     else if (this.type_0 == typeof(DateTimeOffset))
     {
         this.enum14_0 = Enum14.ReadAsDateTimeOffset;
     }
     else
     {
         this.enum14_0 = Enum14.Read;
     }
 }
Пример #27
0
        void JContainer.‭‏‌‏‌‫‌‍‌‮‮‫‎‫‫‬‌‭‫​‏‮‪‮‪‌‍‭‪‮(JToken jtoken_2, JToken jtoken_3)
        {
            Class203.smethod_2(jtoken_2, "o");
            if (jtoken_2.Type != JTokenType.Property)
            {
                throw new ArgumentException("Can not add {0} to {1}.".smethod_1(CultureInfo.InvariantCulture, jtoken_2.GetType(), base.GetType()));
            }
            JProperty property = (JProperty)jtoken_2;

            if (jtoken_3 != null)
            {
                JProperty property2 = (JProperty)jtoken_3;
                if (property.Name == property2.Name)
                {
                    return;
                }
            }
            if (this.class79_0.method_8(property.Name, out jtoken_3))
            {
                throw new ArgumentException("Can not add property {0} to {1}. Property with the same name already exists on object.".smethod_1(CultureInfo.InvariantCulture, property.Name, base.GetType()));
            }
        }
Пример #28
0
 public JsonValidatingReader(JsonReader reader)
 {
     Class203.smethod_2(reader, "reader");
     this.jsonReader_0 = reader;
     this.stack_0      = new Stack <Class91>();
 }
Пример #29
0
 public JsonPropertyCollection(Type type) : base(StringComparer.Ordinal)
 {
     Class203.smethod_2(type, "type");
     this.type_0 = type;
 }
Пример #30
0
 public JTokenWriter(JContainer container)
 {
     Class203.smethod_2(container, "container");
     this.jcontainer_0 = container;
     this.jcontainer_1 = container;
 }