[Plugin system] Move read-only filesystems to dependency injection.

This commit is contained in:
2023-10-05 16:55:03 +01:00
parent bc7e02b24c
commit 696f3ffa9a
13 changed files with 36 additions and 62 deletions

View File

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