Exemplo n.º 1
0
    // Token: 0x060009A9 RID: 2473 RVA: 0x00038134 File Offset: 0x00036334
    private void method_37(JsonWriter jsonWriter_0, IDictionary idictionary_0, JsonDictionaryContract jsonDictionaryContract_0, JsonProperty jsonProperty_0, JsonContainerContract jsonContainerContract_0, JsonProperty jsonProperty_1)
    {
        Interface1 @interface;
        object     obj = ((@interface = (idictionary_0 as Interface1)) != null) ? @interface.UnderlyingDictionary : idictionary_0;

        this.method_17(jsonWriter_0, jsonDictionaryContract_0, obj);
        this.list_0.Add(obj);
        this.method_21(jsonWriter_0, obj, jsonDictionaryContract_0, jsonProperty_0, jsonContainerContract_0, jsonProperty_1);
        if (jsonDictionaryContract_0.EwhtYgWttB() == null)
        {
            jsonDictionaryContract_0.method_5(this.jsonSerializer_0.icontractResolver_0.ResolveContract(jsonDictionaryContract_0.DictionaryValueType ?? typeof(object)));
        }
        if (jsonDictionaryContract_0.method_7() == null)
        {
            jsonDictionaryContract_0.method_8(this.jsonSerializer_0.icontractResolver_0.ResolveContract(jsonDictionaryContract_0.DictionaryKeyType ?? typeof(object)));
        }
        int top = jsonWriter_0.Top;

        using (IDictionaryEnumerator enumerator = idictionary_0.GetEnumerator())
        {
            while (enumerator.MoveNext())
            {
                DictionaryEntry entry = enumerator.Entry;
                bool            escape;
                string          text = this.method_38(jsonWriter_0, entry.Key, jsonDictionaryContract_0.method_7(), out escape);
                text = ((jsonDictionaryContract_0.DictionaryKeyResolver != null) ? jsonDictionaryContract_0.DictionaryKeyResolver(text) : text);
                try
                {
                    object       value         = entry.Value;
                    JsonContract jsonContract_ = jsonDictionaryContract_0.method_6() ?? this.method_7(value);
                    if (this.method_11(value, null, jsonContract_, jsonDictionaryContract_0, jsonProperty_0))
                    {
                        jsonWriter_0.WritePropertyName(text, escape);
                        this.method_14(jsonWriter_0, value);
                    }
                    else if (this.method_13(jsonWriter_0, value, null, jsonContract_, jsonDictionaryContract_0, jsonProperty_0))
                    {
                        jsonWriter_0.WritePropertyName(text, escape);
                        this.method_9(jsonWriter_0, value, jsonContract_, null, jsonDictionaryContract_0, jsonProperty_0);
                    }
                }
                catch (Exception exception_)
                {
                    if (!base.method_4(obj, jsonDictionaryContract_0, text, null, jsonWriter_0.xEuXaafal7(), exception_))
                    {
                        throw;
                    }
                    this.method_39(jsonWriter_0, top);
                }
            }
        }
        jsonWriter_0.WriteEndObject();
        this.list_0.RemoveAt(this.list_0.Count - 1);
        this.method_18(jsonWriter_0, jsonDictionaryContract_0, obj);
    }
Exemplo n.º 2
0
        private void method_7(JsonWriter jsonWriter_0, object object_0, JsonContract jsonContract_1, JsonProperty jsonProperty_0, JsonContainerContract jsonContainerContract_0, JsonProperty jsonProperty_1)
        {
            if (object_0 == null)
            {
                jsonWriter_0.WriteNull();
            }
            else
            {
                JsonConverter converter;
                if ((((((converter = (jsonProperty_0 != null) ? jsonProperty_0.Converter : null) != null) || ((converter = (jsonProperty_1 != null) ? jsonProperty_1.ItemConverter : null) != null)) || ((converter = (jsonContainerContract_0 != null) ? jsonContainerContract_0.ItemConverter : null) != null)) || ((((converter = jsonContract_1.Converter) != null) || ((converter = base.jsonSerializer_0.method_2(jsonContract_1.UnderlyingType)) != null)) || ((converter = jsonContract_1.JsonConverter_0) != null))) && converter.CanWrite)
                {
                    this.method_25(jsonWriter_0, converter, object_0, jsonContract_1, jsonContainerContract_0, jsonProperty_1);
                }
                else
                {
                    switch (jsonContract_1.enum15_0)
                    {
                    case Enum15.Object:
                        this.method_17(jsonWriter_0, object_0, (JsonObjectContract)jsonContract_1, jsonProperty_0, jsonContainerContract_0, jsonProperty_1);
                        return;

                    case Enum15.Array:
                    {
                        JsonArrayContract contract = (JsonArrayContract)jsonContract_1;
                        if (contract.IsMultidimensionalArray)
                        {
                            this.method_27(jsonWriter_0, (Array)object_0, contract, jsonProperty_0, jsonContainerContract_0, jsonProperty_1);
                            return;
                        }
                        this.method_26(jsonWriter_0, (IEnumerable)object_0, contract, jsonProperty_0, jsonContainerContract_0, jsonProperty_1);
                        return;
                    }

                    case Enum15.Primitive:
                        this.method_6(jsonWriter_0, object_0, (JsonPrimitiveContract)jsonContract_1, jsonProperty_0, jsonContainerContract_0, jsonProperty_1);
                        return;

                    case Enum15.String:
                        this.method_14(jsonWriter_0, object_0, (JsonStringContract)jsonContract_1);
                        return;

                    case Enum15.Dictionary:
                    {
                        JsonDictionaryContract contract2 = (JsonDictionaryContract)jsonContract_1;
                        this.method_34(jsonWriter_0, (object_0 is IDictionary) ? ((IDictionary)object_0) : contract2.method_5(object_0), contract2, jsonProperty_0, jsonContainerContract_0, jsonProperty_1);
                        return;
                    }

                    case Enum15.Dynamic:
                        this.method_31(jsonWriter_0, (IDynamicMetaObjectProvider)object_0, (JsonDynamicContract)jsonContract_1, jsonProperty_0, jsonContainerContract_0, jsonProperty_1);
                        return;

                    case Enum15.Serializable:
                        this.method_30(jsonWriter_0, (ISerializable)object_0, (JsonISerializableContract)jsonContract_1, jsonProperty_0, jsonContainerContract_0, jsonProperty_1);
                        return;

                    case Enum15.Linq:
                        ((JToken)object_0).WriteTo(jsonWriter_0, base.jsonSerializer_0.JsonConverterCollection_0.ToArray <JsonConverter>());
                        return;
                    }
                }
            }
        }