Exemplo n.º 1
0
        /// <summary>
        /// Loads an IModule from a .DLL file.
        /// </summary>
        /// <param name="dllName">full path to the .DLL file</param>
        /// <returns>IModule if loaded successfully, null if not</returns>
        public static IModule LoadModule(string dllName)
        {
            IModule result = (IModule)StaticDllManager.Load(dllName, ModuleInterfaceName);

            // Registers the modules command with its .DLL file path.
            if (result != null)
            {
                if (CommandRegistry.ContainsKey(result.Command))
                {
                    Core.HandleEx(new Exception("LoadModule could not load '" + dllName + "' because a module with the command '" + result.Command + "' has already been loaded."));
                }
                else
                {
                    CommandRegistry.Add(result.Command, dllName);
                }
            }
            return(result);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Searches for a loaded instance of the module with the given the full path of .DLL
 /// </summary>
 /// <param name="dllName">full path of dll file</param>
 /// <returns>the found instance or null if not found</returns>
 public static IModule GetExistingModule(string dllName)
 {
     return((IModule)StaticDllManager.GetExistingInstance(dllName, ModuleInterfaceName));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Unloads all modules from address space and clears the command registry.
 /// </summary>
 public static void UnloadModules()
 {
     StaticDllManager.Unload();
     CommandRegistry.Clear();
 }