diff --git a/Aaru.Images/A2R/A2R.cs b/Aaru.Images/A2R/A2R.cs
index e936f3259..820ba41bc 100644
--- a/Aaru.Images/A2R/A2R.cs
+++ b/Aaru.Images/A2R/A2R.cs
@@ -45,25 +45,25 @@ namespace Aaru.DiscImages;
/// Implements reading A2R flux images
public sealed partial class A2R : IFluxImage, IMediaImage, IWritableImage, IWritableFluxImage
{
- ImageInfo _imageInfo;
- Stream _a2rStream;
- IFilter _a2rFilter;
- FileStream _writingStream;
- A2rHeader Header;
- Dictionary Meta;
- InfoChunkV2 _infoChunkV2;
- InfoChunkV3 _infoChunkV3;
- List _a2rCaptures;
- uint _currentResolution;
+ const string MODULE_NAME = "A2R plugin";
+ List _a2rCaptures;
+ IFilter _a2rFilter;
+ Stream _a2rStream;
// Offset from the start of the current RWCP to the next capture
uint _currentCaptureOffset = 16;
+ uint _currentResolution;
// 53 = A2R header, INFO header, INFO data
- long _currentRwcpStart = 53;
+ long _currentRwcpStart = 53;
+ ImageInfo _imageInfo;
+ InfoChunkV2 _infoChunkV2;
+ InfoChunkV3 _infoChunkV3;
+ FileStream _writingStream;
+ A2rHeader Header;
+ Dictionary Meta;
- public A2R()
- {
+ public A2R() =>
_imageInfo = new ImageInfo
{
ReadableSectorTags = new List(),
@@ -87,7 +87,4 @@ public sealed partial class A2R : IFluxImage, IMediaImage, IWritableImage, IWrit
DriveSerialNumber = null,
DriveFirmwareRevision = null
};
- }
-
- const string MODULE_NAME = "A2R plugin";
}
\ No newline at end of file
diff --git a/Aaru.Images/A2R/Constants.cs b/Aaru.Images/A2R/Constants.cs
index 5b7da91db..ba174c019 100644
--- a/Aaru.Images/A2R/Constants.cs
+++ b/Aaru.Images/A2R/Constants.cs
@@ -49,6 +49,11 @@ public sealed partial class A2R
0x49, 0x4E, 0x46, 0x4F // INFO
};
+ readonly byte[] _metaChunkSignature =
+ {
+ 0x4D, 0x45, 0x54, 0x41 // META
+ };
+
readonly byte[] _rwcpChunkSignature =
{
0x52, 0x57, 0x43, 0x50 // RWCP
@@ -59,11 +64,6 @@ public sealed partial class A2R
0x53, 0x4C, 0x56, 0x44 // SLVD
};
- readonly byte[] _metaChunkSignature =
- {
- 0x4D, 0x45, 0x54, 0x41 // META
- };
-
readonly byte[] _strmChunkSignature =
{
0x53, 0x54, 0x52, 0x4D // STRM
diff --git a/Aaru.Images/A2R/Enums.cs b/Aaru.Images/A2R/Enums.cs
index cfc85ac87..7b3e7e617 100644
--- a/Aaru.Images/A2R/Enums.cs
+++ b/Aaru.Images/A2R/Enums.cs
@@ -36,15 +36,28 @@ namespace Aaru.DiscImages;
public sealed partial class A2R
{
- [SuppressMessage("ReSharper", "InconsistentNaming")]
- public enum A2rDriveType : byte
- {
- SS_525_40trk_quarterStep = 0x1, DS_35_80trk_appleCLV = 0x2, DS_525_80trk = 0x3,
- DS_525_40trk = 0x4, DS_35_80trk = 0x5, DS_8 = 0x6
- }
+#region A2rDiskType enum
public enum A2rDiskType : byte
{
- _525 = 0x01, _35 = 0x2,
+ _525 = 0x01,
+ _35 = 0x2
}
+
+#endregion
+
+#region A2rDriveType enum
+
+ [SuppressMessage("ReSharper", "InconsistentNaming")]
+ public enum A2rDriveType : byte
+ {
+ SS_525_40trk_quarterStep = 0x1,
+ DS_35_80trk_appleCLV = 0x2,
+ DS_525_80trk = 0x3,
+ DS_525_40trk = 0x4,
+ DS_35_80trk = 0x5,
+ DS_8 = 0x6
+ }
+
+#endregion
}
\ No newline at end of file
diff --git a/Aaru.Images/A2R/Helpers.cs b/Aaru.Images/A2R/Helpers.cs
index 786e8a4fc..5e6f7da9d 100644
--- a/Aaru.Images/A2R/Helpers.cs
+++ b/Aaru.Images/A2R/Helpers.cs
@@ -40,8 +40,8 @@ namespace Aaru.DiscImages;
public sealed partial class A2R
{
///
- /// Takes a Head, Track and Sub-Track representation, as well as the MediaType,
- /// and converts it to the Track representation used by A2R.
+ /// Takes a Head, Track and Sub-Track representation, as well as the MediaType,
+ /// and converts it to the Track representation used by A2R.
///
/// The head number
/// The track number
@@ -51,14 +51,14 @@ public sealed partial class A2R
static long HeadTrackSubToA2rLocation(uint head, ushort track, byte subTrack, MediaType mediaType)
{
if(mediaType == MediaType.Apple32SS)
- return head + (track * 4) + subTrack;
+ return head + track * 4 + subTrack;
- return head + (track * 2);
+ return head + track * 2;
}
///
- /// Takes a Head, Track and Sub-Track representation, as well as the A2rDriveType,
- /// and converts it to the Track representation used by A2R.
+ /// Takes a Head, Track and Sub-Track representation, as well as the A2rDriveType,
+ /// and converts it to the Track representation used by A2R.
///
/// The head number
/// The track number
@@ -68,22 +68,22 @@ public sealed partial class A2R
static long HeadTrackSubToA2rLocation(uint head, ushort track, byte subTrack, A2rDriveType driveType)
{
if(driveType == A2rDriveType.SS_525_40trk_quarterStep)
- return head + (track * 4) + subTrack;
+ return head + track * 4 + subTrack;
- return head + (track * 2);
+ return head + track * 2;
}
///
- /// Takes an A2R location and a MediaType, and converts it to a Head, Track and Sub-Track representation
- /// used by the internal representation. The MediaType is needed because the track location is different
- /// for different types of media sources.
+ /// Takes an A2R location and a MediaType, and converts it to a Head, Track and Sub-Track representation
+ /// used by the internal representation. The MediaType is needed because the track location is different
+ /// for different types of media sources.
///
/// A2R format location
///
/// The head number
/// The track number
/// The sub-track number
- static void A2rLocationToHeadTrackSub(uint location, MediaType mediaType, out uint head, out ushort track,
+ static void A2rLocationToHeadTrackSub(uint location, MediaType mediaType, out uint head, out ushort track,
out byte subTrack)
{
if(mediaType == MediaType.Apple32SS)
@@ -101,8 +101,8 @@ public sealed partial class A2R
}
///
- /// Takes a single number flux (uint length) and converts it to a flux in the
- /// internal representation format (byte length)
+ /// Takes a single number flux (uint length) and converts it to a flux in the
+ /// internal representation format (byte length)
///
/// The uint flux representation
/// The byte[] flux representation
@@ -111,12 +111,11 @@ public sealed partial class A2R
uint over = ticks / 255;
if(over == 0)
- return new[]
- {
- (byte)ticks
- };
+ {
+ return new[] { (byte)ticks };
+ }
- byte[] expanded = new byte[over + 1];
+ var expanded = new byte[over + 1];
Array.Fill(expanded, (byte)255, 0, (int)over);
expanded[^1] = (byte)(ticks % 255);
@@ -125,8 +124,8 @@ public sealed partial class A2R
}
///
- /// Takes a flux representation in the internal format (byte length) and converts it to
- /// an array of single number fluxes (uint length)
+ /// Takes a flux representation in the internal format (byte length) and converts it to
+ /// an array of single number fluxes (uint length)
///
/// The byte[] flux representation
/// The uint flux representation
@@ -151,9 +150,9 @@ public sealed partial class A2R
}
///
- /// A2R has two types of flux capture types; "timing" and "xtiming". The only difference is the length of the
- /// capture, with "timing" being about 1¼ revolutions. This function returns true if the flux buffer is "timing"
- /// and false otherwise.
+ /// A2R has two types of flux capture types; "timing" and "xtiming". The only difference is the length of the
+ /// capture, with "timing" being about 1¼ revolutions. This function returns true if the flux buffer is "timing"
+ /// and false otherwise.
///
/// The resolution of the flux capture
/// The flux data
diff --git a/Aaru.Images/A2R/Identify.cs b/Aaru.Images/A2R/Identify.cs
index f31d559ae..57f2501a3 100644
--- a/Aaru.Images/A2R/Identify.cs
+++ b/Aaru.Images/A2R/Identify.cs
@@ -39,6 +39,8 @@ namespace Aaru.DiscImages;
public sealed partial class A2R
{
+#region IFluxImage Members
+
///
public bool Identify(IFilter imageFilter)
{
@@ -48,10 +50,12 @@ public sealed partial class A2R
if(stream.Length < 8)
return false;
- byte[] hdr = new byte[4];
+ var hdr = new byte[4];
stream.EnsureRead(hdr, 0, 4);
return _a2rV2Signature.SequenceEqual(hdr) || _a2rV3Signature.SequenceEqual(hdr);
}
+
+#endregion
}
\ No newline at end of file
diff --git a/Aaru.Images/A2R/Properties.cs b/Aaru.Images/A2R/Properties.cs
index 0ade183b7..ec36a8ad6 100644
--- a/Aaru.Images/A2R/Properties.cs
+++ b/Aaru.Images/A2R/Properties.cs
@@ -41,44 +41,61 @@ namespace Aaru.DiscImages;
public sealed partial class A2R
{
+ bool IsWritingRwcps { get; set; }
+
+#region IFluxImage Members
+
///
public ImageInfo Info => _imageInfo;
+
///
public string Name => Localization.A2R_Name;
+
///
public Guid Id => new("7497c26a-fe44-4b50-a2e6-de50a9f3c13f");
+
///
public string Author => Authors.RebeccaWallander;
+
///
public string Format => "A2R";
+
///
public List DumpHardware => null;
+
///
public Metadata AaruMetadata => null;
+
+#endregion
+
+#region IWritableImage Members
+
///
- public IEnumerable KnownExtensions => new[]
- {
- ".a2r"
- };
+ public IEnumerable KnownExtensions => new[] { ".a2r" };
+
///
public IEnumerable SupportedMediaTags => null;
+
///
public IEnumerable SupportedMediaTypes => new[]
{
// 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.Unknown
};
+
///
public IEnumerable<(string name, Type type, string description, object @default)> SupportedOptions =>
Array.Empty<(string name, Type type, string description, object @default)>();
+
///
public IEnumerable SupportedSectorTags => Array.Empty();
+
///
public bool IsWriting { get; private set; }
+
///
public string ErrorMessage { get; private set; }
-
- bool IsWritingRwcps { get; set; }
+
+#endregion
}
\ No newline at end of file
diff --git a/Aaru.Images/A2R/Read.cs b/Aaru.Images/A2R/Read.cs
index c8956bac0..e7de15c4b 100644
--- a/Aaru.Images/A2R/Read.cs
+++ b/Aaru.Images/A2R/Read.cs
@@ -45,6 +45,8 @@ namespace Aaru.DiscImages;
public sealed partial class A2R
{
+#region IFluxImage Members
+
///
public ErrorNumber Open(IFilter imageFilter)
{
@@ -53,7 +55,7 @@ public sealed partial class A2R
_a2rFilter = imageFilter;
- byte[] hdr = new byte[Marshal.SizeOf()];
+ var hdr = new byte[Marshal.SizeOf()];
_a2rStream.EnsureRead(hdr, 0, Marshal.SizeOf());
Header = Marshal.ByteArrayToStructureLittleEndian(hdr);
@@ -61,13 +63,13 @@ public sealed partial class A2R
AaruConsole.DebugWriteLine(MODULE_NAME, "header.signature = \"{0}\"",
StringHandlers.CToString(Header.signature));
- AaruConsole.DebugWriteLine(MODULE_NAME, "header.version = {0}", Header.version);
+ AaruConsole.DebugWriteLine(MODULE_NAME, "header.version = {0}", Header.version);
AaruConsole.DebugWriteLine(MODULE_NAME, "header.highBitTest = {0:X2}", Header.highBitTest);
AaruConsole.DebugWriteLine(MODULE_NAME, "header.lineTest = {0:X2} {1:X2} {2:X2}", Header.lineTest[0],
Header.lineTest[1], Header.lineTest[2]);
- byte[] infoMagic = new byte[4];
+ var infoMagic = new byte[4];
_a2rStream.EnsureRead(infoMagic, 0, 4);
// There must be an INFO chunk after the header (at byte 16)
@@ -80,7 +82,7 @@ public sealed partial class A2R
{
case 0x32:
{
- byte[] infoChnk = new byte[Marshal.SizeOf()];
+ var infoChnk = new byte[Marshal.SizeOf()];
_a2rStream.EnsureRead(infoChnk, 0, Marshal.SizeOf());
_infoChunkV2 = Marshal.ByteArrayToStructureLittleEndian(infoChnk);
@@ -118,14 +120,15 @@ public sealed partial class A2R
_imageInfo.MediaType = MediaType.Apple32SS;
break;
- default: return ErrorNumber.OutOfRange;
+ default:
+ return ErrorNumber.OutOfRange;
}
break;
}
case 0x33:
{
- byte[] infoChk = new byte[Marshal.SizeOf()];
+ var infoChk = new byte[Marshal.SizeOf()];
_a2rStream.EnsureRead(infoChk, 0, Marshal.SizeOf());
_infoChunkV3 = Marshal.ByteArrayToStructureLittleEndian(infoChk);
@@ -191,7 +194,8 @@ public sealed partial class A2R
_imageInfo.Cylinders = 40;
break;
- default: return ErrorNumber.OutOfRange;
+ default:
+ return ErrorNumber.OutOfRange;
}
break;
@@ -202,7 +206,7 @@ public sealed partial class A2R
while(_a2rStream.Position < _a2rStream.Length)
{
- byte[] chunkHdr = new byte[Marshal.SizeOf()];
+ var chunkHdr = new byte[Marshal.SizeOf()];
_a2rStream.EnsureRead(chunkHdr, 0, Marshal.SizeOf());
ChunkHeader chunkHeader = Marshal.ByteArrayToStructureLittleEndian(chunkHdr);
_a2rStream.Seek(-Marshal.SizeOf(), SeekOrigin.Current);
@@ -210,7 +214,7 @@ public sealed partial class A2R
switch(chunkHeader.chunkId)
{
case var rwcp when rwcp.SequenceEqual(_rwcpChunkSignature):
- byte[] rwcpBuffer = new byte[Marshal.SizeOf()];
+ var rwcpBuffer = new byte[Marshal.SizeOf()];
_a2rStream.EnsureRead(rwcpBuffer, 0, Marshal.SizeOf());
RwcpChunkHeader rwcpChunk = Marshal.ByteArrayToStructureLittleEndian(rwcpBuffer);
@@ -222,11 +226,11 @@ public sealed partial class A2R
captureType = (byte)_a2rStream.ReadByte()
};
- byte[] location = new byte[2];
+ var location = new byte[2];
_a2rStream.EnsureRead(location, 0, 2);
capture.location = BitConverter.ToUInt16(location);
- A2rLocationToHeadTrackSub(capture.location, _imageInfo.MediaType, out capture.head,
+ A2rLocationToHeadTrackSub(capture.location, _imageInfo.MediaType, out capture.head,
out capture.track, out capture.subTrack);
if(capture.head + 1 > _imageInfo.Heads)
@@ -238,14 +242,14 @@ public sealed partial class A2R
capture.numberOfIndexSignals = (byte)_a2rStream.ReadByte();
capture.indexSignals = new uint[capture.numberOfIndexSignals];
- for(int i = 0; capture.numberOfIndexSignals > i; i++)
+ for(var i = 0; capture.numberOfIndexSignals > i; i++)
{
- byte[] index = new byte[4];
+ var index = new byte[4];
_a2rStream.EnsureRead(index, 0, 4);
capture.indexSignals[i] = BitConverter.ToUInt32(index);
}
- byte[] dataSize = new byte[4];
+ var dataSize = new byte[4];
_a2rStream.EnsureRead(dataSize, 0, 4);
capture.captureDataSize = BitConverter.ToUInt32(dataSize);
@@ -264,7 +268,7 @@ public sealed partial class A2R
_a2rStream.Seek(Marshal.SizeOf(), SeekOrigin.Current);
- byte[] metadataBuffer = new byte[chunkHeader.chunkSize];
+ var metadataBuffer = new byte[chunkHeader.chunkSize];
_a2rStream.EnsureRead(metadataBuffer, 0, (int)chunkHeader.chunkSize);
string metaData = Encoding.UTF8.GetString(metadataBuffer);
@@ -286,9 +290,10 @@ public sealed partial class A2R
_imageInfo.MediaTitle = title;
break;
- case var slvd when slvd.SequenceEqual(_slvdChunkSignature): return ErrorNumber.NotImplemented;
+ case var slvd when slvd.SequenceEqual(_slvdChunkSignature):
+ return ErrorNumber.NotImplemented;
case var strm when strm.SequenceEqual(_strmChunkSignature):
- byte[] strmBuffer = new byte[Marshal.SizeOf()];
+ var strmBuffer = new byte[Marshal.SizeOf()];
_a2rStream.EnsureRead(strmBuffer, 0, Marshal.SizeOf());
ChunkHeader strmChunk = Marshal.ByteArrayToStructureLittleEndian(strmBuffer);
@@ -305,7 +310,7 @@ public sealed partial class A2R
numberOfIndexSignals = 1
};
- A2rLocationToHeadTrackSub(capture.location, _imageInfo.MediaType, out capture.head,
+ A2rLocationToHeadTrackSub(capture.location, _imageInfo.MediaType, out capture.head,
out capture.track, out capture.subTrack);
if(capture.head + 1 > _imageInfo.Heads)
@@ -314,11 +319,11 @@ public sealed partial class A2R
if(capture.track + 1 > _imageInfo.Cylinders)
_imageInfo.Cylinders = (uint)(capture.track + 1);
- byte[] dataSize = new byte[4];
+ var dataSize = new byte[4];
_a2rStream.EnsureRead(dataSize, 0, 4);
capture.captureDataSize = BitConverter.ToUInt32(dataSize);
- byte[] index = new byte[4];
+ var index = new byte[4];
_a2rStream.EnsureRead(index, 0, 4);
capture.indexSignals[0] = BitConverter.ToUInt32(index);
@@ -349,7 +354,7 @@ public sealed partial class A2R
}
///
- public ErrorNumber ReadFluxIndexResolution(uint head, ushort track, byte subTrack, uint captureIndex,
+ public ErrorNumber ReadFluxIndexResolution(uint head, ushort track, byte subTrack, uint captureIndex,
out ulong resolution)
{
resolution = StreamCaptureAtIndex(head, track, subTrack, captureIndex).resolution;
@@ -358,7 +363,7 @@ public sealed partial class A2R
}
///
- public ErrorNumber ReadFluxDataResolution(uint head, ushort track, byte subTrack, uint captureIndex,
+ public ErrorNumber ReadFluxDataResolution(uint head, ushort track, byte subTrack, uint captureIndex,
out ulong resolution)
{
resolution = StreamCaptureAtIndex(head, track, subTrack, captureIndex).resolution;
@@ -367,7 +372,7 @@ public sealed partial class A2R
}
///
- public ErrorNumber ReadFluxResolution(uint head, ushort track, byte subTrack, uint captureIndex,
+ public ErrorNumber ReadFluxResolution(uint head, ushort track, byte subTrack, uint captureIndex,
out ulong indexResolution, out ulong dataResolution)
{
indexResolution = dataResolution = StreamCaptureAtIndex(head, track, subTrack, captureIndex).resolution;
@@ -376,8 +381,8 @@ public sealed partial class A2R
}
///
- public ErrorNumber ReadFluxCapture(uint head, ushort track, byte subTrack, uint captureIndex,
- out ulong indexResolution, out ulong dataResolution, out byte[] indexBuffer,
+ public ErrorNumber ReadFluxCapture(uint head, ushort track, byte subTrack, uint captureIndex,
+ out ulong indexResolution, out ulong dataResolution, out byte[] indexBuffer,
out byte[] dataBuffer)
{
dataBuffer = indexBuffer = null;
@@ -399,7 +404,7 @@ public sealed partial class A2R
}
///
- public ErrorNumber ReadFluxIndexCapture(uint head, ushort track, byte subTrack, uint captureIndex,
+ public ErrorNumber ReadFluxIndexCapture(uint head, ushort track, byte subTrack, uint captureIndex,
out byte[] buffer)
{
buffer = null;
@@ -414,7 +419,7 @@ public sealed partial class A2R
uint previousTicks = 0;
- for(int i = 0; i < capture.numberOfIndexSignals; i++)
+ for(var i = 0; i < capture.numberOfIndexSignals; i++)
{
uint ticks = capture.indexSignals[i] - previousTicks;
tmpBuffer.AddRange(UInt32ToFluxRepresentation(ticks));
@@ -461,6 +466,10 @@ public sealed partial class A2R
return ErrorNumber.NoError;
}
+#endregion
+
+#region IMediaImage Members
+
///
public ErrorNumber ReadMediaTag(MediaTagType tag, out byte[] buffer) => throw new NotImplementedException();
@@ -486,6 +495,8 @@ public sealed partial class A2R
public ErrorNumber ReadSectorTag(ulong sectorAddress, SectorTagType tag, out byte[] buffer) =>
throw new NotImplementedException();
+#endregion
+
StreamCapture StreamCaptureAtIndex(uint head, ushort track, byte subTrack, uint captureIndex)
{
long index = HeadTrackSubToA2rLocation(head, track, subTrack, _imageInfo.MediaType);
diff --git a/Aaru.Images/A2R/Structs.cs b/Aaru.Images/A2R/Structs.cs
index d8eb8f81c..fcb53c60b 100644
--- a/Aaru.Images/A2R/Structs.cs
+++ b/Aaru.Images/A2R/Structs.cs
@@ -36,6 +36,8 @@ namespace Aaru.DiscImages;
public sealed partial class A2R
{
+#region Nested type: A2rHeader
+
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct A2rHeader
{
@@ -47,6 +49,10 @@ public sealed partial class A2R
public byte[] lineTest; // Should always be 0x0A 0x0D 0x0A
}
+#endregion
+
+#region Nested type: ChunkHeader
+
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct ChunkHeader
{
@@ -55,6 +61,10 @@ public sealed partial class A2R
public uint chunkSize;
}
+#endregion
+
+#region Nested type: InfoChunkV2
+
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct InfoChunkV2
{
@@ -67,6 +77,10 @@ public sealed partial class A2R
public byte synchronized;
}
+#endregion
+
+#region Nested type: InfoChunkV3
+
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct InfoChunkV3
{
@@ -80,6 +94,10 @@ public sealed partial class A2R
public byte hardSectorCount;
}
+#endregion
+
+#region Nested type: RwcpChunkHeader
+
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct RwcpChunkHeader
{
@@ -90,6 +108,24 @@ public sealed partial class A2R
public byte[] reserved;
}
+#endregion
+
+#region Nested type: SlvdChunkHeader
+
+ [StructLayout(LayoutKind.Sequential, Pack = 1)]
+ public struct SlvdChunkHeader
+ {
+ public ChunkHeader header;
+ public byte version;
+ public uint resolution;
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
+ public byte[] reserved;
+ }
+
+#endregion
+
+#region Nested type: StreamCapture
+
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct StreamCapture
{
@@ -106,15 +142,9 @@ public sealed partial class A2R
public byte subTrack;
}
- [StructLayout(LayoutKind.Sequential, Pack = 1)]
- public struct SlvdChunkHeader
- {
- public ChunkHeader header;
- public byte version;
- public uint resolution;
- [MarshalAs(UnmanagedType.ByValArray, SizeConst = 11)]
- public byte[] reserved;
- }
+#endregion
+
+#region Nested type: TrackHeader
[StructLayout(LayoutKind.Sequential, Pack = 1)]
public struct TrackHeader
@@ -129,4 +159,6 @@ public sealed partial class A2R
public uint[] indexSignals;
public uint fluxDataSize;
}
+
+#endregion
}
\ No newline at end of file
diff --git a/Aaru.Images/A2R/Write.cs b/Aaru.Images/A2R/Write.cs
index fdcdeff78..32ee5c6eb 100644
--- a/Aaru.Images/A2R/Write.cs
+++ b/Aaru.Images/A2R/Write.cs
@@ -45,9 +45,88 @@ namespace Aaru.DiscImages;
public sealed partial class A2R
{
+#region IWritableFluxImage Members
+
+ ///
+ public ErrorNumber WriteFluxCapture(ulong indexResolution, ulong dataResolution, byte[] indexBuffer,
+ byte[] dataBuffer, uint head, ushort track, byte subTrack, uint captureIndex)
+ {
+ if(!IsWriting)
+ {
+ ErrorMessage = Localization.Tried_to_write_on_a_non_writable_image;
+
+ return ErrorNumber.WriteError;
+ }
+
+ // An RWCP chunk can only have one capture resolution. If the resolution changes we need to create a new chunk.
+ if(_currentResolution != dataResolution)
+ {
+ if(IsWritingRwcps)
+ {
+ CloseRwcpChunk();
+
+ _writingStream.Seek(_currentRwcpStart, SeekOrigin.Begin);
+ WriteRwcpHeader();
+
+ _currentRwcpStart = _writingStream.Length;
+ _currentCaptureOffset = 16;
+ }
+
+ IsWritingRwcps = true;
+
+ _currentResolution = (uint)dataResolution;
+ }
+
+ _writingStream.Seek(_currentRwcpStart + _currentCaptureOffset + Marshal.SizeOf(),
+ SeekOrigin.Begin);
+
+ _writingStream.WriteByte(0x43);
+
+ _writingStream.WriteByte(IsCaptureTypeTiming(dataResolution, dataBuffer) ? (byte)1 : (byte)3);
+
+ _writingStream.
+ Write(
+ BitConverter.GetBytes((ushort)HeadTrackSubToA2rLocation(head, track, subTrack, _infoChunkV3.driveType)),
+ 0, 2);
+
+ List a2rIndices = FluxRepresentationsToUInt32List(indexBuffer);
+
+ if(a2rIndices[0] == 0)
+ a2rIndices.RemoveAt(0);
+
+ _writingStream.WriteByte((byte)a2rIndices.Count);
+
+ long previousIndex = 0;
+
+ foreach(uint index in a2rIndices)
+ {
+ _writingStream.Write(BitConverter.GetBytes(index + previousIndex), 0, 4);
+ previousIndex += index;
+ }
+
+ _writingStream.Write(BitConverter.GetBytes(dataBuffer.Length), 0, 4);
+ _writingStream.Write(dataBuffer, 0, dataBuffer.Length);
+
+ _currentCaptureOffset += (uint)(9 + a2rIndices.Count * 4 + dataBuffer.Length);
+
+ return ErrorNumber.NoError;
+ }
+
+ ///
+ public ErrorNumber WriteFluxIndexCapture(ulong resolution, byte[] index, uint head, ushort track, byte subTrack,
+ uint captureIndex) => ErrorNumber.NoError;
+
+ ///
+ public ErrorNumber WriteFluxDataCapture(ulong resolution, byte[] data, uint head, ushort track, byte subTrack,
+ uint captureIndex) => ErrorNumber.NoError;
+
+#endregion
+
+#region IWritableImage Members
+
///
public bool Create(string path, MediaType mediaType, Dictionary options, ulong sectors,
- uint sectorSize)
+ uint sectorSize)
{
try
{
@@ -69,12 +148,12 @@ public sealed partial class A2R
Header.lineTest = "\n\r\n"u8.ToArray();
_infoChunkV3.driveType = mediaType switch
- {
- MediaType.DOS_525_DS_DD_9 => A2rDriveType.DS_525_40trk,
- MediaType.Apple32SS => A2rDriveType.SS_525_40trk_quarterStep,
- MediaType.Unknown => A2rDriveType.DS_35_80trk,
- _ => _infoChunkV3.driveType
- };
+ {
+ MediaType.DOS_525_DS_DD_9 => A2rDriveType.DS_525_40trk,
+ MediaType.Apple32SS => A2rDriveType.SS_525_40trk_quarterStep,
+ MediaType.Unknown => A2rDriveType.DS_35_80trk,
+ _ => _infoChunkV3.driveType
+ };
return true;
}
@@ -134,7 +213,7 @@ public sealed partial class A2R
_infoChunkV3.hardSectorCount = 0;
Meta.Add("image_date", DateTime.Now.ToString("O"));
- Meta.Add("title", imageInfo.MediaTitle);
+ Meta.Add("title", imageInfo.MediaTitle);
return true;
}
@@ -169,80 +248,10 @@ public sealed partial class A2R
///
public bool WriteSectorsLong(byte[] data, ulong sectorAddress, uint length) => throw new NotImplementedException();
- ///
- public ErrorNumber WriteFluxCapture(ulong indexResolution, ulong dataResolution, byte[] indexBuffer,
- byte[] dataBuffer, uint head, ushort track, byte subTrack, uint captureIndex)
- {
- if(!IsWriting)
- {
- ErrorMessage = Localization.Tried_to_write_on_a_non_writable_image;
-
- return ErrorNumber.WriteError;
- }
-
- // An RWCP chunk can only have one capture resolution. If the resolution changes we need to create a new chunk.
- if(_currentResolution != dataResolution)
- {
- if(IsWritingRwcps)
- {
- CloseRwcpChunk();
-
- _writingStream.Seek(_currentRwcpStart, SeekOrigin.Begin);
- WriteRwcpHeader();
-
- _currentRwcpStart = _writingStream.Length;
- _currentCaptureOffset = 16;
- }
-
- IsWritingRwcps = true;
-
- _currentResolution = (uint)dataResolution;
- }
-
- _writingStream.Seek(_currentRwcpStart + _currentCaptureOffset + Marshal.SizeOf(),
- SeekOrigin.Begin);
-
- _writingStream.WriteByte(0x43);
-
- _writingStream.WriteByte(IsCaptureTypeTiming(dataResolution, dataBuffer) ? (byte)1 : (byte)3);
-
- _writingStream.
- Write(BitConverter.GetBytes((ushort)HeadTrackSubToA2rLocation(head, track, subTrack, _infoChunkV3.driveType)),
- 0, 2);
-
- List a2rIndices = FluxRepresentationsToUInt32List(indexBuffer);
-
- if(a2rIndices[0] == 0)
- a2rIndices.RemoveAt(0);
-
- _writingStream.WriteByte((byte)a2rIndices.Count);
-
- long previousIndex = 0;
-
- foreach(uint index in a2rIndices)
- {
- _writingStream.Write(BitConverter.GetBytes(index + previousIndex), 0, 4);
- previousIndex += index;
- }
-
- _writingStream.Write(BitConverter.GetBytes(dataBuffer.Length), 0, 4);
- _writingStream.Write(dataBuffer, 0, dataBuffer.Length);
-
- _currentCaptureOffset += (uint)(9 + (a2rIndices.Count * 4) + dataBuffer.Length);
-
- return ErrorNumber.NoError;
- }
-
- ///
- public ErrorNumber WriteFluxIndexCapture(ulong resolution, byte[] index, uint head, ushort track, byte subTrack,
- uint captureIndex) => ErrorNumber.NoError;
-
- ///
- public ErrorNumber WriteFluxDataCapture(ulong resolution, byte[] data, uint head, ushort track, byte subTrack,
- uint captureIndex) => ErrorNumber.NoError;
+#endregion
///
- /// writes the header to an RWCP chunk, up to and including the reserved bytes, to stream.
+ /// writes the header to an RWCP chunk, up to and including the reserved bytes, to stream.
///
///
ErrorNumber WriteRwcpHeader()
@@ -254,15 +263,12 @@ public sealed partial class A2R
return ErrorNumber.WriteError;
}
- _writingStream.Write(_rwcpChunkSignature, 0, 4);
+ _writingStream.Write(_rwcpChunkSignature, 0, 4);
_writingStream.Write(BitConverter.GetBytes(_currentCaptureOffset + 1), 0, 4);
_writingStream.WriteByte(1);
_writingStream.Write(BitConverter.GetBytes(_currentResolution), 0, 4);
- byte[] reserved =
- {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
- };
+ byte[] reserved = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
_writingStream.Write(reserved, 0, 11);
@@ -270,7 +276,7 @@ public sealed partial class A2R
}
///
- /// Writes the entire INFO chunk to stream.
+ /// Writes the entire INFO chunk to stream.
///
///
ErrorNumber WriteInfoChunk()
@@ -282,7 +288,7 @@ public sealed partial class A2R
return ErrorNumber.WriteError;
}
- _writingStream.Write(_infoChunkV3.header.chunkId, 0, 4);
+ _writingStream.Write(_infoChunkV3.header.chunkId, 0, 4);
_writingStream.Write(BitConverter.GetBytes(_infoChunkV3.header.chunkSize), 0, 4);
_writingStream.WriteByte(_infoChunkV3.version);
_writingStream.Write(_infoChunkV3.creator, 0, 32);
@@ -295,7 +301,7 @@ public sealed partial class A2R
}
///
- /// Writes the entire META chunk to stream.
+ /// Writes the entire META chunk to stream.
///
///
ErrorNumber WriteMetaChunk()
@@ -313,13 +319,13 @@ public sealed partial class A2R
Aggregate(static (concat, str) => $"{concat}\n{str}") + '\n');
_writingStream.Write(BitConverter.GetBytes((uint)metaString.Length), 0, 4);
- _writingStream.Write(metaString, 0, metaString.Length);
+ _writingStream.Write(metaString, 0, metaString.Length);
return ErrorNumber.NoError;
}
///
- /// Writes the closing byte to an RWCP chunk signaling its end, to stream.
+ /// Writes the closing byte to an RWCP chunk signaling its end, to stream.
///
///
ErrorNumber CloseRwcpChunk()
diff --git a/Aaru.Images/Aaru.Images.csproj b/Aaru.Images/Aaru.Images.csproj
index ea2c1daf1..7e71dc21b 100644
--- a/Aaru.Images/Aaru.Images.csproj
+++ b/Aaru.Images/Aaru.Images.csproj
@@ -35,8 +35,8 @@
CS1591;CS1574
-
-
+
+
$(Version)+{chash:8}
@@ -44,25 +44,25 @@
true
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
@@ -74,6 +74,6 @@
-
+
diff --git a/Aaru.Images/Aaru.Images.csproj.DotSettings b/Aaru.Images/Aaru.Images.csproj.DotSettings
index 4db06027b..e639e22d9 100644
--- a/Aaru.Images/Aaru.Images.csproj.DotSettings
+++ b/Aaru.Images/Aaru.Images.csproj.DotSettings
@@ -2,92 +2,92 @@
xmlns:s="clr-namespace:System;assembly=mscorlib"
xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xml:space="preserve">
True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
- True
\ No newline at end of file
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
+ True
\ No newline at end of file
diff --git a/Aaru.Images/AaruFormat/AaruFormat.cs b/Aaru.Images/AaruFormat/AaruFormat.cs
index a1d197ada..99bc00dec 100644
--- a/Aaru.Images/AaruFormat/AaruFormat.cs
+++ b/Aaru.Images/AaruFormat/AaruFormat.cs
@@ -83,7 +83,8 @@ namespace Aaru.DiscImages;
/// Implements reading and writing AaruFormat media images
public sealed partial class AaruFormat : IWritableOpticalImage, IVerifiableImage, IWritableTapeImage
{
- bool _alreadyWrittenZero;
+ const string MODULE_NAME = "Aaru Format plugin";
+ bool _alreadyWrittenZero;
/// Cache of uncompressed blocks.
Dictionary _blockCache;
/// Cache of block headers.
@@ -129,10 +130,10 @@ public sealed partial class AaruFormat : IWritableOpticalImage, IVerifiableImage
long _outMemoryDdtPosition;
bool _rewinded;
byte[] _sectorCprMai;
- byte[] _sectorIed;
- byte[] _sectorId;
- byte[] _sectorEdc;
byte[] _sectorDecryptedTitleKey;
+ byte[] _sectorEdc;
+ byte[] _sectorId;
+ byte[] _sectorIed;
/// Cache for data that prefixes the user data on a sector (e.g. sync).
byte[] _sectorPrefix;
uint[] _sectorPrefixDdt;
@@ -187,6 +188,4 @@ public sealed partial class AaruFormat : IWritableOpticalImage, IVerifiableImage
DriveSerialNumber = null,
DriveFirmwareRevision = null
};
-
- const string MODULE_NAME = "Aaru Format plugin";
}
\ No newline at end of file
diff --git a/Aaru.Images/AaruFormat/CdEcc.cs b/Aaru.Images/AaruFormat/CdEcc.cs
index 02f9b96c5..84f42ac53 100644
--- a/Aaru.Images/AaruFormat/CdEcc.cs
+++ b/Aaru.Images/AaruFormat/CdEcc.cs
@@ -55,12 +55,12 @@ public sealed partial class AaruFormat
for(uint i = 0; i < 256; i++)
{
uint edc = i;
- uint j = (uint)((i << 1) ^ ((i & 0x80) == 0x80 ? 0x11D : 0));
+ var j = (uint)(i << 1 ^ ((i & 0x80) == 0x80 ? 0x11D : 0));
_eccFTable[i] = (byte)j;
_eccBTable[i ^ j] = (byte)i;
for(j = 0; j < 8; j++)
- edc = (edc >> 1) ^ ((edc & 1) > 0 ? 0xD8018001 : 0);
+ edc = edc >> 1 ^ ((edc & 1) > 0 ? 0xD8018001 : 0);
_edcTable[i] = edc;
}
@@ -93,13 +93,13 @@ public sealed partial class AaruFormat
if(!correctEccQ)
return false;
- uint storedEdc = BitConverter.ToUInt32(sector, 0x810);
+ var storedEdc = BitConverter.ToUInt32(sector, 0x810);
uint edc = 0;
- int size = 0x810;
- int pos = 0;
+ var size = 0x810;
+ var pos = 0;
for(; size > 0; size--)
- edc = (edc >> 8) ^ _edcTable[(edc ^ sector[pos++]) & 0xFF];
+ edc = edc >> 8 ^ _edcTable[(edc ^ sector[pos++]) & 0xFF];
uint calculatedEdc = edc;
@@ -111,7 +111,7 @@ public sealed partial class AaruFormat
if(!_initedEdc)
EccInit();
- byte[] zeroAddress = new byte[4];
+ var zeroAddress = new byte[4];
bool correctEccP = CheckEcc(zeroAddress, sector, 86, 24, 2, 86, sector, 0, 0x10, 0x81C);
@@ -123,28 +123,28 @@ public sealed partial class AaruFormat
if(!correctEccQ)
return false;
- uint storedEdc = BitConverter.ToUInt32(sector, 0x818);
+ var storedEdc = BitConverter.ToUInt32(sector, 0x818);
uint edc = 0;
- int size = 0x808;
- int pos = 0x10;
+ var size = 0x808;
+ var pos = 0x10;
for(; size > 0; size--)
- edc = (edc >> 8) ^ _edcTable[(edc ^ sector[pos++]) & 0xFF];
+ edc = edc >> 8 ^ _edcTable[(edc ^ sector[pos++]) & 0xFF];
uint calculatedEdc = edc;
return calculatedEdc == storedEdc;
}
- bool CheckEcc(byte[] address, byte[] data, uint majorCount, uint minorCount, uint majorMult, uint minorInc,
- byte[] ecc, int addressOffset, int dataOffset, int eccOffset)
+ bool CheckEcc(byte[] address, byte[] data, uint majorCount, uint minorCount, uint majorMult, uint minorInc,
+ byte[] ecc, int addressOffset, int dataOffset, int eccOffset)
{
uint size = majorCount * minorCount;
uint major;
for(major = 0; major < majorCount; major++)
{
- uint idx = ((major >> 1) * majorMult) + (major & 1);
+ uint idx = (major >> 1) * majorMult + (major & 1);
byte eccA = 0;
byte eccB = 0;
uint minor;
@@ -172,15 +172,15 @@ public sealed partial class AaruFormat
return true;
}
- void WriteEcc(byte[] address, byte[] data, uint majorCount, uint minorCount, uint majorMult, uint minorInc,
- ref byte[] ecc, int addressOffset, int dataOffset, int eccOffset)
+ void WriteEcc(byte[] address, byte[] data, uint majorCount, uint minorCount, uint majorMult, uint minorInc,
+ ref byte[] ecc, int addressOffset, int dataOffset, int eccOffset)
{
uint size = majorCount * minorCount;
uint major;
for(major = 0; major < majorCount; major++)
{
- uint idx = ((major >> 1) * majorMult) + (major & 1);
+ uint idx = (major >> 1) * majorMult + (major & 1);
byte eccA = 0;
byte eccB = 0;
uint minor;
@@ -206,7 +206,7 @@ public sealed partial class AaruFormat
void EccWriteSector(byte[] address, byte[] data, ref byte[] ecc, int addressOffset, int dataOffset, int eccOffset)
{
- WriteEcc(address, data, 86, 24, 2, 86, ref ecc, addressOffset, dataOffset, eccOffset); // P
+ WriteEcc(address, data, 86, 24, 2, 86, ref ecc, addressOffset, dataOffset, eccOffset); // P
WriteEcc(address, data, 52, 43, 86, 88, ref ecc, addressOffset, dataOffset, eccOffset + 0xAC); // Q
}
@@ -214,7 +214,7 @@ public sealed partial class AaruFormat
((byte)((pos + 150) / 75 / 60), (byte)((pos + 150) / 75 % 60), (byte)((pos + 150) % 75));
static void ReconstructPrefix(ref byte[] sector, // must point to a full 2352-byte sector
- TrackType type, long lba)
+ TrackType type, long lba)
{
//
// Sync
@@ -234,9 +234,9 @@ public sealed partial class AaruFormat
(byte minute, byte second, byte frame) msf = LbaToMsf(lba);
- sector[0x00C] = (byte)(((msf.minute / 10) << 4) + (msf.minute % 10));
- sector[0x00D] = (byte)(((msf.second / 10) << 4) + (msf.second % 10));
- sector[0x00E] = (byte)(((msf.frame / 10) << 4) + (msf.frame % 10));
+ sector[0x00C] = (byte)((msf.minute / 10 << 4) + msf.minute % 10);
+ sector[0x00D] = (byte)((msf.second / 10 << 4) + msf.second % 10);
+ sector[0x00E] = (byte)((msf.frame / 10 << 4) + msf.frame % 10);
switch(type)
{
@@ -264,12 +264,13 @@ public sealed partial class AaruFormat
sector[0x013] = sector[0x017];
break;
- default: return;
+ default:
+ return;
}
}
void ReconstructEcc(ref byte[] sector, // must point to a full 2352-byte sector
- TrackType type)
+ TrackType type)
{
byte[] computedEdc;
@@ -305,10 +306,11 @@ public sealed partial class AaruFormat
sector[0x92F] = computedEdc[3];
break;
- default: return;
+ default:
+ return;
}
- byte[] zeroAddress = new byte[4];
+ var zeroAddress = new byte[4];
switch(type)
{
@@ -334,7 +336,8 @@ public sealed partial class AaruFormat
EccWriteSector(zeroAddress, sector, ref sector, 0, 0x10, 0x81C);
break;
- default: return;
+ default:
+ return;
}
//
@@ -350,7 +353,7 @@ public sealed partial class AaruFormat
int pos = srcOffset;
for(; size > 0; size--)
- edc = (edc >> 8) ^ _edcTable[(edc ^ src[pos++]) & 0xFF];
+ edc = edc >> 8 ^ _edcTable[(edc ^ src[pos++]) & 0xFF];
return edc;
}
diff --git a/Aaru.Images/AaruFormat/ClauniaSubchannelTransform.cs b/Aaru.Images/AaruFormat/ClauniaSubchannelTransform.cs
index c187c3e73..a5c814861 100644
--- a/Aaru.Images/AaruFormat/ClauniaSubchannelTransform.cs
+++ b/Aaru.Images/AaruFormat/ClauniaSubchannelTransform.cs
@@ -43,19 +43,19 @@ public sealed partial class AaruFormat
if(interleaved == null)
return null;
- int[] p = new int[interleaved.Length / 8];
- int[] q = new int[interleaved.Length / 8];
- int[] r = new int[interleaved.Length / 8];
- int[] s = new int[interleaved.Length / 8];
- int[] t = new int[interleaved.Length / 8];
- int[] u = new int[interleaved.Length / 8];
- int[] v = new int[interleaved.Length / 8];
- int[] w = new int[interleaved.Length / 8];
+ var p = new int[interleaved.Length / 8];
+ var q = new int[interleaved.Length / 8];
+ var r = new int[interleaved.Length / 8];
+ var s = new int[interleaved.Length / 8];
+ var t = new int[interleaved.Length / 8];
+ var u = new int[interleaved.Length / 8];
+ var v = new int[interleaved.Length / 8];
+ var w = new int[interleaved.Length / 8];
var stopwatch = new Stopwatch();
stopwatch.Start();
- for(int i = 0; i < interleaved.Length; i += 8)
+ for(var i = 0; i < interleaved.Length; i += 8)
{
p[i / 8] = interleaved[i] & 0x80;
p[i / 8] += (interleaved[i + 1] & 0x80) >> 1;
@@ -133,7 +133,7 @@ public sealed partial class AaruFormat
stopwatch.Stop();
TimeSpan deinterleave = stopwatch.Elapsed;
- byte[] sequential = new byte[interleaved.Length];
+ var sequential = new byte[interleaved.Length];
stopwatch.Restart();
int qStart = p.Length * 1;
@@ -144,7 +144,7 @@ public sealed partial class AaruFormat
int vStart = p.Length * 6;
int wStart = p.Length * 7;
- for(int i = 0; i < p.Length; i++)
+ for(var i = 0; i < p.Length; i++)
{
sequential[i] = (byte)p[i];
sequential[qStart + i] = (byte)q[i];
@@ -176,14 +176,14 @@ public sealed partial class AaruFormat
if(sequential == null)
return null;
- int[] p = new int[sequential.Length / 8];
- int[] q = new int[sequential.Length / 8];
- int[] r = new int[sequential.Length / 8];
- int[] s = new int[sequential.Length / 8];
- int[] t = new int[sequential.Length / 8];
- int[] u = new int[sequential.Length / 8];
- int[] v = new int[sequential.Length / 8];
- int[] w = new int[sequential.Length / 8];
+ var p = new int[sequential.Length / 8];
+ var q = new int[sequential.Length / 8];
+ var r = new int[sequential.Length / 8];
+ var s = new int[sequential.Length / 8];
+ var t = new int[sequential.Length / 8];
+ var u = new int[sequential.Length / 8];
+ var v = new int[sequential.Length / 8];
+ var w = new int[sequential.Length / 8];
int qStart = p.Length * 1;
int rStart = p.Length * 2;
@@ -196,7 +196,7 @@ public sealed partial class AaruFormat
var stopwatch = new Stopwatch();
stopwatch.Start();
- for(int i = 0; i < p.Length; i++)
+ for(var i = 0; i < p.Length; i++)
{
p[i] = sequential[i];
q[i] = sequential[qStart + i];
@@ -211,10 +211,10 @@ public sealed partial class AaruFormat
stopwatch.Stop();
TimeSpan desequentialize = stopwatch.Elapsed;
- byte[] interleaved = new byte[sequential.Length];
+ var interleaved = new byte[sequential.Length];
stopwatch.Restart();
- for(int i = 0; i < interleaved.Length; i += 8)
+ for(var i = 0; i < interleaved.Length; i += 8)
{
interleaved[i] = (byte)((p[i / 8] & 0x80) == 0x80 ? 0x80 : 0);
interleaved[i + 1] += (byte)((p[i / 8] & 0x40) == 0x40 ? 0x80 : 0);
diff --git a/Aaru.Images/AaruFormat/Enums.cs b/Aaru.Images/AaruFormat/Enums.cs
index 936100ee8..5fdecfbf8 100644
--- a/Aaru.Images/AaruFormat/Enums.cs
+++ b/Aaru.Images/AaruFormat/Enums.cs
@@ -36,6 +36,77 @@ namespace Aaru.DiscImages;
public sealed partial class AaruFormat
{
+#region Nested type: BlockType
+
+ /// List of known blocks types
+ enum BlockType : uint
+ {
+ /// Block containing data
+ DataBlock = 0x4B4C4244,
+ /// Block containing a deduplication table
+ DeDuplicationTable = 0x2A544444,
+ /// Block containing the index
+ Index = 0x58444E49,
+ /// Block containing the index
+ Index2 = 0x32584449,
+ /// Block containing logical geometry
+ GeometryBlock = 0x4D4F4547,
+ /// Block containing metadata
+ MetadataBlock = 0x4154454D,
+ /// Block containing optical disc tracks
+ TracksBlock = 0x534B5254,
+ /// Block containing CICM XML metadata
+ CicmBlock = 0x4D434943,
+ /// Block containing contents checksums
+ ChecksumBlock = 0x4D534B43,
+ /// TODO: Block containing data position measurements
+ DataPositionMeasurementBlock = 0x2A4D5044,
+ /// TODO: Block containing a snapshot index
+ SnapshotBlock = 0x50414E53,
+ /// TODO: Block containing how to locate the parent image
+ ParentBlock = 0x544E5250,
+ /// Block containing an array of hardware used to create the image
+ DumpHardwareBlock = 0x2A504D44,
+ /// Block containing list of files for a tape image
+ TapeFileBlock = 0x454C4654,
+ /// Block containing list of partitions for a tape image
+ TapePartitionBlock = 0x54425054,
+ /// Block containing list of indexes for Compact Disc tracks
+ CompactDiscIndexesBlock = 0x58494443,
+ /// Block containing JSON version of Aaru Metadata
+ AaruMetadataJsonBlock = 0x444D534A
+ }
+
+#endregion
+
+#region Nested type: CdFixFlags
+
+ enum CdFixFlags : uint
+ {
+ NotDumped = 0x10000000,
+ Correct = 0x20000000,
+ Mode2Form1Ok = 0x30000000,
+ Mode2Form2Ok = 0x40000000,
+ Mode2Form2NoCrc = 0x50000000
+ }
+
+#endregion
+
+#region Nested type: ChecksumAlgorithm
+
+ enum ChecksumAlgorithm : byte
+ {
+ Invalid = 0,
+ Md5 = 1,
+ Sha1 = 2,
+ Sha256 = 3,
+ SpamSum = 4
+ }
+
+#endregion
+
+#region Nested type: CompressionType
+
/// List of known compression types
enum CompressionType : ushort
{
@@ -49,6 +120,10 @@ public sealed partial class AaruFormat
LzmaClauniaSubchannelTransform = 3
}
+#endregion
+
+#region Nested type: DataType
+
/// List of known data types
enum DataType : ushort
{
@@ -226,54 +301,5 @@ public sealed partial class AaruFormat
DvdSectorEdc = 85
}
- /// List of known blocks types
- enum BlockType : uint
- {
- /// Block containing data
- DataBlock = 0x4B4C4244,
- /// Block containing a deduplication table
- DeDuplicationTable = 0x2A544444,
- /// Block containing the index
- Index = 0x58444E49,
- /// Block containing the index
- Index2 = 0x32584449,
- /// Block containing logical geometry
- GeometryBlock = 0x4D4F4547,
- /// Block containing metadata
- MetadataBlock = 0x4154454D,
- /// Block containing optical disc tracks
- TracksBlock = 0x534B5254,
- /// Block containing CICM XML metadata
- CicmBlock = 0x4D434943,
- /// Block containing contents checksums
- ChecksumBlock = 0x4D534B43,
- /// TODO: Block containing data position measurements
- DataPositionMeasurementBlock = 0x2A4D5044,
- /// TODO: Block containing a snapshot index
- SnapshotBlock = 0x50414E53,
- /// TODO: Block containing how to locate the parent image
- ParentBlock = 0x544E5250,
- /// Block containing an array of hardware used to create the image
- DumpHardwareBlock = 0x2A504D44,
- /// Block containing list of files for a tape image
- TapeFileBlock = 0x454C4654,
- /// Block containing list of partitions for a tape image
- TapePartitionBlock = 0x54425054,
- /// Block containing list of indexes for Compact Disc tracks
- CompactDiscIndexesBlock = 0x58494443,
- /// Block containing JSON version of Aaru Metadata
- AaruMetadataJsonBlock = 0x444D534A
- }
-
- enum ChecksumAlgorithm : byte
- {
- Invalid = 0, Md5 = 1, Sha1 = 2,
- Sha256 = 3, SpamSum = 4
- }
-
- enum CdFixFlags : uint
- {
- NotDumped = 0x10000000, Correct = 0x20000000, Mode2Form1Ok = 0x30000000,
- Mode2Form2Ok = 0x40000000, Mode2Form2NoCrc = 0x50000000
- }
+#endregion
}
\ No newline at end of file
diff --git a/Aaru.Images/AaruFormat/Helpers.cs b/Aaru.Images/AaruFormat/Helpers.cs
index 28caf1975..d8589ec36 100644
--- a/Aaru.Images/AaruFormat/Helpers.cs
+++ b/Aaru.Images/AaruFormat/Helpers.cs
@@ -57,8 +57,10 @@ public sealed partial class AaruFormat
_imageInfo.DriveModel = decoded.ProductName;
if(string.IsNullOrWhiteSpace(_imageInfo.DriveFirmwareRevision))
+ {
_imageInfo.DriveFirmwareRevision =
$"{(decoded.ProductRevision & 0xF0) >> 4:X2}.{decoded.ProductRevision & 0x0F:X2}";
+ }
if(string.IsNullOrWhiteSpace(_imageInfo.DriveSerialNumber))
_imageInfo.DriveSerialNumber = $"{decoded.ProductSerialNumber}";
@@ -76,8 +78,10 @@ public sealed partial class AaruFormat
_imageInfo.DriveModel = decoded.ProductName;
if(string.IsNullOrWhiteSpace(_imageInfo.DriveFirmwareRevision))
+ {
_imageInfo.DriveFirmwareRevision =
$"{(decoded.ProductRevision & 0xF0) >> 4:X2}.{decoded.ProductRevision & 0x0F:X2}";
+ }
if(string.IsNullOrWhiteSpace(_imageInfo.DriveSerialNumber))
_imageInfo.DriveSerialNumber = $"{decoded.ProductSerialNumber}";
@@ -104,7 +108,7 @@ public sealed partial class AaruFormat
}
// Search for ATA or ATAPI IDENTIFY
- if(!_mediaTags.TryGetValue(MediaTagType.ATA_IDENTIFY, out byte[] ataIdentify) &&
+ if(!_mediaTags.TryGetValue(MediaTagType.ATA_IDENTIFY, out byte[] ataIdentify) &&
!_mediaTags.TryGetValue(MediaTagType.ATAPI_IDENTIFY, out ataIdentify))
return;
@@ -118,6 +122,7 @@ public sealed partial class AaruFormat
string[] separated = identify.Model.Split(' ');
if(separated.Length == 1)
+ {
if(string.IsNullOrWhiteSpace(_imageInfo.DriveModel))
_imageInfo.DriveModel = separated[0];
else
@@ -128,6 +133,7 @@ public sealed partial class AaruFormat
if(string.IsNullOrWhiteSpace(_imageInfo.DriveModel))
_imageInfo.DriveModel = separated[^1];
}
+ }
if(string.IsNullOrWhiteSpace(_imageInfo.DriveFirmwareRevision))
_imageInfo.DriveFirmwareRevision = identify.FirmwareRevision;
@@ -235,8 +241,10 @@ public sealed partial class AaruFormat
case MediaType.VideoNow:
case MediaType.VideoNowColor:
case MediaType.VideoNowXp:
- case MediaType.CVD: return MetadataMediaType.OpticalDisc;
- default: return MetadataMediaType.BlockMedia;
+ case MediaType.CVD:
+ return MetadataMediaType.OpticalDisc;
+ default:
+ return MetadataMediaType.BlockMedia;
}
}
@@ -252,7 +260,7 @@ public sealed partial class AaruFormat
long oldPosition = _imageStream.Position;
_imageStream.Position = _outMemoryDdtPosition + Marshal.SizeOf();
_imageStream.Position += (long)(sectorAddress * sizeof(ulong));
- byte[] temp = new byte[sizeof(ulong)];
+ var temp = new byte[sizeof(ulong)];
_imageStream.EnsureRead(temp, 0, sizeof(ulong));
_imageStream.Position = oldPosition;
entry = BitConverter.ToUInt64(temp, 0);
@@ -287,153 +295,246 @@ public sealed partial class AaruFormat
// Converts between image data type and Aaru media tag type
static MediaTagType GetMediaTagTypeForDataType(DataType type) => type switch
- {
- DataType.CompactDiscPartialToc => MediaTagType.CD_TOC,
- DataType.CompactDiscSessionInfo => MediaTagType.CD_SessionInfo,
- DataType.CompactDiscToc => MediaTagType.CD_FullTOC,
- DataType.CompactDiscPma => MediaTagType.CD_PMA,
- DataType.CompactDiscAtip => MediaTagType.CD_ATIP,
- DataType.CompactDiscLeadInCdText => MediaTagType.CD_TEXT,
- DataType.DvdPfi => MediaTagType.DVD_PFI,
- DataType.DvdLeadInCmi => MediaTagType.DVD_CMI,
- DataType.DvdDiscKey => MediaTagType.DVD_DiscKey,
- DataType.DvdBca => MediaTagType.DVD_BCA,
- DataType.DvdDmi => MediaTagType.DVD_DMI,
- DataType.DvdMediaIdentifier => MediaTagType.DVD_MediaIdentifier,
- DataType.DvdMediaKeyBlock => MediaTagType.DVD_MKB,
- DataType.DvdRamDds => MediaTagType.DVDRAM_DDS,
- DataType.DvdRamMediumStatus => MediaTagType.DVDRAM_MediumStatus,
- DataType.DvdRamSpareArea => MediaTagType.DVDRAM_SpareArea,
- DataType.DvdRRmd => MediaTagType.DVDR_RMD,
- DataType.DvdRPrerecordedInfo => MediaTagType.DVDR_PreRecordedInfo,
- DataType.DvdRMediaIdentifier => MediaTagType.DVDR_MediaIdentifier,
- DataType.DvdRPfi => MediaTagType.DVDR_PFI,
- DataType.DvdAdip => MediaTagType.DVD_ADIP,
- DataType.HdDvdCpi => MediaTagType.HDDVD_CPI,
- DataType.HdDvdMediumStatus => MediaTagType.HDDVD_MediumStatus,
- DataType.DvdDlLayerCapacity => MediaTagType.DVDDL_LayerCapacity,
- DataType.DvdDlMiddleZoneAddress => MediaTagType.DVDDL_MiddleZoneAddress,
- DataType.DvdDlJumpIntervalSize => MediaTagType.DVDDL_JumpIntervalSize,
- DataType.DvdDlManualLayerJumpLba => MediaTagType.DVDDL_ManualLayerJumpLBA,
- DataType.BlurayDi => MediaTagType.BD_DI,
- DataType.BlurayBca => MediaTagType.BD_BCA,
- DataType.BlurayDds => MediaTagType.BD_DDS,
- DataType.BlurayCartridgeStatus => MediaTagType.BD_CartridgeStatus,
- DataType.BluraySpareArea => MediaTagType.BD_SpareArea,
- DataType.AacsVolumeIdentifier => MediaTagType.AACS_VolumeIdentifier,
- DataType.AacsSerialNumber => MediaTagType.AACS_SerialNumber,
- DataType.AacsMediaIdentifier => MediaTagType.AACS_MediaIdentifier,
- DataType.AacsMediaKeyBlock => MediaTagType.AACS_MKB,
- DataType.AacsDataKeys => MediaTagType.AACS_DataKeys,
- DataType.AacsLbaExtents => MediaTagType.AACS_LBAExtents,
- DataType.CprmMediaKeyBlock => MediaTagType.AACS_CPRM_MKB,
- DataType.HybridRecognizedLayers => MediaTagType.Hybrid_RecognizedLayers,
- DataType.ScsiMmcWriteProtection => MediaTagType.MMC_WriteProtection,
- DataType.ScsiMmcDiscInformation => MediaTagType.MMC_DiscInformation,
- DataType.ScsiMmcTrackResourcesInformation => MediaTagType.MMC_TrackResourcesInformation,
- DataType.ScsiMmcPowResourcesInformation => MediaTagType.MMC_POWResourcesInformation,
- DataType.ScsiInquiry => MediaTagType.SCSI_INQUIRY,
- DataType.ScsiModePage2A => MediaTagType.SCSI_MODEPAGE_2A,
- DataType.AtaIdentify => MediaTagType.ATA_IDENTIFY,
- DataType.AtapiIdentify => MediaTagType.ATAPI_IDENTIFY,
- DataType.PcmciaCis => MediaTagType.PCMCIA_CIS,
- DataType.SecureDigitalCid => MediaTagType.SD_CID,
- DataType.SecureDigitalCsd => MediaTagType.SD_CSD,
- DataType.SecureDigitalScr => MediaTagType.SD_SCR,
- DataType.SecureDigitalOcr => MediaTagType.SD_OCR,
- DataType.MultiMediaCardCid => MediaTagType.MMC_CID,
- DataType.MultiMediaCardCsd => MediaTagType.MMC_CSD,
- DataType.MultiMediaCardOcr => MediaTagType.MMC_OCR,
- DataType.MultiMediaCardExtendedCsd => MediaTagType.MMC_ExtendedCSD,
- DataType.XboxSecuritySector => MediaTagType.Xbox_SecuritySector,
- DataType.FloppyLeadOut => MediaTagType.Floppy_LeadOut,
- DataType.DvdDiscControlBlock => MediaTagType.DCB,
- DataType.CompactDiscFirstTrackPregap => MediaTagType.CD_FirstTrackPregap,
- DataType.CompactDiscLeadOut => MediaTagType.CD_LeadOut,
- DataType.ScsiModeSense6 => MediaTagType.SCSI_MODESENSE_6,
- DataType.ScsiModeSense10 => MediaTagType.SCSI_MODESENSE_10,
- DataType.UsbDescriptors => MediaTagType.USB_Descriptors,
- DataType.XboxDmi => MediaTagType.Xbox_DMI,
- DataType.XboxPfi => MediaTagType.Xbox_PFI,
- DataType.CompactDiscMediaCatalogueNumber => MediaTagType.CD_MCN,
- DataType.CompactDiscLeadIn => MediaTagType.CD_LeadIn,
- DataType.DvdDiscKeyDecrypted => MediaTagType.DVD_DiscKey_Decrypted,
- _ => throw new ArgumentOutOfRangeException()
- };
+ {
+ DataType.CompactDiscPartialToc => MediaTagType.
+ CD_TOC,
+ DataType.CompactDiscSessionInfo =>
+ MediaTagType.CD_SessionInfo,
+ DataType.CompactDiscToc => MediaTagType.
+ CD_FullTOC,
+ DataType.CompactDiscPma => MediaTagType.CD_PMA,
+ DataType.CompactDiscAtip => MediaTagType.
+ CD_ATIP,
+ DataType.CompactDiscLeadInCdText =>
+ MediaTagType.CD_TEXT,
+ DataType.DvdPfi => MediaTagType.DVD_PFI,
+ DataType.DvdLeadInCmi => MediaTagType.DVD_CMI,
+ DataType.DvdDiscKey =>
+ MediaTagType.DVD_DiscKey,
+ DataType.DvdBca => MediaTagType.DVD_BCA,
+ DataType.DvdDmi => MediaTagType.DVD_DMI,
+ DataType.DvdMediaIdentifier => MediaTagType.
+ DVD_MediaIdentifier,
+ DataType.DvdMediaKeyBlock => MediaTagType.
+ DVD_MKB,
+ DataType.DvdRamDds => MediaTagType.DVDRAM_DDS,
+ DataType.DvdRamMediumStatus => MediaTagType.
+ DVDRAM_MediumStatus,
+ DataType.DvdRamSpareArea => MediaTagType.
+ DVDRAM_SpareArea,
+ DataType.DvdRRmd => MediaTagType.DVDR_RMD,
+ DataType.DvdRPrerecordedInfo => MediaTagType.
+ DVDR_PreRecordedInfo,
+ DataType.DvdRMediaIdentifier => MediaTagType.
+ DVDR_MediaIdentifier,
+ DataType.DvdRPfi => MediaTagType.DVDR_PFI,
+ DataType.DvdAdip => MediaTagType.DVD_ADIP,
+ DataType.HdDvdCpi => MediaTagType.HDDVD_CPI,
+ DataType.HdDvdMediumStatus => MediaTagType.
+ HDDVD_MediumStatus,
+ DataType.DvdDlLayerCapacity => MediaTagType.
+ DVDDL_LayerCapacity,
+ DataType.DvdDlMiddleZoneAddress =>
+ MediaTagType.DVDDL_MiddleZoneAddress,
+ DataType.DvdDlJumpIntervalSize => MediaTagType.
+ DVDDL_JumpIntervalSize,
+ DataType.DvdDlManualLayerJumpLba =>
+ MediaTagType.DVDDL_ManualLayerJumpLBA,
+ DataType.BlurayDi => MediaTagType.BD_DI,
+ DataType.BlurayBca => MediaTagType.BD_BCA,
+ DataType.BlurayDds => MediaTagType.BD_DDS,
+ DataType.BlurayCartridgeStatus => MediaTagType.
+ BD_CartridgeStatus,
+ DataType.BluraySpareArea => MediaTagType.
+ BD_SpareArea,
+ DataType.AacsVolumeIdentifier => MediaTagType.
+ AACS_VolumeIdentifier,
+ DataType.AacsSerialNumber => MediaTagType.
+ AACS_SerialNumber,
+ DataType.AacsMediaIdentifier => MediaTagType.
+ AACS_MediaIdentifier,
+ DataType.AacsMediaKeyBlock => MediaTagType.
+ AACS_MKB,
+ DataType.AacsDataKeys => MediaTagType.
+ AACS_DataKeys,
+ DataType.AacsLbaExtents => MediaTagType.
+ AACS_LBAExtents,
+ DataType.CprmMediaKeyBlock => MediaTagType.
+ AACS_CPRM_MKB,
+ DataType.HybridRecognizedLayers =>
+ MediaTagType.Hybrid_RecognizedLayers,
+ DataType.ScsiMmcWriteProtection =>
+ MediaTagType.MMC_WriteProtection,
+ DataType.ScsiMmcDiscInformation =>
+ MediaTagType.MMC_DiscInformation,
+ DataType.ScsiMmcTrackResourcesInformation =>
+ MediaTagType.MMC_TrackResourcesInformation,
+ DataType.ScsiMmcPowResourcesInformation =>
+ MediaTagType.MMC_POWResourcesInformation,
+ DataType.ScsiInquiry => MediaTagType.
+ SCSI_INQUIRY,
+ DataType.ScsiModePage2A => MediaTagType.
+ SCSI_MODEPAGE_2A,
+ DataType.AtaIdentify => MediaTagType.
+ ATA_IDENTIFY,
+ DataType.AtapiIdentify => MediaTagType.
+ ATAPI_IDENTIFY,
+ DataType.PcmciaCis => MediaTagType.PCMCIA_CIS,
+ DataType.SecureDigitalCid => MediaTagType.
+ SD_CID,
+ DataType.SecureDigitalCsd => MediaTagType.
+ SD_CSD,
+ DataType.SecureDigitalScr => MediaTagType.
+ SD_SCR,
+ DataType.SecureDigitalOcr => MediaTagType.
+ SD_OCR,
+ DataType.MultiMediaCardCid => MediaTagType.
+ MMC_CID,
+ DataType.MultiMediaCardCsd => MediaTagType.
+ MMC_CSD,
+ DataType.MultiMediaCardOcr => MediaTagType.
+ MMC_OCR,
+ DataType.MultiMediaCardExtendedCsd =>
+ MediaTagType.MMC_ExtendedCSD,
+ DataType.XboxSecuritySector => MediaTagType.
+ Xbox_SecuritySector,
+ DataType.FloppyLeadOut => MediaTagType.
+ Floppy_LeadOut,
+ DataType.DvdDiscControlBlock => MediaTagType.
+ DCB,
+ DataType.CompactDiscFirstTrackPregap =>
+ MediaTagType.CD_FirstTrackPregap,
+ DataType.CompactDiscLeadOut => MediaTagType.
+ CD_LeadOut,
+ DataType.ScsiModeSense6 => MediaTagType.
+ SCSI_MODESENSE_6,
+ DataType.ScsiModeSense10 => MediaTagType.
+ SCSI_MODESENSE_10,
+ DataType.UsbDescriptors => MediaTagType.
+ USB_Descriptors,
+ DataType.XboxDmi => MediaTagType.Xbox_DMI,
+ DataType.XboxPfi => MediaTagType.Xbox_PFI,
+ DataType.CompactDiscMediaCatalogueNumber =>
+ MediaTagType.CD_MCN,
+ DataType.CompactDiscLeadIn => MediaTagType.
+ CD_LeadIn,
+ DataType.DvdDiscKeyDecrypted => MediaTagType.
+ DVD_DiscKey_Decrypted,
+ _ => throw new ArgumentOutOfRangeException()
+ };
// Converts between Aaru media tag type and image data type
static DataType GetDataTypeForMediaTag(MediaTagType tag) => tag switch
- {
- MediaTagType.CD_TOC => DataType.CompactDiscPartialToc,
- MediaTagType.CD_SessionInfo => DataType.CompactDiscSessionInfo,
- MediaTagType.CD_FullTOC => DataType.CompactDiscToc,
- MediaTagType.CD_PMA => DataType.CompactDiscPma,
- MediaTagType.CD_ATIP => DataType.CompactDiscAtip,
- MediaTagType.CD_TEXT => DataType.CompactDiscLeadInCdText,
- MediaTagType.DVD_PFI => DataType.DvdPfi,
- MediaTagType.DVD_CMI => DataType.DvdLeadInCmi,
- MediaTagType.DVD_DiscKey => DataType.DvdDiscKey,
- MediaTagType.DVD_BCA => DataType.DvdBca,
- MediaTagType.DVD_DMI => DataType.DvdDmi,
- MediaTagType.DVD_MediaIdentifier => DataType.DvdMediaIdentifier,
- MediaTagType.DVD_MKB => DataType.DvdMediaKeyBlock,
- MediaTagType.DVDRAM_DDS => DataType.DvdRamDds,
- MediaTagType.DVDRAM_MediumStatus => DataType.DvdRamMediumStatus,
- MediaTagType.DVDRAM_SpareArea => DataType.DvdRamSpareArea,
- MediaTagType.DVDR_RMD => DataType.DvdRRmd,
- MediaTagType.DVDR_PreRecordedInfo => DataType.DvdRPrerecordedInfo,
- MediaTagType.DVDR_MediaIdentifier => DataType.DvdRMediaIdentifier,
- MediaTagType.DVDR_PFI => DataType.DvdRPfi,
- MediaTagType.DVD_ADIP => DataType.DvdAdip,
- MediaTagType.HDDVD_CPI => DataType.HdDvdCpi,
- MediaTagType.HDDVD_MediumStatus => DataType.HdDvdMediumStatus,
- MediaTagType.DVDDL_LayerCapacity => DataType.DvdDlLayerCapacity,
- MediaTagType.DVDDL_MiddleZoneAddress => DataType.DvdDlMiddleZoneAddress,
- MediaTagType.DVDDL_JumpIntervalSize => DataType.DvdDlJumpIntervalSize,
- MediaTagType.DVDDL_ManualLayerJumpLBA => DataType.DvdDlManualLayerJumpLba,
- MediaTagType.BD_DI => DataType.BlurayDi,
- MediaTagType.BD_BCA => DataType.BlurayBca,
- MediaTagType.BD_DDS => DataType.BlurayDds,
- MediaTagType.BD_CartridgeStatus => DataType.BlurayCartridgeStatus,
- MediaTagType.BD_SpareArea => DataType.BluraySpareArea,
- MediaTagType.AACS_VolumeIdentifier => DataType.AacsVolumeIdentifier,
- MediaTagType.AACS_SerialNumber => DataType.AacsSerialNumber,
- MediaTagType.AACS_MediaIdentifier => DataType.AacsMediaIdentifier,
- MediaTagType.AACS_MKB => DataType.AacsMediaKeyBlock,
- MediaTagType.AACS_DataKeys => DataType.AacsDataKeys,
- MediaTagType.AACS_LBAExtents => DataType.AacsLbaExtents,
- MediaTagType.AACS_CPRM_MKB => DataType.CprmMediaKeyBlock,
- MediaTagType.Hybrid_RecognizedLayers => DataType.HybridRecognizedLayers,
- MediaTagType.MMC_WriteProtection => DataType.ScsiMmcWriteProtection,
- MediaTagType.MMC_DiscInformation => DataType.ScsiMmcDiscInformation,
- MediaTagType.MMC_TrackResourcesInformation => DataType.ScsiMmcTrackResourcesInformation,
- MediaTagType.MMC_POWResourcesInformation => DataType.ScsiMmcPowResourcesInformation,
- MediaTagType.SCSI_INQUIRY => DataType.ScsiInquiry,
- MediaTagType.SCSI_MODEPAGE_2A => DataType.ScsiModePage2A,
- MediaTagType.ATA_IDENTIFY => DataType.AtaIdentify,
- MediaTagType.ATAPI_IDENTIFY => DataType.AtapiIdentify,
- MediaTagType.PCMCIA_CIS => DataType.PcmciaCis,
- MediaTagType.SD_CID => DataType.SecureDigitalCid,
- MediaTagType.SD_CSD => DataType.SecureDigitalCsd,
- MediaTagType.SD_SCR => DataType.SecureDigitalScr,
- MediaTagType.SD_OCR => DataType.SecureDigitalOcr,
- MediaTagType.MMC_CID => DataType.MultiMediaCardCid,
- MediaTagType.MMC_CSD => DataType.MultiMediaCardCsd,
- MediaTagType.MMC_OCR => DataType.MultiMediaCardOcr,
- MediaTagType.MMC_ExtendedCSD => DataType.MultiMediaCardExtendedCsd,
- MediaTagType.Xbox_SecuritySector => DataType.XboxSecuritySector,
- MediaTagType.Floppy_LeadOut => DataType.FloppyLeadOut,
- MediaTagType.DCB => DataType.DvdDiscControlBlock,
- MediaTagType.CD_FirstTrackPregap => DataType.CompactDiscFirstTrackPregap,
- MediaTagType.CD_LeadOut => DataType.CompactDiscLeadOut,
- MediaTagType.SCSI_MODESENSE_6 => DataType.ScsiModeSense6,
- MediaTagType.SCSI_MODESENSE_10 => DataType.ScsiModeSense10,
- MediaTagType.USB_Descriptors => DataType.UsbDescriptors,
- MediaTagType.Xbox_DMI => DataType.XboxDmi,
- MediaTagType.Xbox_PFI => DataType.XboxPfi,
- MediaTagType.CD_MCN => DataType.CompactDiscMediaCatalogueNumber,
- MediaTagType.CD_LeadIn => DataType.CompactDiscLeadIn,
- MediaTagType.DVD_DiscKey_Decrypted => DataType.DvdDiscKeyDecrypted,
- _ => throw new ArgumentOutOfRangeException(nameof(tag), tag, null)
- };
+ {
+ MediaTagType.CD_TOC => DataType.
+ CompactDiscPartialToc,
+ MediaTagType.CD_SessionInfo => DataType.
+ CompactDiscSessionInfo,
+ MediaTagType.CD_FullTOC => DataType.CompactDiscToc,
+ MediaTagType.CD_PMA => DataType.CompactDiscPma,
+ MediaTagType.CD_ATIP => DataType.CompactDiscAtip,
+ MediaTagType.CD_TEXT => DataType.
+ CompactDiscLeadInCdText,
+ MediaTagType.DVD_PFI => DataType.DvdPfi,
+ MediaTagType.DVD_CMI => DataType.DvdLeadInCmi,
+ MediaTagType.DVD_DiscKey => DataType.DvdDiscKey,
+ MediaTagType.DVD_BCA => DataType.DvdBca,
+ MediaTagType.DVD_DMI => DataType.DvdDmi,
+ MediaTagType.DVD_MediaIdentifier => DataType.
+ DvdMediaIdentifier,
+ MediaTagType.DVD_MKB => DataType.DvdMediaKeyBlock,
+ MediaTagType.DVDRAM_DDS => DataType.DvdRamDds,
+ MediaTagType.DVDRAM_MediumStatus => DataType.
+ DvdRamMediumStatus,
+ MediaTagType.DVDRAM_SpareArea => DataType.
+ DvdRamSpareArea,
+ MediaTagType.DVDR_RMD => DataType.DvdRRmd,
+ MediaTagType.DVDR_PreRecordedInfo => DataType.
+ DvdRPrerecordedInfo,
+ MediaTagType.DVDR_MediaIdentifier => DataType.
+ DvdRMediaIdentifier,
+ MediaTagType.DVDR_PFI => DataType.DvdRPfi,
+ MediaTagType.DVD_ADIP => DataType.DvdAdip,
+ MediaTagType.HDDVD_CPI => DataType.HdDvdCpi,
+ MediaTagType.HDDVD_MediumStatus => DataType.
+ HdDvdMediumStatus,
+ MediaTagType.DVDDL_LayerCapacity => DataType.
+ DvdDlLayerCapacity,
+ MediaTagType.DVDDL_MiddleZoneAddress => DataType.
+ DvdDlMiddleZoneAddress,
+ MediaTagType.DVDDL_JumpIntervalSize => DataType.
+ DvdDlJumpIntervalSize,
+ MediaTagType.DVDDL_ManualLayerJumpLBA => DataType.
+ DvdDlManualLayerJumpLba,
+ MediaTagType.BD_DI => DataType.BlurayDi,
+ MediaTagType.BD_BCA => DataType.BlurayBca,
+ MediaTagType.BD_DDS => DataType.BlurayDds,
+ MediaTagType.BD_CartridgeStatus => DataType.
+ BlurayCartridgeStatus,
+ MediaTagType.BD_SpareArea => DataType.
+ BluraySpareArea,
+ MediaTagType.AACS_VolumeIdentifier => DataType.
+ AacsVolumeIdentifier,
+ MediaTagType.AACS_SerialNumber => DataType.
+ AacsSerialNumber,
+ MediaTagType.AACS_MediaIdentifier => DataType.
+ AacsMediaIdentifier,
+ MediaTagType.AACS_MKB => DataType.AacsMediaKeyBlock,
+ MediaTagType.AACS_DataKeys => DataType.AacsDataKeys,
+ MediaTagType.AACS_LBAExtents => DataType.
+ AacsLbaExtents,
+ MediaTagType.AACS_CPRM_MKB => DataType.
+ CprmMediaKeyBlock,
+ MediaTagType.Hybrid_RecognizedLayers => DataType.
+ HybridRecognizedLayers,
+ MediaTagType.MMC_WriteProtection => DataType.
+ ScsiMmcWriteProtection,
+ MediaTagType.MMC_DiscInformation => DataType.
+ ScsiMmcDiscInformation,
+ MediaTagType.MMC_TrackResourcesInformation =>
+ DataType.ScsiMmcTrackResourcesInformation,
+ MediaTagType.MMC_POWResourcesInformation =>
+ DataType.ScsiMmcPowResourcesInformation,
+ MediaTagType.SCSI_INQUIRY => DataType.ScsiInquiry,
+ MediaTagType.SCSI_MODEPAGE_2A => DataType.
+ ScsiModePage2A,
+ MediaTagType.ATA_IDENTIFY => DataType.AtaIdentify,
+ MediaTagType.ATAPI_IDENTIFY => DataType.
+ AtapiIdentify,
+ MediaTagType.PCMCIA_CIS => DataType.PcmciaCis,
+ MediaTagType.SD_CID => DataType.SecureDigitalCid,
+ MediaTagType.SD_CSD => DataType.SecureDigitalCsd,
+ MediaTagType.SD_SCR => DataType.SecureDigitalScr,
+ MediaTagType.SD_OCR => DataType.SecureDigitalOcr,
+ MediaTagType.MMC_CID => DataType.MultiMediaCardCid,
+ MediaTagType.MMC_CSD => DataType.MultiMediaCardCsd,
+ MediaTagType.MMC_OCR => DataType.MultiMediaCardOcr,
+ MediaTagType.MMC_ExtendedCSD => DataType.
+ MultiMediaCardExtendedCsd,
+ MediaTagType.Xbox_SecuritySector => DataType.
+ XboxSecuritySector,
+ MediaTagType.Floppy_LeadOut => DataType.
+ FloppyLeadOut,
+ MediaTagType.DCB => DataType.DvdDiscControlBlock,
+ MediaTagType.CD_FirstTrackPregap => DataType.
+ CompactDiscFirstTrackPregap,
+ MediaTagType.CD_LeadOut => DataType.
+ CompactDiscLeadOut,
+ MediaTagType.SCSI_MODESENSE_6 => DataType.
+ ScsiModeSense6,
+ MediaTagType.SCSI_MODESENSE_10 => DataType.
+ ScsiModeSense10,
+ MediaTagType.USB_Descriptors => DataType.
+ UsbDescriptors,
+ MediaTagType.Xbox_DMI => DataType.XboxDmi,
+ MediaTagType.Xbox_PFI => DataType.XboxPfi,
+ MediaTagType.CD_MCN => DataType.
+ CompactDiscMediaCatalogueNumber,
+ MediaTagType.CD_LeadIn =>
+ DataType.CompactDiscLeadIn,
+ MediaTagType.DVD_DiscKey_Decrypted => DataType.
+ DvdDiscKeyDecrypted,
+ _ => throw new ArgumentOutOfRangeException(
+ nameof(tag), tag, null)
+ };
}
\ No newline at end of file
diff --git a/Aaru.Images/AaruFormat/Identify.cs b/Aaru.Images/AaruFormat/Identify.cs
index f63270bfe..4c7301a17 100644
--- a/Aaru.Images/AaruFormat/Identify.cs
+++ b/Aaru.Images/AaruFormat/Identify.cs
@@ -38,6 +38,8 @@ namespace Aaru.DiscImages;
public sealed partial class AaruFormat
{
+#region IWritableOpticalImage Members
+
///
public bool Identify(IFilter imageFilter)
{
@@ -53,4 +55,6 @@ public sealed partial class AaruFormat
return _header.identifier is DIC_MAGIC or AARU_MAGIC && _header.imageMajorVersion <= AARUFMT_VERSION;
}
+
+#endregion
}
\ No newline at end of file
diff --git a/Aaru.Images/AaruFormat/Properties.cs b/Aaru.Images/AaruFormat/Properties.cs
index c6d1121bd..036f41a53 100644
--- a/Aaru.Images/AaruFormat/Properties.cs
+++ b/Aaru.Images/AaruFormat/Properties.cs
@@ -44,6 +44,8 @@ namespace Aaru.DiscImages;
public sealed partial class AaruFormat
{
+#region IWritableOpticalImage Members
+
///
public OpticalImageCapabilities OpticalCapabilities => OpticalImageCapabilities.CanStoreAudioTracks |
OpticalImageCapabilities.CanStoreDataTracks |
@@ -60,33 +62,47 @@ public sealed partial class AaruFormat
OpticalImageCapabilities.CanStoreNotCdTracks |
OpticalImageCapabilities.CanStoreIndexes |
OpticalImageCapabilities.CanStoreHiddenTracks;
+
///
public ImageInfo Info => _imageInfo;
+
///
public string Name => Localization.AaruFormat_Name;
+
///
public Guid Id => new("49360069-1784-4A2F-B723-0C844D610B0A");
+
///
public string Format => "Aaru";
+
///
public string Author => Authors.NataliaPortillo;
+
///
public List Partitions { get; private set; }
+
///
public List