/// <summary>
        /// Initialises a new EventMapMetadataTableRow
        /// </summary>
        /// <param name="contents">The contents of the file</param>
        /// <param name="offset">The offset of the current row</param>
        public EventMapMetadataTableRow(byte[] contents, Offset offset, IIndexDetails indexDetails)
        {
            this.FileOffset = offset;

            byte typeDefIndexSize = indexDetails.GetSizeOfIndex(MetadataTables.TypeDef);
            byte eventIndexSize   = indexDetails.GetSizeOfIndex(MetadataTables.Event);

            _parentIndex    = new Index(contents, offset, typeDefIndexSize);
            _eventListIndex = new Index(contents, offset, eventIndexSize);
        }
        /// <summary>
        /// Initialises a new instance of the PropertyMapMetadataTableRow
        /// </summary>
        /// <param name="contents">The contents of the file</param>
        /// <param name="offset">The offset for this row</param>
        public PropertyMapMetadataTableRow(byte[] contents, Offset offset, IIndexDetails indexDetails)
        {
            this.FileOffset = offset;

            byte sizeOfTypeDefIndex  = indexDetails.GetSizeOfIndex(MetadataTables.TypeDef);
            byte sizeOfPropertyIndex = indexDetails.GetSizeOfIndex(MetadataTables.Property);

            _parent       = new Index(contents, offset, sizeOfTypeDefIndex);
            _propertyList = new Index(contents, offset, sizeOfPropertyIndex);
        }
        /// <summary>
        /// Initialises a new instance of the FieldRVAMetadataTableRow class
        /// </summary>
        /// <param name="content">The content of the file</param>
        /// <param name="offset">The offset for the current row</param>
        public FieldRVAMetadataTableRow(byte[] content, Offset offset, IIndexDetails indexDetails)
        {
            this.FileOffset = offset;

            byte sizeOfFieldIndex = indexDetails.GetSizeOfIndex(MetadataTables.Field);

            _rva        = FieldReader.ToUInt32(content, offset.Shift(4));
            _fieldIndex = new Index(content, offset, sizeOfFieldIndex);
        }
Esempio n. 4
0
        /// <summary>
        /// Initialises a new instance of the NestedClassMetadataTableRow class
        /// </summary>
        /// <param name="contents">The contents of the file</param>
        /// <param name="offset">The offset of the current row</param>
        public NestedClassMetadataTableRow(byte[] contents, Offset offset, IIndexDetails indexDetails)
        {
            this.FileOffset = offset;

            byte sizeOfTypeDefIndex = indexDetails.GetSizeOfIndex(MetadataTables.TypeDef);

            _nestedClass    = new Index(contents, offset, sizeOfTypeDefIndex);
            _enclosingClass = new Index(contents, offset, sizeOfTypeDefIndex);
        }
Esempio n. 5
0
        /// <summary>
        /// Initialises a new instance of the FieldLayoutMetadataTableRow
        /// </summary>
        /// <param name="contents">The contents of the file</param>
        /// <param name="offset">The offset of the current row</param>
        public FieldLayoutMetadataTableRow(byte[] contents, Offset offset, IIndexDetails indexDetails)
        {
            this.FileOffset = offset;

            byte sizeOfFieldIndex = indexDetails.GetSizeOfIndex(MetadataTables.Field);

            _offset     = BitConverter.ToUInt32(contents, offset.Shift(4));
            _fieldIndex = new Index(contents, offset, sizeOfFieldIndex);
        }
