Move plugin registers to source generator.

This commit is contained in:
2022-12-14 20:56:08 +00:00
parent b69dad87b2
commit 5fb23f1024
43 changed files with 488 additions and 286 deletions

View File

@@ -1,7 +1,7 @@
<component name="ProjectRunConfigurationManager">
<configuration default="false" name="Aaru" type="DotNetProject" factoryName=".NET Project">
<option name="EXE_PATH" value="$PROJECT_DIR$/Aaru/bin/Debug/net6/aaru" />
<option name="PROGRAM_PARAMETERS" value="m dump /dev/sda foo4.z64" />
<option name="EXE_PATH" value="$PROJECT_DIR$/Aaru/bin/Debug/net7.0/aaru.exe" />
<option name="PROGRAM_PARAMETERS" value="formats" />
<option name="WORKING_DIRECTORY" value="$USER_HOME$/Desktop" />
<option name="PASS_PARENT_ENVS" value="1" />
<option name="USE_EXTERNAL_CONSOLE" value="0" />
@@ -12,7 +12,7 @@
<option name="PROJECT_ARGUMENTS_TRACKING" value="1" />
<option name="PROJECT_WORKING_DIRECTORY_TRACKING" value="0" />
<option name="PROJECT_KIND" value="DotNetCore" />
<option name="PROJECT_TFM" value="net6.0" />
<option name="PROJECT_TFM" value="net7.0" />
<method v="2">
<option name="Build" />
</method>

View File

@@ -28,6 +28,7 @@
<Authors>Natalia Portillo &lt;claunia@claunia.com&gt;</Authors>
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<NoWarn>CS1591;CS1574</NoWarn>
@@ -58,4 +59,7 @@
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Aaru.Generators\Aaru.Generators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
</ItemGroup>
</Project>

View File

@@ -1,4 +1,4 @@
// /***************************************************************************
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
@@ -38,49 +38,11 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Aaru.CommonTypes.Interfaces;
namespace Aaru.Archives;
// Needs to have the interface here so the source generator knows THIS IS the class
// ReSharper disable once RedundantExtendsListEntry
/// <inheritdoc />
public sealed class Register : IPluginRegister
{
/// <inheritdoc />
public List<Type> GetAllChecksumPlugins() => null;
/// <inheritdoc />
public List<Type> GetAllFilesystemPlugins() => null;
/// <inheritdoc />
public List<Type> GetAllFilterPlugins() => null;
/// <inheritdoc />
public List<Type> GetAllFloppyImagePlugins() => null;
/// <inheritdoc />
public List<Type> GetAllMediaImagePlugins() => null;
/// <inheritdoc />
public List<Type> GetAllPartitionPlugins() => null;
/// <inheritdoc />
public List<Type> GetAllReadOnlyFilesystemPlugins() => null;
/// <inheritdoc />
public List<Type> GetAllWritableFloppyImagePlugins() => null;
/// <inheritdoc />
public List<Type> GetAllWritableImagePlugins() => null;
/// <inheritdoc />
public List<Type> GetAllArchivePlugins() => Assembly.GetExecutingAssembly().GetTypes().
Where(t => t.GetInterfaces().Contains(typeof(IArchive))).
Where(t => t.IsClass).ToList();
/// <inheritdoc />
public List<Type> GetAllByteAddressablePlugins() => null;
}
public sealed partial class Register : IPluginRegister {}

View File

@@ -29,6 +29,7 @@
<Authors>Natalia Portillo &lt;claunia@claunia.com&gt;</Authors>
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<NoWarn>CS1591;CS1574</NoWarn>
@@ -76,4 +77,7 @@
<LastGenOutput>Localization.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Aaru.Generators\Aaru.Generators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
</ItemGroup>
</Project>

View File

@@ -64,6 +64,8 @@
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=jfs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=lif/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=lisafs/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=localization/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
@@ -109,6 +111,7 @@
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=squash/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=sysv/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=ucsdpascal/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=udf/@EntryIndexedValue">True</s:Boolean>
<s:Boolean

