mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Update media scan GUI error times via events.
This commit is contained in:
@@ -109,4 +109,10 @@ namespace DiscImageChef.Core
|
||||
/// <param name="time">Time in milliseconds</param>
|
||||
/// <param name="blocks">Number of blocks scanned</param>
|
||||
public delegate void ScanTimeHandler(double time, uint blocks);
|
||||
|
||||
/// <summary>
|
||||
/// Specified a number of blocks could not be read on scan
|
||||
/// </summary>
|
||||
/// <param name="blocks">Number of blocks scanned</param>
|
||||
public delegate void ScanUnreadableHandler(uint blocks);
|
||||
}
|
||||
@@ -155,6 +155,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
}
|
||||
else
|
||||
{
|
||||
ScanUnreadable?.Invoke(blocksToRead);
|
||||
results.Errored += blocksToRead;
|
||||
for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
|
||||
|
||||
@@ -250,6 +251,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
}
|
||||
else
|
||||
{
|
||||
ScanUnreadable?.Invoke(blocksToRead);
|
||||
results.Errored += blocksToRead;
|
||||
results.UnreadableSectors.Add(currentBlock);
|
||||
mhddLog.Write(currentBlock, duration < 500 ? 65535 : duration);
|
||||
|
||||
@@ -68,6 +68,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
/// Event raised to update the status of an undeterminate progress bar
|
||||
/// </summary>
|
||||
public event PulseProgressHandler PulseProgress;
|
||||
public event ScanTimeHandler ScanTime;
|
||||
public event ScanTimeHandler ScanTime;
|
||||
public event ScanUnreadableHandler ScanUnreadable;
|
||||
}
|
||||
}
|
||||
@@ -345,6 +345,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
}
|
||||
else
|
||||
{
|
||||
ScanUnreadable?.Invoke(blocksToRead);
|
||||
results.Errored += blocksToRead;
|
||||
for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
|
||||
|
||||
@@ -417,6 +418,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
// TODO: Separate errors on kind of errors.
|
||||
else
|
||||
{
|
||||
ScanUnreadable?.Invoke(blocksToRead);
|
||||
results.Errored += blocksToRead;
|
||||
for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
|
||||
|
||||
|
||||
@@ -186,6 +186,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
||||
}
|
||||
else
|
||||
{
|
||||
ScanUnreadable?.Invoke(blocksToRead);
|
||||
results.Errored += blocksToRead;
|
||||
for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
|
||||
|
||||
|
||||
@@ -98,9 +98,10 @@ namespace DiscImageChef.Gui.Forms
|
||||
|
||||
Statistics.AddDevice(dev);
|
||||
|
||||
localResults = new ScanResults();
|
||||
scanner = new MediaScan(null, null, devicePath, dev);
|
||||
scanner.ScanTime += OnScanTime;
|
||||
localResults = new ScanResults();
|
||||
scanner = new MediaScan(null, null, devicePath, dev);
|
||||
scanner.ScanTime += OnScanTime;
|
||||
scanner.ScanUnreadable += OnScanUnreadable;
|
||||
ScanResults results = scanner.Scan();
|
||||
|
||||
Application.Instance.Invoke(() =>
|
||||
@@ -147,6 +148,15 @@ namespace DiscImageChef.Gui.Forms
|
||||
});
|
||||
}
|
||||
|
||||
void OnScanUnreadable(uint blocks)
|
||||
{
|
||||
Application.Instance.Invoke(() =>
|
||||
{
|
||||
localResults.Errored += blocks;
|
||||
lblUnreadableSectors.Text = $"{localResults.Errored} sectors could not be read.";
|
||||
});
|
||||
}
|
||||
|
||||
void OnScanTime(double time, uint blocks)
|
||||
{
|
||||
Application.Instance.Invoke(() =>
|
||||
|
||||
Reference in New Issue
Block a user