public InteropStateManager(ModuleDesc generatedAssembly) { _generatedAssembly = generatedAssembly; _structMarshallingThunkHashtable = new StructMarshallingThunkHashTable(this, _generatedAssembly.GetGlobalModuleType()); _nativeStructHashtable = new NativeStructTypeHashtable(this, _generatedAssembly); _delegateMarshallingThunkHashtable = new DelegateMarshallingStubHashtable(this, _generatedAssembly.GetGlobalModuleType()); _forwardDelegateCreationStubHashtable = new ForwardDelegateCreationStubHashtable(this, _generatedAssembly.GetGlobalModuleType()); _pInvokeDelegateWrapperHashtable = new PInvokeDelegateWrapperHashtable(this, _generatedAssembly); _inlineArrayHashtable = new InlineArrayHashTable(this, _generatedAssembly); _pInvokeLazyFixupFieldHashtable = new PInvokeLazyFixupFieldHashtable(_generatedAssembly.GetGlobalModuleType()); _pInvokeCalliHashtable = new PInvokeCalliHashtable(this, _generatedAssembly.GetGlobalModuleType()); }
private void InitializeScopeDefinition(Cts.ModuleDesc module, ScopeDefinition scopeDefinition) { var assemblyDesc = module as Cts.IAssemblyDesc; if (assemblyDesc != null) { var assemblyName = assemblyDesc.GetName(); scopeDefinition.Name = HandleString(assemblyName.Name); #if NETFX_45 // With NET 4.5 contract System.Reflection 4.0.0.0 EcmaModule has no way // to set Culture in its AssemblyName. scopeDefinition.Culture = HandleString(assemblyName.CultureName ?? ""); #else scopeDefinition.Culture = HandleString(assemblyName.CultureName); #endif scopeDefinition.MajorVersion = checked ((ushort)assemblyName.Version.Major); scopeDefinition.MinorVersion = checked ((ushort)assemblyName.Version.Minor); scopeDefinition.BuildNumber = checked ((ushort)assemblyName.Version.Build); scopeDefinition.RevisionNumber = checked ((ushort)assemblyName.Version.Revision); Debug.Assert((int)AssemblyFlags.PublicKey == (int)AssemblyNameFlags.PublicKey); Debug.Assert((int)AssemblyFlags.Retargetable == (int)AssemblyNameFlags.Retargetable); scopeDefinition.Flags = (AssemblyFlags)assemblyName.Flags; if (assemblyName.ContentType == AssemblyContentType.WindowsRuntime) { scopeDefinition.Flags |= (AssemblyFlags)((int)AssemblyContentType.WindowsRuntime << 9); } if ((scopeDefinition.Flags & AssemblyFlags.PublicKey) != 0) { scopeDefinition.PublicKey = assemblyName.GetPublicKey(); } else { scopeDefinition.PublicKey = assemblyName.GetPublicKeyToken(); } Cts.MetadataType moduleType = module.GetGlobalModuleType(); if (moduleType != null && _policy.GeneratesMetadata(moduleType)) { scopeDefinition.GlobalModuleType = (TypeDefinition)HandleType(moduleType); } Cts.Ecma.EcmaAssembly ecmaAssembly = module as Cts.Ecma.EcmaAssembly; if (ecmaAssembly != null) { Ecma.CustomAttributeHandleCollection customAttributes = ecmaAssembly.AssemblyDefinition.GetCustomAttributes(); if (customAttributes.Count > 0) { scopeDefinition.CustomAttributes = HandleCustomAttributes(ecmaAssembly, customAttributes); } Cts.MethodDesc entryPoint = ecmaAssembly.EntryPoint; if (entryPoint != null && _policy.GeneratesMetadata(entryPoint)) { scopeDefinition.EntryPoint = (QualifiedMethod)HandleQualifiedMethod(entryPoint); } } } else { throw new NotSupportedException("Multi-module assemblies"); } }
public InteropStateManager(ModuleDesc generatedAssembly) { _generatedAssembly = generatedAssembly; _structMarshallingThunkHashtable = new StructMarshallingThunkHashTable(this, _generatedAssembly.GetGlobalModuleType()); _nativeStructHashtable = new NativeStructTypeHashtable(this, _generatedAssembly); _delegateMarshallingThunkHashtable = new DelegateMarshallingStubHashtable(this, _generatedAssembly.GetGlobalModuleType()); }