private ExtensionDataSetter method_3(Type type_0) { ExtensionDataSetter setter = null; foreach (Type type in this.method_10(type_0)) { IList <MemberInfo> list = new List <MemberInfo>(); list.smethod_1 <MemberInfo>(type.GetProperties(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)); list.smethod_1 <MemberInfo>(type.GetFields(BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance | BindingFlags.DeclaredOnly)); using (IEnumerator <MemberInfo> enumerator2 = list.GetEnumerator()) { MemberInfo current; while (enumerator2.MoveNext()) { current = enumerator2.Current; MemberTypes types = current.smethod_1(); if (((types == MemberTypes.Property) || (types == MemberTypes.Field)) && current.IsDefined(typeof(JsonExtensionDataAttribute), false)) { Type type3; Type type2 = Class194.smethod_20(current); if (!Class194.smethod_14(type2, typeof(IDictionary <,>), out type3)) { goto Label_01AF; } Type type4 = type3.GetGenericArguments()[0]; Type type5 = type3.GetGenericArguments()[1]; if (Class194.smethod_12(type2, typeof(IDictionary <,>))) { type2 = typeof(Dictionary <,>).MakeGenericType(new Type[] { type4, type5 }); } if (!type4.IsAssignableFrom(typeof(string)) || !type5.IsAssignableFrom(typeof(JToken))) { goto Label_01AF; } Class126 class2 = new Class126(); MethodInfo method = type2.GetMethod("Add", new Type[] { type4, type5 }); class2.func_0 = Class139.Class166_0.method_0 <object>(current); class2.action_0 = Class139.Class166_0.method_1 <object>(current); class2.func_1 = Class139.Class166_0.ns20.Class166. <object>(type2); class2.delegate3_0 = Class139.Class166_0.ns20.Class166. <object>(method); setter = new ExtensionDataSetter(class2.method_0); } } continue; Label_01AF: throw new JsonException("Invalid extension data attribute on '{0}'. Member '{1}' type must implement IDictionary<string, JToken>.".smethod_1(CultureInfo.InvariantCulture, smethod_4(current.DeclaringType), current.Name)); } } return(setter); }
private void method_13(JsonProperty jsonProperty_0, MemberInfo memberInfo_0, bool bool_4) { Class129 class2 = new Class129(); MemberInfo property = memberInfo_0.DeclaringType.GetProperty(memberInfo_0.Name + "Specified"); if (property == null) { property = memberInfo_0.DeclaringType.GetField(memberInfo_0.Name + "Specified"); } if ((property != null) && (Class194.smethod_20(property) == typeof(bool))) { class2.func_0 = Class139.Class166_0.method_0 <object>(property); jsonProperty_0.GetIsSpecified = new Predicate <object>(class2.method_0); if (Class194.smethod_26(property, bool_4, false)) { jsonProperty_0.SetIsSpecified = Class139.Class166_0.method_1 <object>(property); } } }
protected virtual JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization) { bool flag; JsonProperty property = new JsonProperty { PropertyType = Class194.smethod_20(member), DeclaringType = member.DeclaringType, ValueProvider = this.CreateMemberValueProvider(member) }; this.method_11(property, member, member.Name, member.DeclaringType, memberSerialization, out flag); if (memberSerialization != MemberSerialization.Fields) { property.Readable = Class194.smethod_25(member, flag); property.Writable = Class194.smethod_26(member, flag, property.HasMemberAttribute); } else { property.Readable = true; property.Writable = true; } property.ShouldSerialize = this.method_12(member); this.method_13(property, member, flag); return(property); }