Ejemplo n.º 1
0
        public MetadataHeapsBuilder(
            int userStringIndexStartOffset = 0,
            int stringIndexStartOffset     = 0,
            int blobIndexStartOffset       = 0,
            int guidIndexStartOffset       = 0)
        {
            // Add zero-th entry to heaps.
            // Full metadata represent empty blob/string at heap index 0.
            // Delta metadata requires these to avoid nil generation-relative handles,
            // which are technically viable but confusing.
            _blobWriter.WriteByte(0);
            _stringWriter.WriteByte(0);
            _userStringWriter.WriteByte(0);

            // When EnC delta is applied #US, #String and #Blob heaps are appended.
            // Thus indices of strings and blobs added to this generation are offset
            // by the sum of respective heap sizes of all previous generations.
            _userStringIndexStartOffset = userStringIndexStartOffset;
            _stringIndexStartOffset     = stringIndexStartOffset;
            _blobIndexStartOffset       = blobIndexStartOffset;

            // Unlike other heaps, #Guid heap in EnC delta is zero-padded.
            _guidWriter.Pad(guidIndexStartOffset);
        }