Add PulseProgress event to ATA dumper.

This commit is contained in:
2019-04-19 18:06:18 +01:00
parent bcb3a370a5
commit 7228a523e7
4 changed files with 13 additions and 6 deletions

View File

@@ -352,7 +352,7 @@ namespace DiscImageChef.Core.Devices.Dumping
break;
}
DicConsole.Write("\rTrimming sector {0}", badSector);
PulseProgress?.Invoke($"\rTrimming sector {badSector}");
bool error = ataReader.ReadBlock(out cmdBuf, badSector, out duration);
@@ -390,9 +390,9 @@ namespace DiscImageChef.Core.Devices.Dumping
break;
}
DicConsole.Write("\rRetrying sector {0}, pass {1}, {3}{2}", badSector, pass,
forward ? "forward" : "reverse",
persistent ? "recovering partial data, " : "");
PulseProgress?.Invoke(string.Format("\rRetrying sector {0}, pass {1}, {3}{2}",
badSector, pass, forward ? "forward" : "reverse",
persistent ? "recovering partial data, " : ""));
bool error = ataReader.ReadBlock(out cmdBuf, badSector, out duration);
@@ -452,8 +452,8 @@ namespace DiscImageChef.Core.Devices.Dumping
if(currentSpeed < minSpeed && currentSpeed != 0) minSpeed = currentSpeed;
#pragma warning restore RECS0018 // Comparison of floating point numbers with equality operator
DicConsole.Write("\rReading cylinder {0} head {1} sector {2} ({3:F3} MiB/sec.)", cy,
hd, sc, currentSpeed);
PulseProgress
?.Invoke($"\rReading cylinder {cy} head {hd} sector {sc} ({currentSpeed:F3} MiB/sec.)");
bool error = ataReader.ReadChs(out cmdBuf, cy, hd, sc, out duration);

View File

@@ -6,5 +6,6 @@ namespace DiscImageChef.Core.Devices.Dumping
public event ErrorMessageHandler ErrorMessage;
public event ErrorMessageHandler StoppingErrorMessage;
public event UpdateProgressHandler UpdateProgress;
public event PulseProgressHandler PulseProgress;
}
}

View File

@@ -300,6 +300,7 @@ namespace DiscImageChef.Commands
dumper.ErrorMessage += Progress.ErrorMessage;
dumper.StoppingErrorMessage += Progress.ErrorMessage;
dumper.UpdateProgress += Progress.UpdateProgress;
dumper.PulseProgress += Progress.PulseProgress;
if(dev.IsUsb && dev.UsbVendorId == 0x054C &&
(dev.UsbProductId == 0x01C8 || dev.UsbProductId == 0x01C9 || dev.UsbProductId == 0x02D2))

View File

@@ -48,6 +48,11 @@ namespace DiscImageChef
DicConsole.Write("\r" + text);
}
internal static void PulseProgress(string text)
{
DicConsole.Write("\r" + text);
}
internal static void InitProgress2() { }
internal static void EndProgress2()