Plugins - Reworked bootstrapper

This commit is contained in:
Robert committed 2021-04-30 17:39:58 +02:00
1 parent 5cae14efd3
commit 21700aaad5
13 files changed
+288 -135

No files matched your search

@@ -345,13 +345,13 @@ namespace Artemis.Core.Services
if (!featureTypes.Any())
_logger.Warning("Plugin {plugin} contains no features", plugin);
List<Type> bootstrappers = plugin.Assembly.GetTypes().Where(t => typeof(IPluginBootstrapper).IsAssignableFrom(t)).ToList();
List<Type> bootstrappers = plugin.Assembly.GetTypes().Where(t => typeof(PluginBootstrapper).IsAssignableFrom(t)).ToList();
if (bootstrappers.Count > 1)
_logger.Warning($"{plugin} has more than one bootstrapper, only initializing {bootstrappers.First().FullName}");
if (bootstrappers.Any())
{
plugin.Bootstrapper = (IPluginBootstrapper?) Activator.CreateInstance(bootstrappers.First());
plugin.Bootstrapper?.OnPluginLoaded(plugin);
plugin.Bootstrapper = (PluginBootstrapper?) Activator.CreateInstance(bootstrappers.First());
plugin.Bootstrapper?.InternalOnPluginLoaded(plugin);
}
lock (_plugins)