diff --git a/Aaru.Generators/PluginRegisterGenerator.cs b/Aaru.Generators/PluginRegisterGenerator.cs index 6bfa6d162..0058ba579 100644 --- a/Aaru.Generators/PluginRegisterGenerator.cs +++ b/Aaru.Generators/PluginRegisterGenerator.cs @@ -54,6 +54,8 @@ public void Execute(GeneratorExecutionContext context) List writableFloppyImagePlugins = ((PluginFinder)context.SyntaxReceiver)?.WritableFloppyImagePlugins; List writableImagePlugins = ((PluginFinder)context.SyntaxReceiver)?.WritableImagePlugins; List byteAddressableImagePlugins = ((PluginFinder)context.SyntaxReceiver)?.ByteAddressableImagePlugins; + List fluxImagePlugins = ((PluginFinder)context.SyntaxReceiver)?.FluxImagePlugins; + List writableFluxImagePlugins = ((PluginFinder)context.SyntaxReceiver)?.WritableFluxImagePlugins; StringBuilder sb = new(); @@ -269,6 +271,32 @@ public void Execute(GeneratorExecutionContext context) else sb.AppendLine(" public void RegisterByteAddressablePlugins(IServiceCollection services) {}"); + if(fluxImagePlugins?.Count > 0) + { + sb.AppendLine(" public void RegisterFluxImagePlugins(IServiceCollection services)"); + sb.AppendLine(" {"); + + foreach(string plugin in fluxImagePlugins.Distinct()) + sb.AppendLine($" services.AddTransient();"); + + sb.AppendLine(" }"); + } + else + sb.AppendLine(" public void RegisterFluxImagePlugins(IServiceCollection services) {}"); + + if(writableFluxImagePlugins?.Count > 0) + { + sb.AppendLine(" public void RegisterWritableFluxImagePlugins(IServiceCollection services)"); + sb.AppendLine(" {"); + + foreach(string plugin in writableFluxImagePlugins.Distinct()) + sb.AppendLine($" services.AddTransient();"); + + sb.AppendLine(" }"); + } + else + sb.AppendLine(" public void RegisterWritableFluxImagePlugins(IServiceCollection services) {}"); + sb.AppendLine("}"); context.AddSource("Register.g.cs", sb.ToString()); @@ -291,6 +319,8 @@ sealed class PluginFinder : ISyntaxReceiver public List WritableFloppyImagePlugins { get; } = []; public List WritableImagePlugins { get; } = []; public List ByteAddressableImagePlugins { get; } = []; + public List FluxImagePlugins { get; } = []; + public List WritableFluxImagePlugins { get; } = []; public ClassDeclarationSyntax Register { get; private set; } #region ISyntaxReceiver Members @@ -340,11 +370,20 @@ public void OnVisitSyntaxNode(SyntaxNode syntaxNode) if(!FloppyImagePlugins.Contains(plugin.Identifier.Text)) FloppyImagePlugins.Add(plugin.Identifier.Text); + if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier + .ValueText == + "IFluxImage") == + true) + if(!FluxImagePlugins.Contains(plugin.Identifier.Text)) + FluxImagePlugins.Add(plugin.Identifier.Text); + + if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier .ValueText is "IMediaImage" or "IOpticalMediaImage" or "IFloppyImage" - or "ITapeImage") == + or "ITapeImage" + or "IFluxImage") == true) if(!MediaImagePlugins.Contains(plugin.Identifier.Text)) MediaImagePlugins.Add(plugin.Identifier.Text); @@ -374,11 +413,21 @@ .ValueText is "IMediaImage" WritableFloppyImagePlugins.Add(plugin.Identifier.Text); } + if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier + .ValueText == + "IWritableFluxImage") == + true) + { + if(!WritableFluxImagePlugins.Contains(plugin.Identifier.Text)) + WritableFluxImagePlugins.Add(plugin.Identifier.Text); + } + if(plugin.BaseList?.Types.Any(t => ((t as SimpleBaseTypeSyntax)?.Type as IdentifierNameSyntax)?.Identifier .ValueText is "IWritableImage" or "IWritableOpticalImage" or "IWritableTapeImage" - or "IByteAddressableImage") == + or "IByteAddressableImage" + or "IWritableFluxImage") == true) { if(!WritableImagePlugins.Contains(plugin.Identifier.Text)) diff --git a/Aaru.Images/A2R/Enums.cs b/Aaru.Images/A2R/Enums.cs index 40070c8bf..0b7eecce5 100644 --- a/Aaru.Images/A2R/Enums.cs +++ b/Aaru.Images/A2R/Enums.cs @@ -57,7 +57,9 @@ public enum A2rDriveType : byte DS_525_80trk = 0x3, DS_525_40trk = 0x4, DS_35_80trk = 0x5, - DS_8 = 0x6 + DS_8 = 0x6, + DS_3_80trk = 0x7, + DS_3_40trk = 0x8 } #endregion diff --git a/Aaru.Images/A2R/Properties.cs b/Aaru.Images/A2R/Properties.cs index 79d06cd1f..7e2cb3f54 100644 --- a/Aaru.Images/A2R/Properties.cs +++ b/Aaru.Images/A2R/Properties.cs @@ -88,7 +88,7 @@ public sealed partial class A2R { // TODO: A2R supports a lot more formats, please add more whence tested. MediaType.DOS_35_DS_DD_9, MediaType.DOS_35_HD, MediaType.DOS_525_DS_DD_9, MediaType.DOS_525_HD, - MediaType.Apple32SS, MediaType.Unknown + MediaType.Apple32SS, MediaType.AppleSonyDS, MediaType.Unknown }; /// diff --git a/Aaru.Images/A2R/Write.cs b/Aaru.Images/A2R/Write.cs index 2fe888039..daa23a65d 100644 --- a/Aaru.Images/A2R/Write.cs +++ b/Aaru.Images/A2R/Write.cs @@ -155,6 +155,9 @@ public bool Create(string path, MediaType mediaType, Dictionary _infoChunkV3.driveType = mediaType switch { MediaType.DOS_525_DS_DD_9 => A2rDriveType.DS_525_40trk, + MediaType.DOS_35_HD => A2rDriveType.DS_35_80trk, + MediaType.DOS_525_HD => A2rDriveType.DS_525_80trk, + MediaType.AppleSonyDS => A2rDriveType.DS_35_80trk_appleCLV, MediaType.Apple32SS => A2rDriveType.SS_525_40trk_quarterStep, MediaType.Unknown => A2rDriveType.DS_35_80trk, _ => _infoChunkV3.driveType