void AppendCustomAttrs(IList <CustomAttributeDataMirror> attrs, TypeMirror type, bool inherit)
        {
#if ENABLE_CECIL
            if (cattrs == null && Metadata != null && !Metadata.HasCustomAttributes)
            {
                cattrs = new CustomAttributeDataMirror [0];
            }
#endif

            if (cattrs == null)
            {
                CattrInfo[] info = vm.conn.Type_GetCustomAttributes(id, 0, false);
                cattrs = CustomAttributeDataMirror.Create(vm, info);
            }

            foreach (var attr in cattrs)
            {
                if (type == null || attr.Constructor.DeclaringType == type)
                {
                    attrs.Add(attr);
                }
            }

            if (inherit && BaseType != null)
            {
                BaseType.AppendCustomAttrs(attrs, type, inherit);
            }
        }
Beispiel #2
0
        CustomAttributeDataMirror[] GetCAttrs(TypeMirror type, bool inherit)
        {
#if ENABLE_CECIL
            if (cattrs == null && Metadata != null && !Metadata.HasCustomAttributes)
            {
                cattrs = new CustomAttributeDataMirror [0];
            }
#endif

            // FIXME: Handle inherit
            if (cattrs == null)
            {
                CattrInfo[] info = vm.conn.Type_GetFieldCustomAttributes(DeclaringType.Id, id, 0, false);
                cattrs = CustomAttributeDataMirror.Create(vm, info);
            }
            var res = new List <CustomAttributeDataMirror> ();
            foreach (var attr in cattrs)
            {
                if (type == null || attr.Constructor.DeclaringType == type)
                {
                    res.Add(attr);
                }
            }
            return(res.ToArray());
        }
Beispiel #3
0
        CustomAttributeDataMirror[] GetCAttrs(TypeMirror type)
        {
            vm.CheckProtocolVersion(2, 58);

#if ENABLE_CECIL
            if (cattrs == null && meta != null && !Metadata.HasCustomAttributes)
            {
                cattrs = new CustomAttributeDataMirror [0];
            }
#endif

            if (cattrs == null)
            {
                CattrInfo[] info = vm.conn.Assembly_GetCustomAttributes(id, 0);
                cattrs = CustomAttributeDataMirror.Create(vm, info);
            }
            var res = new List <CustomAttributeDataMirror> ();
            foreach (var attr in cattrs)
            {
                if (type == null || attr.Constructor.DeclaringType == type)
                {
                    res.Add(attr);
                }
            }
            return(res.ToArray());
        }
Beispiel #4
0
        CustomAttributeDataMirror[] GetCAttrs(TypeMirror type, bool inherit)
        {
            // FIXME: Handle inherit
            if (cattrs == null)
            {
                CattrInfo[] info = vm.conn.Type_GetCustomAttributes(id, 0, false);
                cattrs = CustomAttributeDataMirror.Create(vm, info);
            }
            var res = new List <CustomAttributeDataMirror> ();

            foreach (var attr in cattrs)
            {
                if (type == null || attr.Constructor.DeclaringType == type)
                {
                    res.Add(attr);
                }
            }
            return(res.ToArray());
        }