internal ModuleDesc(ExecutionEngine executionEngine, Module reflModule) { executionEngine.Context._modules.Add(reflModule, this); _executionEngine = executionEngine; _reflModule = reflModule; _assembly = executionEngine.ResolveAssembly(reflModule.Assembly); _scopeName = reflModule.ScopeName; _types = new List <TypeDesc>(); }
/// <summary> /// Loads an assembly into <see cref="ExecutionEngine"/> /// </summary> /// <param name="assembly"></param> /// <param name="originalAssemblyData"></param> /// <returns></returns> public AssemblyDesc LoadAssembly(Assembly assembly, byte[] originalAssemblyData = null) { if (assembly is null) { throw new ArgumentNullException(nameof(assembly)); } nint rawAssembly = 0; if (!(originalAssemblyData is null)) { string path = Path.GetTempFileName(); File.WriteAllBytes(path, originalAssemblyData); rawAssembly = Pal.MapFile(path, true); } var assemblyDesc = new AssemblyDesc(this, assembly, rawAssembly); foreach (var module in assembly.Modules) { ResolveModule(module); } return(assemblyDesc); }