Exemplo n.º 1
0
    // Token: 0x060009A8 RID: 2472 RVA: 0x00037FF0 File Offset: 0x000361F0
    private bool method_36(TypeNameHandling typeNameHandling_0, JsonContract jsonContract_0, JsonProperty jsonProperty_0, JsonContainerContract jsonContainerContract_0, JsonProperty jsonProperty_1)
    {
        TypeNameHandling typeNameHandling_ = ((jsonProperty_0 != null) ? jsonProperty_0.TypeNameHandling : null) ?? (((jsonProperty_1 != null) ? jsonProperty_1.ItemTypeNameHandling : null) ?? (((jsonContainerContract_0 != null) ? jsonContainerContract_0.ItemTypeNameHandling : null) ?? this.jsonSerializer_0.typeNameHandling_0));

        if (this.method_27(typeNameHandling_, typeNameHandling_0))
        {
            return(true);
        }
        if (this.method_27(typeNameHandling_, TypeNameHandling.Auto))
        {
            if (jsonProperty_0 != null)
            {
                if (jsonContract_0.type_0 != jsonProperty_0.method_0().CreatedType)
                {
                    return(true);
                }
            }
            else if (jsonContainerContract_0 != null)
            {
                if (jsonContainerContract_0.EwhtYgWttB() == null || jsonContract_0.type_0 != jsonContainerContract_0.EwhtYgWttB().CreatedType)
                {
                    return(true);
                }
            }
            else if (this.type_0 != null && this.list_0.Count == this.int_0)
            {
                JsonContract jsonContract = this.jsonSerializer_0.icontractResolver_0.ResolveContract(this.type_0);
                if (jsonContract_0.type_0 != jsonContract.CreatedType)
                {
                    return(true);
                }
            }
        }
        return(false);
    }
Exemplo n.º 2
0
 // Token: 0x06000998 RID: 2456 RVA: 0x0003748C File Offset: 0x0003568C
 private bool method_20(JsonWriter jsonWriter_0, object object_0, JsonContainerContract jsonContainerContract_0, JsonProperty jsonProperty_0, JsonProperty jsonProperty_1, out JsonContract jsonContract_0, out object object_1)
 {
     if (!jsonProperty_1.Ignored && jsonProperty_1.Readable && this.ShouldSerialize(jsonWriter_0, jsonProperty_1, object_0) && this.method_40(jsonWriter_0, jsonProperty_1, object_0))
     {
         if (jsonProperty_1.method_0() == null)
         {
             jsonProperty_1.method_1(this.jsonSerializer_0.icontractResolver_0.ResolveContract(jsonProperty_1.PropertyType));
         }
         object_1       = jsonProperty_1.ValueProvider.GetValue(object_0);
         jsonContract_0 = (jsonProperty_1.method_0().bool_4 ? jsonProperty_1.method_0() : this.method_7(object_1));
         if (this.method_12(object_1, jsonContainerContract_0 as JsonObjectContract, jsonProperty_1))
         {
             if (this.method_11(object_1, jsonProperty_1, jsonContract_0, jsonContainerContract_0, jsonProperty_0))
             {
                 jsonProperty_1.method_3(jsonWriter_0);
                 this.method_14(jsonWriter_0, object_1);
                 return(false);
             }
             if (!this.method_13(jsonWriter_0, object_1, jsonProperty_1, jsonContract_0, jsonContainerContract_0, jsonProperty_0))
             {
                 return(false);
             }
             if (object_1 == null)
             {
                 JsonObjectContract jsonObjectContract = jsonContainerContract_0 as JsonObjectContract;
                 Required           required           = jsonProperty_1.nullable_0 ?? (((jsonObjectContract != null) ? jsonObjectContract.ItemRequired : null) ?? Required.Default);
                 if (required == Required.Always)
                 {
                     throw JsonSerializationException.Create(null, jsonWriter_0.xEuXaafal7(), "Cannot write a null value for property '{0}'. Property requires a value.".smethod_0(CultureInfo.InvariantCulture, jsonProperty_1.PropertyName), null);
                 }
                 if (required == Required.DisallowNull)
                 {
                     throw JsonSerializationException.Create(null, jsonWriter_0.xEuXaafal7(), "Cannot write a null value for property '{0}'. Property requires a non-null value.".smethod_0(CultureInfo.InvariantCulture, jsonProperty_1.PropertyName), null);
                 }
             }
             return(true);
         }
     }
     jsonContract_0 = null;
     object_1       = null;
     return(false);
 }