mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Code style fixes.
This commit is contained in:
@@ -65,7 +65,7 @@
|
||||
the pointer in the corresponding deduplication table.
|
||||
|
||||
P.S.: Data Position Measurement is doable, as soon as I know how to do it.
|
||||
P.S.2: Support for floppy image containg bitslices and/or fluxes will be added soon.
|
||||
P.S.2: Support for floppy image contaning bitslices and/or fluxes will be added soon.
|
||||
*/
|
||||
|
||||
using System;
|
||||
@@ -81,7 +81,7 @@ using SharpCompress.Compressors.LZMA;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AaruFormat : IWritableOpticalImage, IVerifiableImage, IWritableTapeImage
|
||||
public sealed partial class AaruFormat : IWritableOpticalImage, IVerifiableImage, IWritableTapeImage
|
||||
{
|
||||
bool _alreadyWrittenZero;
|
||||
/// <summary>Cache of uncompressed blocks.</summary>
|
||||
|
||||
@@ -36,7 +36,7 @@ using Aaru.CommonTypes.Enums;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AaruFormat
|
||||
public sealed partial class AaruFormat
|
||||
{
|
||||
byte[] _eccBTable;
|
||||
byte[] _eccFTable;
|
||||
@@ -111,14 +111,14 @@ namespace Aaru.DiscImages
|
||||
if(!_initedEdc)
|
||||
EccInit();
|
||||
|
||||
byte[] zeroaddress = new byte[4];
|
||||
byte[] zeroAddress = new byte[4];
|
||||
|
||||
bool correctEccP = CheckEcc(zeroaddress, sector, 86, 24, 2, 86, sector, 0, 0x10, 0x81C);
|
||||
bool correctEccP = CheckEcc(zeroAddress, sector, 86, 24, 2, 86, sector, 0, 0x10, 0x81C);
|
||||
|
||||
if(!correctEccP)
|
||||
return false;
|
||||
|
||||
bool correctEccQ = CheckEcc(zeroaddress, sector, 52, 43, 86, 88, sector, 0, 0x10, 0x81C + 0xAC);
|
||||
bool correctEccQ = CheckEcc(zeroAddress, sector, 52, 43, 86, 88, sector, 0, 0x10, 0x81C + 0xAC);
|
||||
|
||||
if(!correctEccQ)
|
||||
return false;
|
||||
@@ -309,7 +309,7 @@ namespace Aaru.DiscImages
|
||||
default: return;
|
||||
}
|
||||
|
||||
byte[] zeroaddress = new byte[4];
|
||||
byte[] zeroAddress = new byte[4];
|
||||
|
||||
switch(type)
|
||||
{
|
||||
@@ -332,7 +332,7 @@ namespace Aaru.DiscImages
|
||||
|
||||
break;
|
||||
case TrackType.CdMode2Form1:
|
||||
EccWriteSector(zeroaddress, sector, ref sector, 0, 0x10, 0x81C);
|
||||
EccWriteSector(zeroAddress, sector, ref sector, 0, 0x10, 0x81C);
|
||||
|
||||
break;
|
||||
default: return;
|
||||
|
||||
@@ -35,7 +35,7 @@ using Aaru.Console;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AaruFormat
|
||||
public sealed partial class AaruFormat
|
||||
{
|
||||
static byte[] ClauniaSubchannelTransform(byte[] interleaved)
|
||||
{
|
||||
|
||||
@@ -32,11 +32,11 @@
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AaruFormat
|
||||
public sealed partial class AaruFormat
|
||||
{
|
||||
/// <summary>Old magic identidier = "DICMFRMT".</summary>
|
||||
/// <summary>Old magic identifier = "DICMFRMT".</summary>
|
||||
const ulong DIC_MAGIC = 0x544D52464D434944;
|
||||
/// <summary>Magic identidier = "AARUFRMT".</summary>
|
||||
/// <summary>Magic identifier = "AARUFRMT".</summary>
|
||||
const ulong AARU_MAGIC = 0x544D524655524141;
|
||||
/// <summary>
|
||||
/// Image format version. A change in this number indicates an incompatible change to the format that prevents
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AaruFormat
|
||||
public sealed partial class AaruFormat
|
||||
{
|
||||
/// <summary>List of known compression types</summary>
|
||||
enum CompressionType : ushort
|
||||
|
||||
@@ -40,7 +40,7 @@ using Aaru.Helpers;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AaruFormat
|
||||
public sealed partial class AaruFormat
|
||||
{
|
||||
/// <summary>Checks for media tags that may contain metadata and sets it up if not already set</summary>
|
||||
void SetMetadataFromTags()
|
||||
|
||||
@@ -36,7 +36,7 @@ using Aaru.Helpers;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AaruFormat
|
||||
public sealed partial class AaruFormat
|
||||
{
|
||||
public bool Identify(IFilter imageFilter)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ using Schemas;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AaruFormat
|
||||
public sealed partial class AaruFormat
|
||||
{
|
||||
public OpticalImageCapabilities OpticalCapabilities => OpticalImageCapabilities.CanStoreAudioTracks |
|
||||
OpticalImageCapabilities.CanStoreDataTracks |
|
||||
|
||||
@@ -54,7 +54,7 @@ using TrackType = Aaru.CommonTypes.Enums.TrackType;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AaruFormat
|
||||
public sealed partial class AaruFormat
|
||||
{
|
||||
public bool Open(IFilter imageFilter)
|
||||
{
|
||||
@@ -383,112 +383,124 @@ namespace Aaru.DiscImages
|
||||
if(ddtHeader.identifier != BlockType.DeDuplicationTable)
|
||||
break;
|
||||
|
||||
if(entry.dataType == DataType.UserData)
|
||||
switch(entry.dataType)
|
||||
{
|
||||
_imageInfo.Sectors = ddtHeader.entries;
|
||||
_shift = ddtHeader.shift;
|
||||
case DataType.UserData:
|
||||
_imageInfo.Sectors = ddtHeader.entries;
|
||||
_shift = ddtHeader.shift;
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes",
|
||||
GC.GetTotalMemory(false));
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes",
|
||||
GC.GetTotalMemory(false));
|
||||
|
||||
// Check for DDT compression
|
||||
switch(ddtHeader.compression)
|
||||
// Check for DDT compression
|
||||
switch(ddtHeader.compression)
|
||||
{
|
||||
case CompressionType.Lzma:
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", "Decompressing DDT...");
|
||||
DateTime ddtStart = DateTime.UtcNow;
|
||||
byte[] compressedDdt = new byte[ddtHeader.cmpLength - LZMA_PROPERTIES_LENGTH];
|
||||
byte[] lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH];
|
||||
_imageStream.Read(lzmaProperties, 0, LZMA_PROPERTIES_LENGTH);
|
||||
_imageStream.Read(compressedDdt, 0, compressedDdt.Length);
|
||||
var compressedDdtMs = new MemoryStream(compressedDdt);
|
||||
var lzmaDdt = new LzmaStream(lzmaProperties, compressedDdtMs);
|
||||
byte[] decompressedDdt = new byte[ddtHeader.length];
|
||||
lzmaDdt.Read(decompressedDdt, 0, (int)ddtHeader.length);
|
||||
lzmaDdt.Close();
|
||||
compressedDdtMs.Close();
|
||||
_userDataDdt = MemoryMarshal.Cast<byte, ulong>(decompressedDdt).ToArray();
|
||||
DateTime ddtEnd = DateTime.UtcNow;
|
||||
_inMemoryDdt = true;
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin",
|
||||
"Took {0} seconds to decompress DDT",
|
||||
(ddtEnd - ddtStart).TotalSeconds);
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes",
|
||||
GC.GetTotalMemory(false));
|
||||
|
||||
break;
|
||||
case CompressionType.None:
|
||||
_inMemoryDdt = false;
|
||||
_outMemoryDdtPosition = (long)entry.offset;
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes",
|
||||
GC.GetTotalMemory(false));
|
||||
|
||||
break;
|
||||
default:
|
||||
throw new
|
||||
ImageNotSupportedException($"Found unsupported compression algorithm {(ushort)ddtHeader.compression}");
|
||||
}
|
||||
|
||||
foundUserDataDdt = true;
|
||||
|
||||
break;
|
||||
case DataType.CdSectorPrefixCorrected:
|
||||
case DataType.CdSectorSuffixCorrected:
|
||||
{
|
||||
case CompressionType.Lzma:
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", "Decompressing DDT...");
|
||||
DateTime ddtStart = DateTime.UtcNow;
|
||||
byte[] compressedDdt = new byte[ddtHeader.cmpLength - LZMA_PROPERTIES_LENGTH];
|
||||
byte[] lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH];
|
||||
_imageStream.Read(lzmaProperties, 0, LZMA_PROPERTIES_LENGTH);
|
||||
_imageStream.Read(compressedDdt, 0, compressedDdt.Length);
|
||||
var compressedDdtMs = new MemoryStream(compressedDdt);
|
||||
var lzmaDdt = new LzmaStream(lzmaProperties, compressedDdtMs);
|
||||
byte[] decompressedDdt = new byte[ddtHeader.length];
|
||||
lzmaDdt.Read(decompressedDdt, 0, (int)ddtHeader.length);
|
||||
lzmaDdt.Close();
|
||||
compressedDdtMs.Close();
|
||||
_userDataDdt = MemoryMarshal.Cast<byte, ulong>(decompressedDdt).ToArray();
|
||||
DateTime ddtEnd = DateTime.UtcNow;
|
||||
_inMemoryDdt = true;
|
||||
uint[] cdDdt = new uint[ddtHeader.entries];
|
||||
byte[] decompressedDdt = new byte[ddtHeader.length];
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin",
|
||||
"Took {0} seconds to decompress DDT",
|
||||
(ddtEnd - ddtStart).TotalSeconds);
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes",
|
||||
GC.GetTotalMemory(false));
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes",
|
||||
GC.GetTotalMemory(false));
|
||||
// Check for DDT compression
|
||||
switch(ddtHeader.compression)
|
||||
{
|
||||
case CompressionType.Lzma:
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", "Decompressing DDT...");
|
||||
DateTime ddtStart = DateTime.UtcNow;
|
||||
byte[] compressedDdt = new byte[ddtHeader.cmpLength - LZMA_PROPERTIES_LENGTH];
|
||||
byte[] lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH];
|
||||
_imageStream.Read(lzmaProperties, 0, LZMA_PROPERTIES_LENGTH);
|
||||
_imageStream.Read(compressedDdt, 0, compressedDdt.Length);
|
||||
var compressedDdtMs = new MemoryStream(compressedDdt);
|
||||
var lzmaDdt = new LzmaStream(lzmaProperties, compressedDdtMs);
|
||||
lzmaDdt.Read(decompressedDdt, 0, (int)ddtHeader.length);
|
||||
lzmaDdt.Close();
|
||||
compressedDdtMs.Close();
|
||||
DateTime ddtEnd = DateTime.UtcNow;
|
||||
|
||||
break;
|
||||
case CompressionType.None:
|
||||
_inMemoryDdt = false;
|
||||
_outMemoryDdtPosition = (long)entry.offset;
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin",
|
||||
"Took {0} seconds to decompress DDT",
|
||||
(ddtEnd - ddtStart).TotalSeconds);
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes",
|
||||
GC.GetTotalMemory(false));
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes",
|
||||
GC.GetTotalMemory(false));
|
||||
|
||||
break;
|
||||
default:
|
||||
throw new
|
||||
ImageNotSupportedException($"Found unsupported compression algorithm {(ushort)ddtHeader.compression}");
|
||||
break;
|
||||
case CompressionType.None:
|
||||
_imageStream.Read(decompressedDdt, 0, decompressedDdt.Length);
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes",
|
||||
GC.GetTotalMemory(false));
|
||||
|
||||
break;
|
||||
default:
|
||||
throw new
|
||||
ImageNotSupportedException($"Found unsupported compression algorithm {(ushort)ddtHeader.compression}");
|
||||
}
|
||||
|
||||
cdDdt = MemoryMarshal.Cast<byte, uint>(decompressedDdt).ToArray();
|
||||
|
||||
switch(entry.dataType)
|
||||
{
|
||||
case DataType.CdSectorPrefixCorrected:
|
||||
_sectorPrefixDdt = cdDdt;
|
||||
|
||||
break;
|
||||
case DataType.CdSectorSuffixCorrected:
|
||||
_sectorSuffixDdt = cdDdt;
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes",
|
||||
GC.GetTotalMemory(false));
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
foundUserDataDdt = true;
|
||||
}
|
||||
else if(entry.dataType == DataType.CdSectorPrefixCorrected ||
|
||||
entry.dataType == DataType.CdSectorSuffixCorrected)
|
||||
{
|
||||
uint[] cdDdt = new uint[ddtHeader.entries];
|
||||
byte[] decompressedDdt = new byte[ddtHeader.length];
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes",
|
||||
GC.GetTotalMemory(false));
|
||||
|
||||
// Check for DDT compression
|
||||
switch(ddtHeader.compression)
|
||||
{
|
||||
case CompressionType.Lzma:
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", "Decompressing DDT...");
|
||||
DateTime ddtStart = DateTime.UtcNow;
|
||||
byte[] compressedDdt = new byte[ddtHeader.cmpLength - LZMA_PROPERTIES_LENGTH];
|
||||
byte[] lzmaProperties = new byte[LZMA_PROPERTIES_LENGTH];
|
||||
_imageStream.Read(lzmaProperties, 0, LZMA_PROPERTIES_LENGTH);
|
||||
_imageStream.Read(compressedDdt, 0, compressedDdt.Length);
|
||||
var compressedDdtMs = new MemoryStream(compressedDdt);
|
||||
var lzmaDdt = new LzmaStream(lzmaProperties, compressedDdtMs);
|
||||
lzmaDdt.Read(decompressedDdt, 0, (int)ddtHeader.length);
|
||||
lzmaDdt.Close();
|
||||
compressedDdtMs.Close();
|
||||
DateTime ddtEnd = DateTime.UtcNow;
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin",
|
||||
"Took {0} seconds to decompress DDT",
|
||||
(ddtEnd - ddtStart).TotalSeconds);
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes",
|
||||
GC.GetTotalMemory(false));
|
||||
|
||||
break;
|
||||
case CompressionType.None:
|
||||
_imageStream.Read(decompressedDdt, 0, decompressedDdt.Length);
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes",
|
||||
GC.GetTotalMemory(false));
|
||||
|
||||
break;
|
||||
default:
|
||||
throw new
|
||||
ImageNotSupportedException($"Found unsupported compression algorithm {(ushort)ddtHeader.compression}");
|
||||
}
|
||||
|
||||
cdDdt = MemoryMarshal.Cast<byte, uint>(decompressedDdt).ToArray();
|
||||
|
||||
if(entry.dataType == DataType.CdSectorPrefixCorrected)
|
||||
_sectorPrefixDdt = cdDdt;
|
||||
else if(entry.dataType == DataType.CdSectorSuffixCorrected)
|
||||
_sectorSuffixDdt = cdDdt;
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes",
|
||||
GC.GetTotalMemory(false));
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -1206,21 +1218,21 @@ namespace Aaru.DiscImages
|
||||
|
||||
Track[] tracks = Tracks.ToArray();
|
||||
|
||||
for(int i = 0; i < tracks.Length; i++)
|
||||
foreach(Track trk in tracks)
|
||||
{
|
||||
byte[] sector = ReadSector(tracks[i].TrackStartSector);
|
||||
tracks[i].TrackBytesPerSector = sector.Length;
|
||||
byte[] sector = ReadSector(trk.TrackStartSector);
|
||||
trk.TrackBytesPerSector = sector.Length;
|
||||
|
||||
tracks[i].TrackRawBytesPerSector =
|
||||
trk.TrackRawBytesPerSector =
|
||||
(_sectorPrefix != null && _sectorSuffix != null) ||
|
||||
(_sectorPrefixDdt != null && _sectorSuffixDdt != null) ? 2352 : sector.Length;
|
||||
|
||||
if(_sectorSubchannel == null)
|
||||
continue;
|
||||
|
||||
tracks[i].TrackSubchannelFile = tracks[i].TrackFile;
|
||||
tracks[i].TrackSubchannelFilter = tracks[i].TrackFilter;
|
||||
tracks[i].TrackSubchannelType = TrackSubchannelType.Raw;
|
||||
trk.TrackSubchannelFile = trk.TrackFile;
|
||||
trk.TrackSubchannelFilter = trk.TrackFilter;
|
||||
trk.TrackSubchannelType = TrackSubchannelType.Raw;
|
||||
}
|
||||
|
||||
AaruConsole.DebugWriteLine("Aaru Format plugin", "Memory snapshot: {0} bytes",
|
||||
@@ -1262,51 +1274,55 @@ namespace Aaru.DiscImages
|
||||
if(_imageInfo.XmlMediaType != XmlMediaType.OpticalDisc)
|
||||
return true;
|
||||
|
||||
if(_imageInfo.MediaType != MediaType.CD &&
|
||||
_imageInfo.MediaType != MediaType.CDDA &&
|
||||
_imageInfo.MediaType != MediaType.CDG &&
|
||||
_imageInfo.MediaType != MediaType.CDEG &&
|
||||
_imageInfo.MediaType != MediaType.CDI &&
|
||||
_imageInfo.MediaType != MediaType.CDROM &&
|
||||
_imageInfo.MediaType != MediaType.CDROMXA &&
|
||||
_imageInfo.MediaType != MediaType.CDPLUS &&
|
||||
_imageInfo.MediaType != MediaType.CDMO &&
|
||||
_imageInfo.MediaType != MediaType.CDR &&
|
||||
_imageInfo.MediaType != MediaType.CDRW &&
|
||||
_imageInfo.MediaType != MediaType.CDMRW &&
|
||||
_imageInfo.MediaType != MediaType.VCD &&
|
||||
_imageInfo.MediaType != MediaType.SVCD &&
|
||||
_imageInfo.MediaType != MediaType.PCD &&
|
||||
_imageInfo.MediaType != MediaType.DTSCD &&
|
||||
_imageInfo.MediaType != MediaType.CDMIDI &&
|
||||
_imageInfo.MediaType != MediaType.CDV &&
|
||||
_imageInfo.MediaType != MediaType.CDIREADY &&
|
||||
_imageInfo.MediaType != MediaType.FMTOWNS &&
|
||||
_imageInfo.MediaType != MediaType.PS1CD &&
|
||||
_imageInfo.MediaType != MediaType.PS2CD &&
|
||||
_imageInfo.MediaType != MediaType.MEGACD &&
|
||||
_imageInfo.MediaType != MediaType.SATURNCD &&
|
||||
_imageInfo.MediaType != MediaType.GDROM &&
|
||||
_imageInfo.MediaType != MediaType.GDR &&
|
||||
_imageInfo.MediaType != MediaType.MilCD &&
|
||||
_imageInfo.MediaType != MediaType.SuperCDROM2 &&
|
||||
_imageInfo.MediaType != MediaType.JaguarCD &&
|
||||
_imageInfo.MediaType != MediaType.ThreeDO &&
|
||||
_imageInfo.MediaType != MediaType.PCFX &&
|
||||
_imageInfo.MediaType != MediaType.NeoGeoCD &&
|
||||
_imageInfo.MediaType != MediaType.CDTV &&
|
||||
_imageInfo.MediaType != MediaType.CD32 &&
|
||||
_imageInfo.MediaType != MediaType.Playdia &&
|
||||
_imageInfo.MediaType != MediaType.Pippin &&
|
||||
_imageInfo.MediaType != MediaType.VideoNow &&
|
||||
_imageInfo.MediaType != MediaType.VideoNowColor &&
|
||||
_imageInfo.MediaType != MediaType.VideoNowXp &&
|
||||
_imageInfo.MediaType != MediaType.CVD)
|
||||
if(_imageInfo.MediaType == MediaType.CD ||
|
||||
_imageInfo.MediaType == MediaType.CDDA ||
|
||||
_imageInfo.MediaType == MediaType.CDG ||
|
||||
_imageInfo.MediaType == MediaType.CDEG ||
|
||||
_imageInfo.MediaType == MediaType.CDI ||
|
||||
_imageInfo.MediaType == MediaType.CDROM ||
|
||||
_imageInfo.MediaType == MediaType.CDROMXA ||
|
||||
_imageInfo.MediaType == MediaType.CDPLUS ||
|
||||
_imageInfo.MediaType == MediaType.CDMO ||
|
||||
_imageInfo.MediaType == MediaType.CDR ||
|
||||
_imageInfo.MediaType == MediaType.CDRW ||
|
||||
_imageInfo.MediaType == MediaType.CDMRW ||
|
||||
_imageInfo.MediaType == MediaType.VCD ||
|
||||
_imageInfo.MediaType == MediaType.SVCD ||
|
||||
_imageInfo.MediaType == MediaType.PCD ||
|
||||
_imageInfo.MediaType == MediaType.DTSCD ||
|
||||
_imageInfo.MediaType == MediaType.CDMIDI ||
|
||||
_imageInfo.MediaType == MediaType.CDV ||
|
||||
_imageInfo.MediaType == MediaType.CDIREADY ||
|
||||
_imageInfo.MediaType == MediaType.FMTOWNS ||
|
||||
_imageInfo.MediaType == MediaType.PS1CD ||
|
||||
_imageInfo.MediaType == MediaType.PS2CD ||
|
||||
_imageInfo.MediaType == MediaType.MEGACD ||
|
||||
_imageInfo.MediaType == MediaType.SATURNCD ||
|
||||
_imageInfo.MediaType == MediaType.GDROM ||
|
||||
_imageInfo.MediaType == MediaType.GDR ||
|
||||
_imageInfo.MediaType == MediaType.MilCD ||
|
||||
_imageInfo.MediaType == MediaType.SuperCDROM2 ||
|
||||
_imageInfo.MediaType == MediaType.JaguarCD ||
|
||||
_imageInfo.MediaType == MediaType.ThreeDO ||
|
||||
_imageInfo.MediaType == MediaType.PCFX ||
|
||||
_imageInfo.MediaType == MediaType.NeoGeoCD ||
|
||||
_imageInfo.MediaType == MediaType.CDTV ||
|
||||
_imageInfo.MediaType == MediaType.CD32 ||
|
||||
_imageInfo.MediaType == MediaType.Playdia ||
|
||||
_imageInfo.MediaType == MediaType.Pippin ||
|
||||
_imageInfo.MediaType == MediaType.VideoNow ||
|
||||
_imageInfo.MediaType == MediaType.VideoNowColor ||
|
||||
_imageInfo.MediaType == MediaType.VideoNowXp ||
|
||||
_imageInfo.MediaType == MediaType.CVD)
|
||||
return true;
|
||||
|
||||
{
|
||||
foreach(Track track in Tracks)
|
||||
{
|
||||
track.TrackPregap = 0;
|
||||
track.Indexes?.Clear();
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -1432,7 +1448,7 @@ namespace Aaru.DiscImages
|
||||
|
||||
Track trk = Tracks.FirstOrDefault(t => t.TrackSequence == track);
|
||||
|
||||
if(trk.TrackSequence != track)
|
||||
if(trk?.TrackSequence != track)
|
||||
throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image");
|
||||
|
||||
return ReadSector(trk.TrackStartSector + sectorAddress);
|
||||
@@ -1445,7 +1461,7 @@ namespace Aaru.DiscImages
|
||||
|
||||
Track trk = Tracks.FirstOrDefault(t => t.TrackSequence == track);
|
||||
|
||||
if(trk.TrackSequence != track)
|
||||
if(trk?.TrackSequence != track)
|
||||
throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image");
|
||||
|
||||
return ReadSectorTag(trk.TrackStartSector + sectorAddress, tag);
|
||||
@@ -1483,6 +1499,10 @@ namespace Aaru.DiscImages
|
||||
Track trk = Tracks.FirstOrDefault(t => sectorAddress >= t.TrackStartSector &&
|
||||
sectorAddress <= t.TrackEndSector);
|
||||
|
||||
if(trk is null)
|
||||
throw new ArgumentOutOfRangeException(nameof(sectorAddress),
|
||||
"Can't found track containing requested sector");
|
||||
|
||||
if(trk.TrackSequence == 0 &&
|
||||
trk.TrackStartSector == 0 &&
|
||||
trk.TrackEndSector == 0)
|
||||
@@ -1705,7 +1725,7 @@ namespace Aaru.DiscImages
|
||||
|
||||
Track trk = Tracks.FirstOrDefault(t => t.TrackSequence == track);
|
||||
|
||||
if(trk.TrackSequence != track)
|
||||
if(trk?.TrackSequence != track)
|
||||
throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image");
|
||||
|
||||
if(trk.TrackStartSector + sectorAddress + length > trk.TrackEndSector + 1)
|
||||
@@ -1722,7 +1742,7 @@ namespace Aaru.DiscImages
|
||||
|
||||
Track trk = Tracks.FirstOrDefault(t => t.TrackSequence == track);
|
||||
|
||||
if(trk.TrackSequence != track)
|
||||
if(trk?.TrackSequence != track)
|
||||
throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image");
|
||||
|
||||
if(trk.TrackStartSector + sectorAddress + length > trk.TrackEndSector + 1)
|
||||
@@ -1740,6 +1760,10 @@ namespace Aaru.DiscImages
|
||||
Track trk = Tracks.FirstOrDefault(t => sectorAddress >= t.TrackStartSector &&
|
||||
sectorAddress <= t.TrackEndSector);
|
||||
|
||||
if(trk is null)
|
||||
throw new ArgumentOutOfRangeException(nameof(sectorAddress),
|
||||
"Can't found track containing requested sector");
|
||||
|
||||
if(trk.TrackSequence == 0 &&
|
||||
trk.TrackStartSector == 0 &&
|
||||
trk.TrackEndSector == 0)
|
||||
@@ -1936,7 +1960,7 @@ namespace Aaru.DiscImages
|
||||
|
||||
Track trk = Tracks.FirstOrDefault(t => t.TrackSequence == track);
|
||||
|
||||
if(trk.TrackSequence != track)
|
||||
if(trk?.TrackSequence != track)
|
||||
throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image");
|
||||
|
||||
return ReadSectorLong(trk.TrackStartSector + sectorAddress);
|
||||
@@ -1953,6 +1977,10 @@ namespace Aaru.DiscImages
|
||||
Track trk = Tracks.FirstOrDefault(t => sectorAddress >= t.TrackStartSector &&
|
||||
sectorAddress <= t.TrackEndSector);
|
||||
|
||||
if(trk is null)
|
||||
throw new ArgumentOutOfRangeException(nameof(sectorAddress),
|
||||
"Can't found track containing requested sector");
|
||||
|
||||
if(trk.TrackSequence == 0 &&
|
||||
trk.TrackStartSector == 0 &&
|
||||
trk.TrackEndSector == 0)
|
||||
@@ -2106,7 +2134,7 @@ namespace Aaru.DiscImages
|
||||
|
||||
Track trk = Tracks.FirstOrDefault(t => t.TrackSequence == track);
|
||||
|
||||
if(trk.TrackSequence != track)
|
||||
if(trk?.TrackSequence != track)
|
||||
throw new ArgumentOutOfRangeException(nameof(track), "Track does not exist in disc image");
|
||||
|
||||
if(trk.TrackStartSector + sectorAddress + length > trk.TrackEndSector + 1)
|
||||
|
||||
@@ -36,7 +36,7 @@ using Aaru.CommonTypes.Enums;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AaruFormat
|
||||
public sealed partial class AaruFormat
|
||||
{
|
||||
/// <summary>Header, at start of file</summary>
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1, CharSet = CharSet.Unicode)]
|
||||
|
||||
@@ -36,7 +36,7 @@ using Aaru.CommonTypes.Structs;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AaruFormat
|
||||
public sealed partial class AaruFormat
|
||||
{
|
||||
public List<TapeFile> Files { get; private set; }
|
||||
public List<TapePartition> TapePartitions { get; private set; }
|
||||
|
||||
@@ -39,7 +39,7 @@ using Aaru.Helpers;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AaruFormat
|
||||
public sealed partial class AaruFormat
|
||||
{
|
||||
public bool? VerifyMediaImage()
|
||||
{
|
||||
|
||||
@@ -56,7 +56,7 @@ using TrackType = Aaru.CommonTypes.Enums.TrackType;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AaruFormat
|
||||
public sealed partial class AaruFormat
|
||||
{
|
||||
public bool Create(string path, MediaType mediaType, Dictionary<string, string> options, ulong sectors,
|
||||
uint sectorSize)
|
||||
@@ -195,7 +195,7 @@ namespace Aaru.DiscImages
|
||||
// This really, cannot happen
|
||||
if(!SupportedMediaTypes.Contains(mediaType))
|
||||
{
|
||||
ErrorMessage = $"Unsupport media format {mediaType}";
|
||||
ErrorMessage = $"Unsupported media format {mediaType}";
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -1049,6 +1049,9 @@ namespace Aaru.DiscImages
|
||||
trk = Tracks.FirstOrDefault(t => sectorAddress >= t.TrackStartSector &&
|
||||
sectorAddress <= t.TrackEndSector);
|
||||
|
||||
if(trk is null)
|
||||
trk.TrackType = TrackType.Data; // TODO: Check intersession data type
|
||||
|
||||
if(trk.TrackSequence == 0 &&
|
||||
trk.TrackStartSector == 0 &&
|
||||
trk.TrackEndSector == 0)
|
||||
@@ -1074,30 +1077,37 @@ namespace Aaru.DiscImages
|
||||
|
||||
byte[] lzmaProperties = new byte[0];
|
||||
|
||||
if(_currentBlockHeader.compression == CompressionType.Flac)
|
||||
switch(_currentBlockHeader.compression)
|
||||
{
|
||||
long remaining = (_currentBlockOffset * SAMPLES_PER_SECTOR) % _flakeWriter.Settings.BlockSize;
|
||||
|
||||
// Fill FLAC block
|
||||
if(remaining != 0)
|
||||
case CompressionType.Flac:
|
||||
{
|
||||
var audioBuffer =
|
||||
new AudioBuffer(AudioPCMConfig.RedBook, new byte[remaining * 4], (int)remaining);
|
||||
long remaining = (_currentBlockOffset * SAMPLES_PER_SECTOR) % _flakeWriter.Settings.BlockSize;
|
||||
|
||||
_flakeWriter.Write(audioBuffer);
|
||||
// Fill FLAC block
|
||||
if(remaining != 0)
|
||||
{
|
||||
var audioBuffer =
|
||||
new AudioBuffer(AudioPCMConfig.RedBook, new byte[remaining * 4], (int)remaining);
|
||||
|
||||
_flakeWriter.Write(audioBuffer);
|
||||
}
|
||||
|
||||
_flakeWriter.Close();
|
||||
|
||||
break;
|
||||
}
|
||||
case CompressionType.Lzma:
|
||||
{
|
||||
lzmaProperties = _lzmaBlockStream.Properties;
|
||||
_lzmaBlockStream.Close();
|
||||
_lzmaBlockStream = null;
|
||||
cmpCrc64Context.Update(lzmaProperties);
|
||||
|
||||
_flakeWriter.Close();
|
||||
}
|
||||
else if(_currentBlockHeader.compression == CompressionType.Lzma)
|
||||
{
|
||||
lzmaProperties = _lzmaBlockStream.Properties;
|
||||
_lzmaBlockStream.Close();
|
||||
_lzmaBlockStream = null;
|
||||
cmpCrc64Context.Update(lzmaProperties);
|
||||
if(_blockStream.Length > _decompressedStream.Length)
|
||||
_currentBlockHeader.compression = CompressionType.None;
|
||||
|
||||
if(_blockStream.Length > _decompressedStream.Length)
|
||||
_currentBlockHeader.compression = CompressionType.None;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(_currentBlockHeader.compression == CompressionType.None)
|
||||
@@ -1266,6 +1276,13 @@ namespace Aaru.DiscImages
|
||||
Tracks.FirstOrDefault(trk => sectorAddress >= trk.TrackStartSector &&
|
||||
sectorAddress <= trk.TrackEndSector);
|
||||
|
||||
if(track is null)
|
||||
{
|
||||
ErrorMessage = "Track not found";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
if(track.TrackSequence == 0 &&
|
||||
track.TrackStartSector == 0 &&
|
||||
track.TrackEndSector == 0)
|
||||
@@ -1321,11 +1338,9 @@ namespace Aaru.DiscImages
|
||||
return WriteSector(sector, sectorAddress);
|
||||
}
|
||||
|
||||
if(_sectorSuffixMs == null)
|
||||
_sectorSuffixMs = new NonClosableStream();
|
||||
_sectorSuffixMs ??= new NonClosableStream();
|
||||
|
||||
if(_sectorPrefixMs == null)
|
||||
_sectorPrefixMs = new NonClosableStream();
|
||||
_sectorPrefixMs ??= new NonClosableStream();
|
||||
|
||||
if(_sectorSuffixDdt == null)
|
||||
{
|
||||
@@ -1333,8 +1348,7 @@ namespace Aaru.DiscImages
|
||||
EccInit();
|
||||
}
|
||||
|
||||
if(_sectorPrefixDdt == null)
|
||||
_sectorPrefixDdt = new uint[_imageInfo.Sectors];
|
||||
_sectorPrefixDdt ??= new uint[_imageInfo.Sectors];
|
||||
|
||||
sector = new byte[2048];
|
||||
|
||||
@@ -1419,11 +1433,9 @@ namespace Aaru.DiscImages
|
||||
return WriteSector(sector, sectorAddress);
|
||||
}
|
||||
|
||||
if(_sectorSuffixMs == null)
|
||||
_sectorSuffixMs = new NonClosableStream();
|
||||
_sectorSuffixMs ??= new NonClosableStream();
|
||||
|
||||
if(_sectorPrefixMs == null)
|
||||
_sectorPrefixMs = new NonClosableStream();
|
||||
_sectorPrefixMs ??= new NonClosableStream();
|
||||
|
||||
if(_sectorSuffixDdt == null)
|
||||
{
|
||||
@@ -1431,8 +1443,7 @@ namespace Aaru.DiscImages
|
||||
EccInit();
|
||||
}
|
||||
|
||||
if(_sectorPrefixDdt == null)
|
||||
_sectorPrefixDdt = new uint[_imageInfo.Sectors];
|
||||
_sectorPrefixDdt ??= new uint[_imageInfo.Sectors];
|
||||
|
||||
sector = new byte[2328];
|
||||
|
||||
@@ -1484,22 +1495,19 @@ namespace Aaru.DiscImages
|
||||
_sectorPrefixMs.Write(data, 0, 16);
|
||||
}
|
||||
|
||||
if(_mode2Subheaders == null)
|
||||
_mode2Subheaders = new byte[_imageInfo.Sectors * 8];
|
||||
_mode2Subheaders ??= new byte[_imageInfo.Sectors * 8];
|
||||
|
||||
bool form2 = (data[18] & 0x20) == 0x20 || (data[22] & 0x20) == 0x20;
|
||||
|
||||
if(form2)
|
||||
{
|
||||
bool correctEdc;
|
||||
uint computedEdc = ComputeEdc(0, data, 0x91C, 0x10);
|
||||
uint edc = BitConverter.ToUInt32(data, 0x92C);
|
||||
correctEdc = computedEdc == edc;
|
||||
bool correctEdc = computedEdc == edc;
|
||||
|
||||
sector = new byte[2324];
|
||||
|
||||
if(_sectorSuffixDdt == null)
|
||||
_sectorSuffixDdt = new uint[_imageInfo.Sectors];
|
||||
_sectorSuffixDdt ??= new uint[_imageInfo.Sectors];
|
||||
|
||||
Array.Copy(data, 24, sector, 0, 2324);
|
||||
|
||||
@@ -1527,19 +1535,17 @@ namespace Aaru.DiscImages
|
||||
else
|
||||
{
|
||||
bool correctEcc = SuffixIsCorrectMode2(data);
|
||||
bool correctEdc;
|
||||
|
||||
uint computedEdc = ComputeEdc(0, data, 0x808, 0x10);
|
||||
uint edc = BitConverter.ToUInt32(data, 0x818);
|
||||
correctEdc = computedEdc == edc;
|
||||
bool correctEdc = computedEdc == edc;
|
||||
|
||||
sector = new byte[2048];
|
||||
Array.Copy(data, 24, sector, 0, 2048);
|
||||
|
||||
if(correctEcc && correctEdc)
|
||||
{
|
||||
if(_sectorSuffixDdt == null)
|
||||
_sectorSuffixDdt = new uint[_imageInfo.Sectors];
|
||||
_sectorSuffixDdt ??= new uint[_imageInfo.Sectors];
|
||||
|
||||
_sectorSuffixDdt[sectorAddress] = (uint)CdFixFlags.Mode2Form1Ok;
|
||||
}
|
||||
@@ -1668,8 +1674,7 @@ namespace Aaru.DiscImages
|
||||
if(newTag == null)
|
||||
return WriteSector(sector, sectorAddress);
|
||||
|
||||
if(_sectorSubchannel == null)
|
||||
_sectorSubchannel = new byte[newTag.Length * (int)_imageInfo.Sectors];
|
||||
_sectorSubchannel ??= new byte[newTag.Length * (int)_imageInfo.Sectors];
|
||||
|
||||
Array.Copy(newTag, 0, _sectorSubchannel, newTag.Length * (int)sectorAddress, newTag.Length);
|
||||
|
||||
@@ -2013,17 +2018,14 @@ namespace Aaru.DiscImages
|
||||
if(!string.IsNullOrWhiteSpace(dump.Serial))
|
||||
dumpSerial = Encoding.UTF8.GetBytes(dump.Serial);
|
||||
|
||||
if(dump.Software != null)
|
||||
{
|
||||
if(!string.IsNullOrWhiteSpace(dump.Software.Name))
|
||||
dumpSoftwareName = Encoding.UTF8.GetBytes(dump.Software.Name);
|
||||
if(!string.IsNullOrWhiteSpace(dump.Software?.Name))
|
||||
dumpSoftwareName = Encoding.UTF8.GetBytes(dump.Software.Name);
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(dump.Software.Version))
|
||||
dumpSoftwareVersion = Encoding.UTF8.GetBytes(dump.Software.Version);
|
||||
if(!string.IsNullOrWhiteSpace(dump.Software?.Version))
|
||||
dumpSoftwareVersion = Encoding.UTF8.GetBytes(dump.Software.Version);
|
||||
|
||||
if(!string.IsNullOrWhiteSpace(dump.Software.OperatingSystem))
|
||||
dumpSoftwareOperatingSystem = Encoding.UTF8.GetBytes(dump.Software.OperatingSystem);
|
||||
}
|
||||
if(!string.IsNullOrWhiteSpace(dump.Software?.OperatingSystem))
|
||||
dumpSoftwareOperatingSystem = Encoding.UTF8.GetBytes(dump.Software.OperatingSystem);
|
||||
|
||||
var dumpEntry = new DumpHardwareEntry
|
||||
{
|
||||
@@ -2292,19 +2294,23 @@ namespace Aaru.DiscImages
|
||||
|
||||
for(int t = 0; t < TapePartitions.Count; t++)
|
||||
{
|
||||
tapePartitionEntries[t] = new TapePartitionEntry();
|
||||
tapePartitionEntries[t].Number = TapePartitions[t].Number;
|
||||
tapePartitionEntries[t].FirstBlock = TapePartitions[t].FirstBlock;
|
||||
tapePartitionEntries[t].LastBlock = TapePartitions[t].LastBlock;
|
||||
tapePartitionEntries[t] = new TapePartitionEntry
|
||||
{
|
||||
Number = TapePartitions[t].Number,
|
||||
FirstBlock = TapePartitions[t].FirstBlock,
|
||||
LastBlock = TapePartitions[t].LastBlock
|
||||
};
|
||||
}
|
||||
|
||||
byte[] tapePartitionEntriesData =
|
||||
MemoryMarshal.Cast<TapePartitionEntry, byte>(tapePartitionEntries).ToArray();
|
||||
|
||||
var tapePartitionHeader = new TapePartitionHeader();
|
||||
tapePartitionHeader.identifier = BlockType.TapePartitionBlock;
|
||||
tapePartitionHeader.entries = (byte)tapePartitionEntries.Length;
|
||||
tapePartitionHeader.length = (ulong)tapePartitionEntriesData.Length;
|
||||
var tapePartitionHeader = new TapePartitionHeader
|
||||
{
|
||||
identifier = BlockType.TapePartitionBlock,
|
||||
entries = (byte)tapePartitionEntries.Length,
|
||||
length = (ulong)tapePartitionEntriesData.Length
|
||||
};
|
||||
|
||||
_crc64 = new Crc64Context();
|
||||
_crc64.Update(tapePartitionEntriesData);
|
||||
@@ -3578,7 +3584,7 @@ namespace Aaru.DiscImages
|
||||
|
||||
if(_imageInfo.XmlMediaType != XmlMediaType.BlockMedia)
|
||||
{
|
||||
ErrorMessage = "Tried to set geometry on a media that doesn't suppport it";
|
||||
ErrorMessage = "Tried to set geometry on a media that doesn't support it";
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -3627,9 +3633,8 @@ namespace Aaru.DiscImages
|
||||
|
||||
track = Tracks.FirstOrDefault(trk => sectorAddress == trk.TrackSequence);
|
||||
|
||||
if(track.TrackSequence == 0 &&
|
||||
track.TrackStartSector == 0 &&
|
||||
track.TrackEndSector == 0)
|
||||
if(track is null ||
|
||||
(track.TrackSequence == 0 && track.TrackStartSector == 0 && track.TrackEndSector == 0))
|
||||
{
|
||||
ErrorMessage = $"Can't find track {sectorAddress}";
|
||||
|
||||
@@ -3689,8 +3694,7 @@ namespace Aaru.DiscImages
|
||||
return false;
|
||||
}
|
||||
|
||||
if(_sectorSubchannel == null)
|
||||
_sectorSubchannel = new byte[_imageInfo.Sectors * 96];
|
||||
_sectorSubchannel ??= new byte[_imageInfo.Sectors * 96];
|
||||
|
||||
Array.Copy(data, 0, _sectorSubchannel, (int)(96 * sectorAddress), 96);
|
||||
|
||||
@@ -3733,8 +3737,7 @@ namespace Aaru.DiscImages
|
||||
return false;
|
||||
}
|
||||
|
||||
if(_sectorSubchannel == null)
|
||||
_sectorSubchannel = new byte[_imageInfo.Sectors * 96];
|
||||
_sectorSubchannel ??= new byte[_imageInfo.Sectors * 96];
|
||||
|
||||
if((sectorAddress * 96) + (length * 96) > (ulong)_sectorSubchannel.LongLength)
|
||||
{
|
||||
@@ -3776,14 +3779,11 @@ namespace Aaru.DiscImages
|
||||
/// <returns>The properties as a byte array</returns>
|
||||
static byte[] CompressDataToStreamWithLZMA(byte[] data, LzmaEncoderProperties properties, Stream stream)
|
||||
{
|
||||
byte[] propertiesArray;
|
||||
using var lzmaStream = new LzmaStream(properties, false, stream);
|
||||
|
||||
using(var lzmaStream = new LzmaStream(properties, false, stream))
|
||||
{
|
||||
lzmaStream.Write(data, 0, data.Length);
|
||||
propertiesArray = new byte[lzmaStream.Properties.Length];
|
||||
lzmaStream.Properties.CopyTo(propertiesArray, 0);
|
||||
}
|
||||
lzmaStream.Write(data, 0, data.Length);
|
||||
byte[] propertiesArray = new byte[lzmaStream.Properties.Length];
|
||||
lzmaStream.Properties.CopyTo(propertiesArray, 0);
|
||||
|
||||
return propertiesArray;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Alcohol120 : IWritableOpticalImage
|
||||
public sealed partial class Alcohol120 : IWritableOpticalImage
|
||||
{
|
||||
AlcoholFooter _alcFooter;
|
||||
IFilter _alcImage;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Alcohol120
|
||||
public sealed partial class Alcohol120
|
||||
{
|
||||
const byte _maximumSupportedVersion = 1;
|
||||
readonly byte[] _alcoholSignature =
|
||||
|
||||
@@ -34,7 +34,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Alcohol120
|
||||
public sealed partial class Alcohol120
|
||||
{
|
||||
[SuppressMessage("ReSharper", "InconsistentNaming")]
|
||||
enum AlcoholMediumType : ushort
|
||||
|
||||
@@ -35,24 +35,8 @@ using Aaru.CommonTypes.Enums;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Alcohol120
|
||||
public sealed partial class Alcohol120
|
||||
{
|
||||
static ushort AlcoholTrackModeToBytesPerSector(AlcoholTrackMode trackMode)
|
||||
{
|
||||
switch(trackMode)
|
||||
{
|
||||
case AlcoholTrackMode.Audio:
|
||||
case AlcoholTrackMode.Mode1:
|
||||
case AlcoholTrackMode.Mode2:
|
||||
case AlcoholTrackMode.Mode2F1:
|
||||
case AlcoholTrackMode.Mode2F2:
|
||||
case AlcoholTrackMode.Mode2F2Alt:
|
||||
case AlcoholTrackMode.Mode2F1Alt: return 2352;
|
||||
case AlcoholTrackMode.DVD: return 2048;
|
||||
default: return 0;
|
||||
}
|
||||
}
|
||||
|
||||
static ushort AlcoholTrackModeToCookedBytesPerSector(AlcoholTrackMode trackMode)
|
||||
{
|
||||
switch(trackMode)
|
||||
|
||||
@@ -37,7 +37,7 @@ using Aaru.Helpers;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Alcohol120
|
||||
public sealed partial class Alcohol120
|
||||
{
|
||||
public bool Identify(IFilter imageFilter)
|
||||
{
|
||||
|
||||
@@ -40,7 +40,7 @@ using Schemas;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Alcohol120
|
||||
public sealed partial class Alcohol120
|
||||
{
|
||||
public OpticalImageCapabilities OpticalCapabilities => OpticalImageCapabilities.CanStoreAudioTracks |
|
||||
OpticalImageCapabilities.CanStoreDataTracks |
|
||||
|
||||
@@ -49,7 +49,7 @@ using Session = Aaru.CommonTypes.Structs.Session;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Alcohol120
|
||||
public sealed partial class Alcohol120
|
||||
{
|
||||
public bool Open(IFilter imageFilter)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Alcohol120
|
||||
public sealed partial class Alcohol120
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct AlcoholHeader
|
||||
|
||||
@@ -36,7 +36,7 @@ using Aaru.Checksums;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Alcohol120
|
||||
public sealed partial class Alcohol120
|
||||
{
|
||||
public bool? VerifySector(ulong sectorAddress)
|
||||
{
|
||||
|
||||
@@ -45,14 +45,14 @@ using TrackType = Aaru.CommonTypes.Enums.TrackType;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Alcohol120
|
||||
public sealed partial class Alcohol120
|
||||
{
|
||||
public bool Create(string path, MediaType mediaType, Dictionary<string, string> options, ulong sectors,
|
||||
uint sectorSize)
|
||||
{
|
||||
if(!SupportedMediaTypes.Contains(mediaType))
|
||||
{
|
||||
ErrorMessage = $"Unsupport media format {mediaType}";
|
||||
ErrorMessage = $"Unsupported media format {mediaType}";
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -70,7 +70,7 @@ namespace Aaru.DiscImages
|
||||
|
||||
_imageStream =
|
||||
new
|
||||
FileStream(Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path)) + ".mdf",
|
||||
FileStream(Path.Combine(Path.GetDirectoryName(path) ?? "", Path.GetFileNameWithoutExtension(path)) + ".mdf",
|
||||
FileMode.OpenOrCreate, FileAccess.ReadWrite, FileShare.None);
|
||||
}
|
||||
catch(IOException e)
|
||||
@@ -418,6 +418,9 @@ namespace Aaru.DiscImages
|
||||
{
|
||||
Track firstTrackInSession = tracks.FirstOrDefault(t => t.TrackSession == tmpTracks[i].TrackSession);
|
||||
|
||||
if(firstTrackInSession is null)
|
||||
continue;
|
||||
|
||||
if(tmpTracks[i].TrackSequence == firstTrackInSession.TrackSequence)
|
||||
{
|
||||
if(tmpTracks[i].TrackSequence > 1)
|
||||
@@ -478,9 +481,8 @@ namespace Aaru.DiscImages
|
||||
|
||||
byte sessions = byte.MinValue;
|
||||
|
||||
foreach(Track t in _writingTracks)
|
||||
if(t.TrackSession > byte.MinValue)
|
||||
sessions = (byte)t.TrackSession;
|
||||
foreach(Track t in _writingTracks.Where(t => t.TrackSession > byte.MinValue))
|
||||
sessions = (byte)t.TrackSession;
|
||||
|
||||
var header = new AlcoholHeader
|
||||
{
|
||||
@@ -626,9 +628,8 @@ namespace Aaru.DiscImages
|
||||
|
||||
(byte minute, byte second, byte frame) leadinPmsf = LbaToMsf(lastTrack.TrackEndSector + 1);
|
||||
|
||||
if(decodedToc.HasValue &&
|
||||
decodedToc.Value.TrackDescriptors.Any(t => t.SessionNumber == i && t.POINT >= 0xA0 &&
|
||||
t.POINT <= 0xAF))
|
||||
if(decodedToc?.TrackDescriptors.Any(t => t.SessionNumber == i && t.POINT >= 0xA0 &&
|
||||
t.POINT <= 0xAF) == true)
|
||||
foreach(FullTOC.TrackDataDescriptor tocTrk in
|
||||
decodedToc.Value.TrackDescriptors.Where(t => t.SessionNumber == i && t.POINT >= 0xA0 &&
|
||||
t.POINT <= 0xAF))
|
||||
@@ -707,9 +708,8 @@ namespace Aaru.DiscImages
|
||||
{
|
||||
var alcTrk = new AlcoholTrack();
|
||||
|
||||
if(decodedToc.HasValue &&
|
||||
decodedToc.Value.TrackDescriptors.Any(t => t.SessionNumber == i &&
|
||||
t.POINT == track.TrackSequence))
|
||||
if(decodedToc?.TrackDescriptors.Any(t => t.SessionNumber == i &&
|
||||
t.POINT == track.TrackSequence) == true)
|
||||
{
|
||||
FullTOC.TrackDataDescriptor tocTrk =
|
||||
decodedToc.Value.TrackDescriptors.First(t => t.SessionNumber == i &&
|
||||
@@ -805,8 +805,7 @@ namespace Aaru.DiscImages
|
||||
_alcTrackExtras.Add((int)track.TrackSequence, trkExtra);
|
||||
}
|
||||
|
||||
if(decodedToc.HasValue &&
|
||||
decodedToc.Value.TrackDescriptors.Any(t => t.SessionNumber == i && t.POINT >= 0xB0))
|
||||
if(decodedToc?.TrackDescriptors.Any(t => t.SessionNumber == i && t.POINT >= 0xB0) == true)
|
||||
foreach(FullTOC.TrackDataDescriptor tocTrk in
|
||||
decodedToc.Value.TrackDescriptors.Where(t => t.SessionNumber == i && t.POINT >= 0xB0))
|
||||
{
|
||||
@@ -880,34 +879,37 @@ namespace Aaru.DiscImages
|
||||
|
||||
byte[] filename = Encoding.Unicode.GetBytes("*.mdf"); // Yup, Alcohol stores no filename but a wildcard.
|
||||
|
||||
IntPtr blockPtr;
|
||||
|
||||
// Write header
|
||||
_descriptorStream.Seek(0, SeekOrigin.Begin);
|
||||
byte[] block = new byte[Marshal.SizeOf<AlcoholHeader>()];
|
||||
blockPtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(Marshal.SizeOf<AlcoholHeader>());
|
||||
byte[] block = new byte[Marshal.SizeOf<AlcoholHeader>()];
|
||||
IntPtr blockPtr = System.Runtime.InteropServices.Marshal.AllocHGlobal(Marshal.SizeOf<AlcoholHeader>());
|
||||
System.Runtime.InteropServices.Marshal.StructureToPtr(header, blockPtr, true);
|
||||
System.Runtime.InteropServices.Marshal.Copy(blockPtr, block, 0, block.Length);
|
||||
System.Runtime.InteropServices.Marshal.FreeHGlobal(blockPtr);
|
||||
_descriptorStream.Write(block, 0, block.Length);
|
||||
|
||||
// Write DVD structures if pressent
|
||||
// Write DVD structures if present
|
||||
if(header.structuresOffset != 0)
|
||||
{
|
||||
if(_dmi != null)
|
||||
{
|
||||
_descriptorStream.Seek(header.structuresOffset, SeekOrigin.Begin);
|
||||
|
||||
if(_dmi.Length == 2052)
|
||||
_descriptorStream.Write(_dmi, 0, 2052);
|
||||
else if(_dmi.Length == 2048)
|
||||
switch(_dmi.Length)
|
||||
{
|
||||
_descriptorStream.Write(new byte[]
|
||||
{
|
||||
0x08, 0x02, 0x00, 0x00
|
||||
}, 0, 4);
|
||||
case 2052:
|
||||
_descriptorStream.Write(_dmi, 0, 2052);
|
||||
|
||||
_descriptorStream.Write(_dmi, 0, 2048);
|
||||
break;
|
||||
case 2048:
|
||||
_descriptorStream.Write(new byte[]
|
||||
{
|
||||
0x08, 0x02, 0x00, 0x00
|
||||
}, 0, 4);
|
||||
|
||||
_descriptorStream.Write(_dmi, 0, 2048);
|
||||
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Anex86 : IWritableImage
|
||||
public sealed partial class Anex86 : IWritableImage
|
||||
{
|
||||
IFilter _anexImageFilter;
|
||||
Anex86Header _fdihdr;
|
||||
|
||||
@@ -37,7 +37,7 @@ using Aaru.Helpers;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Anex86
|
||||
public sealed partial class Anex86
|
||||
{
|
||||
public bool Identify(IFilter imageFilter)
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ using Schemas;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Anex86
|
||||
public sealed partial class Anex86
|
||||
{
|
||||
public ImageInfo Info => _imageInfo;
|
||||
|
||||
|
||||
@@ -40,7 +40,7 @@ using Aaru.Helpers;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Anex86
|
||||
public sealed partial class Anex86
|
||||
{
|
||||
public bool Open(IFilter imageFilter)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Anex86
|
||||
public sealed partial class Anex86
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct Anex86Header
|
||||
|
||||
@@ -32,11 +32,10 @@
|
||||
|
||||
using Aaru.CommonTypes.Enums;
|
||||
using Aaru.CommonTypes.Exceptions;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Anex86 : IWritableImage
|
||||
public sealed partial class Anex86
|
||||
{
|
||||
public byte[] ReadDiskTag(MediaTagType tag) =>
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
|
||||
@@ -42,7 +42,7 @@ using Marshal = Aaru.Helpers.Marshal;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Anex86
|
||||
public sealed partial class Anex86
|
||||
{
|
||||
public bool Create(string path, MediaType mediaType, Dictionary<string, string> options, ulong sectors,
|
||||
uint sectorSize)
|
||||
@@ -64,7 +64,7 @@ namespace Aaru.DiscImages
|
||||
|
||||
if(!SupportedMediaTypes.Contains(mediaType))
|
||||
{
|
||||
ErrorMessage = $"Unsupport media format {mediaType}";
|
||||
ErrorMessage = $"Unsupported media format {mediaType}";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Apple2Mg : IWritableImage
|
||||
public sealed partial class Apple2Mg : IWritableImage
|
||||
{
|
||||
IFilter _a2MgImageFilter;
|
||||
byte[] _decodedImage;
|
||||
|
||||
@@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Local")]
|
||||
public partial class Apple2Mg
|
||||
public sealed partial class Apple2Mg
|
||||
{
|
||||
/// <summary>Magic number, "2IMG"</summary>
|
||||
const uint MAGIC = 0x474D4932;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Apple2Mg
|
||||
public sealed partial class Apple2Mg
|
||||
{
|
||||
enum SectorOrder : uint
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ using Aaru.CommonTypes;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Apple2Mg
|
||||
public sealed partial class Apple2Mg
|
||||
{
|
||||
MediaType GetMediaType()
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ using Aaru.Helpers;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Apple2Mg
|
||||
public sealed partial class Apple2Mg
|
||||
{
|
||||
public bool Identify(IFilter imageFilter)
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ using Schemas;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Apple2Mg
|
||||
public sealed partial class Apple2Mg
|
||||
{
|
||||
public ImageInfo Info => _imageInfo;
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ using Aaru.Helpers;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Apple2Mg
|
||||
public sealed partial class Apple2Mg
|
||||
{
|
||||
public bool Open(IFilter imageFilter)
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Apple2Mg
|
||||
public sealed partial class Apple2Mg
|
||||
{
|
||||
[SuppressMessage("ReSharper", "NotAccessedField.Local"), StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct A2ImgHeader
|
||||
|
||||
@@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Apple2Mg
|
||||
public sealed partial class Apple2Mg
|
||||
{
|
||||
public byte[] ReadDiskTag(MediaTagType tag) =>
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
|
||||
@@ -43,7 +43,7 @@ using Schemas;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Apple2Mg
|
||||
public sealed partial class Apple2Mg
|
||||
{
|
||||
public bool Create(string path, MediaType mediaType, Dictionary<string, string> options, ulong sectors,
|
||||
uint sectorSize)
|
||||
@@ -59,7 +59,7 @@ namespace Aaru.DiscImages
|
||||
|
||||
if(!SupportedMediaTypes.Contains(mediaType))
|
||||
{
|
||||
ErrorMessage = $"Unsupport media format {mediaType}";
|
||||
ErrorMessage = $"Unsupported media format {mediaType}";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AppleDos : IWritableImage
|
||||
public sealed partial class AppleDos : IWritableImage
|
||||
{
|
||||
byte[] _deinterleaved;
|
||||
string _extension;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AppleDos
|
||||
public sealed partial class AppleDos
|
||||
{
|
||||
readonly int[] _deinterleave =
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AppleDos
|
||||
public sealed partial class AppleDos
|
||||
{
|
||||
public bool Identify(IFilter imageFilter)
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ using Schemas;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AppleDos
|
||||
public sealed partial class AppleDos
|
||||
{
|
||||
public ImageInfo Info => _imageInfo;
|
||||
|
||||
|
||||
@@ -38,7 +38,7 @@ using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AppleDos
|
||||
public sealed partial class AppleDos
|
||||
{
|
||||
public bool Open(IFilter imageFilter)
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AppleDos
|
||||
public sealed partial class AppleDos
|
||||
{
|
||||
public byte[] ReadSectorTag(ulong sectorAddress, SectorTagType tag) =>
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
|
||||
@@ -40,7 +40,7 @@ using Schemas;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AppleDos
|
||||
public sealed partial class AppleDos
|
||||
{
|
||||
public bool Create(string path, MediaType mediaType, Dictionary<string, string> options, ulong sectors,
|
||||
uint sectorSize)
|
||||
@@ -54,7 +54,7 @@ namespace Aaru.DiscImages
|
||||
|
||||
if(mediaType != MediaType.Apple33SS)
|
||||
{
|
||||
ErrorMessage = $"Unsupport media format {mediaType}";
|
||||
ErrorMessage = $"Unsupported media format {mediaType}";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs;
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
// TODO: Checksum sectors
|
||||
public partial class AppleNib : IMediaImage
|
||||
public sealed partial class AppleNib : IMediaImage
|
||||
{
|
||||
Dictionary<ulong, byte[]> _addressFields;
|
||||
Dictionary<ulong, byte[]> _cookedSectors;
|
||||
|
||||
@@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Local")]
|
||||
public partial class AppleNib
|
||||
public sealed partial class AppleNib
|
||||
{
|
||||
readonly byte[] _apple3Sign =
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ using Aaru.CommonTypes;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AppleNib
|
||||
public sealed partial class AppleNib
|
||||
{
|
||||
MediaType GetMediaType()
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ using Aaru.Decoders.Floppy;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AppleNib
|
||||
public sealed partial class AppleNib
|
||||
{
|
||||
public bool Identify(IFilter imageFilter)
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ using Schemas;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AppleNib
|
||||
public sealed partial class AppleNib
|
||||
{
|
||||
public ImageInfo Info => _imageInfo;
|
||||
|
||||
|
||||
@@ -43,7 +43,7 @@ using Aaru.Decoders.Floppy;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AppleNib
|
||||
public sealed partial class AppleNib
|
||||
{
|
||||
public bool Open(IFilter imageFilter)
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class AppleNib
|
||||
public sealed partial class AppleNib
|
||||
{
|
||||
public byte[] ReadDiskTag(MediaTagType tag) =>
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
|
||||
@@ -39,7 +39,7 @@ using Aaru.CommonTypes.Structs;
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
// TODO: Check writing
|
||||
public partial class Apridisk : IWritableImage
|
||||
public sealed partial class Apridisk : IWritableImage
|
||||
{
|
||||
ImageInfo _imageInfo;
|
||||
|
||||
|
||||
@@ -35,7 +35,7 @@ using System.IO;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Apridisk
|
||||
public sealed partial class Apridisk
|
||||
{
|
||||
static uint Decompress(byte[] compressed, out byte[] decompressed)
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Apridisk
|
||||
public sealed partial class Apridisk
|
||||
{
|
||||
readonly byte[] _signature =
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Apridisk
|
||||
public sealed partial class Apridisk
|
||||
{
|
||||
enum RecordType : uint
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Apridisk
|
||||
public sealed partial class Apridisk
|
||||
{
|
||||
(ushort cylinder, byte head, byte sector) LbaToChs(ulong lba)
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Apridisk
|
||||
public sealed partial class Apridisk
|
||||
{
|
||||
public bool Identify(IFilter imageFilter)
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ using Schemas;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Apridisk
|
||||
public sealed partial class Apridisk
|
||||
{
|
||||
public ImageInfo Info => _imageInfo;
|
||||
|
||||
|
||||
@@ -41,7 +41,7 @@ using Aaru.Helpers;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Apridisk
|
||||
public sealed partial class Apridisk
|
||||
{
|
||||
public bool Open(IFilter imageFilter)
|
||||
{
|
||||
|
||||
@@ -34,7 +34,7 @@ using System.Runtime.InteropServices;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Apridisk
|
||||
public sealed partial class Apridisk
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct ApridiskRecord
|
||||
|
||||
@@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Apridisk
|
||||
public sealed partial class Apridisk
|
||||
{
|
||||
public byte[] ReadDiskTag(MediaTagType tag) =>
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
|
||||
@@ -43,14 +43,14 @@ using Marshal = Aaru.Helpers.Marshal;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Apridisk
|
||||
public sealed partial class Apridisk
|
||||
{
|
||||
public bool Create(string path, MediaType mediaType, Dictionary<string, string> options, ulong sectors,
|
||||
uint sectorSize)
|
||||
{
|
||||
if(!SupportedMediaTypes.Contains(mediaType))
|
||||
{
|
||||
ErrorMessage = $"Unsupport media format {mediaType}";
|
||||
ErrorMessage = $"Unsupported media format {mediaType}";
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -38,7 +38,7 @@ using Aaru.CommonTypes.Structs;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Blu : IWritableImage, IVerifiableSectorsImage
|
||||
public sealed partial class Blu : IWritableImage, IVerifiableSectorsImage
|
||||
{
|
||||
IFilter _bluImageFilter;
|
||||
int _bptag;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Blu
|
||||
public sealed partial class Blu
|
||||
{
|
||||
const string PROFILE_NAME = "PROFILE ";
|
||||
const string PROFILE10_NAME = "PROFILE 10 ";
|
||||
|
||||
@@ -37,7 +37,7 @@ using Aaru.Helpers;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Blu
|
||||
public sealed partial class Blu
|
||||
{
|
||||
public bool Identify(IFilter imageFilter)
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ using Schemas;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Blu
|
||||
public sealed partial class Blu
|
||||
{
|
||||
public ImageInfo Info => _imageInfo;
|
||||
public string Name => "Basic Lisa Utility";
|
||||
|
||||
@@ -41,7 +41,7 @@ using Aaru.Helpers;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Blu
|
||||
public sealed partial class Blu
|
||||
{
|
||||
public bool Open(IFilter imageFilter)
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ using Aaru.CommonTypes.Exceptions;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Blu
|
||||
public sealed partial class Blu
|
||||
{
|
||||
public byte[] ReadDiskTag(MediaTagType tag) =>
|
||||
throw new FeatureUnsupportedImageException("Feature not supported by image format");
|
||||
|
||||
@@ -34,7 +34,7 @@ using System.Collections.Generic;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Blu
|
||||
public sealed partial class Blu
|
||||
{
|
||||
// TODO: Check tag checkums
|
||||
public bool? VerifySector(ulong sectorAddress) => null;
|
||||
|
||||
@@ -45,7 +45,7 @@ using Version = Aaru.CommonTypes.Interop.Version;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Blu
|
||||
public sealed partial class Blu
|
||||
{
|
||||
public bool Create(string path, MediaType mediaType, Dictionary<string, string> options, ulong sectors,
|
||||
uint sectorSize)
|
||||
@@ -66,7 +66,7 @@ namespace Aaru.DiscImages
|
||||
|
||||
if(!SupportedMediaTypes.Contains(mediaType))
|
||||
{
|
||||
ErrorMessage = $"Unsupport media format {mediaType}";
|
||||
ErrorMessage = $"Unsupported media format {mediaType}";
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -246,8 +246,7 @@ namespace Aaru.DiscImages
|
||||
return false;
|
||||
}
|
||||
|
||||
if(newTag == null)
|
||||
newTag = new byte[longSectorSize - 512];
|
||||
newTag ??= new byte[longSectorSize - 512];
|
||||
|
||||
_writingStream.Seek(longSectorSize + ((long)sectorAddress * longSectorSize), SeekOrigin.Begin);
|
||||
_writingStream.Write(data, 0, 512);
|
||||
@@ -351,8 +350,7 @@ namespace Aaru.DiscImages
|
||||
return false;
|
||||
}
|
||||
|
||||
if(newTag == null)
|
||||
newTag = new byte[longSectorSize - 512];
|
||||
newTag ??= new byte[longSectorSize - 512];
|
||||
|
||||
_writingStream.Seek(longSectorSize + ((long)sectorAddress * longSectorSize), SeekOrigin.Begin);
|
||||
_writingStream.Write(data, (int)(givenSectorSize * i), 512);
|
||||
|
||||
@@ -39,16 +39,15 @@ using Aaru.CommonTypes.Structs;
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
// TODO: Too many unknowns, plus a completely unknown footer, to make this writable
|
||||
public partial class BlindWrite4 : IOpticalMediaImage
|
||||
public sealed partial class BlindWrite4 : IOpticalMediaImage
|
||||
{
|
||||
List<Bw4TrackDescriptor> _bwTracks;
|
||||
IFilter _dataFilter, _subFilter;
|
||||
|
||||
Bw4Header _header;
|
||||
ImageInfo _imageInfo;
|
||||
Stream _imageStream;
|
||||
Dictionary<uint, ulong> _offsetmap;
|
||||
Dictionary<uint, byte> _trackFlags;
|
||||
Bw4Header _header;
|
||||
ImageInfo _imageInfo;
|
||||
Stream _imageStream;
|
||||
Dictionary<uint, ulong> _offsetmap;
|
||||
Dictionary<uint, byte> _trackFlags;
|
||||
|
||||
public BlindWrite4() => _imageInfo = new ImageInfo
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class BlindWrite4
|
||||
public sealed partial class BlindWrite4
|
||||
{
|
||||
/// <summary>"BLINDWRITE TOC FILE"</summary>
|
||||
readonly byte[] _bw4Signature =
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class BlindWrite4
|
||||
public sealed partial class BlindWrite4
|
||||
{
|
||||
enum Bw4TrackType : byte
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class BlindWrite4
|
||||
public sealed partial class BlindWrite4
|
||||
{
|
||||
public bool Identify(IFilter imageFilter)
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ using Schemas;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class BlindWrite4
|
||||
public sealed partial class BlindWrite4
|
||||
{
|
||||
public ImageInfo Info => _imageInfo;
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ using Session = Aaru.CommonTypes.Structs.Session;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class BlindWrite4
|
||||
public sealed partial class BlindWrite4
|
||||
{
|
||||
public bool Open(IFilter imageFilter)
|
||||
{
|
||||
|
||||
@@ -35,7 +35,7 @@ using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class BlindWrite4
|
||||
public sealed partial class BlindWrite4
|
||||
{
|
||||
struct Bw4Header
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ using Aaru.Checksums;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class BlindWrite4
|
||||
public sealed partial class BlindWrite4
|
||||
{
|
||||
public bool? VerifySector(ulong sectorAddress)
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ using Aaru.CommonTypes.Structs;
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
// TODO: Too many unknowns to make this writable
|
||||
public partial class BlindWrite5 : IOpticalMediaImage
|
||||
public sealed partial class BlindWrite5 : IOpticalMediaImage
|
||||
{
|
||||
byte[] _atip;
|
||||
byte[] _bca;
|
||||
@@ -52,16 +52,15 @@ namespace Aaru.DiscImages
|
||||
byte[] _dpm;
|
||||
List<DataFileCharacteristics> _filePaths;
|
||||
byte[] _fullToc;
|
||||
|
||||
Bw5Header _header;
|
||||
ImageInfo _imageInfo;
|
||||
Stream _imageStream;
|
||||
byte[] _mode2A;
|
||||
Dictionary<uint, ulong> _offsetmap;
|
||||
byte[] _pfi;
|
||||
byte[] _pma;
|
||||
Dictionary<uint, byte> _trackFlags;
|
||||
byte[] _unkBlock;
|
||||
Bw5Header _header;
|
||||
ImageInfo _imageInfo;
|
||||
Stream _imageStream;
|
||||
byte[] _mode2A;
|
||||
Dictionary<uint, ulong> _offsetmap;
|
||||
byte[] _pfi;
|
||||
byte[] _pma;
|
||||
Dictionary<uint, byte> _trackFlags;
|
||||
byte[] _unkBlock;
|
||||
|
||||
public BlindWrite5() => _imageInfo = new ImageInfo
|
||||
{
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class BlindWrite5
|
||||
public sealed partial class BlindWrite5
|
||||
{
|
||||
/// <summary>"BWT5 STREAM FOOT"</summary>
|
||||
readonly byte[] _bw5Footer =
|
||||
|
||||
@@ -35,7 +35,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
[SuppressMessage("ReSharper", "UnusedMember.Local")]
|
||||
public partial class BlindWrite5
|
||||
public sealed partial class BlindWrite5
|
||||
{
|
||||
enum Bw5TrackType : byte
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ using Aaru.Decoders.SCSI.MMC;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class BlindWrite5
|
||||
public sealed partial class BlindWrite5
|
||||
{
|
||||
static TrackType BlindWriteTrackTypeToTrackType(Bw5TrackType trackType)
|
||||
{
|
||||
|
||||
@@ -36,7 +36,7 @@ using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class BlindWrite5
|
||||
public sealed partial class BlindWrite5
|
||||
{
|
||||
public bool Identify(IFilter imageFilter)
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ using Schemas;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class BlindWrite5
|
||||
public sealed partial class BlindWrite5
|
||||
{
|
||||
public ImageInfo Info => _imageInfo;
|
||||
|
||||
|
||||
@@ -53,7 +53,7 @@ using Session = Aaru.CommonTypes.Structs.Session;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class BlindWrite5
|
||||
public sealed partial class BlindWrite5
|
||||
{
|
||||
public bool Open(IFilter imageFilter)
|
||||
{
|
||||
@@ -1245,9 +1245,10 @@ namespace Aaru.DiscImages
|
||||
public byte[] ReadSectors(ulong sectorAddress, uint length, uint track)
|
||||
{
|
||||
// TODO: Cross data files
|
||||
var aaruTrack = new Track();
|
||||
|
||||
aaruTrack.TrackSequence = 0;
|
||||
var aaruTrack = new Track
|
||||
{
|
||||
TrackSequence = 0
|
||||
};
|
||||
|
||||
foreach(Track bwTrack in Tracks.Where(bwTrack => bwTrack.TrackSequence == track))
|
||||
{
|
||||
@@ -1379,9 +1380,10 @@ namespace Aaru.DiscImages
|
||||
public byte[] ReadSectorsTag(ulong sectorAddress, uint length, uint track, SectorTagType tag)
|
||||
{
|
||||
// TODO: Cross data files
|
||||
var aaruTrack = new Track();
|
||||
|
||||
aaruTrack.TrackSequence = 0;
|
||||
var aaruTrack = new Track
|
||||
{
|
||||
TrackSequence = 0
|
||||
};
|
||||
|
||||
foreach(Track bwTrack in Tracks.Where(bwTrack => bwTrack.TrackSequence == track))
|
||||
{
|
||||
@@ -1818,9 +1820,10 @@ namespace Aaru.DiscImages
|
||||
public byte[] ReadSectorsLong(ulong sectorAddress, uint length, uint track)
|
||||
{
|
||||
// TODO: Cross data files
|
||||
var aaruTrack = new Track();
|
||||
|
||||
aaruTrack.TrackSequence = 0;
|
||||
var aaruTrack = new Track
|
||||
{
|
||||
TrackSequence = 0
|
||||
};
|
||||
|
||||
foreach(Track bwTrack in Tracks.Where(bwTrack => bwTrack.TrackSequence == track))
|
||||
{
|
||||
|
||||
@@ -37,7 +37,7 @@ using Aaru.Decoders.SCSI.MMC;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class BlindWrite5
|
||||
public sealed partial class BlindWrite5
|
||||
{
|
||||
[StructLayout(LayoutKind.Sequential, Pack = 1)]
|
||||
struct Bw5Header
|
||||
|
||||
@@ -36,7 +36,7 @@ using Aaru.Checksums;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class BlindWrite5
|
||||
public sealed partial class BlindWrite5
|
||||
{
|
||||
public bool? VerifySector(ulong sectorAddress)
|
||||
{
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace Aaru.DiscImages
|
||||
{
|
||||
// TODO: Doesn't support compositing from several files
|
||||
// TODO: Doesn't support silences that are not in files
|
||||
public partial class Cdrdao : IWritableOpticalImage
|
||||
public sealed partial class Cdrdao : IWritableOpticalImage
|
||||
{
|
||||
IFilter _cdrdaoFilter;
|
||||
StreamWriter _descriptorStream;
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Cdrdao
|
||||
public sealed partial class Cdrdao
|
||||
{
|
||||
/// <summary>Audio track, 2352 bytes/sector</summary>
|
||||
const string CDRDAO_TRACK_TYPE_AUDIO = "AUDIO";
|
||||
|
||||
@@ -35,7 +35,7 @@ using Aaru.CommonTypes.Structs;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Cdrdao
|
||||
public sealed partial class Cdrdao
|
||||
{
|
||||
static ushort CdrdaoTrackTypeToBytesPerSector(string trackType)
|
||||
{
|
||||
|
||||
@@ -38,7 +38,7 @@ using Aaru.Console;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Cdrdao
|
||||
public sealed partial class Cdrdao
|
||||
{
|
||||
public bool Identify(IFilter imageFilter)
|
||||
{
|
||||
|
||||
@@ -39,7 +39,7 @@ using Schemas;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Cdrdao
|
||||
public sealed partial class Cdrdao
|
||||
{
|
||||
public OpticalImageCapabilities OpticalCapabilities => OpticalImageCapabilities.CanStoreAudioTracks |
|
||||
OpticalImageCapabilities.CanStoreDataTracks |
|
||||
|
||||
@@ -47,7 +47,7 @@ using Session = Aaru.CommonTypes.Structs.Session;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Cdrdao
|
||||
public sealed partial class Cdrdao
|
||||
{
|
||||
public bool Open(IFilter imageFilter)
|
||||
{
|
||||
@@ -60,7 +60,7 @@ namespace Aaru.DiscImages
|
||||
{
|
||||
imageFilter.GetDataForkStream().Seek(0, SeekOrigin.Begin);
|
||||
_tocStream = new StreamReader(imageFilter.GetDataForkStream());
|
||||
bool intrack = false;
|
||||
bool inTrack = false;
|
||||
|
||||
// Initialize all RegExs
|
||||
var regexComment = new Regex(REGEX_COMMENT);
|
||||
@@ -103,12 +103,12 @@ namespace Aaru.DiscImages
|
||||
Comment = ""
|
||||
};
|
||||
|
||||
var currenttrack = new CdrdaoTrack();
|
||||
var currentTrack = new CdrdaoTrack();
|
||||
uint currentTrackNumber = 0;
|
||||
currenttrack.Indexes = new Dictionary<int, ulong>();
|
||||
currenttrack.Pregap = 0;
|
||||
currentTrack.Indexes = new Dictionary<int, ulong>();
|
||||
currentTrack.Pregap = 0;
|
||||
ulong currentSector = 0;
|
||||
int nextindex = 2;
|
||||
int nextIndex = 2;
|
||||
var commentBuilder = new StringBuilder();
|
||||
|
||||
_tocStream = new StreamReader(_cdrdaoFilter.GetDataForkStream());
|
||||
@@ -238,48 +238,48 @@ namespace Aaru.DiscImages
|
||||
lineNumber, matchTrack.Groups["type"].Value,
|
||||
matchTrack.Groups["subchan"].Value);
|
||||
|
||||
if(intrack)
|
||||
if(inTrack)
|
||||
{
|
||||
currentSector += currenttrack.Sectors;
|
||||
currentSector += currentTrack.Sectors;
|
||||
|
||||
if(currenttrack.Pregap != currenttrack.Sectors &&
|
||||
!currenttrack.Indexes.ContainsKey(1))
|
||||
currenttrack.Indexes.Add(1, currenttrack.StartSector + currenttrack.Pregap);
|
||||
if(currentTrack.Pregap != currentTrack.Sectors &&
|
||||
!currentTrack.Indexes.ContainsKey(1))
|
||||
currentTrack.Indexes.Add(1, currentTrack.StartSector + currentTrack.Pregap);
|
||||
|
||||
_discimage.Tracks.Add(currenttrack);
|
||||
_discimage.Tracks.Add(currentTrack);
|
||||
|
||||
currenttrack = new CdrdaoTrack
|
||||
currentTrack = new CdrdaoTrack
|
||||
{
|
||||
Indexes = new Dictionary<int, ulong>(),
|
||||
Pregap = 0
|
||||
};
|
||||
|
||||
nextindex = 2;
|
||||
nextIndex = 2;
|
||||
}
|
||||
|
||||
currentTrackNumber++;
|
||||
intrack = true;
|
||||
inTrack = true;
|
||||
|
||||
switch(matchTrack.Groups["type"].Value)
|
||||
{
|
||||
case "AUDIO":
|
||||
case "MODE1_RAW":
|
||||
case "MODE2_RAW":
|
||||
currenttrack.Bps = 2352;
|
||||
currentTrack.Bps = 2352;
|
||||
|
||||
break;
|
||||
case "MODE1":
|
||||
case "MODE2_FORM1":
|
||||
currenttrack.Bps = 2048;
|
||||
currentTrack.Bps = 2048;
|
||||
|
||||
break;
|
||||
case "MODE2_FORM2":
|
||||
currenttrack.Bps = 2324;
|
||||
currentTrack.Bps = 2324;
|
||||
|
||||
break;
|
||||
case "MODE2":
|
||||
case "MODE2_FORM_MIX":
|
||||
currenttrack.Bps = 2336;
|
||||
currentTrack.Bps = 2336;
|
||||
|
||||
break;
|
||||
default:
|
||||
@@ -291,10 +291,10 @@ namespace Aaru.DiscImages
|
||||
{
|
||||
case "": break;
|
||||
case "RW":
|
||||
currenttrack.Packedsubchannel = true;
|
||||
currentTrack.Packedsubchannel = true;
|
||||
goto case "RW_RAW";
|
||||
case "RW_RAW":
|
||||
currenttrack.Subchannel = true;
|
||||
currentTrack.Subchannel = true;
|
||||
|
||||
break;
|
||||
default:
|
||||
@@ -302,39 +302,39 @@ namespace Aaru.DiscImages
|
||||
NotSupportedException($"Track subchannel mode {matchTrack.Groups["subchan"].Value} is unsupported");
|
||||
}
|
||||
|
||||
currenttrack.Tracktype = matchTrack.Groups["type"].Value;
|
||||
currentTrack.Tracktype = matchTrack.Groups["type"].Value;
|
||||
|
||||
currenttrack.Sequence = currentTrackNumber;
|
||||
currenttrack.StartSector = currentSector;
|
||||
currentTrack.Sequence = currentTrackNumber;
|
||||
currentTrack.StartSector = currentSector;
|
||||
}
|
||||
else if(matchCopy.Success)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("CDRDAO plugin", "Found {1} COPY at line {0}", lineNumber,
|
||||
matchCopy.Groups["no"].Value);
|
||||
|
||||
currenttrack.FlagDcp |= intrack && matchCopy.Groups["no"].Value == "";
|
||||
currentTrack.FlagDcp |= inTrack && matchCopy.Groups["no"].Value == "";
|
||||
}
|
||||
else if(matchEmphasis.Success)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("CDRDAO plugin", "Found {1} PRE_EMPHASIS at line {0}", lineNumber,
|
||||
matchEmphasis.Groups["no"].Value);
|
||||
|
||||
currenttrack.FlagPre |= intrack && matchEmphasis.Groups["no"].Value == "";
|
||||
currentTrack.FlagPre |= inTrack && matchEmphasis.Groups["no"].Value == "";
|
||||
}
|
||||
else if(matchStereo.Success)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("CDRDAO plugin", "Found {1}_CHANNEL_AUDIO at line {0}", lineNumber,
|
||||
matchStereo.Groups["num"].Value);
|
||||
|
||||
currenttrack.Flag_4Ch |= intrack && matchStereo.Groups["num"].Value == "FOUR";
|
||||
currentTrack.Flag_4Ch |= inTrack && matchStereo.Groups["num"].Value == "FOUR";
|
||||
}
|
||||
else if(matchIsrc.Success)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("CDRDAO plugin", "Found ISRC \"{1}\" at line {0}", lineNumber,
|
||||
matchIsrc.Groups["isrc"].Value);
|
||||
|
||||
if(intrack)
|
||||
currenttrack.Isrc = matchIsrc.Groups["isrc"].Value;
|
||||
if(inTrack)
|
||||
currentTrack.Isrc = matchIsrc.Groups["isrc"].Value;
|
||||
}
|
||||
else if(matchIndex.Success)
|
||||
{
|
||||
@@ -346,35 +346,35 @@ namespace Aaru.DiscImages
|
||||
ulong nextIndexPos = (ulong.Parse(lengthString[0]) * 60 * 75) +
|
||||
(ulong.Parse(lengthString[1]) * 75) + ulong.Parse(lengthString[2]);
|
||||
|
||||
currenttrack.Indexes.Add(nextindex,
|
||||
nextIndexPos + currenttrack.Pregap + currenttrack.StartSector);
|
||||
currentTrack.Indexes.Add(nextIndex,
|
||||
nextIndexPos + currentTrack.Pregap + currentTrack.StartSector);
|
||||
}
|
||||
else if(matchPregap.Success)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("CDRDAO plugin", "Found START \"{1}\" at line {0}", lineNumber,
|
||||
matchPregap.Groups["address"].Value);
|
||||
|
||||
currenttrack.Indexes.Add(0, currenttrack.StartSector);
|
||||
currentTrack.Indexes.Add(0, currentTrack.StartSector);
|
||||
|
||||
if(matchPregap.Groups["address"].Value != "")
|
||||
{
|
||||
string[] lengthString = matchPregap.Groups["address"].Value.Split(':');
|
||||
|
||||
currenttrack.Pregap = (ulong.Parse(lengthString[0]) * 60 * 75) +
|
||||
currentTrack.Pregap = (ulong.Parse(lengthString[0]) * 60 * 75) +
|
||||
(ulong.Parse(lengthString[1]) * 75) + ulong.Parse(lengthString[2]);
|
||||
}
|
||||
else
|
||||
currenttrack.Pregap = currenttrack.Sectors;
|
||||
currentTrack.Pregap = currentTrack.Sectors;
|
||||
}
|
||||
else if(matchZeroPregap.Success)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("CDRDAO plugin", "Found PREGAP \"{1}\" at line {0}", lineNumber,
|
||||
matchZeroPregap.Groups["length"].Value);
|
||||
|
||||
currenttrack.Indexes.Add(0, currenttrack.StartSector);
|
||||
currentTrack.Indexes.Add(0, currentTrack.StartSector);
|
||||
string[] lengthString = matchZeroPregap.Groups["length"].Value.Split(':');
|
||||
|
||||
currenttrack.Pregap = (ulong.Parse(lengthString[0]) * 60 * 75) +
|
||||
currentTrack.Pregap = (ulong.Parse(lengthString[0]) * 60 * 75) +
|
||||
(ulong.Parse(lengthString[1]) * 75) + ulong.Parse(lengthString[2]);
|
||||
}
|
||||
else if(matchZeroData.Success)
|
||||
@@ -394,7 +394,7 @@ namespace Aaru.DiscImages
|
||||
|
||||
filtersList = new FiltersList();
|
||||
|
||||
currenttrack.Trackfile = new CdrdaoTrackFile
|
||||
currentTrack.Trackfile = new CdrdaoTrackFile
|
||||
{
|
||||
Datafilter =
|
||||
filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(),
|
||||
@@ -416,20 +416,20 @@ namespace Aaru.DiscImages
|
||||
(ulong.Parse(startString[1]) * 75) + ulong.Parse(startString[2]);
|
||||
}
|
||||
|
||||
currenttrack.Trackfile.Offset += startSectors * currenttrack.Bps;
|
||||
currentTrack.Trackfile.Offset += startSectors * currentTrack.Bps;
|
||||
|
||||
if(matchAudioFile.Groups["length"].Value != "")
|
||||
{
|
||||
string[] lengthString = matchAudioFile.Groups["length"].Value.Split(':');
|
||||
|
||||
currenttrack.Sectors = (ulong.Parse(lengthString[0]) * 60 * 75) +
|
||||
currentTrack.Sectors = (ulong.Parse(lengthString[0]) * 60 * 75) +
|
||||
(ulong.Parse(lengthString[1]) * 75) +
|
||||
ulong.Parse(lengthString[2]);
|
||||
}
|
||||
else
|
||||
currenttrack.Sectors =
|
||||
((ulong)currenttrack.Trackfile.Datafilter.GetDataForkLength() -
|
||||
currenttrack.Trackfile.Offset) / currenttrack.Bps;
|
||||
currentTrack.Sectors =
|
||||
((ulong)currentTrack.Trackfile.Datafilter.GetDataForkLength() -
|
||||
currentTrack.Trackfile.Offset) / currentTrack.Bps;
|
||||
}
|
||||
else if(matchFile.Success)
|
||||
{
|
||||
@@ -438,7 +438,7 @@ namespace Aaru.DiscImages
|
||||
|
||||
filtersList = new FiltersList();
|
||||
|
||||
currenttrack.Trackfile = new CdrdaoTrackFile
|
||||
currentTrack.Trackfile = new CdrdaoTrackFile
|
||||
{
|
||||
Datafilter =
|
||||
filtersList.GetFilter(Path.Combine(imageFilter.GetParentFolder(),
|
||||
@@ -454,22 +454,22 @@ namespace Aaru.DiscImages
|
||||
{
|
||||
string[] lengthString = matchFile.Groups["length"].Value.Split(':');
|
||||
|
||||
currenttrack.Sectors = (ulong.Parse(lengthString[0]) * 60 * 75) +
|
||||
currentTrack.Sectors = (ulong.Parse(lengthString[0]) * 60 * 75) +
|
||||
(ulong.Parse(lengthString[1]) * 75) +
|
||||
ulong.Parse(lengthString[2]);
|
||||
}
|
||||
else
|
||||
currenttrack.Sectors =
|
||||
((ulong)currenttrack.Trackfile.Datafilter.GetDataForkLength() -
|
||||
currenttrack.Trackfile.Offset) / currenttrack.Bps;
|
||||
currentTrack.Sectors =
|
||||
((ulong)currentTrack.Trackfile.Datafilter.GetDataForkLength() -
|
||||
currentTrack.Trackfile.Offset) / currentTrack.Bps;
|
||||
}
|
||||
else if(matchTitle.Success)
|
||||
{
|
||||
AaruConsole.DebugWriteLine("CDRDAO plugin", "Found TITLE \"{1}\" at line {0}", lineNumber,
|
||||
matchTitle.Groups["title"].Value);
|
||||
|
||||
if(intrack)
|
||||
currenttrack.Title = matchTitle.Groups["title"].Value;
|
||||
if(inTrack)
|
||||
currentTrack.Title = matchTitle.Groups["title"].Value;
|
||||
else
|
||||
_discimage.Title = matchTitle.Groups["title"].Value;
|
||||
}
|
||||
@@ -478,8 +478,8 @@ namespace Aaru.DiscImages
|
||||
AaruConsole.DebugWriteLine("CDRDAO plugin", "Found PERFORMER \"{1}\" at line {0}",
|
||||
lineNumber, matchPerformer.Groups["performer"].Value);
|
||||
|
||||
if(intrack)
|
||||
currenttrack.Performer = matchPerformer.Groups["performer"].Value;
|
||||
if(inTrack)
|
||||
currentTrack.Performer = matchPerformer.Groups["performer"].Value;
|
||||
else
|
||||
_discimage.Performer = matchPerformer.Groups["performer"].Value;
|
||||
}
|
||||
@@ -488,8 +488,8 @@ namespace Aaru.DiscImages
|
||||
AaruConsole.DebugWriteLine("CDRDAO plugin", "Found SONGWRITER \"{1}\" at line {0}",
|
||||
lineNumber, matchSongwriter.Groups["songwriter"].Value);
|
||||
|
||||
if(intrack)
|
||||
currenttrack.Songwriter = matchSongwriter.Groups["songwriter"].Value;
|
||||
if(inTrack)
|
||||
currentTrack.Songwriter = matchSongwriter.Groups["songwriter"].Value;
|
||||
else
|
||||
_discimage.Songwriter = matchSongwriter.Groups["songwriter"].Value;
|
||||
}
|
||||
@@ -498,8 +498,8 @@ namespace Aaru.DiscImages
|
||||
AaruConsole.DebugWriteLine("CDRDAO plugin", "Found COMPOSER \"{1}\" at line {0}",
|
||||
lineNumber, matchComposer.Groups["composer"].Value);
|
||||
|
||||
if(intrack)
|
||||
currenttrack.Composer = matchComposer.Groups["composer"].Value;
|
||||
if(inTrack)
|
||||
currentTrack.Composer = matchComposer.Groups["composer"].Value;
|
||||
else
|
||||
_discimage.Composer = matchComposer.Groups["composer"].Value;
|
||||
}
|
||||
@@ -508,8 +508,8 @@ namespace Aaru.DiscImages
|
||||
AaruConsole.DebugWriteLine("CDRDAO plugin", "Found ARRANGER \"{1}\" at line {0}",
|
||||
lineNumber, matchArranger.Groups["arranger"].Value);
|
||||
|
||||
if(intrack)
|
||||
currenttrack.Arranger = matchArranger.Groups["arranger"].Value;
|
||||
if(inTrack)
|
||||
currentTrack.Arranger = matchArranger.Groups["arranger"].Value;
|
||||
else
|
||||
_discimage.Arranger = matchArranger.Groups["arranger"].Value;
|
||||
}
|
||||
@@ -518,8 +518,8 @@ namespace Aaru.DiscImages
|
||||
AaruConsole.DebugWriteLine("CDRDAO plugin", "Found MESSAGE \"{1}\" at line {0}", lineNumber,
|
||||
matchMessage.Groups["message"].Value);
|
||||
|
||||
if(intrack)
|
||||
currenttrack.Message = matchMessage.Groups["message"].Value;
|
||||
if(inTrack)
|
||||
currentTrack.Message = matchMessage.Groups["message"].Value;
|
||||
else
|
||||
_discimage.Message = matchMessage.Groups["message"].Value;
|
||||
}
|
||||
@@ -528,7 +528,7 @@ namespace Aaru.DiscImages
|
||||
AaruConsole.DebugWriteLine("CDRDAO plugin", "Found DISC_ID \"{1}\" at line {0}", lineNumber,
|
||||
matchDiscId.Groups["discid"].Value);
|
||||
|
||||
if(!intrack)
|
||||
if(!inTrack)
|
||||
_discimage.DiskId = matchDiscId.Groups["discid"].Value;
|
||||
}
|
||||
else if(matchUpc.Success)
|
||||
@@ -536,7 +536,7 @@ namespace Aaru.DiscImages
|
||||
AaruConsole.DebugWriteLine("CDRDAO plugin", "Found UPC_EAN \"{1}\" at line {0}", lineNumber,
|
||||
matchUpc.Groups["catalog"].Value);
|
||||
|
||||
if(!intrack)
|
||||
if(!inTrack)
|
||||
_discimage.Barcode = matchUpc.Groups["catalog"].Value;
|
||||
}
|
||||
|
||||
@@ -559,13 +559,13 @@ namespace Aaru.DiscImages
|
||||
*/
|
||||
}
|
||||
|
||||
if(currenttrack.Sequence != 0)
|
||||
if(currentTrack.Sequence != 0)
|
||||
{
|
||||
if(currenttrack.Pregap != currenttrack.Sectors &&
|
||||
!currenttrack.Indexes.ContainsKey(1))
|
||||
currenttrack.Indexes.Add(1, currenttrack.StartSector + currenttrack.Pregap);
|
||||
if(currentTrack.Pregap != currentTrack.Sectors &&
|
||||
!currentTrack.Indexes.ContainsKey(1))
|
||||
currentTrack.Indexes.Add(1, currentTrack.StartSector + currentTrack.Pregap);
|
||||
|
||||
_discimage.Tracks.Add(currenttrack);
|
||||
_discimage.Tracks.Add(currentTrack);
|
||||
}
|
||||
|
||||
_discimage.Comment = commentBuilder.ToString();
|
||||
|
||||
@@ -37,7 +37,7 @@ using Aaru.CommonTypes.Interfaces;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Cdrdao
|
||||
public sealed partial class Cdrdao
|
||||
{
|
||||
[SuppressMessage("ReSharper", "NotAccessedField.Local")]
|
||||
struct CdrdaoTrackFile
|
||||
|
||||
@@ -36,7 +36,7 @@ using Aaru.Checksums;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Cdrdao
|
||||
public sealed partial class Cdrdao
|
||||
{
|
||||
public bool? VerifySector(ulong sectorAddress)
|
||||
{
|
||||
|
||||
@@ -43,7 +43,7 @@ using TrackType = Aaru.CommonTypes.Enums.TrackType;
|
||||
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
public partial class Cdrdao
|
||||
public sealed partial class Cdrdao
|
||||
{
|
||||
public bool Create(string path, MediaType mediaType, Dictionary<string, string> options, ulong sectors,
|
||||
uint sectorSize)
|
||||
@@ -61,7 +61,7 @@ namespace Aaru.DiscImages
|
||||
|
||||
if(_separateTracksWriting)
|
||||
{
|
||||
ErrorMessage = "Separate tracksnot yet implemented";
|
||||
ErrorMessage = "Separate tracks not yet implemented";
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -72,7 +72,7 @@ namespace Aaru.DiscImages
|
||||
|
||||
if(!SupportedMediaTypes.Contains(mediaType))
|
||||
{
|
||||
ErrorMessage = $"Unsupport media format {mediaType}";
|
||||
ErrorMessage = $"Unsupported media format {mediaType}";
|
||||
|
||||
return false;
|
||||
}
|
||||
@@ -87,7 +87,9 @@ namespace Aaru.DiscImages
|
||||
// TODO: Separate tracks
|
||||
try
|
||||
{
|
||||
_writingBaseName = Path.Combine(Path.GetDirectoryName(path), Path.GetFileNameWithoutExtension(path));
|
||||
_writingBaseName =
|
||||
Path.Combine(Path.GetDirectoryName(path) ?? "", Path.GetFileNameWithoutExtension(path));
|
||||
|
||||
_descriptorStream = new StreamWriter(path, false, Encoding.ASCII);
|
||||
}
|
||||
catch(IOException e)
|
||||
|
||||
@@ -40,7 +40,7 @@ using Aaru.Decoders.CD;
|
||||
namespace Aaru.DiscImages
|
||||
{
|
||||
// TODO: Implement track flags
|
||||
public partial class CdrWin : IWritableOpticalImage, IVerifiableImage
|
||||
public sealed partial class CdrWin : IWritableOpticalImage, IVerifiableImage
|
||||
{
|
||||
IFilter _cdrwinFilter;
|
||||
StreamReader _cueStream;
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user