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); }
protected virtual JsonObjectContract CreateObjectContract(Type objectType) { JsonObjectContract contract = new JsonObjectContract(objectType); this.method_7(contract); bool ignoreSerializableAttribute = this.IgnoreSerializableAttribute; contract.MemberSerialization = Class139.smethod_7(contract.type_0, ignoreSerializableAttribute); contract.Properties.smethod_1 <JsonProperty>(this.CreateProperties(contract.type_0, contract.MemberSerialization)); JsonObjectAttribute attribute = Class139.smethod_1(contract.type_0); if (attribute != null) { contract.ItemRequired = attribute.nullable_4; } ConstructorInfo constructor = this.method_4(contract.type_0); if (constructor != null) { contract.OverrideConstructor = constructor; contract.ConstructorParameters.smethod_1 <JsonProperty>(this.CreateConstructorParameters(constructor, contract.Properties)); } else if (contract.MemberSerialization == MemberSerialization.Fields) { if (Class139.Boolean_1) { contract.DefaultCreator = new Func <object>(contract.method_5); } } else if ((contract.DefaultCreator == null) || contract.DefaultCreatorNonPublic) { ConstructorInfo info2 = this.method_5(contract.type_0); if (info2 != null) { contract.ParametrizedConstructor = info2; contract.ConstructorParameters.smethod_1 <JsonProperty>(this.CreateConstructorParameters(info2, contract.Properties)); } } contract.ExtensionDataSetter = this.method_3(contract.type_0); return(contract); }