コード例 #1
0
        /// <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);
        }
コード例 #2
0
 /// <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;
 }
コード例 #3
0
ファイル: ModuleWrapper.cs プロジェクト: GuardianRG/Animus
 /// <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;
 }