Ejemplo n.º 1
0
 public override void Parse(CLRMetaDataParser parser)
 {
     Parent = (CLRTypeDefRow)parser.ReadTable(CLRMetaDataTables.TableIndex.TypeDef);
     m_firstProperty = parser.ReadTableRawRow(CLRMetaDataTables.TableIndex.Property);
 }
Ejemplo n.º 2
0
        public override void Parse(CLRMetaDataParser parser)
        {
            m_childClasses = new List<CLRTypeDefRow>();
            m_implementedInterfaces = new List<CLRTableRow>();
            m_methodImpls = new List<CLRMethodImplRow>();

            GenericParameters = null;

            uint flags = parser.ReadU32();

            uint vis = flags & 0x07;
            if (vis > 0x07)
                throw new ParseFailedException("Invalid visibility");

            uint layout = flags & 0x18;
            if (layout != 0x0 && layout != 0x08 && layout != 0x10)
                throw new ParseFailedException("Invalid layout");

            uint semantics = flags & 0x20;
            if (semantics != 0 && semantics != 0x20)
                throw new ParseFailedException("Invalid semantics");

            Visibility = (TypeVisibility)vis;
            ClassLayout = (TypeClassLayout)layout;
            Semantics = (TypeSemantics)semantics;
            IsAbstract = (flags & 0x80) != 0;
            IsSealed = (flags & 0x100) != 0;
            IsSpecialName = (flags & 0x400) != 0;
            IsImported = (flags & 0x1000) != 0;
            IsSerializable = (flags & 0x2000) != 0;
            StringFormat = (TypeStringFormat)(flags & 0x30000);
            CustomStringFormat = (byte)((flags & 0xc00000) >> 22);
            IsBeforeFieldInit = (flags & 0x100000) != 0;
            IsRTSpecialName = (flags & 0x800) != 0;
            HasSecurity = (flags & 0x40000) != 0;
            IsTypeForwarder = (flags & 0x200000) != 0;

            TypeName = parser.ReadString();
            TypeNamespace = parser.ReadString();
            Extends = parser.ReadTypeDefOrRefOrSpec();
            m_firstField = parser.ReadTableRawRow(CLRMetaDataTables.TableIndex.Field);
            m_firstMethodDef = parser.ReadTableRawRow(CLRMetaDataTables.TableIndex.MethodDef);

            if (m_firstField == 0 || m_firstMethodDef == 0)
                throw new ParseFailedException("Invalid method/field def span");
        }