private void ImportTypeSpecsAndMemberRefsIfSpecified(ModuleDefinition module, DotNetDirectoryBuffer buffer) { if ((MetadataBuilderFlags & MetadataBuilderFlags.PreserveTypeSpecificationIndices) != 0) { ImportTableIntoTableBuffers <TypeSpecification>(module, TableIndex.TypeSpec, buffer.GetTypeSpecificationToken); } if ((MetadataBuilderFlags & MetadataBuilderFlags.PreserveMemberReferenceIndices) != 0) { ImportTableIntoTableBuffers <MemberReference>(module, TableIndex.MemberRef, buffer.GetMemberReferenceToken); } }
private void ImportRemainingTablesIntoTableBuffersIfSpecified(ModuleDefinition module, DotNetDirectoryBuffer buffer) { if (module.DotNetDirectory is null) { return; } if ((MetadataBuilderFlags & MetadataBuilderFlags.PreserveStandAloneSignatureIndices) != 0) { ImportTableIntoTableBuffers <StandAloneSignature>(module, TableIndex.StandAloneSig, buffer.GetStandAloneSignatureToken); } if ((MetadataBuilderFlags & MetadataBuilderFlags.PreserveMethodSpecificationIndices) != 0) { ImportTableIntoTableBuffers <MethodSpecification>(module, TableIndex.MethodSpec, buffer.GetMethodSpecificationToken); } }
private void ImportBasicTablesIntoTableBuffersIfSpecified(ModuleDefinition module, DotNetDirectoryBuffer buffer) { if (module.DotNetDirectory is null) { return; } // NOTE: The order of this table importing is crucial. // // Assembly refs should always be imported prior to importing type refs, which should be imported before // any other member reference or definition, as the Get/Add methods of DotNetDirectoryBuffer try to add // any missing assembly and/or type references to the buffer as well. Therefore, to make sure that assembly // and type reference tokens are still preserved, we need to prioritize these. if ((MetadataBuilderFlags & MetadataBuilderFlags.PreserveAssemblyReferenceIndices) != 0) { ImportTableIntoTableBuffers <AssemblyReference>(module, TableIndex.AssemblyRef, buffer.GetAssemblyReferenceToken); } if ((MetadataBuilderFlags & MetadataBuilderFlags.PreserveModuleReferenceIndices) != 0) { ImportTableIntoTableBuffers <ModuleReference>(module, TableIndex.ModuleRef, buffer.GetModuleReferenceToken); } if ((MetadataBuilderFlags & MetadataBuilderFlags.PreserveTypeReferenceIndices) != 0) { ImportTableIntoTableBuffers <TypeReference>(module, TableIndex.TypeRef, buffer.GetTypeReferenceToken); } }