Beispiel #1
0
        private void WriteTables(MetadataTableStream tables)
        {
            string tableName = tables.IsOptimized ? MetadataConstants.StreamTable : MetadataConstants.StreamTableUnoptimized;

            WriteStreamHeader(tableName, _state.TablesLength);

            var compressionInfo = _compressionInfo;

            // Header
            _blob.Write(ref _state.StreamPos, (int)0);             // Reserved, 4 bytes

            _blob.Write(ref _state.StreamPos, (byte)tables.SchemaMajorVersion);
            _blob.Write(ref _state.StreamPos, (byte)tables.SchemaMinorVersion);

            // Flags
            var heapFlags = HeapOffsetFlags.None;

            if (compressionInfo.StringHeapOffsetSize4)
            {
                heapFlags |= HeapOffsetFlags.StringHeap4;
            }
            if (compressionInfo.GuidHeapOffsetSize4)
            {
                heapFlags |= HeapOffsetFlags.GuidHeap4;
            }
            if (compressionInfo.BlobHeapOffsetSize4)
            {
                heapFlags |= HeapOffsetFlags.BlobHeap4;
            }

            _blob.Write(ref _state.StreamPos, (byte)heapFlags);

            _blob.Write(ref _state.StreamPos, (byte)1);             // Reserved, 1 bytes

            // Mask
            _blob.Write(ref _state.StreamPos, (ulong)GetMaskValid(tables));
            _blob.Write(ref _state.StreamPos, (ulong)GetMaskSorted(tables));

            // Row counts
            for (int i = 0; i < MetadataConstants.TableCount; i++)
            {
                int count = tables[i].Count;
                if (count > 0)
                {
                    _blob.Write(ref _state.StreamPos, (int)count);
                }
            }

            // Tables
            for (int i = 0; i < MetadataConstants.TableCount; i++)
            {
                var table = tables[i];
                if (table.Count > 0)
                {
                    _tableOffsets[(int)table.Type] = _state.StreamPos;
                    table.Write(_blob, ref _state.StreamPos, compressionInfo);
                }
            }
        }
 public MetadataScope()
 {
     _frameworkVersionMoniker = MicrosoftNetFramework.VersionMonikerLatest;
     _tables      = new MetadataTableStream(this);
     _strings     = new MetadataStringStream();
     _userStrings = new MetadataUserStringStream();
     _guids       = new MetadataGuidStream();
     _blobs       = new MetadataBlobStream();
 }
Beispiel #3
0
        private ulong GetMaskValid(MetadataTableStream tables)
        {
            ulong mask = 0;

            for (int i = 0; i < MetadataConstants.TableCount; i++)
            {
                var table = tables[i];
                if (table.Count > 0)
                {
                    mask |= 1UL << i;
                }
            }

            return(mask);
        }
 internal PropertyPtrTable(MetadataTableStream stream)
     : base(MetadataTableType.PropertyPtr, stream)
 {
 }
 internal FileTable(MetadataTableStream stream)
     : base(MetadataTableType.File, stream)
 {
 }
Beispiel #6
0
 internal FieldPtrTable(MetadataTableStream stream)
     : base(MetadataTableType.FieldPtr, stream)
 {
 }
Beispiel #7
0
 internal ModuleRefTable(MetadataTableStream stream)
     : base(MetadataTableType.ModuleRef, stream)
 {
 }
 internal AssemblyOSTable(MetadataTableStream stream)
     : base(MetadataTableType.AssemblyOS, stream)
 {
 }
Beispiel #9
0
 internal FieldRVATable(MetadataTableStream stream)
     : base(MetadataTableType.FieldRVA, stream)
 {
 }
Beispiel #10
0
 internal ParamPtrTable(MetadataTableStream stream)
     : base(MetadataTableType.ParamPtr, stream)
 {
 }
Beispiel #11
0
 private ulong GetMaskSorted(MetadataTableStream tables)
 {
     return(tables.SortMask);
 }
Beispiel #12
0
 internal FieldMarshalTable(MetadataTableStream stream)
     : base(MetadataTableType.FieldMarshal, stream)
 {
 }
		internal DeclSecurityTable(MetadataTableStream stream)
			: base(MetadataTableType.DeclSecurity, stream)
		{
		}
 internal MethodImplTable(MetadataTableStream stream)
     : base(MetadataTableType.MethodImpl, stream)
 {
 }
Beispiel #15
0
 internal ENCLogTable(MetadataTableStream stream)
     : base(MetadataTableType.ENCLog, stream)
 {
 }
Beispiel #16
0
 internal StandAloneSigTable(MetadataTableStream stream)
     : base(MetadataTableType.StandAloneSig, stream)
 {
 }
 internal TypeRefTable(MetadataTableStream stream)
     : base(MetadataTableType.TypeRef, stream)
 {
 }
Beispiel #18
0
 internal MethodSpecTable(MetadataTableStream stream)
     : base(MetadataTableType.MethodSpec, stream)
 {
 }
 internal MetadataPtrTable(int type, MetadataTableStream stream)
     : base(type, stream)
 {
     _rows = new int[DefaultCapacity];
 }
 internal MetadataTable(int type, MetadataTableStream stream)
     : base(type, stream)
 {
 }
Beispiel #21
0
 internal EventMapTable(MetadataTableStream stream)
     : base(MetadataTableType.EventMap, stream)
 {
 }
Beispiel #22
0
 internal GenericParamConstraintTable(MetadataTableStream stream)
     : base(MetadataTableType.GenericParamConstraint, stream)
 {
 }
 internal AssemblyProcessorTable(MetadataTableStream stream)
     : base(MetadataTableType.AssemblyProcessor, stream)
 {
 }
 internal ExportedTypeTable(MetadataTableStream stream)
     : base(MetadataTableType.ExportedType, stream)
 {
 }
Beispiel #25
0
 internal TypeSpecTable(MetadataTableStream stream)
     : base(MetadataTableType.TypeSpec, stream)
 {
 }
 internal MethodPtrTable(MetadataTableStream stream)
     : base(MetadataTableType.MethodPtr, stream)
 {
 }
Beispiel #27
0
 internal MethodTable(MetadataTableStream stream)
     : base(MetadataTableType.MethodDef, stream)
 {
 }
Beispiel #28
0
 internal MemberRefTable(MetadataTableStream stream)
     : base(MetadataTableType.MemberRef, stream)
 {
 }
 internal PropertyMapTable(MetadataTableStream stream)
     : base(MetadataTableType.PropertyMap, stream)
 {
 }
Beispiel #30
0
 internal ManifestResourceTable(MetadataTableStream stream)
     : base(MetadataTableType.ManifestResource, stream)
 {
 }