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

This commit is contained in:
2023-10-06 00:40:44 +01:00
parent 02a207c320
commit 508b78719d
10 changed files with 31 additions and 56 deletions

View File

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