private void Loader_Reloaded(object sender, PluginReloadedEventArgs eventArgs) { if (_options.EnableHotStart) { HostManager.Restart(); } }
private static async Task ReloadedInfo(object sender, PluginReloadedEventArgs eventArgs) { Console.ForegroundColor = ConsoleColor.Blue; Console.WriteLine($"Reload Triggered, EventArgs: {eventArgs.Loader} / {sender}"); Console.ResetColor(); await RestartPlugin(eventArgs.Loader); }
private void PluginReloaded(object sender, PluginReloadedEventArgs eventArgs) { var pluginAssembly = eventArgs.Loader.LoadDefaultAssembly(); var pluginTypes = pluginAssembly.GetTypes().Where(t => typeof(IPlugin).IsAssignableFrom(t) && !t.IsAbstract); var pluginsToRemove = Plugins.Where(p => pluginTypes.Any(x => x.FullName == p.Key.GetType().FullName)); foreach (var plugin in pluginsToRemove) { Plugins.Remove(plugin.Key); } var serviceCollection = new ServiceCollection(); ConfigurePlugins(serviceCollection, pluginAssembly); var provider = serviceCollection.BuildServiceProvider(); var plugins = provider.GetServices <IPlugin>(); foreach (var plugin in plugins) { Plugins.Add(plugin, true); _mediator.Publish(new PluginLogNotification { Message = $"Loaded {plugin.Name} ({plugin.Description})", LogLevel = LogLevel.Information }); } _mediator.Publish(new PluginLogNotification { Message = $"Successfully reloaded {plugins.Count()} plugins", LogLevel = LogLevel.Information }); }
private static void ShowPluginInfo(object sender, PluginReloadedEventArgs eventArgs) { Console.ForegroundColor = ConsoleColor.Blue; Console.Write("HotReloadApp: "); Console.ResetColor(); Console.WriteLine("plugin was reloaded"); InvokePlugin(eventArgs.Loader); }
private static void GameLoader_Reloaded(object sender, PluginReloadedEventArgs eventArgs) { Console.WriteLine("Reloaded DLL"); }