示例#1
0
 private bool method_18(JsonWriter jsonWriter_0, object object_0, JsonContainerContract jsonContainerContract_0, JsonProperty jsonProperty_0, JsonProperty jsonProperty_1, out JsonContract jsonContract_1, out object object_1)
 {
     if ((!jsonProperty_1.Ignored && jsonProperty_1.Readable) && (this.method_37(jsonWriter_0, jsonProperty_1, object_0) && this.method_38(jsonWriter_0, jsonProperty_1, object_0)))
     {
         if (jsonProperty_1.JsonContract_0 == null)
         {
             jsonProperty_1.JsonContract_0 = base.jsonSerializer_0.icontractResolver_0.ResolveContract(jsonProperty_1.PropertyType);
         }
         object_1       = jsonProperty_1.ValueProvider.GetValue(object_0);
         jsonContract_1 = jsonProperty_1.JsonContract_0.bool_2 ? jsonProperty_1.JsonContract_0 : this.method_5(object_1);
         if (this.method_10(object_1, jsonProperty_1))
         {
             if (this.method_9(object_1, jsonProperty_1, jsonContract_1, jsonContainerContract_0, jsonProperty_0))
             {
                 jsonProperty_1.method_2(jsonWriter_0);
                 this.method_12(jsonWriter_0, object_1);
                 return(false);
             }
             if (!this.method_11(jsonWriter_0, object_1, jsonProperty_1, jsonContract_1, jsonContainerContract_0, jsonProperty_0))
             {
                 return(false);
             }
             if (object_1 == null)
             {
                 Required?          nullable3;
                 JsonObjectContract contract = jsonContainerContract_0 as JsonObjectContract;
                 Required?          nullable = jsonProperty_1.nullable_0;
                 if (!nullable.HasValue)
                 {
                     nullable3 = (contract != null) ? contract.ItemRequired : null;
                 }
                 Required required = nullable3.HasValue ? nullable.GetValueOrDefault() : Required.Default;
                 if (required == Required.Always)
                 {
                     throw JsonSerializationException.smethod_3(null, jsonWriter_0.String_0, "Cannot write a null value for property '{0}'. Property requires a value.".smethod_0(CultureInfo.InvariantCulture, jsonProperty_1.PropertyName), null);
                 }
             }
             return(true);
         }
     }
     jsonContract_1 = null;
     object_1       = null;
     return(false);
 }
示例#2
0
        private void method_17(JsonWriter jsonWriter_0, object object_0, JsonObjectContract jsonObjectContract_0, JsonProperty jsonProperty_0, JsonContainerContract jsonContainerContract_0, JsonProperty jsonProperty_1)
        {
            this.method_15(jsonWriter_0, jsonObjectContract_0, object_0);
            this.list_0.Add(object_0);
            this.method_19(jsonWriter_0, object_0, jsonObjectContract_0, jsonProperty_0, jsonContainerContract_0, jsonProperty_1);
            int top  = jsonWriter_0.Top;
            int num2 = 0;

            while (true)
            {
                if (num2 >= jsonObjectContract_0.Properties.Count)
                {
                    break;
                }
                JsonProperty property = jsonObjectContract_0.Properties[num2];
                try
                {
                    object       obj2;
                    JsonContract contract;
                    if (this.method_18(jsonWriter_0, object_0, jsonObjectContract_0, jsonProperty_0, property, out contract, out obj2))
                    {
                        property.method_2(jsonWriter_0);
                        this.method_7(jsonWriter_0, obj2, contract, property, jsonObjectContract_0, jsonProperty_0);
                    }
                }
                catch (Exception exception)
                {
                    if (!base.method_2(object_0, jsonObjectContract_0, property.PropertyName, null, jsonWriter_0.String_0, exception))
                    {
                        throw;
                    }
                    this.method_36(jsonWriter_0, top);
                }
                num2++;
            }
            jsonWriter_0.WriteEndObject();
            this.list_0.RemoveAt(this.list_0.Count - 1);
            this.method_16(jsonWriter_0, jsonObjectContract_0, object_0);
        }
