Esempio n. 1
0
        // Token: 0x060015AF RID: 5551 RVA: 0x0006739C File Offset: 0x0006559C
        private static T GetAttribute <T>(Type type) where T : Attribute
        {
            Type associatedMetadataType = Class_470.GetAssociatedMetadataType(type);
            T    attribute;

            if (associatedMetadataType != null)
            {
                attribute = Class_514.GetAttribute <T>(associatedMetadataType, true);
                if (attribute != null)
                {
                    return(attribute);
                }
            }
            attribute = Class_514.GetAttribute <T>(type, true);
            if (attribute != null)
            {
                return(attribute);
            }
            foreach (Type attributeProvider in type.GetInterfaces())
            {
                attribute = Class_514.GetAttribute <T>(attributeProvider, true);
                if (attribute != null)
                {
                    return(attribute);
                }
            }
            return(default(T));
        }
Esempio n. 2
0
        // Token: 0x060015B1 RID: 5553 RVA: 0x00067510 File Offset: 0x00065710
        public static T GetAttribute <T>(object provider) where T : Attribute
        {
            Type type = provider as Type;

            if (type != null)
            {
                return(Class_470.GetAttribute <T>(type));
            }
            MemberInfo memberInfo = provider as MemberInfo;

            if (memberInfo != null)
            {
                return(Class_470.GetAttribute <T>(memberInfo));
            }
            return(Class_514.GetAttribute <T>(provider, true));
        }
Esempio n. 3
0
        // Token: 0x060014DB RID: 5339 RVA: 0x00060810 File Offset: 0x0005EA10
        private string dmethod_3816(Type arg_0)
        {
            Class_316 cachedAttribute = Class_470.GetCachedAttribute <Class_316>(arg_0);

            if (cachedAttribute != null && !string.IsNullOrEmpty(cachedAttribute.prop_2))
            {
                return(cachedAttribute.prop_2);
            }
            DescriptionAttribute attribute = Class_514.GetAttribute <DescriptionAttribute>(arg_0);

            if (attribute != null)
            {
                return(attribute.Description);
            }
            return(null);
        }
Esempio n. 4
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));
        }