[Plugin system] Move writable floppy images to dependency injection.

This commit is contained in:
2023-10-06 00:19:45 +01:00
parent 79680da4e9
commit 02a207c320
3 changed files with 8 additions and 8 deletions

View File

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