Use a block map in media scan in the GUI.

This commit is contained in:
2019-04-21 16:40:16 +01:00
parent b0efcddd25
commit 294ebe89dd
8 changed files with 97 additions and 41 deletions

View File

@@ -117,6 +117,7 @@ namespace DiscImageChef.Core.Devices.Scanning
{
UpdateStatus?.Invoke($"Reading {blocksToRead} sectors at a time.");
InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead);
mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
ibgLog = new IbgLog(ibgLogPath, ATA_PROFILE);
@@ -149,13 +150,13 @@ namespace DiscImageChef.Core.Devices.Scanning
else if(duration >= 3) results.B += blocksToRead;
else results.A += blocksToRead;
ScanTime?.Invoke(duration, blocksToRead);
ScanTime?.Invoke(i, duration);
mhddLog.Write(i, duration);
ibgLog.Write(i, currentSpeed * 1024);
}
else
{
ScanUnreadable?.Invoke(blocksToRead);
ScanUnreadable?.Invoke(i);
results.Errored += blocksToRead;
for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
@@ -207,6 +208,7 @@ namespace DiscImageChef.Core.Devices.Scanning
}
else
{
InitBlockMap?.Invoke(results.Blocks, blockSize, blocksToRead);
mhddLog = new MhddLog(mhddLogPath, dev, results.Blocks, blockSize, blocksToRead);
ibgLog = new IbgLog(ibgLogPath, ATA_PROFILE);
@@ -245,13 +247,13 @@ namespace DiscImageChef.Core.Devices.Scanning
else if(duration >= 3) results.B += blocksToRead;
else results.A += blocksToRead;
ScanTime?.Invoke(duration, blocksToRead);
ScanTime?.Invoke(currentBlock, duration);
mhddLog.Write(currentBlock, duration);
ibgLog.Write(currentBlock, currentSpeed * 1024);
}
else
{
ScanUnreadable?.Invoke(blocksToRead);
ScanUnreadable?.Invoke(currentBlock);
results.Errored += blocksToRead;
results.UnreadableSectors.Add(currentBlock);
mhddLog.Write(currentBlock, duration < 500 ? 65535 : duration);