public async Task OnReload() { Logger.LogInfo("Reloading..."); await pluginManager.DisablePlugins(); await moduleManager.DisableModules(); await pluginManager.UnloadPlugins(); await moduleManager.UnloadModules(); LoggerManager.Dispose(); config = await LoadConfig(argsReader.GetOrDefault("config", Path.Combine(PathExt.GetConfigPath(), "config.yml"))); LoggerManager.Init(config.Logging.GetAppender()); await moduleManager.LoadModules(Path.GetFullPath(config.ModulesPath)); await moduleManager.InitModules(); await pluginManager.LoadPlugins(Path.GetFullPath(config.PluginsPath)); await pluginManager.InitPlugins(); await moduleManager.EnableModules(); await pluginManager.EnablePlugins(); Logger.LogInfo("Reloaded!"); }
protected override async Task OnLoad() { PathExt.EnsureFolders(); argsReader = new ArgsReader(Args); config = await LoadConfig(argsReader.GetOrDefault("config", Path.Combine(PathExt.GetConfigPath(), "config.yml"))); LoggerManager.Dispose(); LoggerManager.Init(config.Logging.GetAppender()); Logger.LogInfo("Loading..."); cliServer = new CliServer(argsReader.GetOrDefault("pipe", "htcsharp")); cliServer.AddCommand(new ReloadCommand(this)); moduleManager = new ModuleManager(version, configureServices => { configureServices.AddSingleton(cliServer); }); await moduleManager.LoadModules(Path.GetFullPath(config.ModulesPath)); await moduleManager.InitModules(); pluginManager = new PluginManager(version, moduleManager, configureServices => { configureServices.AddSingleton(cliServer); }); await pluginManager.LoadPlugins(Path.GetFullPath(config.PluginsPath)); await pluginManager.InitPlugins(); }