/// <summary> /// Loads a module. /// </summary> /// <returns>The module.</returns> /// <param name="path">Path.</param> public IModule LoadModule(string path) { var proxy = AppDomainProxy.Create(); var loader = proxy.LoadAssembly(path); var assembly = loader.assembly; var types = assembly.GetExportedTypes(); foreach (var type in types) { if (type.IsClass && type.GetInterface(typeof(IModule).FullName) != null) { var module = Activator.CreateInstance(type) as IModule; modules.Add(new ModuleWrapper(proxy, module)); return(module); } } return(null); }
/// <summary> /// Initializes a new instance of the <see cref="ModuleWrapper"/> class. /// </summary> /// <param name="proxy">Proxy.</param> /// <param name="module">Module.</param> public ModuleWrapper(AppDomainProxy proxy, IModule module) { Proxy = proxy; Module = module; }