View File

@@ -28,7 +28,7 @@
using System.Diagnostics.CodeAnalysis;
namespace Aaru.Filesystems.LisaFS;
namespace Aaru.Filesystems;
[SuppressMessage("ReSharper", "UnusedMember.Local")]
public sealed partial class LisaFS

View File

@@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs;
using Aaru.Decoders;
using Aaru.Helpers;
namespace Aaru.Filesystems.LisaFS;
namespace Aaru.Filesystems;
public sealed partial class LisaFS
{

View File

@@ -32,7 +32,7 @@ using Aaru.Console;
using Aaru.Decoders;
using Aaru.Helpers;
namespace Aaru.Filesystems.LisaFS;
namespace Aaru.Filesystems;
public sealed partial class LisaFS
{

View File

@@ -33,7 +33,7 @@ using Aaru.Console;
using Aaru.Decoders;
using Aaru.Helpers;
namespace Aaru.Filesystems.LisaFS;
namespace Aaru.Filesystems;
public sealed partial class LisaFS
{

View File

@@ -38,7 +38,7 @@ using Claunia.Encoding;
using Schemas;
using Encoding = System.Text.Encoding;
namespace Aaru.Filesystems.LisaFS;
namespace Aaru.Filesystems;
public sealed partial class LisaFS
{

View File

@@ -32,7 +32,7 @@ using System.Text;
using Aaru.CommonTypes.Interfaces;
using Schemas;
namespace Aaru.Filesystems.LisaFS;
namespace Aaru.Filesystems;
// All information by Natalia Portillo
// Variable names from Lisa API

View File

@@ -32,7 +32,7 @@ using System;
using System.Diagnostics.CodeAnalysis;
#pragma warning disable CS0649
namespace Aaru.Filesystems.LisaFS;
namespace Aaru.Filesystems;
public sealed partial class LisaFS
{

View File

@@ -39,7 +39,7 @@ using Claunia.Encoding;
using Schemas;
using Encoding = System.Text.Encoding;
namespace Aaru.Filesystems.LisaFS;
namespace Aaru.Filesystems;
public sealed partial class LisaFS
{

View File

@@ -38,7 +38,7 @@ using Aaru.CommonTypes.Enums;
using Aaru.Decoders;
using Aaru.Helpers;
namespace Aaru.Filesystems.LisaFS;
namespace Aaru.Filesystems;
public sealed partial class LisaFS
{

View File

@@ -32,52 +32,11 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Aaru.CommonTypes.Interfaces;
namespace Aaru.Filesystems;
// Needs to have the interface here so the source generator knows THIS IS the class
// ReSharper disable once RedundantExtendsListEntry
/// <inheritdoc />
public sealed class Register : IPluginRegister
{
/// <inheritdoc />
public List<Type> GetAllChecksumPlugins() => null;
/// <inheritdoc />
public List<Type> GetAllFilesystemPlugins() => Assembly.GetExecutingAssembly().GetTypes().
Where(t => t.GetInterfaces().Contains(typeof(IFilesystem))).
Where(t => t.IsClass).ToList();
/// <inheritdoc />
public List<Type> GetAllFilterPlugins() => null;
/// <inheritdoc />
public List<Type> GetAllFloppyImagePlugins() => null;
/// <inheritdoc />
public List<Type> GetAllMediaImagePlugins() => null;
/// <inheritdoc />
public List<Type> GetAllPartitionPlugins() => null;
/// <inheritdoc />
public List<Type> GetAllReadOnlyFilesystemPlugins() => Assembly.GetExecutingAssembly().GetTypes().
Where(t => t.GetInterfaces().
Contains(typeof(IReadOnlyFilesystem))).
Where(t => t.IsClass).ToList();
/// <inheritdoc />
public List<Type> GetAllWritableFloppyImagePlugins() => null;
/// <inheritdoc />
public List<Type> GetAllWritableImagePlugins() => null;
/// <inheritdoc />
public List<Type> GetAllArchivePlugins() => null;
/// <inheritdoc />
public List<Type> GetAllByteAddressablePlugins() => null;
}
public sealed partial class Register : IPluginRegister {}

View File

@@ -32,7 +32,7 @@
using System.Diagnostics.CodeAnalysis;
namespace Aaru.Filesystems.UCSDPascal;
namespace Aaru.Filesystems;
// Information from Call-A.P.P.L.E. Pascal Disk Directory Structure
[SuppressMessage("ReSharper", "UnusedMember.Local")]

View File

@@ -36,7 +36,7 @@ using System.Linq;
using Aaru.CommonTypes.Enums;
using Aaru.Helpers;
namespace Aaru.Filesystems.UCSDPascal;
namespace Aaru.Filesystems;
// Information from Call-A.P.P.L.E. Pascal Disk Directory Structure
public sealed partial class PascalPlugin

View File

@@ -32,7 +32,7 @@ using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Structs;
using Aaru.Helpers;
namespace Aaru.Filesystems.UCSDPascal;
namespace Aaru.Filesystems;
// Information from Call-A.P.P.L.E. Pascal Disk Directory Structure
public sealed partial class PascalPlugin

View File

@@ -41,7 +41,7 @@ using Claunia.Encoding;
using Schemas;
using Encoding = System.Text.Encoding;
namespace Aaru.Filesystems.UCSDPascal;
namespace Aaru.Filesystems;
// Information from Call-A.P.P.L.E. Pascal Disk Directory Structure
public sealed partial class PascalPlugin

View File

@@ -32,7 +32,7 @@
using System.Diagnostics.CodeAnalysis;
namespace Aaru.Filesystems.UCSDPascal;
namespace Aaru.Filesystems;
// Information from Call-A.P.P.L.E. Pascal Disk Directory Structure
[SuppressMessage("ReSharper", "NotAccessedField.Local")]

View File

@@ -41,7 +41,7 @@ using Claunia.Encoding;
using Schemas;
using Encoding = System.Text.Encoding;
namespace Aaru.Filesystems.UCSDPascal;
namespace Aaru.Filesystems;
// Information from Call-A.P.P.L.E. Pascal Disk Directory Structure
public sealed partial class PascalPlugin

View File

@@ -37,7 +37,7 @@ using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Interfaces;
using Schemas;
namespace Aaru.Filesystems.UCSDPascal;
namespace Aaru.Filesystems;
// Information from Call-A.P.P.L.E. Pascal Disk Directory Structure
/// <inheritdoc />

View File

@@ -28,6 +28,7 @@
<Authors>Natalia Portillo &lt;claunia@claunia.com&gt;</Authors>
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<NoWarn>CS1591;CS1574</NoWarn>
@@ -60,4 +61,7 @@
<PackageReference Include="SharpCompress" Version="0.32.2"/>
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.3" PrivateAssets="all"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Aaru.Generators\Aaru.Generators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
</ItemGroup>
</Project>

View File

@@ -36,49 +36,11 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Aaru.CommonTypes.Interfaces;
namespace Aaru.Filters;
// Needs to have the interface here so the source generator knows THIS IS the class
// ReSharper disable once RedundantExtendsListEntry
/// <inheritdoc />
public class Register : IPluginRegister
{
/// <inheritdoc />
public List<Type> GetAllChecksumPlugins() => null;
/// <inheritdoc />
public List<Type> GetAllFilesystemPlugins() => null;
/// <inheritdoc />
public List<Type> GetAllFilterPlugins() => Assembly.GetExecutingAssembly().GetTypes().
Where(t => t.GetInterfaces().Contains(typeof(IFilter))).
Where(t => t.IsClass).ToList();
/// <inheritdoc />
public List<Type> GetAllFloppyImagePlugins() => null;
/// <inheritdoc />
public List<Type> GetAllMediaImagePlugins() => null;
/// <inheritdoc />
public List<Type> GetAllPartitionPlugins() => null;
/// <inheritdoc />
public List<Type> GetAllReadOnlyFilesystemPlugins() => null;
/// <inheritdoc />
public List<Type> GetAllWritableFloppyImagePlugins() => null;
/// <inheritdoc />
public List<Type> GetAllWritableImagePlugins() => null;
/// <inheritdoc />
public List<Type> GetAllArchivePlugins() => null;
/// <inheritdoc />
public List<Type> GetAllByteAddressablePlugins() => null;
}
public sealed partial class Register : IPluginRegister {}

View File

@@ -0,0 +1,16 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<LangVersion>latest</LangVersion>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.4.0"/>
</ItemGroup>
</Project>

View File

@@ -0,0 +1,354 @@
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
{
/// <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;
string @namespace =
(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;
List<ClassDeclarationSyntax> archives = ((PluginFinder)context.SyntaxReceiver)?.Archives;
List<ClassDeclarationSyntax> checksums = ((PluginFinder)context.SyntaxReceiver)?.Checksums;
List<ClassDeclarationSyntax> fileSystems = ((PluginFinder)context.SyntaxReceiver)?.FileSystems;
List<ClassDeclarationSyntax> filters = ((PluginFinder)context.SyntaxReceiver)?.Filters;
List<ClassDeclarationSyntax> floppyImagePlugins = ((PluginFinder)context.SyntaxReceiver)?.FloppyImagePlugins;
List<ClassDeclarationSyntax> partitionPlugins = ((PluginFinder)context.SyntaxReceiver)?.PartitionPlugins;
List<ClassDeclarationSyntax> mediaImagePlugins = ((PluginFinder)context.SyntaxReceiver)?.MediaImagePlugins;
List<ClassDeclarationSyntax> readOnlyFileSystems = ((PluginFinder)context.SyntaxReceiver)?.ReadOnlyFileSystems;
List<ClassDeclarationSyntax> writableFloppyImagePlugins =
((PluginFinder)context.SyntaxReceiver)?.WritableFloppyImagePlugins;
List<ClassDeclarationSyntax> writableImagePlugins =
((PluginFinder)context.SyntaxReceiver)?.WritableImagePlugins;
List<ClassDeclarationSyntax> byteAddressableImagePlugins =
((PluginFinder)context.SyntaxReceiver)?.ByteAddressableImagePlugins;
StringBuilder sb = new();
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
// ****************************************************************************/");
sb.AppendLine();
sb.AppendLine("using System;");
sb.AppendLine("using System.Collections.Generic;");
sb.AppendLine("using Aaru.CommonTypes.Interfaces;");
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(" {");
foreach(ClassDeclarationSyntax plugin in archives)
sb.AppendLine($" typeof({plugin.Identifier.Text}),");
sb.AppendLine(" };");
}
else
sb.AppendLine(" public List<Type> GetAllArchivePlugins() => null;");
sb.AppendLine();
if(checksums?.Count > 0)
{
sb.AppendLine(" public List<Type> GetAllChecksumPlugins() => new()");
sb.AppendLine(" {");
foreach(ClassDeclarationSyntax plugin in checksums)
sb.AppendLine($" typeof({plugin.Identifier.Text}),");
sb.AppendLine(" };");
}
else
sb.AppendLine(" public List<Type> GetAllChecksumPlugins() => null;");
sb.AppendLine();
if(fileSystems?.Count > 0)
{
sb.AppendLine(" public List<Type> GetAllFilesystemPlugins() => new()");
sb.AppendLine(" {");
foreach(ClassDeclarationSyntax plugin in fileSystems)
sb.AppendLine($" typeof({plugin.Identifier.Text}),");
sb.AppendLine(" };");
}
else
sb.AppendLine(" public List<Type> GetAllFilesystemPlugins() => null;");
sb.AppendLine();
if(filters?.Count > 0)
{
sb.AppendLine(" public List<Type> GetAllFilterPlugins() => new()");
sb.AppendLine(" {");
foreach(ClassDeclarationSyntax plugin in filters)
sb.AppendLine($" typeof({plugin.Identifier.Text}),");
sb.AppendLine(" };");
}
else
sb.AppendLine(" public List<Type> GetAllFilterPlugins() => null;");
sb.AppendLine();
if(floppyImagePlugins?.Count > 0)
{
sb.AppendLine(" public List<Type> GetAllFloppyImagePlugins() => new()");
sb.AppendLine(" {");
foreach(ClassDeclarationSyntax plugin in floppyImagePlugins)
sb.AppendLine($" typeof({plugin.Identifier.Text}),");
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(" {");
foreach(ClassDeclarationSyntax plugin in mediaImagePlugins)
sb.AppendLine($" typeof({plugin.Identifier.Text}),");
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(" {");
foreach(ClassDeclarationSyntax plugin in partitionPlugins)
sb.AppendLine($" typeof({plugin.Identifier.Text}),");
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(" {");
foreach(ClassDeclarationSyntax plugin in readOnlyFileSystems)
sb.AppendLine($" typeof({plugin.Identifier.Text}),");
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(" {");
foreach(ClassDeclarationSyntax plugin in writableFloppyImagePlugins)
sb.AppendLine($" typeof({plugin.Identifier.Text}),");
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(" {");
foreach(ClassDeclarationSyntax plugin in writableImagePlugins)
sb.AppendLine($" typeof({plugin.Identifier.Text}),");
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(" {");
foreach(ClassDeclarationSyntax plugin in byteAddressableImagePlugins)
sb.AppendLine($" typeof({plugin.Identifier.Text}),");
sb.AppendLine(" };");
}
else
sb.AppendLine(" public List<Type> GetAllByteAddressablePlugins() => null;");
sb.AppendLine("}");
context.AddSource("Register.g.cs", sb.ToString());
}
sealed class PluginFinder : ISyntaxReceiver
{
public List<ClassDeclarationSyntax> Archives { get; } = new();
public List<ClassDeclarationSyntax> Checksums { get; } = new();
public List<ClassDeclarationSyntax> FileSystems { get; } = new();
public List<ClassDeclarationSyntax> Filters { get; } = new();
public List<ClassDeclarationSyntax> FloppyImagePlugins { get; } = new();
public List<ClassDeclarationSyntax> MediaImagePlugins { get; } = new();
public List<ClassDeclarationSyntax> PartitionPlugins { get; } = new();
public List<ClassDeclarationSyntax> ReadOnlyFileSystems { get; } = new();
public List<ClassDeclarationSyntax> WritableFloppyImagePlugins { get; } = new();
public List<ClassDeclarationSyntax> WritableImagePlugins { get; } = new();
public List<ClassDeclarationSyntax> ByteAddressableImagePlugins { get; } = new();
public ClassDeclarationSyntax Register { get; private set; }
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.
ValueText == "IPluginRegister") == true)
Register = plugin;
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
ValueText == "IArchive") == true)
Archives.Add(plugin);
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
ValueText == "IChecksum") == true)
Checksums.Add(plugin);
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
ValueText == "IFilesystem") == true)
FileSystems.Add(plugin);
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
ValueText == "IFilter") == true)
Filters.Add(plugin);
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
ValueText == "IFloppyImage") == true)
FloppyImagePlugins.Add(plugin);
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
ValueText is "IMediaImage" or "IOpticalMediaImage" or "IFloppyImage"
or "ITapeImage") == true)
MediaImagePlugins.Add(plugin);
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
ValueText == "IPartition") == true)
PartitionPlugins.Add(plugin);
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
ValueText == "IReadOnlyFilesystem") == true)
ReadOnlyFileSystems.Add(plugin);
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
ValueText == "IWritableFloppyImage") == true)
WritableFloppyImagePlugins.Add(plugin);
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
ValueText is "IWritableImage" or "IWritableOpticalImage"
or "IWritableTapeImage" or "IByteAddressableImage") == true)
WritableImagePlugins.Add(plugin);
if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier.
ValueText == "IByteAddressableImage") == true)
ByteAddressableImagePlugins.Add(plugin);
}
}
}

