[Plugin system] Move archives to dependency injection.

This commit is contained in:
2023-10-05 16:19:55 +01:00
parent e00af2a93f
commit e19cdd942a
3 changed files with 10 additions and 12 deletions

View File

@@ -109,16 +109,14 @@ public class PluginRegisterGenerator : ISourceGenerator
if(archives?.Count > 0)
{
sb.AppendLine(" public List<Type> GetAllArchivePlugins() => new()");
sb.AppendLine(" public void RegisterArchivePlugins(IServiceCollection services)");
sb.AppendLine(" {");
foreach(string plugin in archives)
sb.AppendLine($" typeof({plugin}),");
sb.AppendLine(" };");
sb.AppendLine($" services.AddTransient<IArchive, {plugin}>();");
sb.AppendLine(" }");
}
else
sb.AppendLine(" public List<Type> GetAllArchivePlugins() => null;");
sb.AppendLine(" public void RegisterArchivePlugins(IServiceCollection services) {}");
sb.AppendLine();