public void UnloadPlugin(IHtcPlugin plugin) { _plugins.Remove(plugin); plugin.OnDisable(); GC.Collect(); GC.WaitForPendingFinalizers(); }
public MySQLRegister(IHtcPlugin pluginContext) { foreach (var plugin in HtcServer.Context.PluginsManager.GetPlugins) { if (plugin is Processor.LuaProcessor processor) { _luaProcessor = processor; } } if (_luaProcessor == null) { Logger.Error("Failed to initialize HtcPlugin.Lua.MySql, dependency context not found."); HtcServer.Context.PluginsManager.UnloadPlugin(pluginContext); return; } UserData.RegisterType <LuaSql>(); UserData.RegisterType <LuaSqlConnection>(); UserData.RegisterType <LuaSqlCommand>(); UserData.RegisterType <LuaSqlTransaction>(); UserData.RegisterType <LuaSqlDataReader>(); UserData.RegisterType <LuaSqlParameters>(); _luaProcessor.LuaLowLevelAccess.RegisterLowLevelClass("mysql", new LuaSql()); }