Ejemplo n.º 1
0
 private void Loader_Reloaded(object sender, PluginReloadedEventArgs eventArgs)
 {
     if (_options.EnableHotStart)
     {
         HostManager.Restart();
     }
 }
Ejemplo n.º 2
0
 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);
 }
Ejemplo n.º 3
0
        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
            });
        }
Ejemplo n.º 4
0
 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);
 }
Ejemplo n.º 5
0
 private static void GameLoader_Reloaded(object sender, PluginReloadedEventArgs eventArgs)
 {
     Console.WriteLine("Reloaded DLL");
 }