示例#3
0
 // Token: 0x0600098F RID: 2447 RVA: 0x00036EA0 File Offset: 0x000350A0
 private bool method_12(object object_0, JsonObjectContract jsonObjectContract_0, JsonProperty jsonProperty_0)
 {
     return((object_0 != null || base.method_1(jsonObjectContract_0, jsonProperty_0) != NullValueHandling.Ignore) && (!this.method_25(jsonProperty_0.DefaultValueHandling.GetValueOrDefault(this.jsonSerializer_0.defaultValueHandling_0), DefaultValueHandling.Ignore) || !Class80.smethod_0(object_0, jsonProperty_0.method_2())));
 }
示例#4
0
        private void method_31(JsonWriter jsonWriter_0, IDynamicMetaObjectProvider idynamicMetaObjectProvider_0, JsonDynamicContract jsonDynamicContract_0, JsonProperty jsonProperty_0, JsonContainerContract jsonContainerContract_0, JsonProperty jsonProperty_1)
        {
            this.method_15(jsonWriter_0, jsonDynamicContract_0, idynamicMetaObjectProvider_0);
            this.list_0.Add(idynamicMetaObjectProvider_0);
            this.method_19(jsonWriter_0, idynamicMetaObjectProvider_0, jsonDynamicContract_0, jsonProperty_0, jsonContainerContract_0, jsonProperty_1);
            int top  = jsonWriter_0.Top;
            int num2 = 0;

            while (true)
            {
                if (num2 >= jsonDynamicContract_0.Properties.Count)
                {
                    break;
                }
                JsonProperty property = jsonDynamicContract_0.Properties[num2];
                if (property.HasMemberAttribute)
                {
                    try
                    {
                        object       obj2;
                        JsonContract contract;
                        if (this.method_18(jsonWriter_0, idynamicMetaObjectProvider_0, jsonDynamicContract_0, jsonProperty_0, property, out contract, out obj2))
                        {
                            property.method_2(jsonWriter_0);
                            this.method_7(jsonWriter_0, obj2, contract, property, jsonDynamicContract_0, jsonProperty_0);
                        }
                    }
                    catch (Exception exception)
                    {
                        if (!base.method_2(idynamicMetaObjectProvider_0, jsonDynamicContract_0, property.PropertyName, null, jsonWriter_0.String_0, exception))
                        {
                            throw;
                        }
                        this.method_36(jsonWriter_0, top);
                    }
                }
                num2++;
            }
            foreach (string str in idynamicMetaObjectProvider_0.smethod_0())
            {
                object obj3;
                if (jsonDynamicContract_0.method_5(idynamicMetaObjectProvider_0, str, out obj3))
                {
                    try
                    {
                        JsonContract contract2 = this.method_5(obj3);
                        if (this.method_32(obj3) && this.method_11(jsonWriter_0, obj3, null, contract2, jsonDynamicContract_0, jsonProperty_0))
                        {
                            string name = (jsonDynamicContract_0.PropertyNameResolver != null) ? jsonDynamicContract_0.PropertyNameResolver(str) : str;
                            jsonWriter_0.WritePropertyName(name);
                            this.method_7(jsonWriter_0, obj3, contract2, null, jsonDynamicContract_0, jsonProperty_0);
                        }
                    }
                    catch (Exception exception2)
                    {
                        if (!base.method_2(idynamicMetaObjectProvider_0, jsonDynamicContract_0, str, null, jsonWriter_0.String_0, exception2))
                        {
                            throw;
                        }
                        this.method_36(jsonWriter_0, top);
                    }
                }
            }
            jsonWriter_0.WriteEndObject();
            this.list_0.RemoveAt(this.list_0.Count - 1);
            this.method_16(jsonWriter_0, jsonDynamicContract_0, idynamicMetaObjectProvider_0);
        }