Esempio n. 1
0
        /// <summary>
        /// Unregisters an already registered EverestModule (mod) dynamically. Invokes Unload.
        /// </summary>
        /// <param name="module"></param>
        internal static void Unregister(this EverestModule module)
        {
            module.Unload();

            Assembly asm = module.GetType().Assembly;

            MainThreadHelper.Do(() => _DetourModManager.Unload(asm));
            _RelinkedAssemblies.Remove(asm);

            // TODO: Unload from LuaLoader
            // TODO: Unload from EntityLoaders
            // TODO: Undo event listeners
            // TODO: Unload from registries
            // TODO: Make sure modules depending on this are unloaded as well.
            // TODO: Unload content, textures, audio, maps, AAAAAAAAAAAAAAAAAAAAAAA

            lock (_Modules) {
                int index = _Modules.IndexOf(module);
                _Modules.RemoveAt(index);
            }

            InvalidateInstallationHash();

            Logger.Log(LogLevel.Info, "core", $"Module {module.Metadata} unregistered.");
        }
Esempio n. 2
0
        /// <summary>
        /// Unregisters an already registered EverestModule (mod) dynamically. Invokes Unload.
        /// </summary>
        /// <param name="module"></param>
        public static void Unregister(this EverestModule module)
        {
            module.Unload();

            lock (_Modules) {
                int index = _Modules.IndexOf(module);
                _Modules.RemoveAt(index);
                _ModuleTypes.RemoveAt(index);
            }

            Logger.Log(LogLevel.Info, "core", $"Module {module.Metadata} unregistered.");
        }