private void method_7(JsonContract jsonContract_0) { JsonContainerAttribute attribute = Class139.smethod_0(jsonContract_0.type_0); if (attribute != null) { jsonContract_0.IsReference = attribute.nullable_0; } else { DataContractAttribute attribute2 = Class139.smethod_5(jsonContract_0.type_0); if ((attribute2 != null) && attribute2.IsReference) { jsonContract_0.IsReference = true; } } jsonContract_0.Converter = this.ResolveContractConverter(jsonContract_0.type_0); jsonContract_0.JsonConverter_0 = JsonSerializer.smethod_1(ilist_0, jsonContract_0.type_0); if (Class194.smethod_6(jsonContract_0.CreatedType, true) || jsonContract_0.CreatedType.smethod_12()) { jsonContract_0.DefaultCreator = this.method_6(jsonContract_0.CreatedType); jsonContract_0.DefaultCreatorNonPublic = !jsonContract_0.CreatedType.smethod_12() && (Class194.smethod_7(jsonContract_0.CreatedType) == null); } this.method_8(jsonContract_0, jsonContract_0.type_0); }
protected virtual List <MemberInfo> GetSerializableMembers(Type objectType) { bool ignoreSerializableAttribute = this.IgnoreSerializableAttribute; MemberSerialization serialization = Class139.smethod_7(objectType, ignoreSerializableAttribute); if (func_0 == null) { func_0 = new Func <MemberInfo, bool>(DefaultContractResolver.smethod_5); } List <MemberInfo> list = Class194.smethod_27(objectType, BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance).Where <MemberInfo>(func_0).ToList <MemberInfo>(); List <MemberInfo> source = new List <MemberInfo>(); if (serialization != MemberSerialization.Fields) { Type type; DataContractAttribute attribute = Class139.smethod_5(objectType); if (func_1 == null) { func_1 = new Func <MemberInfo, bool>(DefaultContractResolver.smethod_6); } List <MemberInfo> list3 = Class194.smethod_27(objectType, this.DefaultMembersSearchFlags).Where <MemberInfo>(func_1).ToList <MemberInfo>(); foreach (MemberInfo info in list) { if (this.SerializeCompilerGeneratedMembers || !info.IsDefined(typeof(CompilerGeneratedAttribute), true)) { if (list3.Contains(info)) { source.Add(info); } else if (Class139.smethod_17 <JsonPropertyAttribute>(info) != null) { source.Add(info); } else if ((attribute != null) && (Class139.smethod_17 <DataMemberAttribute>(info) != null)) { source.Add(info); } else if ((serialization == MemberSerialization.Fields) && (info.smethod_1() == MemberTypes.Field)) { source.Add(info); } } } if (objectType.smethod_13("System.Data.Objects.DataClasses.EntityObject", out type)) { source = source.Where <MemberInfo>(new Func <MemberInfo, bool>(this.method_2)).ToList <MemberInfo>(); } return(source); } foreach (MemberInfo info2 in list) { FieldInfo info3 = info2 as FieldInfo; if ((info3 != null) && !info3.IsStatic) { source.Add(info2); } } return(source); }
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; } }