View File

@@ -29,6 +29,7 @@
<Authors>Natalia Portillo &lt;claunia@claunia.com&gt;</Authors>
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<NoWarn>CS1591;CS1574</NoWarn>
@@ -71,4 +72,7 @@
<LastGenOutput>Localization.Designer.cs</LastGenOutput>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Aaru.Generators\Aaru.Generators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
</ItemGroup>
</Project>

View File

@@ -4,7 +4,7 @@
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=aaruformat/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=alcohol120/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=anex86/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=anex86/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=apple2mg/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=appledos/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=applenib/@EntryIndexedValue">True</s:Boolean>
@@ -12,80 +12,82 @@
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=blindwrite4/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=blindwrite5/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=blu/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=blu/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=cdrdao/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=byteaddressable/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=cdrwin/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=cdrdao/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=chd/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=cdrwin/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=ciscopy/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=chd/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=clonecd/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=ciscopy/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=copyqm/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=clonecd/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=copyqm/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=copytape/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=cpcdsk/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=cpcdsk/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=d88/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=d88/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=dart/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=dart/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=dim/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=dim/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=discferret/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=discjuggler/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=diskcopy42/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=diskdupe/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=dridiskcopy/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=gdi/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=gdi/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=hdcopy/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=hdcopy/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=imd/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=imd/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=kryoflux/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=localization/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=localization/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=maxidisk/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=ndif/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=ndif/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=nero/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=nero/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=nhdr0/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=nhdr0/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=parallels/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=partclone/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=partimage/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=qcow/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=qcow/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=qcow2/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=qcow2/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=qed/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=qed/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=raydim/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=raydim/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=rside/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=rside/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=savedskf/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=supercardpro/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=supercardpro/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=t98/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=t98/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=teledisk/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=udif/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=udif/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=ukvfdi/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=ukvfdi/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=vdi/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=vdi/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=vhd/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=vhd/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=vhdx/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=vhdx/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=virtual98/@EntryIndexedValue">True</s:Boolean>
<s:Boolean
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=vmware/@EntryIndexedValue">True</s:Boolean>
x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=vmware/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=wcdiskimage/@EntryIndexedValue">True</s:Boolean>
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=zzzrawimage/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>

