Пример #1
0
        public Field(uint token)
            : base(token)
        {
            char[] szName = new char[1024];
            uint   outNameSize;
            uint   tokclass, attr, sigBlobSize, constValueType, constValueSize;
            IntPtr sigBlob, constValue;

            Context.importIntf.GetFieldProps
                (token, out tokclass, szName, 1024, out outNameSize, out attr,
                out sigBlob, out sigBlobSize,
                out constValueType, out constValue, out constValueSize);

            this.name          = Decoder.ReadString(szName, (int)outNameSize);
            this.flags         = (CorFieldAttr)attr;
            this.declaringType = Type.Get(tokclass, null);

            int idx = 0;
            CorCallingConvention b = (CorCallingConvention)Decoder.ReadValue(sigBlob, ref idx);

            if (b != CorCallingConvention.FIELD)
            {
                throw new ArgumentException("Not a field signature");
            }
            CustomMod.ReadCustomMods(sigBlob, ref idx);
            this.type = new Type(sigBlob, ref idx, this.declaringType);

            if (this.IsLiteral)
            {
                this.constValue = new ConstValue(constValueType, constValue, constValueSize);
            }
        }
Пример #2
0
        private string ReservedFlagsAsString()
        {
            string       result        = string.Empty;
            CorFieldAttr reservedFlags = Flags & CorFieldAttr.fdReservedMask;

            result = NuGenHelperFunctions.EnumAsString(Flags, CorFieldAttr.fdRTSpecialName, "rtsspecialname ");

            result += NuGenHelperFunctions.EnumAsString(Flags, CorFieldAttr.fdHasFieldMarshal, "marshal ");

            return(result);
        }
Пример #3
0
        private string MemberAccessAsString()
        {
            string       result       = string.Empty;
            CorFieldAttr memberAccess = Flags & CorFieldAttr.fdFieldAccessMask;

            switch (memberAccess)
            {
            case CorFieldAttr.fdPrivateScope:
                result = "privatescope ";
                break;

            case CorFieldAttr.fdPrivate:
                result = "private ";
                break;

            case CorFieldAttr.fdFamANDAssem:
                result = "famandassem ";
                break;

            case CorFieldAttr.fdAssembly:
                result = "assembly ";
                break;

            case CorFieldAttr.fdFamily:
                result = "family ";
                break;

            case CorFieldAttr.fdFamORAssem:
                result = "famorassem ";
                break;

            case CorFieldAttr.fdPublic:
                result = "public ";
                break;
            }

            return(result);
        }