internal static void AssignAssociates(MetadataImport scope, int mdPropEvent, RuntimeType declaringType, RuntimeType reflectedType, out RuntimeMethodInfo addOn, out RuntimeMethodInfo removeOn, out RuntimeMethodInfo fireOn, out RuntimeMethodInfo getter, out RuntimeMethodInfo setter, out MethodInfo[] other, out bool composedOfAllPrivateMethods, out BindingFlags bindingFlags) { RuntimeMethodInfo runtimeMethodInfo; setter = (runtimeMethodInfo = null); getter = (runtimeMethodInfo = runtimeMethodInfo); fireOn = (runtimeMethodInfo = runtimeMethodInfo); removeOn = (runtimeMethodInfo = runtimeMethodInfo); addOn = runtimeMethodInfo; Associates.Attributes attributes = Associates.Attributes.ComposedOfAllVirtualMethods | Associates.Attributes.ComposedOfAllPrivateMethods | Associates.Attributes.ComposedOfNoPublicMembers | Associates.Attributes.ComposedOfNoStaticMembers; while (RuntimeTypeHandle.IsGenericVariable(reflectedType)) { reflectedType = (RuntimeType)reflectedType.BaseType; } bool isInherited = declaringType != reflectedType; List <MethodInfo> list = null; MetadataEnumResult metadataEnumResult; scope.Enum(MetadataTokenType.MethodDef, mdPropEvent, out metadataEnumResult); int num = metadataEnumResult.Length / 2; for (int i = 0; i < num; i++) { int tkMethod = metadataEnumResult[i * 2]; MethodSemanticsAttributes methodSemanticsAttributes = (MethodSemanticsAttributes)metadataEnumResult[i * 2 + 1]; RuntimeMethodInfo runtimeMethodInfo2 = Associates.AssignAssociates(tkMethod, declaringType, reflectedType); if (!(runtimeMethodInfo2 == null)) { MethodAttributes attributes2 = runtimeMethodInfo2.Attributes; bool flag = (attributes2 & MethodAttributes.MemberAccessMask) == MethodAttributes.Private; bool flag2 = (attributes2 & MethodAttributes.Virtual) > MethodAttributes.PrivateScope; MethodAttributes methodAttributes = attributes2 & MethodAttributes.MemberAccessMask; bool flag3 = methodAttributes == MethodAttributes.Public; bool flag4 = (attributes2 & MethodAttributes.Static) > MethodAttributes.PrivateScope; if (flag3) { attributes &= ~Associates.Attributes.ComposedOfNoPublicMembers; attributes &= ~Associates.Attributes.ComposedOfAllPrivateMethods; } else if (!flag) { attributes &= ~Associates.Attributes.ComposedOfAllPrivateMethods; } if (flag4) { attributes &= ~Associates.Attributes.ComposedOfNoStaticMembers; } if (!flag2) { attributes &= ~Associates.Attributes.ComposedOfAllVirtualMethods; } if (methodSemanticsAttributes == MethodSemanticsAttributes.Setter) { setter = runtimeMethodInfo2; } else if (methodSemanticsAttributes == MethodSemanticsAttributes.Getter) { getter = runtimeMethodInfo2; } else if (methodSemanticsAttributes == MethodSemanticsAttributes.Fire) { fireOn = runtimeMethodInfo2; } else if (methodSemanticsAttributes == MethodSemanticsAttributes.AddOn) { addOn = runtimeMethodInfo2; } else if (methodSemanticsAttributes == MethodSemanticsAttributes.RemoveOn) { removeOn = runtimeMethodInfo2; } else { if (list == null) { list = new List <MethodInfo>(num); } list.Add(runtimeMethodInfo2); } } } bool isPublic = (attributes & Associates.Attributes.ComposedOfNoPublicMembers) == (Associates.Attributes) 0; bool isStatic = (attributes & Associates.Attributes.ComposedOfNoStaticMembers) == (Associates.Attributes) 0; bindingFlags = RuntimeType.FilterPreCalculate(isPublic, isInherited, isStatic); composedOfAllPrivateMethods = ((attributes & Associates.Attributes.ComposedOfAllPrivateMethods) > (Associates.Attributes) 0); other = ((list != null) ? list.ToArray() : null); }
internal static void AssignAssociates(MetadataImport scope, int mdPropEvent, RuntimeType declaringType, RuntimeType reflectedType, out RuntimeMethodInfo addOn, out RuntimeMethodInfo removeOn, out RuntimeMethodInfo fireOn, out RuntimeMethodInfo getter, out RuntimeMethodInfo setter, out MethodInfo[] other, out bool composedOfAllPrivateMethods, out BindingFlags bindingFlags) { addOn = removeOn = fireOn = getter = setter = (RuntimeMethodInfo)null; Associates.Attributes attributes1 = Associates.Attributes.ComposedOfAllVirtualMethods | Associates.Attributes.ComposedOfAllPrivateMethods | Associates.Attributes.ComposedOfNoPublicMembers | Associates.Attributes.ComposedOfNoStaticMembers; while (RuntimeTypeHandle.IsGenericVariable(reflectedType)) { reflectedType = (RuntimeType)reflectedType.BaseType; } bool isInherited = declaringType != reflectedType; List <MethodInfo> methodInfoList = (List <MethodInfo>)null; MetadataEnumResult result; scope.Enum(MetadataTokenType.MethodDef, mdPropEvent, out result); int capacity = result.Length / 2; for (int index = 0; index < capacity; ++index) { int tkMethod = result[index * 2]; MethodSemanticsAttributes semanticsAttributes = (MethodSemanticsAttributes)result[index * 2 + 1]; RuntimeType declaredType = declaringType; RuntimeType reflectedType1 = reflectedType; RuntimeMethodInfo runtimeMethodInfo = Associates.AssignAssociates(tkMethod, declaredType, reflectedType1); if (!((MethodInfo)runtimeMethodInfo == (MethodInfo)null)) { MethodAttributes attributes2 = runtimeMethodInfo.Attributes; bool flag1 = (attributes2 & MethodAttributes.MemberAccessMask) == MethodAttributes.Private; bool flag2 = (uint)(attributes2 & MethodAttributes.Virtual) > 0U; int num = (attributes2 & MethodAttributes.MemberAccessMask) == MethodAttributes.Public ? 1 : 0; bool flag3 = (uint)(attributes2 & MethodAttributes.Static) > 0U; if (num != 0) { attributes1 = attributes1 & ~Associates.Attributes.ComposedOfNoPublicMembers & ~Associates.Attributes.ComposedOfAllPrivateMethods; } else if (!flag1) { attributes1 &= ~Associates.Attributes.ComposedOfAllPrivateMethods; } if (flag3) { attributes1 &= ~Associates.Attributes.ComposedOfNoStaticMembers; } if (!flag2) { attributes1 &= ~Associates.Attributes.ComposedOfAllVirtualMethods; } if (semanticsAttributes == MethodSemanticsAttributes.Setter) { setter = runtimeMethodInfo; } else if (semanticsAttributes == MethodSemanticsAttributes.Getter) { getter = runtimeMethodInfo; } else if (semanticsAttributes == MethodSemanticsAttributes.Fire) { fireOn = runtimeMethodInfo; } else if (semanticsAttributes == MethodSemanticsAttributes.AddOn) { addOn = runtimeMethodInfo; } else if (semanticsAttributes == MethodSemanticsAttributes.RemoveOn) { removeOn = runtimeMethodInfo; } else { if (methodInfoList == null) { methodInfoList = new List <MethodInfo>(capacity); } methodInfoList.Add((MethodInfo)runtimeMethodInfo); } } } bool isPublic = (attributes1 & Associates.Attributes.ComposedOfNoPublicMembers) == (Associates.Attributes) 0; bool isStatic = (attributes1 & Associates.Attributes.ComposedOfNoStaticMembers) == (Associates.Attributes) 0; bindingFlags = RuntimeType.FilterPreCalculate(isPublic, isInherited, isStatic); composedOfAllPrivateMethods = (uint)(attributes1 & Associates.Attributes.ComposedOfAllPrivateMethods) > 0U; other = methodInfoList != null?methodInfoList.ToArray() : (MethodInfo[])null; }