[Plugin system] Move byte addressable media images to dependency injection.

This commit is contained in:
2023-10-06 00:46:36 +01:00
parent 508b78719d
commit 9572abf86d
8 changed files with 8 additions and 16 deletions

View File

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