Exemple #1
0
    // Token: 0x06000997 RID: 2455 RVA: 0x000372A0 File Offset: 0x000354A0
    private void method_19(JsonWriter jsonWriter_0, object object_0, JsonObjectContract jsonObjectContract_0, JsonProperty jsonProperty_0, JsonContainerContract jsonContainerContract_0, JsonProperty jsonProperty_1)
    {
        this.method_17(jsonWriter_0, jsonObjectContract_0, object_0);
        this.list_0.Add(object_0);
        this.method_21(jsonWriter_0, object_0, jsonObjectContract_0, jsonProperty_0, jsonContainerContract_0, jsonProperty_1);
        int top = jsonWriter_0.Top;

        for (int i = 0; i < jsonObjectContract_0.Properties.Count; i++)
        {
            JsonProperty jsonProperty = jsonObjectContract_0.Properties[i];
            try
            {
                JsonContract jsonContract_;
                object       object_;
                if (this.method_20(jsonWriter_0, object_0, jsonObjectContract_0, jsonProperty_0, jsonProperty, out jsonContract_, out object_))
                {
                    jsonProperty.method_3(jsonWriter_0);
                    this.method_9(jsonWriter_0, object_, jsonContract_, jsonProperty, jsonObjectContract_0, jsonProperty_0);
                }
            }
            catch (Exception exception_)
            {
                if (!base.method_4(object_0, jsonObjectContract_0, jsonProperty.PropertyName, null, jsonWriter_0.xEuXaafal7(), exception_))
                {
                    throw;
                }
                this.method_39(jsonWriter_0, top);
            }
        }
        ExtensionDataGetter extensionDataGetter = jsonObjectContract_0.ExtensionDataGetter;
        IEnumerable <KeyValuePair <object, object> > enumerable = (extensionDataGetter != null) ? extensionDataGetter(object_0) : null;

        if (enumerable != null)
        {
            foreach (KeyValuePair <object, object> keyValuePair in enumerable)
            {
                JsonContract jsonContract_2 = this.method_7(keyValuePair.Key);
                JsonContract jsonContract_3 = this.method_7(keyValuePair.Value);
                bool         flag;
                string       text = this.method_38(jsonWriter_0, keyValuePair.Key, jsonContract_2, out flag);
                text = ((jsonObjectContract_0.ExtensionDataNameResolver != null) ? jsonObjectContract_0.ExtensionDataNameResolver(text) : text);
                if (this.method_11(keyValuePair.Value, null, jsonContract_3, jsonObjectContract_0, jsonProperty_0))
                {
                    jsonWriter_0.WritePropertyName(text);
                    this.method_14(jsonWriter_0, keyValuePair.Value);
                }
                else if (this.method_13(jsonWriter_0, keyValuePair.Value, null, jsonContract_3, jsonObjectContract_0, jsonProperty_0))
                {
                    jsonWriter_0.WritePropertyName(text);
                    this.method_9(jsonWriter_0, keyValuePair.Value, jsonContract_3, null, jsonObjectContract_0, jsonProperty_0);
                }
            }
        }
        jsonWriter_0.WriteEndObject();
        this.list_0.RemoveAt(this.list_0.Count - 1);
        this.method_18(jsonWriter_0, jsonObjectContract_0, object_0);
    }
Exemple #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);
 }
Exemple #3
0
    // Token: 0x060009A6 RID: 2470 RVA: 0x00037DDC File Offset: 0x00035FDC
    private void method_34(JsonWriter jsonWriter_0, IDynamicMetaObjectProvider idynamicMetaObjectProvider_0, JsonDynamicContract jsonDynamicContract_0, JsonProperty jsonProperty_0, JsonContainerContract jsonContainerContract_0, JsonProperty jsonProperty_1)
    {
        this.method_17(jsonWriter_0, jsonDynamicContract_0, idynamicMetaObjectProvider_0);
        this.list_0.Add(idynamicMetaObjectProvider_0);
        this.method_21(jsonWriter_0, idynamicMetaObjectProvider_0, jsonDynamicContract_0, jsonProperty_0, jsonContainerContract_0, jsonProperty_1);
        int top = jsonWriter_0.Top;

        for (int i = 0; i < jsonDynamicContract_0.Properties.Count; i++)
        {
            JsonProperty jsonProperty = jsonDynamicContract_0.Properties[i];
            if (jsonProperty.HasMemberAttribute)
            {
                try
                {
                    JsonContract jsonContract_;
                    object       object_;
                    if (this.method_20(jsonWriter_0, idynamicMetaObjectProvider_0, jsonDynamicContract_0, jsonProperty_0, jsonProperty, out jsonContract_, out object_))
                    {
                        jsonProperty.method_3(jsonWriter_0);
                        this.method_9(jsonWriter_0, object_, jsonContract_, jsonProperty, jsonDynamicContract_0, jsonProperty_0);
                    }
                }
                catch (Exception exception_)
                {
                    if (!base.method_4(idynamicMetaObjectProvider_0, jsonDynamicContract_0, jsonProperty.PropertyName, null, jsonWriter_0.xEuXaafal7(), exception_))
                    {
                        throw;
                    }
                    this.method_39(jsonWriter_0, top);
                }
            }
        }
        foreach (string text in idynamicMetaObjectProvider_0.smethod_0())
        {
            object object_2;
            if (jsonDynamicContract_0.TryGetMember(idynamicMetaObjectProvider_0, text, out object_2))
            {
                try
                {
                    JsonContract jsonContract_2 = this.method_7(object_2);
                    if (this.method_35(object_2))
                    {
                        if (this.method_13(jsonWriter_0, object_2, null, jsonContract_2, jsonDynamicContract_0, jsonProperty_0))
                        {
                            string name = (jsonDynamicContract_0.PropertyNameResolver != null) ? jsonDynamicContract_0.PropertyNameResolver(text) : text;
                            jsonWriter_0.WritePropertyName(name);
                            this.method_9(jsonWriter_0, object_2, jsonContract_2, null, jsonDynamicContract_0, jsonProperty_0);
                        }
                    }
                }
                catch (Exception exception_2)
                {
                    if (!base.method_4(idynamicMetaObjectProvider_0, jsonDynamicContract_0, text, null, jsonWriter_0.xEuXaafal7(), exception_2))
                    {
                        throw;
                    }
                    this.method_39(jsonWriter_0, top);
                }
            }
        }
        jsonWriter_0.WriteEndObject();
        this.list_0.RemoveAt(this.list_0.Count - 1);
        this.method_18(jsonWriter_0, jsonDynamicContract_0, idynamicMetaObjectProvider_0);
    }