diff --git a/Aaru.Checksums b/Aaru.Checksums
index 843291076..b2612422a 160000
--- a/Aaru.Checksums
+++ b/Aaru.Checksums
@@ -1 +1 @@
-Subproject commit 843291076cd12156aaa09040ecc511eee64db4bd
+Subproject commit b2612422abea422c4b07419b45fd032b5b11801f
diff --git a/Aaru.CommonTypes b/Aaru.CommonTypes
index 1fe6700b1..1389baf6b 160000
--- a/Aaru.CommonTypes
+++ b/Aaru.CommonTypes
@@ -1 +1 @@
-Subproject commit 1fe6700b1143a9054ea48903a6a1647060971674
+Subproject commit 1389baf6b2742edf9e90beb83905571185524817
diff --git a/Aaru.Compression/AppleRle.cs b/Aaru.Compression/AppleRle.cs
index 2a39176f5..0581d6e95 100644
--- a/Aaru.Compression/AppleRle.cs
+++ b/Aaru.Compression/AppleRle.cs
@@ -42,9 +42,8 @@ namespace Aaru.Compression
readonly Stream _inStream;
int _count;
bool _nextA; // true if A, false if B
-
- byte _repeatedByteA, _repeatedByteB;
- bool _repeatMode; // true if we're repeating, false if we're just copying
+ byte _repeatedByteA, _repeatedByteB;
+ bool _repeatMode; // true if we're repeating, false if we're just copying
public AppleRle(Stream stream)
{
diff --git a/Aaru.Core/Checksum.cs b/Aaru.Core/Checksum.cs
index 89ea07ed6..0ed228e56 100644
--- a/Aaru.Core/Checksum.cs
+++ b/Aaru.Core/Checksum.cs
@@ -51,7 +51,7 @@ namespace Aaru.Core
}
/// Checksums and hashes data, with different algorithms multithreaded
- public class Checksum
+ public sealed class Checksum
{
readonly IChecksum _adler32Ctx;
readonly IChecksum _crc16Ctx;
diff --git a/Aaru.Core/DataFile.cs b/Aaru.Core/DataFile.cs
index 60763367b..ea884932e 100644
--- a/Aaru.Core/DataFile.cs
+++ b/Aaru.Core/DataFile.cs
@@ -37,8 +37,9 @@ using Aaru.Console;
namespace Aaru.Core
{
/// Abstracts a datafile with a block based interface
- [SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global")]
- public class DataFile
+ [SuppressMessage("ReSharper", "UnusedMethodReturnValue.Global"),
+ SuppressMessage("ReSharper", "UnusedMember.Global")]
+ public sealed class DataFile
{
readonly FileStream _dataFs;
diff --git a/Aaru.Core/Delegates.cs b/Aaru.Core/Delegates.cs
index 46a442efa..a200e150b 100644
--- a/Aaru.Core/Delegates.cs
+++ b/Aaru.Core/Delegates.cs
@@ -32,7 +32,7 @@
namespace Aaru.Core
{
- /// Initializates a progress indicator (e.g. makes a progress bar visible)
+ /// Initializes a progress indicator (e.g. makes a progress bar visible)
public delegate void InitProgressHandler();
/// Updates a progress indicator with text
@@ -41,10 +41,10 @@ namespace Aaru.Core
/// Pulses a progress indicator with indeterminate boundaries
public delegate void PulseProgressHandler(string text);
- /// Uninitializates a progress indicator (e.g. adds a newline to the console)
+ /// Uninitializes a progress indicator (e.g. adds a newline to the console)
public delegate void EndProgressHandler();
- /// Initializates a secondary progress indicator (e.g. makes a progress bar visible)
+ /// Initializes a secondary progress indicator (e.g. makes a progress bar visible)
public delegate void InitProgressHandler2();
/// Updates a secondary progress indicator with text
@@ -53,10 +53,10 @@ namespace Aaru.Core
/// Pulses a secondary progress indicator with indeterminate boundaries
public delegate void PulseProgressHandler2(string text);
- /// Uninitializates a secondary progress indicator (e.g. adds a newline to the console)
+ /// Uninitializes a secondary progress indicator (e.g. adds a newline to the console)
public delegate void EndProgressHandler2();
- /// Initializates two progress indicators (e.g. makes a progress bar visible)
+ /// Initializes two progress indicators (e.g. makes a progress bar visible)
public delegate void InitTwoProgressHandler();
/// Updates two progress indicators with text
@@ -66,7 +66,7 @@ namespace Aaru.Core
/// Pulses a progress indicator with indeterminate boundaries
public delegate void PulseTwoProgressHandler(string text, string text2);
- /// Uninitializates a progress indicator (e.g. adds a newline to the console)
+ /// Uninitializes a progress indicator (e.g. adds a newline to the console)
public delegate void EndTwoProgressHandler();
/// Updates a status indicator
diff --git a/Aaru.Core/Devices/Dumping/ATA.cs b/Aaru.Core/Devices/Dumping/ATA.cs
index 84769e92b..772f41db7 100644
--- a/Aaru.Core/Devices/Dumping/ATA.cs
+++ b/Aaru.Core/Devices/Dumping/ATA.cs
@@ -54,7 +54,7 @@ namespace Aaru.Core.Devices.Dumping
public partial class Dump
{
/// Dumps an ATA device
- public void Ata()
+ void Ata()
{
if(_dumpRaw)
{
@@ -96,7 +96,7 @@ namespace Aaru.Core.Devices.Dumping
double maxSpeed = double.MinValue;
double minSpeed = double.MaxValue;
- // Initializate reader
+ // Initialize reader
UpdateStatus?.Invoke("Initializing reader.");
_dumpLog.WriteLine("Initializing reader.");
var ataReader = new Reader(_dev, timeout, ataIdentify, _errorLog);
@@ -114,7 +114,7 @@ namespace Aaru.Core.Devices.Dumping
}
uint blockSize = ataReader.LogicalBlockSize;
- uint physicalsectorsize = ataReader.PhysicalBlockSize;
+ uint physicalSectorSize = ataReader.PhysicalBlockSize;
if(ataReader.FindReadCommand())
{
@@ -145,7 +145,7 @@ namespace Aaru.Core.Devices.Dumping
UpdateStatus?.Invoke($"Device can read {blocksToRead} blocks at a time.");
UpdateStatus?.Invoke($"Device reports {blockSize} bytes per logical block.");
- UpdateStatus?.Invoke($"Device reports {physicalsectorsize} bytes per physical block.");
+ UpdateStatus?.Invoke($"Device reports {physicalSectorSize} bytes per physical block.");
_dumpLog.WriteLine("Device reports {0} blocks ({1} bytes).", blocks, blocks * blockSize);
_dumpLog.WriteLine("Device reports {0} cylinders {1} heads {2} sectors per track.", cylinders,
@@ -153,7 +153,7 @@ namespace Aaru.Core.Devices.Dumping
_dumpLog.WriteLine("Device can read {0} blocks at a time.", blocksToRead);
_dumpLog.WriteLine("Device reports {0} bytes per logical block.", blockSize);
- _dumpLog.WriteLine("Device reports {0} bytes per physical block.", physicalsectorsize);
+ _dumpLog.WriteLine("Device reports {0} bytes per physical block.", physicalSectorSize);
bool removable = !_dev.IsCompactFlash &&
ataId.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.Removable);
@@ -277,15 +277,13 @@ namespace Aaru.Core.Devices.Dumping
if(blocks - i < blocksToRead)
blocksToRead = (byte)(blocks - i);
- #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
if(currentSpeed > maxSpeed &&
- currentSpeed != 0)
+ currentSpeed > 0)
maxSpeed = currentSpeed;
if(currentSpeed < minSpeed &&
- currentSpeed != 0)
+ currentSpeed > 0)
minSpeed = currentSpeed;
- #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
UpdateProgress?.Invoke($"Reading sector {i} of {blocks} ({currentSpeed:F3} MiB/sec.)",
(long)i, (long)blocks);
@@ -396,8 +394,8 @@ namespace Aaru.Core.Devices.Dumping
EndProgress?.Invoke();
end = DateTime.UtcNow;
- UpdateStatus?.Invoke($"Trimmming finished in {(end - start).TotalSeconds} seconds.");
- _dumpLog.WriteLine("Trimmming finished in {0} seconds.", (end - start).TotalSeconds);
+ UpdateStatus?.Invoke($"Trimming finished in {(end - start).TotalSeconds} seconds.");
+ _dumpLog.WriteLine("Trimming finished in {0} seconds.", (end - start).TotalSeconds);
}
#endregion Trimming
@@ -493,15 +491,13 @@ namespace Aaru.Core.Devices.Dumping
break;
}
- #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
if(currentSpeed > maxSpeed &&
- currentSpeed != 0)
+ currentSpeed > 0)
maxSpeed = currentSpeed;
if(currentSpeed < minSpeed &&
- currentSpeed != 0)
+ currentSpeed > 0)
minSpeed = currentSpeed;
- #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
PulseProgress?.
Invoke($"Reading cylinder {cy} head {hd} sector {sc} ({currentSpeed:F3} MiB/sec.)");
@@ -698,32 +694,33 @@ namespace Aaru.Core.Devices.Dumping
switch(tuple.Code)
{
case TupleCodes.CISTPL_MANFID:
- ManufacturerIdentificationTuple manfid =
+ ManufacturerIdentificationTuple manufacturerId =
CIS.DecodeManufacturerIdentificationTuple(tuple);
- if(manfid != null)
+ if(manufacturerId != null)
{
- sidecar.BlockMedia[0].PCMCIA.ManufacturerCode = manfid.ManufacturerID;
+ sidecar.BlockMedia[0].PCMCIA.ManufacturerCode =
+ manufacturerId.ManufacturerID;
- sidecar.BlockMedia[0].PCMCIA.CardCode = manfid.CardID;
+ sidecar.BlockMedia[0].PCMCIA.CardCode = manufacturerId.CardID;
sidecar.BlockMedia[0].PCMCIA.ManufacturerCodeSpecified = true;
- sidecar.BlockMedia[0].PCMCIA.CardCodeSpecified = true;
+ sidecar.BlockMedia[0].PCMCIA.CardCodeSpecified = true;
}
break;
case TupleCodes.CISTPL_VERS_1:
- Level1VersionTuple vers = CIS.DecodeLevel1VersionTuple(tuple);
+ Level1VersionTuple version = CIS.DecodeLevel1VersionTuple(tuple);
- if(vers != null)
+ if(version != null)
{
- sidecar.BlockMedia[0].PCMCIA.Manufacturer = vers.Manufacturer;
- sidecar.BlockMedia[0].PCMCIA.ProductName = vers.Product;
+ sidecar.BlockMedia[0].PCMCIA.Manufacturer = version.Manufacturer;
+ sidecar.BlockMedia[0].PCMCIA.ProductName = version.Product;
sidecar.BlockMedia[0].PCMCIA.Compliance =
- $"{vers.MajorVersion}.{vers.MinorVersion}";
+ $"{version.MajorVersion}.{version.MinorVersion}";
sidecar.BlockMedia[0].PCMCIA.AdditionalInformation =
- vers.AdditionalInformation;
+ version.AdditionalInformation;
}
break;
@@ -788,7 +785,7 @@ namespace Aaru.Core.Devices.Dumping
sidecar.BlockMedia[0].DiskSubType = subType;
sidecar.BlockMedia[0].Interface = "ATA";
sidecar.BlockMedia[0].LogicalBlocks = blocks;
- sidecar.BlockMedia[0].PhysicalBlockSize = physicalsectorsize;
+ sidecar.BlockMedia[0].PhysicalBlockSize = physicalSectorSize;
sidecar.BlockMedia[0].LogicalBlockSize = blockSize;
sidecar.BlockMedia[0].Manufacturer = _dev.Manufacturer;
sidecar.BlockMedia[0].Model = _dev.Model;
diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs b/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs
index a0b307f19..133ffaba6 100644
--- a/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs
+++ b/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs
@@ -149,13 +149,13 @@ namespace Aaru.Core.Devices.Dumping
{
ulong sectorSpeedStart = 0; // Used to calculate correct speed
DateTime timeSpeedStart = DateTime.UtcNow; // Time of start for speed calculation
- bool sense = true; // Sense indicator
- byte[] cmdBuf = null; // Data buffer
- byte[] senseBuf = null; // Sense buffer
- double cmdDuration = 0; // Command execution time
- const uint sectorSize = 2352; // Full sector size
- Track firstTrack = tracks.FirstOrDefault(t => t.TrackSequence == 1);
- uint blocksToRead = 0; // How many sectors to read at once
+ bool sense; // Sense indicator
+ byte[] cmdBuf; // Data buffer
+ byte[] senseBuf; // Sense buffer
+ double cmdDuration; // Command execution time
+ const uint sectorSize = 2352; // Full sector size
+ Track firstTrack = tracks.FirstOrDefault(t => t.TrackSequence == 1);
+ uint blocksToRead; // How many sectors to read at once
if(firstTrack is null)
return;
@@ -200,21 +200,14 @@ namespace Aaru.Core.Devices.Dumping
}
}
- #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
-
- // ReSharper disable CompareOfFloatsByEqualityOperator
if(currentSpeed > maxSpeed &&
- currentSpeed != 0)
+ currentSpeed > 0)
maxSpeed = currentSpeed;
if(currentSpeed < minSpeed &&
- currentSpeed != 0)
+ currentSpeed > 0)
minSpeed = currentSpeed;
- // ReSharper restore CompareOfFloatsByEqualityOperator
-
- #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
-
UpdateProgress?.Invoke($"Reading sector {i} of {blocks} ({currentSpeed:F3} MiB/sec.)", (long)i,
(long)blocks);
diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs
index 1299d8b64..849e38f28 100644
--- a/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs
+++ b/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs
@@ -98,12 +98,12 @@ namespace Aaru.Core.Devices.Dumping
{
ulong sectorSpeedStart = 0; // Used to calculate correct speed
DateTime timeSpeedStart = DateTime.UtcNow; // Time of start for speed calculation
- uint blocksToRead = 0; // How many sectors to read at once
- bool sense = true; // Sense indicator
- byte[] cmdBuf = null; // Data buffer
- byte[] senseBuf = null; // Sense buffer
- double cmdDuration = 0; // Command execution time
- const uint sectorSize = 2352; // Full sector size
+ uint blocksToRead; // How many sectors to read at once
+ bool sense = true; // Sense indicator
+ byte[] cmdBuf = null; // Data buffer
+ byte[] senseBuf = null; // Sense buffer
+ double cmdDuration = 0; // Command execution time
+ const uint sectorSize = 2352; // Full sector size
newTrim = false;
PlextorSubchannel supportedPlextorSubchannel;
@@ -259,21 +259,14 @@ namespace Aaru.Core.Devices.Dumping
crossingLeadOut = false;
}
- #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
-
- // ReSharper disable CompareOfFloatsByEqualityOperator
if(currentSpeed > maxSpeed &&
- currentSpeed != 0)
+ currentSpeed > 0)
maxSpeed = currentSpeed;
if(currentSpeed < minSpeed &&
- currentSpeed != 0)
+ currentSpeed > 0)
minSpeed = currentSpeed;
- // ReSharper restore CompareOfFloatsByEqualityOperator
-
- #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
-
UpdateProgress?.Invoke($"Reading sector {i} of {blocks} ({currentSpeed:F3} MiB/sec.)", (long)i,
(long)blocks);
diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs
index c31b1b86d..9c9ade761 100644
--- a/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs
+++ b/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs
@@ -59,7 +59,7 @@ namespace Aaru.Core.Devices.Dumping
/// Implement dumping Compact Discs
// TODO: Barcode
- partial class Dump
+ sealed partial class Dump
{
/// Dumps a compact disc
void CompactDisc()
@@ -386,8 +386,8 @@ namespace Aaru.Core.Devices.Dumping
}
}
- tracks = GetCdTracks(ref blockSize, _dev, dskType, _dumpLog, _force, out lastSector, leadOutStarts,
- mediaTags, StoppingErrorMessage, subType, out toc, trackFlags, UpdateStatus);
+ tracks = GetCdTracks(ref blockSize, _dev, _dumpLog, _force, out lastSector, leadOutStarts, mediaTags,
+ StoppingErrorMessage, subType, out toc, trackFlags, UpdateStatus);
if(tracks is null)
return;
@@ -456,11 +456,8 @@ namespace Aaru.Core.Devices.Dumping
ReadCdTags(ref dskType, mediaTags, out sessions, out firstTrackLastSession);
// Check if output format supports all disc tags we have retrieved so far
- foreach(MediaTagType tag in mediaTags.Keys)
+ foreach(MediaTagType tag in mediaTags.Keys.Where(tag => !_outputPlugin.SupportedMediaTags.Contains(tag)))
{
- if(_outputPlugin.SupportedMediaTags.Contains(tag))
- continue;
-
if(_force)
{
_dumpLog.WriteLine("Output format does not support {0}, continuing...", tag);
@@ -480,14 +477,9 @@ namespace Aaru.Core.Devices.Dumping
UpdateStatus?.Invoke("Solving lead-outs...");
foreach(KeyValuePair leadOuts in leadOutStarts)
- for(int i = 0; i < tracks.Length; i++)
- {
- if(tracks[i].TrackSession != leadOuts.Key)
- continue;
-
- if(tracks[i].TrackEndSector >= (ulong)leadOuts.Value)
- tracks[i].TrackEndSector = (ulong)leadOuts.Value - 1;
- }
+ foreach(Track trk in tracks.Where(trk => trk.TrackSession == leadOuts.Key).
+ Where(trk => trk.TrackEndSector >= (ulong)leadOuts.Value))
+ trk.TrackEndSector = (ulong)leadOuts.Value - 1;
var dataExtents = new ExtentsULong();
@@ -540,31 +532,27 @@ namespace Aaru.Core.Devices.Dumping
}
// Check mode for tracks
- for(int t = 0; t < tracks.Length; t++)
+ foreach(Track trk in tracks.Where(t => t.TrackType != TrackType.Audio))
{
if(!readcd)
{
- tracks[t].TrackType = TrackType.CdMode1;
+ trk.TrackType = TrackType.CdMode1;
continue;
}
- if(tracks[t].TrackType == TrackType.Audio)
- continue;
+ _dumpLog.WriteLine("Checking mode for track {0}...", trk.TrackSequence);
+ UpdateStatus?.Invoke($"Checking mode for track {trk.TrackSequence}...");
- _dumpLog.WriteLine("Checking mode for track {0}...", tracks[t].TrackSequence);
- UpdateStatus?.Invoke($"Checking mode for track {tracks[t].TrackSequence}...");
-
- sense = _dev.ReadCd(out cmdBuf, out _, (uint)(tracks[t].TrackStartSector + tracks[t].TrackPregap),
- blockSize, 1, MmcSectorTypes.AllTypes, false, false, true,
- MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, supportedSubchannel,
- _dev.Timeout, out _);
+ sense = _dev.ReadCd(out cmdBuf, out _, (uint)(trk.TrackStartSector + trk.TrackPregap), blockSize, 1,
+ MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true,
+ MmcErrorField.None, supportedSubchannel, _dev.Timeout, out _);
if(sense)
{
- _dumpLog.WriteLine("Unable to guess mode for track {0}, continuing...", tracks[t].TrackSequence);
+ _dumpLog.WriteLine("Unable to guess mode for track {0}, continuing...", trk.TrackSequence);
- UpdateStatus?.Invoke($"Unable to guess mode for track {tracks[t].TrackSequence}, continuing...");
+ UpdateStatus?.Invoke($"Unable to guess mode for track {trk.TrackSequence}, continuing...");
continue;
}
@@ -572,34 +560,34 @@ namespace Aaru.Core.Devices.Dumping
switch(cmdBuf[15])
{
case 1:
- UpdateStatus?.Invoke($"Track {tracks[t].TrackSequence} is MODE1");
- _dumpLog.WriteLine("Track {0} is MODE1", tracks[t].TrackSequence);
- tracks[t].TrackType = TrackType.CdMode1;
+ UpdateStatus?.Invoke($"Track {trk.TrackSequence} is MODE1");
+ _dumpLog.WriteLine("Track {0} is MODE1", trk.TrackSequence);
+ trk.TrackType = TrackType.CdMode1;
break;
case 2:
if(dskType == MediaType.CDI ||
dskType == MediaType.CDIREADY)
{
- UpdateStatus?.Invoke($"Track {tracks[t].TrackSequence} is MODE2");
- _dumpLog.WriteLine("Track {0} is MODE2", tracks[t].TrackSequence);
- tracks[t].TrackType = TrackType.CdMode2Formless;
+ UpdateStatus?.Invoke($"Track {trk.TrackSequence} is MODE2");
+ _dumpLog.WriteLine("Track {0} is MODE2", trk.TrackSequence);
+ trk.TrackType = TrackType.CdMode2Formless;
break;
}
if((cmdBuf[0x012] & 0x20) == 0x20) // mode 2 form 2
{
- UpdateStatus?.Invoke($"Track {tracks[t].TrackSequence} is MODE2 FORM 2");
- _dumpLog.WriteLine("Track {0} is MODE2 FORM 2", tracks[t].TrackSequence);
- tracks[t].TrackType = TrackType.CdMode2Form2;
+ UpdateStatus?.Invoke($"Track {trk.TrackSequence} is MODE2 FORM 2");
+ _dumpLog.WriteLine("Track {0} is MODE2 FORM 2", trk.TrackSequence);
+ trk.TrackType = TrackType.CdMode2Form2;
break;
}
- UpdateStatus?.Invoke($"Track {tracks[t].TrackSequence} is MODE2 FORM 1");
- _dumpLog.WriteLine("Track {0} is MODE2 FORM 1", tracks[t].TrackSequence);
- tracks[t].TrackType = TrackType.CdMode2Form1;
+ UpdateStatus?.Invoke($"Track {trk.TrackSequence} is MODE2 FORM 1");
+ _dumpLog.WriteLine("Track {0} is MODE2 FORM 1", trk.TrackSequence);
+ trk.TrackType = TrackType.CdMode2Form1;
// These media type specifications do not legally allow mode 2 tracks to be present
if(dskType == MediaType.CDROM ||
@@ -609,8 +597,8 @@ namespace Aaru.Core.Devices.Dumping
break;
default:
- UpdateStatus?.Invoke($"Track {tracks[t].TrackSequence} is unknown mode {cmdBuf[15]}");
- _dumpLog.WriteLine("Track {0} is unknown mode {1}", tracks[t].TrackSequence, cmdBuf[15]);
+ UpdateStatus?.Invoke($"Track {trk.TrackSequence} is unknown mode {cmdBuf[15]}");
+ _dumpLog.WriteLine("Track {0} is unknown mode {1}", trk.TrackSequence, cmdBuf[15]);
break;
}
@@ -1066,9 +1054,9 @@ namespace Aaru.Core.Devices.Dumping
return;
}
- sense = _dev.ReadCd(out cmdBuf, out _, 0, 2352, 1, MmcSectorTypes.AllTypes, false, false, true,
- MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None,
- _dev.Timeout, out _);
+ _dev.ReadCd(out cmdBuf, out _, 0, 2352, 1, MmcSectorTypes.AllTypes, false, false, true,
+ MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None, MmcSubchannel.None, _dev.Timeout,
+ out _);
hiddenData = IsData(cmdBuf);
diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs
index 430edee00..a7a406fc8 100644
--- a/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs
+++ b/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs
@@ -120,10 +120,10 @@ namespace Aaru.Core.Devices.Dumping
Modes.DecodeMode10(cmdBuf, PeripheralDeviceTypes.MultiMediaDevice);
if(dcMode10?.Pages != null)
- foreach(Modes.ModePage modePage in dcMode10.Value.Pages)
- if(modePage.Page == 0x01 &&
- modePage.Subpage == 0x00)
- currentModePage = modePage;
+ foreach(Modes.ModePage modePage in dcMode10.Value.Pages.Where(modePage =>
+ modePage.Page == 0x01 &&
+ modePage.Subpage == 0x00))
+ currentModePage = modePage;
}
}
else
@@ -131,10 +131,10 @@ namespace Aaru.Core.Devices.Dumping
Modes.DecodedMode? dcMode6 = Modes.DecodeMode6(cmdBuf, PeripheralDeviceTypes.MultiMediaDevice);
if(dcMode6?.Pages != null)
- foreach(Modes.ModePage modePage in dcMode6.Value.Pages)
- if(modePage.Page == 0x01 &&
- modePage.Subpage == 0x00)
- currentModePage = modePage;
+ foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage =>
+ modePage.Page == 0x01 &&
+ modePage.Subpage == 0x00))
+ currentModePage = modePage;
}
if(currentModePage == null)
@@ -544,9 +544,9 @@ namespace Aaru.Core.Devices.Dumping
int[] tmpArray = _resume.BadSubchannels.ToArray();
- for(int i = 0; i < tmpArray.Length; i++)
+ foreach(int bs in tmpArray)
{
- uint badSector = (uint)tmpArray[i];
+ uint badSector = (uint)bs;
Track track = tracks.OrderBy(t => t.TrackStartSector).
LastOrDefault(t => badSector >= t.TrackStartSector);
@@ -592,7 +592,7 @@ namespace Aaru.Core.Devices.Dumping
_fixSubchannel, _fixSubchannelCrc, _dumpLog, UpdateStatus,
smallestPregapLbaPerTrack);
- if(subchannelExtents.Contains(tmpArray[i]))
+ if(subchannelExtents.Contains(bs))
continue;
UpdateStatus?.Invoke($"Correctly retried sector {badSector} subchannel in pass {pass}.");
diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs b/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs
index 117af4083..29f60dabe 100644
--- a/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs
+++ b/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs
@@ -106,20 +106,14 @@ namespace Aaru.Core.Devices.Dumping
double cmdDuration = 0;
- #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
-
- // ReSharper disable CompareOfFloatsByEqualityOperator
if(currentSpeed > maxSpeed &&
- currentSpeed != 0)
+ currentSpeed > 0)
maxSpeed = currentSpeed;
if(currentSpeed < minSpeed &&
- currentSpeed != 0)
+ currentSpeed > 0)
minSpeed = currentSpeed;
- // ReSharper restore CompareOfFloatsByEqualityOperator
- #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
-
PulseProgress?.Invoke($"Reading sector {i} at lead-out ({currentSpeed:F3} MiB/sec.)");
if(readcd)
@@ -287,22 +281,15 @@ namespace Aaru.Core.Devices.Dumping
double cmdDuration = 0;
- #pragma warning disable RECS0018 // Comparison of floating point numbers with equality operator
-
- // ReSharper disable CompareOfFloatsByEqualityOperator
if(currentSpeed > maxSpeed &&
- currentSpeed != 0)
+ currentSpeed > 0)
maxSpeed = currentSpeed;
if(currentSpeed < minSpeed &&
- currentSpeed != 0)
+ currentSpeed > 0)
minSpeed = currentSpeed;
- // ReSharper restore CompareOfFloatsByEqualityOperator
- #pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
-
- PulseProgress?.Invoke(string.Format("Reading sector {0} at lead-out ({1:F3} MiB/sec.)", i,
- currentSpeed));
+ PulseProgress?.Invoke($"Reading sector {i} at lead-out ({currentSpeed:F3} MiB/sec.)");
if(readcd)
{
diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs
index 64b7ef395..e27889981 100644
--- a/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs
+++ b/Aaru.Core/Devices/Dumping/CompactDisc/Pregap.cs
@@ -81,10 +81,13 @@ namespace Aaru.Core.Devices.Dumping
PulseProgress?.
Invoke($"Trying to read first track pregap sector {firstTrackPregapBlock} ({currentSpeed:F3} MiB/sec.)");
+ // ReSharper disable IntVariableOverflowInUncheckedContext
sense = _dev.ReadCd(out cmdBuf, out _, (uint)firstTrackPregapBlock, blockSize, 1,
MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true,
MmcErrorField.None, supportedSubchannel, _dev.Timeout, out cmdDuration);
+ // ReSharper restore IntVariableOverflowInUncheckedContext
+
if(!sense &&
!_dev.Error)
{
@@ -170,8 +173,8 @@ namespace Aaru.Core.Devices.Dumping
}
// Initialize the dictionary
- for(int i = 0; i < tracks.Length; i++)
- pregaps[tracks[i].TrackSequence] = 0;
+ foreach(Track t in tracks)
+ pregaps[t.TrackSequence] = 0;
for(int t = 0; t < tracks.Length; t++)
{
@@ -560,28 +563,28 @@ namespace Aaru.Core.Devices.Dumping
}
}
- for(int i = 0; i < tracks.Length; i++)
+ foreach(Track trk in tracks)
{
- tracks[i].TrackPregap = (ulong)pregaps[tracks[i].TrackSequence];
+ trk.TrackPregap = (ulong)pregaps[trk.TrackSequence];
if(dumping)
{
// Minus five, to ensure dumping will fix if there is a pregap LBA 0
int red = 5;
- while(tracks[i].TrackPregap > 0 &&
- red > 0)
+ while(trk.TrackPregap > 0 &&
+ red > 0)
{
- tracks[i].TrackPregap--;
+ trk.TrackPregap--;
red--;
}
}
- tracks[i].TrackStartSector -= tracks[i].TrackPregap;
+ trk.TrackStartSector -= trk.TrackPregap;
#if DEBUG
- dumpLog?.WriteLine($"Track {tracks[i].TrackSequence} pregap is {tracks[i].TrackPregap} sectors");
- updateStatus?.Invoke($"Track {tracks[i].TrackSequence} pregap is {tracks[i].TrackPregap} sectors");
+ dumpLog?.WriteLine($"Track {trk.TrackSequence} pregap is {trk.TrackPregap} sectors");
+ updateStatus?.Invoke($"Track {trk.TrackSequence} pregap is {trk.TrackPregap} sectors");
#endif
}
}
diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Tracks.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Tracks.cs
index 5c09bbddc..bd8c98018 100644
--- a/Aaru.Core/Devices/Dumping/CompactDisc/Tracks.cs
+++ b/Aaru.Core/Devices/Dumping/CompactDisc/Tracks.cs
@@ -33,7 +33,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using Aaru.CommonTypes;
using Aaru.CommonTypes.Enums;
using Aaru.CommonTypes.Structs;
using Aaru.Core.Logging;
@@ -51,7 +50,6 @@ namespace Aaru.Core.Devices.Dumping
/// Reads the TOC, processes it, returns the track list and last sector
/// Size of the read sector in bytes
/// Device
- /// Disc type
/// Dump log
/// Force dump enabled
/// Last sector number
@@ -63,18 +61,18 @@ namespace Aaru.Core.Devices.Dumping
/// Track flags
/// Update status handler
/// List of tracks
- public static Track[] GetCdTracks(ref uint blockSize, Device dev, MediaType dskType, DumpLog dumpLog,
- bool force, out long lastSector, Dictionary leadOutStarts,
+ public static Track[] GetCdTracks(ref uint blockSize, Device dev, DumpLog dumpLog, bool force,
+ out long lastSector, Dictionary leadOutStarts,
Dictionary mediaTags,
ErrorMessageHandler stoppingErrorMessage, TrackSubchannelType subType,
out FullTOC.CDFullTOC? toc, Dictionary trackFlags,
UpdateStatusHandler updateStatus)
{
- byte[] cmdBuf = null; // Data buffer
- const uint sectorSize = 2352; // Full sector size
- bool sense = true; // Sense indicator
- List