Beispiel #1
0
        // Token: 0x060015B0 RID: 5552 RVA: 0x00067430 File Offset: 0x00065630
        private static T GetAttribute <T>(MemberInfo memberInfo) where T : Attribute
        {
            Type associatedMetadataType = Class_470.GetAssociatedMetadataType(memberInfo.DeclaringType);
            T    attribute;

            if (associatedMetadataType != null)
            {
                MemberInfo memberInfoFromType = Class_514.GetMemberInfoFromType(associatedMetadataType, memberInfo);
                if (memberInfoFromType != null)
                {
                    attribute = Class_514.GetAttribute <T>(memberInfoFromType, true);
                    if (attribute != null)
                    {
                        return(attribute);
                    }
                }
            }
            attribute = Class_514.GetAttribute <T>(memberInfo, true);
            if (attribute != null)
            {
                return(attribute);
            }
            if (memberInfo.DeclaringType != null)
            {
                foreach (Type targetType in memberInfo.DeclaringType.GetInterfaces())
                {
                    MemberInfo memberInfoFromType2 = Class_514.GetMemberInfoFromType(targetType, memberInfo);
                    if (memberInfoFromType2 != null)
                    {
                        attribute = Class_514.GetAttribute <T>(memberInfoFromType2, true);
                        if (attribute != null)
                        {
                            return(attribute);
                        }
                    }
                }
            }
            return(default(T));
        }
Beispiel #2
0
        // Token: 0x060015A7 RID: 5543 RVA: 0x0006715C File Offset: 0x0006535C
        public static DataMemberAttribute GetDataMemberAttribute(MemberInfo memberInfo)
        {
            if (memberInfo.MemberType == MemberTypes.Field)
            {
                return(Class_471 <DataMemberAttribute> .GetAttribute(memberInfo));
            }
            PropertyInfo        propertyInfo = (PropertyInfo)memberInfo;
            DataMemberAttribute attribute    = Class_471 <DataMemberAttribute> .GetAttribute(propertyInfo);

            if (attribute == null && propertyInfo.IsVirtual())
            {
                Type type = propertyInfo.DeclaringType;
                while (attribute == null && type != null)
                {
                    PropertyInfo propertyInfo2 = (PropertyInfo)Class_514.GetMemberInfoFromType(type, propertyInfo);
                    if (propertyInfo2 != null && propertyInfo2.IsVirtual())
                    {
                        attribute = Class_471 <DataMemberAttribute> .GetAttribute(propertyInfo2);
                    }
                    type = type.BaseType;
                }
            }
            return(attribute);
        }