[Plugin system] Move floppy images to dependency injection.

This commit is contained in:
2023-10-06 00:14:37 +01:00
parent 509f77036d
commit 79680da4e9
3 changed files with 8 additions and 8 deletions

View File

@@ -161,16 +161,16 @@ public class PluginRegisterGenerator : ISourceGenerator
if(floppyImagePlugins?.Count > 0)
{
sb.AppendLine(" public List<Type> GetAllFloppyImagePlugins() => new()");
sb.AppendLine(" public void RegisterFloppyImagePlugins(IServiceCollection services)");
sb.AppendLine(" {");
foreach(string plugin in floppyImagePlugins)
sb.AppendLine($" typeof({plugin}),");
sb.AppendLine($" services.AddTransient<IFloppyImage, {plugin}>();");
sb.AppendLine(" };");
sb.AppendLine(" }");
}
else
sb.AppendLine(" public List<Type> GetAllFloppyImagePlugins() => null;");
sb.AppendLine(" public void RegisterFloppyImagePlugins(IServiceCollection services) {}");
sb.AppendLine();