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="time">Time in milliseconds</param>
|
||||||
/// <param name="blocks">Number of blocks scanned</param>
|
/// <param name="blocks">Number of blocks scanned</param>
|
||||||
public delegate void ScanTimeHandler(double time, uint blocks);
|
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
|
else
|
||||||
{
|
{
|
||||||
|
ScanUnreadable?.Invoke(blocksToRead);
|
||||||
results.Errored += blocksToRead;
|
results.Errored += blocksToRead;
|
||||||
for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
|
for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
|
||||||
|
|
||||||
@@ -250,6 +251,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
ScanUnreadable?.Invoke(blocksToRead);
|
||||||
results.Errored += blocksToRead;
|
results.Errored += blocksToRead;
|
||||||
results.UnreadableSectors.Add(currentBlock);
|
results.UnreadableSectors.Add(currentBlock);
|
||||||
mhddLog.Write(currentBlock, duration < 500 ? 65535 : duration);
|
mhddLog.Write(currentBlock, duration < 500 ? 65535 : duration);
|
||||||
|
|||||||
@@ -69,5 +69,6 @@ namespace DiscImageChef.Core.Devices.Scanning
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public event PulseProgressHandler PulseProgress;
|
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
|
else
|
||||||
{
|
{
|
||||||
|
ScanUnreadable?.Invoke(blocksToRead);
|
||||||
results.Errored += blocksToRead;
|
results.Errored += blocksToRead;
|
||||||
for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
|
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.
|
// TODO: Separate errors on kind of errors.
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
ScanUnreadable?.Invoke(blocksToRead);
|
||||||
results.Errored += blocksToRead;
|
results.Errored += blocksToRead;
|
||||||
for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
|
for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
|
||||||
|
|
||||||
|
|||||||
@@ -186,6 +186,7 @@ namespace DiscImageChef.Core.Devices.Scanning
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
ScanUnreadable?.Invoke(blocksToRead);
|
||||||
results.Errored += blocksToRead;
|
results.Errored += blocksToRead;
|
||||||
for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
|
for(ulong b = i; b < i + blocksToRead; b++) results.UnreadableSectors.Add(b);
|
||||||
|
|
||||||
|
|||||||
@@ -101,6 +101,7 @@ namespace DiscImageChef.Gui.Forms
|
|||||||
localResults = new ScanResults();
|
localResults = new ScanResults();
|
||||||
scanner = new MediaScan(null, null, devicePath, dev);
|
scanner = new MediaScan(null, null, devicePath, dev);
|
||||||
scanner.ScanTime += OnScanTime;
|
scanner.ScanTime += OnScanTime;
|
||||||
|
scanner.ScanUnreadable += OnScanUnreadable;
|
||||||
ScanResults results = scanner.Scan();
|
ScanResults results = scanner.Scan();
|
||||||
|
|
||||||
Application.Instance.Invoke(() =>
|
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)
|
void OnScanTime(double time, uint blocks)
|
||||||
{
|
{
|
||||||
Application.Instance.Invoke(() =>
|
Application.Instance.Invoke(() =>
|
||||||
|
|||||||
Reference in New Issue
Block a user