예제 #1
0
        // Token: 0x06001784 RID: 6020 RVA: 0x0006F5E8 File Offset: 0x0006D7E8
        private static bool IsOverridenGenericMember(MemberInfo memberInfo, BindingFlags bindingAttr)
        {
            if (memberInfo.MemberType != MemberTypes.Property)
            {
                return(false);
            }
            PropertyInfo propertyInfo = (PropertyInfo)memberInfo;

            if (!propertyInfo.IsVirtual())
            {
                return(false);
            }
            Type declaringType = propertyInfo.DeclaringType;

            if (!declaringType.IsGenericType)
            {
                return(false);
            }
            Type genericTypeDefinition = declaringType.GetGenericTypeDefinition();

            if (genericTypeDefinition == null)
            {
                return(false);
            }
            MemberInfo[] member = genericTypeDefinition.GetMember(propertyInfo.Name, bindingAttr);
            if (member.Length == 0)
            {
                return(false);
            }
            Type memberUnderlyingType = Class_514.GetMemberUnderlyingType(member[0]);

            return(memberUnderlyingType.IsGenericParameter);
        }
예제 #2
0
        // Token: 0x06001693 RID: 5779 RVA: 0x0006A6A4 File Offset: 0x000688A4
        public static Class_491 dmethod_4066(Type arg_0, MethodBase arg_1, params string[] strDizi_0)
        {
            Class_491 class_ = new Class_491();
            Class_480 reflectionDelegateFactory = Class_470.ReflectionDelegateFactory;

            if (arg_1 != null)
            {
                class_.prop_0 = reflectionDelegateFactory.pmethod_4009(arg_1);
            }
            else if (Class_514.HasDefaultConstructor(arg_0, false))
            {
                Class_491.NClass_0 nclass_ = new Class_491.NClass_0();
                nclass_.field_3 = reflectionDelegateFactory.smethod_4010 <object>(arg_0);
                class_.prop_0   = new Class_482 <object>(nclass_.nmethod_1);
            }
            int i = 0;

            while (i < strDizi_0.Length)
            {
                string       text   = strDizi_0[i];
                MemberInfo[] member = arg_0.GetMember(text, BindingFlags.Instance | BindingFlags.Public);
                if (member.Length != 1)
                {
                    throw new ArgumentException("Expected a single member with the name '{0}'.".FormatWith(CultureInfo.InvariantCulture, text));
                }
                MemberInfo  memberInfo = member.Single <MemberInfo>();
                Class_490   class_2    = new Class_490();
                MemberTypes memberType = memberInfo.MemberType;
                if (memberType == MemberTypes.Field)
                {
                    goto IL_CE;
                }
                if (memberType != MemberTypes.Method)
                {
                    if (memberType == MemberTypes.Property)
                    {
                        goto IL_CE;
                    }
                    throw new ArgumentException("Unexpected member type '{0}' for member '{1}'.".FormatWith(CultureInfo.InvariantCulture, memberInfo.MemberType, memberInfo.Name));
                }
                else
                {
                    MethodInfo methodInfo = (MethodInfo)memberInfo;
                    if (methodInfo.IsPublic)
                    {
                        ParameterInfo[] parameters = methodInfo.GetParameters();
                        if (parameters.Length == 0 && methodInfo.ReturnType != typeof(void))
                        {
                            Class_491.NClass_1 nclass_2 = new Class_491.NClass_1();
                            nclass_2.field_4 = reflectionDelegateFactory.lmethod_4008 <object>(methodInfo);
                            class_2.prop_1   = new Func <object, object>(nclass_2.nmethod_3);
                        }
                        else if (parameters.Length == 1 && methodInfo.ReturnType == typeof(void))
                        {
                            Class_491.NClass_2 nclass_3 = new Class_491.NClass_2();
                            nclass_3.field_5 = reflectionDelegateFactory.lmethod_4008 <object>(methodInfo);
                            class_2.prop_2   = new Action <object, object>(nclass_3.nmethod_5);
                        }
                    }
                }
IL_1F9:
                if (Class_514.CanReadMemberValue(memberInfo, false))
                {
                    class_2.prop_1 = reflectionDelegateFactory.dmethod_4006 <object>(memberInfo);
                }
                if (Class_514.CanSetMemberValue(memberInfo, false, false))
                {
                    class_2.prop_2 = reflectionDelegateFactory.kmethod_4007 <object>(memberInfo);
                }
                class_2.prop_0      = Class_514.GetMemberUnderlyingType(memberInfo);
                class_.prop_1[text] = class_2;
                i++;
                continue;
IL_CE:
                if (Class_514.CanReadMemberValue(memberInfo, false))
                {
                    class_2.prop_1 = reflectionDelegateFactory.dmethod_4006 <object>(memberInfo);
                }
                if (Class_514.CanSetMemberValue(memberInfo, false, false))
                {
                    class_2.prop_2 = reflectionDelegateFactory.kmethod_4007 <object>(memberInfo);
                    goto IL_1F9;
                }
                goto IL_1F9;
            }
            return(class_);
        }