2022-12-14 20:56:08 +00:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using Microsoft.CodeAnalysis;
|
|
|
|
|
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
|
|
|
|
|
|
|
|
|
namespace Aaru.Generators;
|
|
|
|
|
|
|
|
|
|
[Generator]
|
|
|
|
|
public class PluginRegisterGenerator : ISourceGenerator
|
|
|
|
|
{
|
2023-10-03 23:24:05 +01:00
|
|
|
#region ISourceGenerator Members
|
|
|
|
|
|
2022-12-14 20:56:08 +00:00
|
|
|
/// <inheritdoc />
|
|
|
|
|
public void Initialize(GeneratorInitializationContext context) =>
|
|
|
|
|
|
|
|
|
|
// Nothing to do
|
|
|
|
|
context.RegisterForSyntaxNotifications(() => new PluginFinder());
|
|
|
|
|
|
|
|
|
|
/// <inheritdoc />
|
|
|
|
|
public void Execute(GeneratorExecutionContext context)
|
|
|
|
|
{
|
|
|
|
|
/*
|
|
|
|
|
#if DEBUG
|
|
|
|
|
if(!Debugger.IsAttached)
|
|
|
|
|
{
|
|
|
|
|
Debugger.Launch();
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
ClassDeclarationSyntax pluginRegister = ((PluginFinder)context.SyntaxReceiver)?.Register;
|
|
|
|
|
|
|
|
|
|
if(pluginRegister == null)
|
|
|
|
|
return;
|
|
|
|
|
|
2023-10-03 23:24:05 +01:00
|
|
|
var @namespace =
|
2022-12-14 20:56:08 +00:00
|
|
|
(pluginRegister.Ancestors().FirstOrDefault(x => x is FileScopedNamespaceDeclarationSyntax) as
|
|
|
|
|
FileScopedNamespaceDeclarationSyntax)?.Name.ToString();
|
|
|
|
|
|
|
|
|
|
@namespace ??=
|
|
|
|
|
(pluginRegister.Ancestors().FirstOrDefault(x => x is NamespaceDeclarationSyntax) as
|
|
|
|
|
NamespaceDeclarationSyntax)?.ToString();
|
|
|
|
|
|
|
|
|
|
string className = pluginRegister.Identifier.Text;
|
|
|
|
|
|
2022-12-17 14:06:03 +00:00
|
|
|
List<string> archives = ((PluginFinder)context.SyntaxReceiver)?.Archives;
|
|
|
|
|
List<string> checksums = ((PluginFinder)context.SyntaxReceiver)?.Checksums;
|
|
|
|
|
List<string> fileSystems = ((PluginFinder)context.SyntaxReceiver)?.FileSystems;
|
|
|
|
|
List<string> filters = ((PluginFinder)context.SyntaxReceiver)?.Filters;
|
|
|
|
|
List<string> floppyImagePlugins = ((PluginFinder)context.SyntaxReceiver)?.FloppyImagePlugins;
|
|
|
|
|
List<string> partitionPlugins = ((PluginFinder)context.SyntaxReceiver)?.PartitionPlugins;
|
|
|
|
|
List<string> mediaImagePlugins = ((PluginFinder)context.SyntaxReceiver)?.MediaImagePlugins;
|
|
|
|
|
List<string> readOnlyFileSystems = ((PluginFinder)context.SyntaxReceiver)?.ReadOnlyFileSystems;
|
|
|
|
|
List<string> writableFloppyImagePlugins = ((PluginFinder)context.SyntaxReceiver)?.WritableFloppyImagePlugins;
|
|
|
|
|
List<string> writableImagePlugins = ((PluginFinder)context.SyntaxReceiver)?.WritableImagePlugins;
|
|
|
|
|
List<string> byteAddressableImagePlugins = ((PluginFinder)context.SyntaxReceiver)?.ByteAddressableImagePlugins;
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
StringBuilder sb = new();
|
|
|
|
|
|
2023-10-04 08:26:35 +01:00
|
|
|
sb.AppendLine("""
|
|
|
|
|
// /***************************************************************************
|
|
|
|
|
// Aaru Data Preservation Suite
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// Filename : Register.g.cs
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
//
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// Registers all plugins in this assembly.
|
|
|
|
|
//
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// Permission is hereby granted, free of charge, to any person obtaining a
|
|
|
|
|
// copy of this software and associated documentation files (the
|
|
|
|
|
// "Software"), to deal in the Software without restriction, including
|
|
|
|
|
// without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
|
// distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
|
// permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
|
// the following conditions:
|
|
|
|
|
//
|
|
|
|
|
// The above copyright notice and this permission notice shall be included
|
|
|
|
|
// in all copies or substantial portions of the Software.
|
|
|
|
|
//
|
|
|
|
|
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
|
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
|
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
|
|
|
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
|
|
|
|
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
|
|
|
|
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
|
|
|
|
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
|
//
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
// Copyright © 2011-2023 Natalia Portillo
|
|
|
|
|
// ****************************************************************************/
|
|
|
|
|
""");
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
sb.AppendLine();
|
|
|
|
|
sb.AppendLine("using System;");
|
|
|
|
|
sb.AppendLine("using System.Collections.Generic;");
|
|
|
|
|
sb.AppendLine("using Aaru.CommonTypes.Interfaces;");
|
2023-10-05 13:04:57 +01:00
|
|
|
sb.AppendLine("using Microsoft.Extensions.DependencyInjection;");
|
2022-12-14 20:56:08 +00:00
|
|
|
sb.AppendLine();
|
|
|
|
|
sb.AppendLine($"namespace {@namespace};");
|
|
|
|
|
sb.AppendLine();
|
|
|
|
|
sb.AppendLine($"public sealed partial class {className} : IPluginRegister");
|
|
|
|
|
sb.AppendLine("{");
|
|
|
|
|
|
|
|
|
|
if(archives?.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
sb.AppendLine(" public List<Type> GetAllArchivePlugins() => new()");
|
|
|
|
|
sb.AppendLine(" {");
|
|
|
|
|
|
2022-12-17 14:06:03 +00:00
|
|
|
foreach(string plugin in archives)
|
|
|
|
|
sb.AppendLine($" typeof({plugin}),");
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
sb.AppendLine(" };");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
sb.AppendLine(" public List<Type> GetAllArchivePlugins() => null;");
|
|
|
|
|
|
|
|
|
|
sb.AppendLine();
|
|
|
|
|
|
|
|
|
|
if(checksums?.Count > 0)
|
|
|
|
|
{
|
2023-10-05 13:04:57 +01:00
|
|
|
sb.AppendLine(" public void RegisterChecksumPlugins(IServiceCollection services)");
|
2022-12-14 20:56:08 +00:00
|
|
|
sb.AppendLine(" {");
|
2022-12-17 14:06:03 +00:00
|
|
|
foreach(string plugin in checksums)
|
2023-10-05 13:04:57 +01:00
|
|
|
sb.AppendLine($" services.AddTransient<IChecksum, {plugin}>();");
|
|
|
|
|
sb.AppendLine(" }");
|
2022-12-14 20:56:08 +00:00
|
|
|
}
|
|
|
|
|
else
|
2023-10-05 13:04:57 +01:00
|
|
|
sb.AppendLine(" public void RegisterChecksumPlugins(IServiceCollection services) {}");
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
sb.AppendLine();
|
|
|
|
|
|
|
|
|
|
if(fileSystems?.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
sb.AppendLine(" public List<Type> GetAllFilesystemPlugins() => new()");
|
|
|
|
|
sb.AppendLine(" {");
|
|
|
|
|
|
2022-12-17 14:06:03 +00:00
|
|
|
foreach(string plugin in fileSystems)
|
|
|
|
|
sb.AppendLine($" typeof({plugin}),");
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
sb.AppendLine(" };");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
sb.AppendLine(" public List<Type> GetAllFilesystemPlugins() => null;");
|
|
|
|
|
|
|
|
|
|
sb.AppendLine();
|
|
|
|
|
|
|
|
|
|
if(filters?.Count > 0)
|
|
|
|
|
{
|
2023-10-05 16:00:59 +01:00
|
|
|
sb.AppendLine(" public void RegisterFilterPlugins(IServiceCollection services)");
|
2022-12-14 20:56:08 +00:00
|
|
|
sb.AppendLine(" {");
|
2022-12-17 14:06:03 +00:00
|
|
|
foreach(string plugin in filters)
|
2023-10-05 16:00:59 +01:00
|
|
|
sb.AppendLine($" services.AddTransient<IFilter, {plugin}>();");
|
|
|
|
|
sb.AppendLine(" }");
|
2022-12-14 20:56:08 +00:00
|
|
|
}
|
|
|
|
|
else
|
2023-10-05 16:00:59 +01:00
|
|
|
sb.AppendLine(" public void RegisterFilterPlugins(IServiceCollection services) {}");
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
sb.AppendLine();
|
|
|
|
|
|
|
|
|
|
if(floppyImagePlugins?.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
sb.AppendLine(" public List<Type> GetAllFloppyImagePlugins() => new()");
|
|
|
|
|
sb.AppendLine(" {");
|
|
|
|
|
|
2022-12-17 14:06:03 +00:00
|
|
|
foreach(string plugin in floppyImagePlugins)
|
|
|
|
|
sb.AppendLine($" typeof({plugin}),");
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
sb.AppendLine(" };");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
sb.AppendLine(" public List<Type> GetAllFloppyImagePlugins() => null;");
|
|
|
|
|
|
|
|
|
|
sb.AppendLine();
|
|
|
|
|
|
|
|
|
|
if(mediaImagePlugins?.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
sb.AppendLine(" public List<Type> GetAllMediaImagePlugins() => new()");
|
|
|
|
|
sb.AppendLine(" {");
|
|
|
|
|
|
2022-12-17 14:06:03 +00:00
|
|
|
foreach(string plugin in mediaImagePlugins)
|
|
|
|
|
sb.AppendLine($" typeof({plugin}),");
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
sb.AppendLine(" };");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
sb.AppendLine(" public List<Type> GetAllMediaImagePlugins() => null;");
|
|
|
|
|
|
|
|
|
|
sb.AppendLine();
|
|
|
|
|
|
|
|
|
|
if(partitionPlugins?.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
sb.AppendLine(" public List<Type> GetAllPartitionPlugins() => new()");
|
|
|
|
|
sb.AppendLine(" {");
|
|
|
|
|
|
2022-12-17 14:06:03 +00:00
|
|
|
foreach(string plugin in partitionPlugins)
|
|
|
|
|
sb.AppendLine($" typeof({plugin}),");
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
sb.AppendLine(" };");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
sb.AppendLine(" public List<Type> GetAllPartitionPlugins() => null;");
|
|
|
|
|
|
|
|
|
|
sb.AppendLine();
|
|
|
|
|
|
|
|
|
|
if(readOnlyFileSystems?.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
sb.AppendLine(" public List<Type> GetAllReadOnlyFilesystemPlugins() => new()");
|
|
|
|
|
sb.AppendLine(" {");
|
|
|
|
|
|
2022-12-17 14:06:03 +00:00
|
|
|
foreach(string plugin in readOnlyFileSystems)
|
|
|
|
|
sb.AppendLine($" typeof({plugin}),");
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
sb.AppendLine(" };");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
sb.AppendLine(" public List<Type> GetAllReadOnlyFilesystemPlugins() => null;");
|
|
|
|
|
|
|
|
|
|
sb.AppendLine();
|
|
|
|
|
|
|
|
|
|
if(writableFloppyImagePlugins?.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
sb.AppendLine(" public List<Type> GetAllWritableFloppyImagePlugins() => new()");
|
|
|
|
|
sb.AppendLine(" {");
|
|
|
|
|
|
2022-12-17 14:06:03 +00:00
|
|
|
foreach(string plugin in writableFloppyImagePlugins)
|
|
|
|
|
sb.AppendLine($" typeof({plugin}),");
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
sb.AppendLine(" };");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
sb.AppendLine(" public List<Type> GetAllWritableFloppyImagePlugins() => null;");
|
|
|
|
|
|
|
|
|
|
sb.AppendLine();
|
|
|
|
|
|
|
|
|
|
if(writableImagePlugins?.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
sb.AppendLine(" public List<Type> GetAllWritableImagePlugins() => new()");
|
|
|
|
|
sb.AppendLine(" {");
|
|
|
|
|
|
2022-12-17 14:06:03 +00:00
|
|
|
foreach(string plugin in writableImagePlugins)
|
|
|
|
|
sb.AppendLine($" typeof({plugin}),");
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
sb.AppendLine(" };");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
sb.AppendLine(" public List<Type> GetAllWritableImagePlugins() => null;");
|
|
|
|
|
|
|
|
|
|
sb.AppendLine();
|
|
|
|
|
|
|
|
|
|
if(byteAddressableImagePlugins?.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
sb.AppendLine(" public List<Type> GetAllByteAddressablePlugins() => new()");
|
|
|
|
|
sb.AppendLine(" {");
|
|
|
|
|
|
2022-12-17 14:06:03 +00:00
|
|
|
foreach(string plugin in byteAddressableImagePlugins)
|
|
|
|
|
sb.AppendLine($" typeof({plugin}),");
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
sb.AppendLine(" };");
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
sb.AppendLine(" public List<Type> GetAllByteAddressablePlugins() => null;");
|
|
|
|
|
|
|
|
|
|
sb.AppendLine("}");
|
|
|
|
|
|
|
|
|
|
context.AddSource("Register.g.cs", sb.ToString());
|
|
|
|
|
}
|
|
|
|
|
|
2023-10-03 23:24:05 +01:00
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region Nested type: PluginFinder
|
|
|
|
|
|
2022-12-14 20:56:08 +00:00
|
|
|
sealed class PluginFinder : ISyntaxReceiver
|
|
|
|
|
{
|
2022-12-17 14:06:03 +00:00
|
|
|
public List<string> Archives { get; } = new();
|
|
|
|
|
public List<string> Checksums { get; } = new();
|
|
|
|
|
public List<string> FileSystems { get; } = new();
|
|
|
|
|
public List<string> Filters { get; } = new();
|
|
|
|
|
public List<string> FloppyImagePlugins { get; } = new();
|
|
|
|
|
public List<string> MediaImagePlugins { get; } = new();
|
|
|
|
|
public List<string> PartitionPlugins { get; } = new();
|
|
|
|
|
public List<string> ReadOnlyFileSystems { get; } = new();
|
|
|
|
|
public List<string> WritableFloppyImagePlugins { get; } = new();
|
|
|
|
|
public List<string> WritableImagePlugins { get; } = new();
|
|
|
|
|
public List<string> ByteAddressableImagePlugins { get; } = new();
|
|
|
|
|
public ClassDeclarationSyntax Register { get; private set; }
|
2022-12-14 20:56:08 +00:00
|
|
|
|
2023-10-03 23:24:05 +01:00
|
|
|
#region ISyntaxReceiver Members
|
|
|
|
|
|
2022-12-14 20:56:08 +00:00
|
|
|
public void OnVisitSyntaxNode(SyntaxNode syntaxNode)
|
|
|
|
|
{
|
|
|
|
|
if(syntaxNode is not ClassDeclarationSyntax plugin)
|
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
|
2023-10-04 17:34:40 +01:00
|
|
|
ValueText ==
|
|
|
|
|
"IPluginRegister") ==
|
|
|
|
|
true)
|
2022-12-14 20:56:08 +00:00
|
|
|
Register = plugin;
|
|
|
|
|
|
|
|
|
|
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
|
2023-10-04 17:34:40 +01:00
|
|
|
ValueText ==
|
|
|
|
|
"IArchive") ==
|
|
|
|
|
true)
|
2023-10-03 23:24:05 +01:00
|
|
|
{
|
2022-12-17 14:06:03 +00:00
|
|
|
if(!Archives.Contains(plugin.Identifier.Text))
|
|
|
|
|
Archives.Add(plugin.Identifier.Text);
|
2023-10-03 23:24:05 +01:00
|
|
|
}
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
|
2023-10-04 17:34:40 +01:00
|
|
|
ValueText ==
|
|
|
|
|
"IChecksum") ==
|
|
|
|
|
true)
|
2023-10-03 23:24:05 +01:00
|
|
|
{
|
2022-12-17 14:06:03 +00:00
|
|
|
if(!Checksums.Contains(plugin.Identifier.Text))
|
|
|
|
|
Checksums.Add(plugin.Identifier.Text);
|
2023-10-03 23:24:05 +01:00
|
|
|
}
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
|
2023-10-04 17:34:40 +01:00
|
|
|
ValueText ==
|
|
|
|
|
"IFilesystem") ==
|
|
|
|
|
true)
|
2023-10-03 23:24:05 +01:00
|
|
|
{
|
2022-12-17 14:06:03 +00:00
|
|
|
if(!FileSystems.Contains(plugin.Identifier.Text))
|
|
|
|
|
FileSystems.Add(plugin.Identifier.Text);
|
2023-10-03 23:24:05 +01:00
|
|
|
}
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
|
2023-10-04 17:34:40 +01:00
|
|
|
ValueText ==
|
|
|
|
|
"IFilter") ==
|
|
|
|
|
true)
|
2023-10-03 23:24:05 +01:00
|
|
|
{
|
2022-12-17 14:06:03 +00:00
|
|
|
if(!Filters.Contains(plugin.Identifier.Text))
|
|
|
|
|
Filters.Add(plugin.Identifier.Text);
|
2023-10-03 23:24:05 +01:00
|
|
|
}
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
|
2023-10-04 17:34:40 +01:00
|
|
|
ValueText ==
|
|
|
|
|
"IFloppyImage") ==
|
|
|
|
|
true)
|
2023-10-03 23:24:05 +01:00
|
|
|
{
|
2022-12-17 14:06:03 +00:00
|
|
|
if(!FloppyImagePlugins.Contains(plugin.Identifier.Text))
|
|
|
|
|
FloppyImagePlugins.Add(plugin.Identifier.Text);
|
2023-10-03 23:24:05 +01:00
|
|
|
}
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
|
|
|
|
|
ValueText is "IMediaImage" or "IOpticalMediaImage" or "IFloppyImage"
|
2023-10-04 17:34:40 +01:00
|
|
|
or "ITapeImage") ==
|
|
|
|
|
true)
|
2023-10-03 23:24:05 +01:00
|
|
|
{
|
2022-12-17 14:06:03 +00:00
|
|
|
if(!MediaImagePlugins.Contains(plugin.Identifier.Text))
|
|
|
|
|
MediaImagePlugins.Add(plugin.Identifier.Text);
|
2023-10-03 23:24:05 +01:00
|
|
|
}
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
|
2023-10-04 17:34:40 +01:00
|
|
|
ValueText ==
|
|
|
|
|
"IPartition") ==
|
|
|
|
|
true)
|
2023-10-03 23:24:05 +01:00
|
|
|
{
|
2022-12-17 14:06:03 +00:00
|
|
|
if(!PartitionPlugins.Contains(plugin.Identifier.Text))
|
|
|
|
|
PartitionPlugins.Add(plugin.Identifier.Text);
|
2023-10-03 23:24:05 +01:00
|
|
|
}
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
|
2023-10-04 17:34:40 +01:00
|
|
|
ValueText ==
|
|
|
|
|
"IReadOnlyFilesystem") ==
|
|
|
|
|
true)
|
2023-10-03 23:24:05 +01:00
|
|
|
{
|
2022-12-17 14:06:03 +00:00
|
|
|
if(!ReadOnlyFileSystems.Contains(plugin.Identifier.Text))
|
|
|
|
|
ReadOnlyFileSystems.Add(plugin.Identifier.Text);
|
2023-10-03 23:24:05 +01:00
|
|
|
}
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
|
2023-10-04 17:34:40 +01:00
|
|
|
ValueText ==
|
|
|
|
|
"IWritableFloppyImage") ==
|
|
|
|
|
true)
|
2023-10-03 23:24:05 +01:00
|
|
|
{
|
2022-12-17 14:06:03 +00:00
|
|
|
if(!WritableFloppyImagePlugins.Contains(plugin.Identifier.Text))
|
|
|
|
|
WritableFloppyImagePlugins.Add(plugin.Identifier.Text);
|
2023-10-03 23:24:05 +01:00
|
|
|
}
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
|
|
|
|
|
ValueText is "IWritableImage" or "IWritableOpticalImage"
|
2023-10-04 17:34:40 +01:00
|
|
|
or "IWritableTapeImage" or "IByteAddressableImage") ==
|
|
|
|
|
true)
|
2023-10-03 23:24:05 +01:00
|
|
|
{
|
2022-12-17 14:06:03 +00:00
|
|
|
if(!WritableImagePlugins.Contains(plugin.Identifier.Text))
|
|
|
|
|
WritableImagePlugins.Add(plugin.Identifier.Text);
|
2023-10-03 23:24:05 +01:00
|
|
|
}
|
2022-12-14 20:56:08 +00:00
|
|
|
|
|
|
|
|
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
|
2023-10-04 17:34:40 +01:00
|
|
|
ValueText ==
|
|
|
|
|
"IByteAddressableImage") ==
|
|
|
|
|
true)
|
2023-10-03 23:24:05 +01:00
|
|
|
{
|
2022-12-17 14:06:03 +00:00
|
|
|
if(!ByteAddressableImagePlugins.Contains(plugin.Identifier.Text))
|
|
|
|
|
ByteAddressableImagePlugins.Add(plugin.Identifier.Text);
|
2023-10-03 23:24:05 +01:00
|
|
|
}
|
2022-12-14 21:21:49 +00:00
|
|
|
|
|
|
|
|
MediaImagePlugins.AddRange(WritableImagePlugins);
|
|
|
|
|
FileSystems.AddRange(ReadOnlyFileSystems);
|
2022-12-14 20:56:08 +00:00
|
|
|
}
|
2023-10-03 23:24:05 +01:00
|
|
|
|
|
|
|
|
#endregion
|
2022-12-14 20:56:08 +00:00
|
|
|
}
|
2023-10-03 23:24:05 +01:00
|
|
|
|
|
|
|
|
#endregion
|
2022-12-14 20:56:08 +00:00
|
|
|
}
|