コード例 #1
0
 protected virtual JsonConverter ResolveContractConverter(Type objectType)
 {
     return(Class139.smethod_10(objectType, objectType));
 }
コード例 #2
0
        private void method_11(JsonProperty jsonProperty_0, object object_1, string string_0, Type type_0, MemberSerialization memberSerialization_0, out bool bool_4)
        {
            DataMemberAttribute attribute2;
            string propertyName;
            DataContractAttribute attribute = Class139.smethod_5(type_0);
            MemberInfo            info      = object_1 as MemberInfo;

            if ((attribute != null) && (info != null))
            {
                attribute2 = Class139.smethod_6(info);
            }
            else
            {
                attribute2 = null;
            }
            JsonPropertyAttribute attribute3 = Class139.smethod_17 <JsonPropertyAttribute>(object_1);

            if (attribute3 != null)
            {
                jsonProperty_0.HasMemberAttribute = true;
            }
            if ((attribute3 != null) && (attribute3.PropertyName != null))
            {
                propertyName = attribute3.PropertyName;
            }
            else if ((attribute2 != null) && (attribute2.Name != null))
            {
                propertyName = attribute2.Name;
            }
            else
            {
                propertyName = string_0;
            }
            jsonProperty_0.PropertyName   = this.ResolvePropertyName(propertyName);
            jsonProperty_0.UnderlyingName = string_0;
            bool flag = false;

            if (attribute3 != null)
            {
                jsonProperty_0.nullable_0           = attribute3.nullable_7;
                jsonProperty_0.Order                = attribute3.nullable_6;
                jsonProperty_0.DefaultValueHandling = attribute3.nullable_1;
                flag = true;
            }
            else if (attribute2 != null)
            {
                jsonProperty_0.nullable_0           = new Required?(attribute2.IsRequired ? Required.AllowNull : Required.Default);
                jsonProperty_0.Order                = (attribute2.Order != -1) ? new int?(attribute2.Order) : null;
                jsonProperty_0.DefaultValueHandling = !attribute2.EmitDefaultValue ? ((DefaultValueHandling?)1) : null;
                flag = true;
            }
            bool flag2 = ((Class139.smethod_17 <JsonIgnoreAttribute>(object_1) != null) || (Class139.smethod_17 <JsonExtensionDataAttribute>(object_1) != null)) || (Class139.smethod_17 <NonSerializedAttribute>(object_1) != null);

            if (memberSerialization_0 != MemberSerialization.OptIn)
            {
                bool flag3 = false;
                flag3 = Class139.smethod_17 <IgnoreDataMemberAttribute>(object_1) != null;
                jsonProperty_0.Ignored = flag2 || flag3;
            }
            else
            {
                jsonProperty_0.Ignored = flag2 || !flag;
            }
            jsonProperty_0.Converter       = Class139.smethod_10(object_1, jsonProperty_0.PropertyType);
            jsonProperty_0.MemberConverter = Class139.smethod_10(object_1, jsonProperty_0.PropertyType);
            DefaultValueAttribute attribute4 = Class139.smethod_17 <DefaultValueAttribute>(object_1);

            if (attribute4 != null)
            {
                jsonProperty_0.DefaultValue = attribute4.Value;
            }
            jsonProperty_0.NullValueHandling         = (attribute3 != null) ? attribute3.nullable_0 : null;
            jsonProperty_0.ReferenceLoopHandling     = (attribute3 != null) ? attribute3.nullable_2 : null;
            jsonProperty_0.ObjectCreationHandling    = (attribute3 != null) ? attribute3.nullable_3 : null;
            jsonProperty_0.TypeNameHandling          = (attribute3 != null) ? attribute3.nullable_4 : null;
            jsonProperty_0.IsReference               = (attribute3 != null) ? attribute3.nullable_5 : null;
            jsonProperty_0.ItemIsReference           = (attribute3 != null) ? attribute3.nullable_8 : null;
            jsonProperty_0.ItemConverter             = ((attribute3 == null) || (attribute3.ItemConverterType == null)) ? null : JsonConverterAttribute.smethod_0(attribute3.ItemConverterType);
            jsonProperty_0.ItemReferenceLoopHandling = (attribute3 != null) ? attribute3.nullable_9 : null;
            jsonProperty_0.ItemTypeNameHandling      = (attribute3 != null) ? attribute3.nullable_10 : null;
            bool_4 = false;
            if ((this.DefaultMembersSearchFlags & BindingFlags.NonPublic) == BindingFlags.NonPublic)
            {
                bool_4 = true;
            }
            if (attribute3 != null)
            {
                bool_4 = true;
            }
            if (memberSerialization_0 == MemberSerialization.Fields)
            {
                bool_4 = true;
            }
            if (attribute2 != null)
            {
                bool_4 = true;
                jsonProperty_0.HasMemberAttribute = true;
            }
        }