mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Refactor] Invert if to reduce nesting.
This commit is contained in:
@@ -1042,29 +1042,27 @@ partial class Dump
|
||||
|
||||
sectorStatus[b] = SectorStatus.Dumped;
|
||||
|
||||
if(inData && _paranoia)
|
||||
{
|
||||
// Check valid sector
|
||||
CdChecksums.CheckCdSector(sector,
|
||||
out bool? correctEccP,
|
||||
out bool? correctEccQ,
|
||||
out bool? correctEdc);
|
||||
if(!inData || !_paranoia) continue;
|
||||
|
||||
if(correctEdc != true || correctEccP != true || correctEccQ != true)
|
||||
{
|
||||
sectorStatus[b] = SectorStatus.Errored;
|
||||
_resume.BadBlocks.Add(i + (ulong)b);
|
||||
// Check valid sector
|
||||
CdChecksums.CheckCdSector(sector,
|
||||
out bool? correctEccP,
|
||||
out bool? correctEccQ,
|
||||
out bool? correctEdc);
|
||||
|
||||
if(correctEdc != true)
|
||||
UpdateStatus?.Invoke(string.Format(UI.Incorrect_EDC_in_sector_0, i + (ulong)b));
|
||||
if(correctEdc == true && correctEccP == true && correctEccQ == true) continue;
|
||||
|
||||
if(correctEccP != true)
|
||||
UpdateStatus?.Invoke(string.Format(UI.Incorrect_ECC_P_in_sector_0, i + (ulong)b));
|
||||
sectorStatus[b] = SectorStatus.Errored;
|
||||
_resume.BadBlocks.Add(i + (ulong)b);
|
||||
|
||||
if(correctEccQ != true)
|
||||
UpdateStatus?.Invoke(string.Format(UI.Incorrect_ECC_Q_in_sector_0, i + (ulong)b));
|
||||
}
|
||||
}
|
||||
if(correctEdc != true)
|
||||
UpdateStatus?.Invoke(string.Format(UI.Incorrect_EDC_in_sector_0, i + (ulong)b));
|
||||
|
||||
if(correctEccP != true)
|
||||
UpdateStatus?.Invoke(string.Format(UI.Incorrect_ECC_P_in_sector_0, i + (ulong)b));
|
||||
|
||||
if(correctEccQ != true)
|
||||
UpdateStatus?.Invoke(string.Format(UI.Incorrect_ECC_Q_in_sector_0, i + (ulong)b));
|
||||
}
|
||||
|
||||
if(supportsLongSectors)
|
||||
|
||||
@@ -206,13 +206,12 @@ public sealed partial class MediaScan
|
||||
ibgLog.Write(i, 0);
|
||||
}
|
||||
|
||||
if(accumulatedSpeedMs >= 100)
|
||||
{
|
||||
currentSpeed = accumulatedSpeedSectors * blockSize / (1048576 * (accumulatedSpeedMs / 1000.0));
|
||||
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||
accumulatedSpeedMs = 0;
|
||||
accumulatedSpeedSectors = 0;
|
||||
}
|
||||
if(accumulatedSpeedMs < 100) continue;
|
||||
|
||||
currentSpeed = accumulatedSpeedSectors * blockSize / (1048576 * (accumulatedSpeedMs / 1000.0));
|
||||
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||
accumulatedSpeedMs = 0;
|
||||
accumulatedSpeedSectors = 0;
|
||||
}
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
@@ -341,16 +340,13 @@ public sealed partial class MediaScan
|
||||
ibgLog.Write(currentBlock, 0);
|
||||
}
|
||||
|
||||
if(accumulatedSpeedMs >= 100)
|
||||
{
|
||||
currentSpeed = accumulatedSpeedSectors *
|
||||
blockSize /
|
||||
(1048576 * (accumulatedSpeedMs / 1000.0));
|
||||
if(accumulatedSpeedMs < 100) continue;
|
||||
|
||||
ScanSpeed?.Invoke(currentBlock, currentSpeed * 1024);
|
||||
accumulatedSpeedMs = 0;
|
||||
accumulatedSpeedSectors = 0;
|
||||
}
|
||||
currentSpeed = accumulatedSpeedSectors * blockSize / (1048576 * (accumulatedSpeedMs / 1000.0));
|
||||
|
||||
ScanSpeed?.Invoke(currentBlock, currentSpeed * 1024);
|
||||
accumulatedSpeedMs = 0;
|
||||
accumulatedSpeedSectors = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -508,13 +508,12 @@ public sealed partial class MediaScan
|
||||
}
|
||||
}
|
||||
|
||||
if(accumulatedSpeedMs >= 100)
|
||||
{
|
||||
currentSpeed = accumulatedSpeedSectors * blockSize / (1048576 * (accumulatedSpeedMs / 1000.0));
|
||||
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||
accumulatedSpeedMs = 0;
|
||||
accumulatedSpeedSectors = 0;
|
||||
}
|
||||
if(accumulatedSpeedMs < 100) continue;
|
||||
|
||||
currentSpeed = accumulatedSpeedSectors * blockSize / (1048576 * (accumulatedSpeedMs / 1000.0));
|
||||
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||
accumulatedSpeedMs = 0;
|
||||
accumulatedSpeedSectors = 0;
|
||||
}
|
||||
|
||||
_scanStopwatch.Stop();
|
||||
@@ -624,13 +623,11 @@ public sealed partial class MediaScan
|
||||
ibgLog.Write(i, 0);
|
||||
}
|
||||
|
||||
if(accumulatedSpeedMs >= 100)
|
||||
{
|
||||
currentSpeed = accumulatedSpeedSectors * blockSize / (1048576 * (accumulatedSpeedMs / 1000.0));
|
||||
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||
accumulatedSpeedMs = 0;
|
||||
accumulatedSpeedSectors = 0;
|
||||
}
|
||||
if(accumulatedSpeedMs < 100) continue;
|
||||
currentSpeed = accumulatedSpeedSectors * blockSize / (1048576 * (accumulatedSpeedMs / 1000.0));
|
||||
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||
accumulatedSpeedMs = 0;
|
||||
accumulatedSpeedSectors = 0;
|
||||
}
|
||||
|
||||
_scanStopwatch.Stop();
|
||||
|
||||
@@ -343,13 +343,12 @@ public sealed partial class MediaScan
|
||||
ibgLog.Write(i, 0);
|
||||
}
|
||||
|
||||
if(accumulatedSpeedMs >= 100)
|
||||
{
|
||||
currentSpeed = accumulatedSpeedSectors * blockSize / (1048576 * (accumulatedSpeedMs / 1000.0));
|
||||
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||
accumulatedSpeedMs = 0;
|
||||
accumulatedSpeedSectors = 0;
|
||||
}
|
||||
if(accumulatedSpeedMs < 100) continue;
|
||||
|
||||
currentSpeed = accumulatedSpeedSectors * blockSize / (1048576 * (accumulatedSpeedMs / 1000.0));
|
||||
ScanSpeed?.Invoke(i, currentSpeed * 1024);
|
||||
accumulatedSpeedMs = 0;
|
||||
accumulatedSpeedSectors = 0;
|
||||
}
|
||||
|
||||
_scanStopwatch.Stop();
|
||||
|
||||
Reference in New Issue
Block a user