mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Register the flux components so they build
This commit is contained in:
@@ -54,6 +54,8 @@ public class PluginRegisterGenerator : ISourceGenerator
|
||||
List<string> writableFloppyImagePlugins = ((PluginFinder)context.SyntaxReceiver)?.WritableFloppyImagePlugins;
|
||||
List<string> writableImagePlugins = ((PluginFinder)context.SyntaxReceiver)?.WritableImagePlugins;
|
||||
List<string> byteAddressableImagePlugins = ((PluginFinder)context.SyntaxReceiver)?.ByteAddressableImagePlugins;
|
||||
List<string> fluxImagePlugins = ((PluginFinder)context.SyntaxReceiver)?.FluxImagePlugins;
|
||||
List<string> writableFluxImagePlugins = ((PluginFinder)context.SyntaxReceiver)?.WritableFluxImagePlugins;
|
||||
|
||||
StringBuilder sb = new();
|
||||
|
||||
@@ -269,6 +271,32 @@ public class PluginRegisterGenerator : ISourceGenerator
|
||||
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<IFluxImage, {plugin}>();");
|
||||
|
||||
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<IWritableFluxImage, {plugin}>();");
|
||||
|
||||
sb.AppendLine(" }");
|
||||
}
|
||||
else
|
||||
sb.AppendLine(" public void RegisterWritableFluxImagePlugins(IServiceCollection services) {}");
|
||||
|
||||
sb.AppendLine("}");
|
||||
|
||||
context.AddSource("Register.g.cs", sb.ToString());
|
||||
@@ -291,6 +319,8 @@ public class PluginRegisterGenerator : ISourceGenerator
|
||||
public List<string> WritableFloppyImagePlugins { get; } = [];
|
||||
public List<string> WritableImagePlugins { get; } = [];
|
||||
public List<string> ByteAddressableImagePlugins { get; } = [];
|
||||
public List<string> FluxImagePlugins { get; } = [];
|
||||
public List<string> WritableFluxImagePlugins { get; } = [];
|
||||
public ClassDeclarationSyntax Register { get; private set; }
|
||||
|
||||
#region ISyntaxReceiver Members
|
||||
@@ -340,11 +370,20 @@ public class PluginRegisterGenerator : ISourceGenerator
|
||||
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 @@ public class PluginRegisterGenerator : ISourceGenerator
|
||||
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))
|
||||
|
||||
@@ -57,7 +57,9 @@ public sealed partial class A2R
|
||||
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
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
/// <inheritdoc />
|
||||
|
||||
@@ -205,6 +205,16 @@ public sealed partial class A2R
|
||||
_imageInfo.Heads = 2;
|
||||
_imageInfo.Cylinders = 40;
|
||||
|
||||
break;
|
||||
case A2rDriveType.DS_3_80trk:
|
||||
_imageInfo.Heads = 2;
|
||||
_imageInfo.Cylinders = 80;
|
||||
|
||||
break;
|
||||
case A2rDriveType.DS_3_40trk:
|
||||
_imageInfo.Heads = 2;
|
||||
_imageInfo.Cylinders = 40;
|
||||
|
||||
break;
|
||||
default:
|
||||
return ErrorNumber.OutOfRange;
|
||||
|
||||
@@ -155,6 +155,9 @@ public sealed partial class A2R
|
||||
_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
|
||||
|
||||
Reference in New Issue
Block a user