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

            _flags    = (ParamAttributeFlags)FieldReader.ToUInt16(contents, offset.Shift(2));
            _sequence = FieldReader.ToUInt16(contents, offset.Shift(2));
            _name     = new StringIndex(contents, sizeOfStringIndex, offset);
        }
예제 #2
0
        /// <summary>
        /// Initialises a new instance of the ModuleMetadataTableRow class
        /// </summary>
        /// <param name="contents">The byte contents of the file</param>
        /// <param name="offset">The offset of this row</param>
        public ModuleMetadataTableRow(byte[] contents, Offset offset, IIndexDetails indexDetails)
        {
            this.FileOffset = offset;

            byte sizeOfGuidIndex = indexDetails.GetSizeOfGuidIndex();

            _generation = FieldReader.ToUInt16(contents, offset.Shift(2));
            _name       = new StringIndex(contents, indexDetails.GetSizeOfStringIndex(), offset);
            _mvid       = FieldReader.ToInt32(contents, offset.Shift(sizeOfGuidIndex), sizeOfGuidIndex);
            _encId      = FieldReader.ToInt32(contents, offset.Shift(sizeOfGuidIndex), sizeOfGuidIndex);
            _encBaseId  = FieldReader.ToInt32(contents, offset.Shift(sizeOfGuidIndex), sizeOfGuidIndex);
        }
        /// <summary>
        /// Initialises a new instance of the EventMetadataTableRow class
        /// </summary>
        /// <param name="contents">The contents of the file</param>
        /// <param name="offset">The offset of the current row</param>
        public EventMetadataTableRow(byte[] contents, Offset offset, ICodedIndexResolver resolver, IIndexDetails indexDetails)
        {
            this.FileOffset = offset;

            int  typeDefOrRefIndexSize = resolver.GetSizeOfIndex(CodedIndexes.TypeDefOrRef);
            byte sizeOfStringIndex     = indexDetails.GetSizeOfStringIndex();

            _eventFlags     = (EventAttributes)BitConverter.ToUInt16(contents, offset.Shift(2));
            _nameIndex      = new StringIndex(contents, sizeOfStringIndex, offset);
            _eventTypeIndex = resolver.Resolve(
                CodedIndexes.TypeDefOrRef,
                FieldReader.ToUInt32(contents, offset.Shift(typeDefOrRefIndexSize), typeDefOrRefIndexSize)
                );
        }
        /// <summary>
        /// Initialises a new instance of the ManifestResourceMetadataTableRow class
        /// </summary>
        /// <param name="contents">The contents of the file</param>
        /// <param name="offset">The offset of this current row</param>
        public ManifestResourceMetadataTableRow(byte[] contents, Offset offset, ICodedIndexResolver resolver, IIndexDetails indexDetails)
        {
            this.FileOffset = offset;

            int  sizeOfImplementationIndex = resolver.GetSizeOfIndex(CodedIndexes.Implementation);
            byte sizeOfStringIndex         = indexDetails.GetSizeOfStringIndex();

            _offset         = BitConverter.ToUInt32(contents, offset.Shift(4));
            _flags          = (ManifestResourceAttributes)BitConverter.ToUInt32(contents, offset.Shift(4));
            _name           = new StringIndex(contents, sizeOfStringIndex, offset);
            _implementation = resolver.Resolve(
                CodedIndexes.Implementation,
                FieldReader.ToUInt32(contents, offset.Shift(sizeOfImplementationIndex), sizeOfImplementationIndex)
                );
        }
        /// <summary>
        /// Initialises a new instance of the AssemblyMetadataTableRow class
        /// </summary>
        /// <param name="contents">The contents of the file</param>
        /// <param name="offset">The offset of the current row</param>
        /// <param name="indexDetails">Object which enables the retrieval of index sizes</param>
        public AssemblyMetadataTableRow(byte[] contents, Offset offset, IIndexDetails indexDetails)
        {
            FileOffset = offset;

            byte sizeOfBlobIndex   = indexDetails.GetSizeOfBlobIndex();
            byte sizeOfStringIndex = indexDetails.GetSizeOfStringIndex();

            _hashAlgId      = (AssemblyHashAlgorithms)FieldReader.ToUInt32(contents, offset.Shift(4));
            _majorVersion   = FieldReader.ToUInt16(contents, offset.Shift(2));
            _minorVersion   = FieldReader.ToUInt16(contents, offset.Shift(2));
            _buildNumber    = FieldReader.ToUInt16(contents, offset.Shift(2));
            _revisionNumber = FieldReader.ToUInt16(contents, offset.Shift(2));
            _flags          = (AssemblyFlags)FieldReader.ToUInt32(contents, offset.Shift(4));
            _publicKey      = FieldReader.ToUInt32(contents, offset.Shift(sizeOfBlobIndex), sizeOfBlobIndex);
            _nameIndex      = new StringIndex(contents, sizeOfStringIndex, offset);
            _culture        = new StringIndex(contents, sizeOfStringIndex, offset);
        }