internal ModuleCoupler(IEnumerable <FileInfo> deps, IEnumerable <FileInfo> dlls) { this._loader = new CollectibleLoader(deps.First().FullName); lock (this._lock) { foreach (var dll in dlls) { try { using (var fs = dll.OpenRead()) { var asm = this._loader.LoadFromStream(fs); // error: foreach (var t in asm.GetTypes()) { if (t.IsSubclassOf(typeof(ModuleBase))) { var inst = Activator.CreateInstance(t) as ModuleBase; this._module = (inst); this.Metadata = this._module.Metadata; this.Id = this._module.Id; break; } } } } catch (ReflectionTypeLoadException reflectEx) { Console.WriteLine(reflectEx.Message); } catch (Exception e) { Console.WriteLine(e); } } } }
public void Dispose() { this._loader.Unload(); this._loader = null; }