Esempio n. 6
0
        /// <summary>
        /// Initialises an instance of the TypeDefMetadataTableRow
        /// </summary>
        /// <param name="contents">The contents of the file</param>
        /// <param name="offset">The offset of the current row</param>
        public TypeDefMetadataTableRow(byte[] contents, Offset offset, ICodedIndexResolver resolver, IIndexDetails indexDetails)
        {
            this.FileOffset = offset;

            int  sizeOfCodedIndex  = resolver.GetSizeOfIndex(CodedIndexes.TypeDefOrRef);
            byte sizeOfStringIndex = indexDetails.GetSizeOfStringIndex();
            byte sizeOfFieldIndex  = indexDetails.GetSizeOfIndex(MetadataTables.Field);
            byte sizeOfMethodIndex = indexDetails.GetSizeOfIndex(MetadataTables.MethodDef);

            _flags          = (TypeAttributes)FieldReader.ToUInt32(contents, offset.Shift(4));
            _nameIndex      = new StringIndex(contents, sizeOfStringIndex, offset);
            _namespaceIndex = new StringIndex(contents, sizeOfStringIndex, offset);
            _extends        = resolver.Resolve(CodedIndexes.TypeDefOrRef,
                                               FieldReader.ToUInt32(contents, offset.Shift(sizeOfCodedIndex), sizeOfCodedIndex)
                                               );
            _fieldList  = new Index(contents, offset, sizeOfFieldIndex);
            _methodList = new Index(contents, offset, sizeOfMethodIndex);
        }
        /// <summary>
        /// Initialises a new instance of the ClassLayoutMetadataTableRow
        /// </summary>
        /// <param name="contents">The contents of the file</param>
        /// <param name="offset">The offset of this row</param>
        /// <param name="sizeOfTypeDefIndex">The size of the indexes to the type def table.</param>
        public ClassLayoutMetadataTableRow(byte[] contents, Offset offset, IIndexDetails indexDetails)
        {
            this.FileOffset = offset;

            byte sizeOfTypeDefIndex = indexDetails.GetSizeOfIndex(MetadataTables.TypeDef);

            _packingSize = BitConverter.ToUInt16(contents, offset.Shift(2));
            _classSize   = BitConverter.ToUInt32(contents, offset.Shift(4));
            _parentIndex = new Index(contents, offset, sizeOfTypeDefIndex);
        }
Esempio n. 8
0
        /// <summary>
        /// Initialises a new instance of the AssemblyRefProcessorMetadataTableRow class
        /// </summary>
        /// <param name="contents">The contents of the file</param>
        /// <param name="offset">The offset of the current row</param>
        public AssemblyRefProcessorMetadataTableRow(byte[] contents, Offset offset, IIndexDetails indexDetails)
        {
            this.FileOffset = offset;

            byte sizeOfAssemblyRefIndex = indexDetails.GetSizeOfIndex(MetadataTables.AssemblyRef);

            offset.Shift(4);
            offset.Shift(sizeOfAssemblyRefIndex);

            _processor   = 0;
            _assemblyRef = new Index();
        }
Esempio n. 9
0
        /// <summary>
        /// Initialises a new instance of the InterfaceImplMetadataTableRow
        /// </summary>
        /// <param name="contents">The contents of the file</param>
        /// <param name="offset">The offset of this row</param>
        public InterfaceImplMetadataTableRow(byte[] contents, Offset offset, ICodedIndexResolver resolver, IIndexDetails indexDetails)
        {
            this.FileOffset = offset;

            int  sizeOfCodedIndex   = resolver.GetSizeOfIndex(CodedIndexes.TypeDefOrRef);
            byte sizeOfTypeDefIndex = indexDetails.GetSizeOfIndex(MetadataTables.TypeDef);

            _class     = new Index(contents, offset, sizeOfTypeDefIndex);
            _interface = resolver.Resolve(CodedIndexes.TypeDefOrRef,
                                          FieldReader.ToUInt32(contents, offset.Shift(sizeOfCodedIndex), sizeOfCodedIndex)
                                          );
        }
Esempio n. 10
0
        /// <summary>
        /// Initialises a new instance of the GenericParamConstraintMetadataTableRow class
        /// </summary>
        /// <param name="stream">The stream containing the metadata</param>
        /// <param name="contents">The contents of the file</param>
        /// <param name="offset">The offset of the current row</param>
        public GenericParamConstraintMetadataTableRow(byte[] contents, Offset offset, ICodedIndexResolver resolver, IIndexDetails indexDetails)
        {
            FileOffset = offset;

            int  sizeOfCodedIndex        = resolver.GetSizeOfIndex(CodedIndexes.TypeDefOrRef);
            byte sizeOfGenericParamIndex = indexDetails.GetSizeOfIndex(MetadataTables.GenericParam);

            _owner      = new Index(contents, offset, sizeOfGenericParamIndex);
            _constraint = resolver.Resolve(
                CodedIndexes.TypeDefOrRef,
                FieldReader.ToUInt32(contents, offset.Shift(sizeOfCodedIndex), sizeOfCodedIndex)
                );
        }
        /// <summary>
        /// Initialises a new instance of the MethodSemanticsMetadataTableRow class
        /// </summary>
        /// <param name="contents">The contents of the file</param>
        /// <param name="offset">The offset of the current row</param>
        public MethodSemanticsMetadataTableRow(byte[] contents, Offset offset, ICodedIndexResolver resolver, IIndexDetails indexDetails)
        {
            this.FileOffset = offset;

            int  sizeOfCodedIndex     = resolver.GetSizeOfIndex(CodedIndexes.HasSemantics);
            byte sizeOfMethodDefIndex = indexDetails.GetSizeOfIndex(MetadataTables.MethodDef);

            _semantics   = (MethodSemanticsAttributes)BitConverter.ToUInt16(contents, offset.Shift(2));
            _method      = new Index(contents, offset, sizeOfMethodDefIndex);
            _association = resolver.Resolve(CodedIndexes.HasSemantics,
                                            FieldReader.ToUInt32(contents, offset.Shift(sizeOfCodedIndex), sizeOfCodedIndex)
                                            );
        }
Esempio n. 12
0
        /// <summary>
        /// Initialises a new instance of the MethodMetadataTableRow class
        /// </summary>
        /// <param name="contents">The contents of the file</param>
        /// <param name="offset">The offset of the current row</param>
        public MethodMetadataTableRow(byte[] contents, Offset offset, IIndexDetails indexDetails)
        {
            this.FileOffset = offset;

            byte sizeOfStringIndex = indexDetails.GetSizeOfStringIndex();
            byte sizeOfBlobIndex   = indexDetails.GetSizeOfBlobIndex();
            byte sizeOfParamIndex  = indexDetails.GetSizeOfIndex(MetadataTables.Param);

            _rva       = FieldReader.ToUInt32(contents, offset.Shift(4));
            _implFlags = (MethodImplFlags)FieldReader.ToUInt16(contents, offset.Shift(2));
            _flags     = (MethodAttributes)FieldReader.ToUInt16(contents, offset.Shift(2));
            _name      = new StringIndex(contents, sizeOfStringIndex, offset);
            _signiture = new BlobIndex(sizeOfBlobIndex, contents, Signatures.Signatures.MethodDef, offset);
            _paramList = new Index(contents, offset, sizeOfParamIndex);
        }
Esempio n. 13
0
        /// <summary>
        /// Initialises a new instance of the ImplMapMetadataTableRow class
        /// </summary>
        /// <param name="content">The content of the file</param>
        /// <param name="offset">The offset of the current row</param>
        public ImplMapMetadataTableRow(byte[] content, Offset offset, ICodedIndexResolver resolver, IIndexDetails indexDetails)
        {
            this.FileOffset = offset;

            int  sizeOfMemberForwardedIndex = resolver.GetSizeOfIndex(CodedIndexes.MemberForwarded);
            byte sizeOfStringIndex          = indexDetails.GetSizeOfStringIndex();
            byte sizeOfModuleRefIndex       = indexDetails.GetSizeOfIndex(MetadataTables.ModuleRef);

            _mappingFlags  = (PInvokeAttributes)FieldReader.ToUInt16(content, offset.Shift(2));
            _memberForward = resolver.Resolve(CodedIndexes.MemberForwarded,
                                              FieldReader.ToUInt32(content, offset.Shift(sizeOfMemberForwardedIndex), sizeOfMemberForwardedIndex)
                                              );
            _importName  = new StringIndex(content, sizeOfStringIndex, offset);
            _importScope = new Index(content, offset, sizeOfModuleRefIndex);
        }
        /// <summary>
        /// Initialises a new instance of AssemblyRefOSMetadataTableRow
        /// </summary>
        /// <param name="contents">The contents of the file</param>
        /// <param name="offset">The offset of the current row</param>
        /// <param name="sizeOfAssemblyRefIndex">The size of the indexes to the assembly ref table</param>
        public AssemblyRefOSMetadataTableRow(byte[] contents, Offset offset, IIndexDetails indexDetails)
        {
            this.FileOffset = offset;

            byte sizeOfAssemblyRefIndex = indexDetails.GetSizeOfIndex(MetadataTables.AssemblyRef);

            // make sure we move the offset on enough if the table is present
            offset.Shift(4);
            offset.Shift(4);
            offset.Shift(4);
            offset.Shift(sizeOfAssemblyRefIndex);

            // set all values to zero as per spec
            _osPlatformId   = 0;
            _osMajorVersion = 0;
            _osMinorVersion = 0;
            _assemblyRef    = new Index();
        }