View File

@@ -12,7 +12,7 @@ using Aaru.Helpers;
using Schemas;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.DiscImages.ByteAddressable;
namespace Aaru.DiscImages;
public class AtariLynx : IByteAddressableImage
{

View File

@@ -12,7 +12,7 @@ using Aaru.Helpers;
using Schemas;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.DiscImages.ByteAddressable;
namespace Aaru.DiscImages;
public class GameBoy : IByteAddressableImage
{

View File

@@ -12,7 +12,7 @@ using Aaru.Helpers;
using Schemas;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.DiscImages.ByteAddressable;
namespace Aaru.DiscImages;
public class GameBoyAdvance : IByteAddressableImage
{

View File

@@ -12,7 +12,7 @@ using Aaru.Helpers;
using Schemas;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.DiscImages.ByteAddressable;
namespace Aaru.DiscImages;
public class MasterSystem : IByteAddressableImage
{

View File

@@ -14,7 +14,7 @@ using Aaru.Database.Models;
using Aaru.Helpers;
using Schemas;
namespace Aaru.DiscImages.ByteAddressable;
namespace Aaru.DiscImages;
public class Nes : IByteAddressableImage
{

View File

@@ -44,7 +44,7 @@ using Aaru.Helpers;
using Schemas;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.DiscImages.ByteAddressable;
namespace Aaru.DiscImages;
/// <inheritdoc />
/// <summary>Implements support for Nintendo 64 cartridge dumps</summary>

View File

@@ -44,7 +44,7 @@ using Aaru.Helpers;
using Schemas;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.DiscImages.ByteAddressable;
namespace Aaru.DiscImages;
/// <inheritdoc />
/// <summary>Implements support for Sega Mega Drive, 32X, Genesis and Pico cartridge dumps</summary>

View File

@@ -12,7 +12,7 @@ using Aaru.Helpers;
using Schemas;
using Marshal = Aaru.Helpers.Marshal;
namespace Aaru.DiscImages.ByteAddressable;
namespace Aaru.DiscImages;
public class SuperNintendo : IByteAddressableImage
{

View File

@@ -36,61 +36,11 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Aaru.CommonTypes.Interfaces;
namespace Aaru.DiscImages;
// Needs to have the interface here so the source generator knows THIS IS the class
// ReSharper disable once RedundantExtendsListEntry
/// <inheritdoc />
public sealed class Register : IPluginRegister
{
/// <inheritdoc />
public List<Type> GetAllChecksumPlugins() => null;
/// <inheritdoc />
public List<Type> GetAllFilesystemPlugins() => null;
/// <inheritdoc />
public List<Type> GetAllFilterPlugins() => null;
/// <inheritdoc />
public List<Type> GetAllFloppyImagePlugins() => Assembly.GetExecutingAssembly().GetTypes().
Where(t => t.GetInterfaces().
Contains(typeof(IFloppyImage))).
Where(t => t.IsClass).ToList();
/// <inheritdoc />
public List<Type> GetAllMediaImagePlugins() => Assembly.GetExecutingAssembly().GetTypes().
Where(t => t.GetInterfaces().Contains(typeof(IMediaImage))).
Where(t => t.IsClass).ToList();
/// <inheritdoc />
public List<Type> GetAllPartitionPlugins() => null;
/// <inheritdoc />
public List<Type> GetAllReadOnlyFilesystemPlugins() => null;
/// <inheritdoc />
public List<Type> GetAllWritableFloppyImagePlugins() => Assembly.GetExecutingAssembly().GetTypes().
Where(t => t.GetInterfaces().
Contains(typeof(IWritableFloppyImage))).
Where(t => t.IsClass).ToList();
/// <inheritdoc />
public List<Type> GetAllWritableImagePlugins() => Assembly.GetExecutingAssembly().GetTypes().
Where(t => t.GetInterfaces().
Contains(typeof(IBaseWritableImage))).
Where(t => t.IsClass).ToList();
/// <inheritdoc />
public List<Type> GetAllArchivePlugins() => null;
/// <inheritdoc />
public List<Type> GetAllByteAddressablePlugins() => Assembly.GetExecutingAssembly().GetTypes().
Where(t => t.GetInterfaces().
Contains(typeof(IByteAddressableImage))).
Where(t => t.IsClass).ToList();
}
public sealed partial class Register : IPluginRegister {}

View File

@@ -29,6 +29,7 @@
<Authors>Natalia Portillo &lt;claunia@claunia.com&gt;</Authors>
<DisableImplicitNamespaceImports>true</DisableImplicitNamespaceImports>
<EnableTrimAnalyzer>true</EnableTrimAnalyzer>
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'Debug' ">
<NoWarn>CS1591;CS1574</NoWarn>
@@ -62,4 +63,7 @@
<PackageReference Include="Spectre.Console" Version="0.45.0"/>
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.3" PrivateAssets="all"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Aaru.Generators\Aaru.Generators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false"/>
</ItemGroup>
</Project>

View File

@@ -36,49 +36,11 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using Aaru.CommonTypes.Interfaces;
namespace Aaru.Partitions;
// Needs to have the interface here so the source generator knows THIS IS the class
// ReSharper disable once RedundantExtendsListEntry
/// <inheritdoc />
public sealed class Register : IPluginRegister
{
/// <inheritdoc />
public List<Type> GetAllChecksumPlugins() => null;
/// <inheritdoc />
public List<Type> GetAllFilesystemPlugins() => null;
/// <inheritdoc />
public List<Type> GetAllFilterPlugins() => null;
/// <inheritdoc />
public List<Type> GetAllFloppyImagePlugins() => null;
/// <inheritdoc />
public List<Type> GetAllMediaImagePlugins() => null;
/// <inheritdoc />
public List<Type> GetAllPartitionPlugins() => Assembly.GetExecutingAssembly().GetTypes().
Where(t => t.GetInterfaces().Contains(typeof(IPartition))).
Where(t => t.IsClass).ToList();
/// <inheritdoc />
public List<Type> GetAllReadOnlyFilesystemPlugins() => null;
/// <inheritdoc />
public List<Type> GetAllWritableFloppyImagePlugins() => null;
/// <inheritdoc />
public List<Type> GetAllWritableImagePlugins() => null;
/// <inheritdoc />
public List<Type> GetAllArchivePlugins() => null;
/// <inheritdoc />
public List<Type> GetAllByteAddressablePlugins() => null;
}
public sealed partial class Register : IPluginRegister {}

View File

@@ -29,7 +29,7 @@
using System.IO;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;
using Aaru.Filesystems.LisaFS;
using Aaru.Filesystems;
using NUnit.Framework;
namespace Aaru.Tests.Filesystems;

View File

@@ -1,6 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.29102.190
# Visual Studio Version 17
VisualStudioVersion = 17.4.33205.214
MinimumVisualStudioVersion = 10.0.40219.1
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aaru", "Aaru\Aaru.csproj", "{7A4B05BE-73C9-4F34-87FE-E80CCF1F732D}"
EndProject
@@ -44,7 +44,11 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aaru.Decryption", "Aaru.Dec
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aaru.Archives", "Aaru.Archives\Aaru.Archives.csproj", "{282271D0-CCC2-4ED7-BA38-EC06A84BB974}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Aaru.Localization", "Aaru.Localization\Aaru.Localization.csproj", "{90B96C70-F449-4B83-9DC7-F69150806F9B}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aaru.Localization", "Aaru.Localization\Aaru.Localization.csproj", "{90B96C70-F449-4B83-9DC7-F69150806F9B}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Aaru.Generators", "Aaru.Generators\Aaru.Generators.csproj", "{BCF89E9A-ADE9-40FD-B892-54D11882558E}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{AF25D4CD-0DA5-4595-99BD-FA4ADB844FD2}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -230,6 +234,14 @@ Global
{90B96C70-F449-4B83-9DC7-F69150806F9B}.Release|Any CPU.Build.0 = Release|Any CPU
{90B96C70-F449-4B83-9DC7-F69150806F9B}.Release|x86.ActiveCfg = Release|Any CPU
{90B96C70-F449-4B83-9DC7-F69150806F9B}.Release|x86.Build.0 = Release|Any CPU
{BCF89E9A-ADE9-40FD-B892-54D11882558E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BCF89E9A-ADE9-40FD-B892-54D11882558E}.Debug|Any CPU.Build.0 = Debug|Any CPU
{BCF89E9A-ADE9-40FD-B892-54D11882558E}.Debug|x86.ActiveCfg = Debug|Any CPU
{BCF89E9A-ADE9-40FD-B892-54D11882558E}.Debug|x86.Build.0 = Debug|Any CPU
{BCF89E9A-ADE9-40FD-B892-54D11882558E}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BCF89E9A-ADE9-40FD-B892-54D11882558E}.Release|Any CPU.Build.0 = Release|Any CPU
{BCF89E9A-ADE9-40FD-B892-54D11882558E}.Release|x86.ActiveCfg = Release|Any CPU
{BCF89E9A-ADE9-40FD-B892-54D11882558E}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE