diff --git a/Aaru.CommonTypes b/Aaru.CommonTypes index f5de3435e..c6506f7b8 160000 --- a/Aaru.CommonTypes +++ b/Aaru.CommonTypes @@ -1 +1 @@ -Subproject commit f5de3435e554c704d61af47ebdf8243564edce2a +Subproject commit c6506f7b8945fe1d8df533543974809f46749ba6 diff --git a/Aaru.Generators/PluginRegisterGenerator.cs b/Aaru.Generators/PluginRegisterGenerator.cs index 1dc25040b..5dbecc376 100644 --- a/Aaru.Generators/PluginRegisterGenerator.cs +++ b/Aaru.Generators/PluginRegisterGenerator.cs @@ -161,16 +161,16 @@ public class PluginRegisterGenerator : ISourceGenerator if(floppyImagePlugins?.Count > 0) { - sb.AppendLine(" public List GetAllFloppyImagePlugins() => new()"); + sb.AppendLine(" public void RegisterFloppyImagePlugins(IServiceCollection services)"); sb.AppendLine(" {"); foreach(string plugin in floppyImagePlugins) - sb.AppendLine($" typeof({plugin}),"); + sb.AppendLine($" services.AddTransient();"); - sb.AppendLine(" };"); + sb.AppendLine(" }"); } else - sb.AppendLine(" public List GetAllFloppyImagePlugins() => null;"); + sb.AppendLine(" public void RegisterFloppyImagePlugins(IServiceCollection services) {}"); sb.AppendLine(); diff --git a/Aaru.Gui/ViewModels/Dialogs/PluginsViewModel.cs b/Aaru.Gui/ViewModels/Dialogs/PluginsViewModel.cs index 34c5ca353..04022f134 100644 --- a/Aaru.Gui/ViewModels/Dialogs/PluginsViewModel.cs +++ b/Aaru.Gui/ViewModels/Dialogs/PluginsViewModel.cs @@ -76,16 +76,16 @@ public sealed class PluginsViewModel : ViewModelBase }); } - foreach(Type imageType in PluginRegister.Singleton.FloppyImages.Values) + foreach(IFloppyImage floppyImage in PluginRegister.Singleton.FloppyImages.Values) { - if(Activator.CreateInstance(imageType) is not IFloppyImage floppyImage) + if(floppyImage is null) continue; FloppyImages.Add(new PluginModel { Name = floppyImage.Name, Uuid = floppyImage.Id, - Version = Assembly.GetAssembly(imageType)?.GetName().Version?.ToString(), + Version = Assembly.GetAssembly(floppyImage.GetType())?.GetName().Version?.ToString(), Author = floppyImage.Author }); }