mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
🐛No retry passes means do not retry errors, act so.
This commit is contained in:
@@ -74,16 +74,15 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
/// <param name="outputPath">Path to output file</param>
|
||||
/// <param name="formatOptions">Formats to pass to output file plugin</param>
|
||||
/// <exception cref="InvalidOperationException">If the resume file is invalid</exception>
|
||||
public static void Dump(Device dev, string devicePath, IWritableImage outputPlugin, ushort retryPasses,
|
||||
bool force, bool dumpRaw, bool persistent, bool stopOnError,
|
||||
ref Resume resume,
|
||||
ref
|
||||
DumpLog dumpLog, Encoding encoding, string outputPrefix,
|
||||
string outputPath,
|
||||
Dictionary<string, string>
|
||||
formatOptions, CICMMetadataType preSidecar, uint skip,
|
||||
bool
|
||||
nometadata)
|
||||
public static void Dump(Device dev, string devicePath,
|
||||
IWritableImage outputPlugin, ushort retryPasses,
|
||||
bool force, bool dumpRaw,
|
||||
bool persistent, bool stopOnError, ref Resume resume,
|
||||
ref DumpLog dumpLog, Encoding encoding,
|
||||
string outputPrefix, string outputPath,
|
||||
Dictionary<string, string> formatOptions, CICMMetadataType preSidecar,
|
||||
uint skip,
|
||||
bool nometadata)
|
||||
{
|
||||
bool aborted;
|
||||
|
||||
@@ -296,17 +295,16 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
DicConsole.WriteLine();
|
||||
mhddLog.Close();
|
||||
ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
blockSize *
|
||||
(double)(blocks + 1) / 1024 / (totalDuration / 1000), devicePath);
|
||||
dumpLog.WriteLine("Dump finished in {0} seconds.",
|
||||
(end - start).TotalSeconds);
|
||||
blockSize * (double)(blocks + 1) / 1024 /
|
||||
(totalDuration / 1000), devicePath);
|
||||
dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds);
|
||||
dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.",
|
||||
(double)blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));
|
||||
dumpLog.WriteLine("Average write speed {0:F3} KiB/sec.",
|
||||
(double)blockSize * (double)(blocks + 1) / 1024 / imageWriteDuration);
|
||||
|
||||
#region Error handling
|
||||
if(resume.BadBlocks.Count > 0 && !aborted)
|
||||
if(resume.BadBlocks.Count > 0 && !aborted && retryPasses > 0)
|
||||
{
|
||||
int pass = 0;
|
||||
bool forward = true;
|
||||
@@ -337,8 +335,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
outputPlugin.WriteSector(cmdBuf, badSector);
|
||||
dumpLog.WriteLine("Correctly retried block {0} in pass {1}.", badSector, pass);
|
||||
}
|
||||
else if(persistent)
|
||||
outputPlugin.WriteSector(cmdBuf, badSector);
|
||||
else if(persistent) outputPlugin.WriteSector(cmdBuf, badSector);
|
||||
}
|
||||
|
||||
if(pass < retryPasses && !aborted && resume.BadBlocks.Count > 0)
|
||||
@@ -426,10 +423,9 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
DicConsole.WriteLine();
|
||||
mhddLog.Close();
|
||||
ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
blockSize *
|
||||
(double)(blocks + 1) / 1024 / (totalDuration / 1000), devicePath);
|
||||
dumpLog.WriteLine("Dump finished in {0} seconds.",
|
||||
(end - start).TotalSeconds);
|
||||
blockSize * (double)(blocks + 1) / 1024 /
|
||||
(totalDuration / 1000), devicePath);
|
||||
dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds);
|
||||
dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.",
|
||||
(double)blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));
|
||||
dumpLog.WriteLine("Average write speed {0:F3} KiB/sec.",
|
||||
@@ -630,10 +626,8 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
}
|
||||
|
||||
if(dev.IsCompactFlash) Statistics.AddMedia(MediaType.CompactFlash, true);
|
||||
else if(dev.IsPcmcia)
|
||||
Statistics.AddMedia(MediaType.PCCardTypeI, true);
|
||||
else
|
||||
Statistics.AddMedia(MediaType.GENERIC_HDD, true);
|
||||
else if(dev.IsPcmcia) Statistics.AddMedia(MediaType.PCCardTypeI, true);
|
||||
else Statistics.AddMedia(MediaType.GENERIC_HDD, true);
|
||||
}
|
||||
else DicConsole.ErrorWriteLine("Unable to communicate with ATA device.");
|
||||
}
|
||||
|
||||
@@ -897,7 +897,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
#region Compact Disc Error handling
|
||||
// TODO: Pass 0 should be called differently, splitting, or something like that, because we are just
|
||||
// separating skipped good sectors from really bad sectors and it's getting too chatty on log there...
|
||||
if(resume.BadBlocks.Count > 0 && !aborted)
|
||||
if(resume.BadBlocks.Count > 0 && !aborted && retryPasses > 0)
|
||||
{
|
||||
int pass = 0;
|
||||
bool forward = true;
|
||||
|
||||
@@ -418,7 +418,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
(double)blockSize * (double)(blocks + 1) / 1024 / imageWriteDuration);
|
||||
|
||||
#region Error handling
|
||||
if(resume.BadBlocks.Count > 0 && !aborted)
|
||||
if(resume.BadBlocks.Count > 0 && !aborted && retryPasses > 0)
|
||||
{
|
||||
int pass = 0;
|
||||
bool forward = true;
|
||||
|
||||
@@ -72,14 +72,15 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
/// <param name="outputPath">Path to output file</param>
|
||||
/// <param name="formatOptions">Formats to pass to output file plugin</param>
|
||||
/// <exception cref="ArgumentException">If you asked to dump long sectors from a SCSI Streaming device</exception>
|
||||
public static void Dump(Device dev, string devicePath, IWritableImage outputPlugin, ushort retryPasses,
|
||||
bool force, bool dumpRaw, bool persistent, bool stopOnError,
|
||||
ref Resume resume,
|
||||
ref
|
||||
DumpLog dumpLog, Encoding encoding, string outputPrefix,
|
||||
string outputPath,
|
||||
Dictionary<string, string>
|
||||
formatOptions, CICMMetadataType preSidecar, uint skip, bool nometadata)
|
||||
public static void Dump(Device dev, string devicePath,
|
||||
IWritableImage outputPlugin, ushort retryPasses,
|
||||
bool force, bool dumpRaw,
|
||||
bool persistent, bool stopOnError, ref Resume resume,
|
||||
ref DumpLog dumpLog, Encoding encoding,
|
||||
string outputPrefix, string outputPath,
|
||||
Dictionary<string, string> formatOptions, CICMMetadataType preSidecar,
|
||||
uint skip,
|
||||
bool nometadata)
|
||||
{
|
||||
bool aborted;
|
||||
|
||||
@@ -125,8 +126,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
blocks = ecsdDecoded.SectorCount;
|
||||
blockSize = (uint)(ecsdDecoded.SectorSize == 1 ? 4096 : 512);
|
||||
if(ecsdDecoded.NativeSectorSize == 0) physicalBlockSize = 512;
|
||||
else if(ecsdDecoded.NativeSectorSize == 1)
|
||||
physicalBlockSize = 4096;
|
||||
else if(ecsdDecoded.NativeSectorSize == 1) physicalBlockSize = 4096;
|
||||
// Supposing it's high-capacity MMC if it has Extended CSD...
|
||||
byteAddressed = false;
|
||||
mediaTags.Add(MediaTagType.MMC_ExtendedCSD, null);
|
||||
@@ -140,8 +140,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
if(blocks == 0)
|
||||
{
|
||||
CSD csdDecoded = Decoders.MMC.Decoders.DecodeCSD(csd);
|
||||
blocks =
|
||||
(ulong)((csdDecoded.Size + 1) * Math.Pow(2, csdDecoded.SizeMultiplier + 2));
|
||||
blocks = (ulong)((csdDecoded.Size + 1) * Math.Pow(2, csdDecoded.SizeMultiplier + 2));
|
||||
blockSize = (uint)Math.Pow(2, csdDecoded.ReadBlockLength);
|
||||
}
|
||||
|
||||
@@ -164,8 +163,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
{
|
||||
Decoders.SecureDigital.CSD csdDecoded = Decoders.SecureDigital.Decoders.DecodeCSD(csd);
|
||||
blocks = (ulong)(csdDecoded.Structure == 0
|
||||
? (csdDecoded.Size + 1) *
|
||||
Math.Pow(2, csdDecoded.SizeMultiplier + 2)
|
||||
? (csdDecoded.Size + 1) * Math.Pow(2, csdDecoded.SizeMultiplier + 2)
|
||||
: (csdDecoded.Size + 1) * 1024);
|
||||
blockSize = (uint)Math.Pow(2, csdDecoded.ReadBlockLength);
|
||||
// Structure >=1 for SDHC/SDXC, so that's block addressed
|
||||
@@ -265,9 +263,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
MhddLog mhddLog = new MhddLog(outputPrefix + ".mhddlog.bin", dev, blocks, blockSize, blocksToRead);
|
||||
IbgLog ibgLog = new IbgLog(outputPrefix + ".ibg", SD_PROFILE);
|
||||
ret = outputPlugin.Create(outputPath,
|
||||
dev.Type == DeviceType.SecureDigital
|
||||
? MediaType.SecureDigital
|
||||
: MediaType.MMC,
|
||||
dev.Type == DeviceType.SecureDigital ? MediaType.SecureDigital : MediaType.MMC,
|
||||
formatOptions, blocks, blockSize);
|
||||
|
||||
// Cannot create image
|
||||
@@ -341,17 +337,16 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
DicConsole.WriteLine();
|
||||
mhddLog.Close();
|
||||
ibgLog.Close(dev, blocks, blockSize, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
blockSize * (double)(blocks + 1) /
|
||||
1024 / (totalDuration / 1000), devicePath);
|
||||
dumpLog.WriteLine("Dump finished in {0} seconds.",
|
||||
(end - start).TotalSeconds);
|
||||
blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000),
|
||||
devicePath);
|
||||
dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds);
|
||||
dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.",
|
||||
(double)blockSize * (double)(blocks + 1) / 1024 / (totalDuration / 1000));
|
||||
dumpLog.WriteLine("Average write speed {0:F3} KiB/sec.",
|
||||
(double)blockSize * (double)(blocks + 1) / 1024 / imageWriteDuration);
|
||||
|
||||
#region Error handling
|
||||
if(resume.BadBlocks.Count > 0 && !aborted)
|
||||
if(resume.BadBlocks.Count > 0 && !aborted && retryPasses > 0)
|
||||
{
|
||||
int pass = 0;
|
||||
bool forward = true;
|
||||
@@ -384,8 +379,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
outputPlugin.WriteSector(cmdBuf, badSector);
|
||||
dumpLog.WriteLine("Correctly retried block {0} in pass {1}.", badSector, pass);
|
||||
}
|
||||
else if(runningPersistent)
|
||||
outputPlugin.WriteSector(cmdBuf, badSector);
|
||||
else if(runningPersistent) outputPlugin.WriteSector(cmdBuf, badSector);
|
||||
}
|
||||
|
||||
if(pass < retryPasses && !aborted && resume.BadBlocks.Count > 0)
|
||||
|
||||
@@ -86,10 +86,11 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
bool persistent, bool stopOnError,
|
||||
Dictionary<MediaTagType, byte[]> mediaTags, ref MediaType dskType,
|
||||
ref Resume resume,
|
||||
ref DumpLog dumpLog,
|
||||
Encoding encoding, string outputPrefix, string outputPath,
|
||||
Dictionary<string, string> formatOptions,
|
||||
CICMMetadataType preSidecar, uint skip, bool nometadata)
|
||||
ref DumpLog dumpLog, Encoding encoding,
|
||||
string outputPrefix, string outputPath,
|
||||
Dictionary<string, string> formatOptions, CICMMetadataType preSidecar,
|
||||
uint skip,
|
||||
bool nometadata)
|
||||
{
|
||||
bool sense;
|
||||
ulong blocks;
|
||||
@@ -640,17 +641,16 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
DicConsole.WriteLine();
|
||||
mhddLog.Close();
|
||||
ibgLog.Close(dev, blocks, BLOCK_SIZE, (end - start).TotalSeconds, currentSpeed * 1024,
|
||||
BLOCK_SIZE * (double)(blocks + 1) /
|
||||
1024 / (totalDuration / 1000), devicePath);
|
||||
dumpLog.WriteLine("Dump finished in {0} seconds.",
|
||||
(end - start).TotalSeconds);
|
||||
BLOCK_SIZE * (double)(blocks + 1) / 1024 / (totalDuration / 1000),
|
||||
devicePath);
|
||||
dumpLog.WriteLine("Dump finished in {0} seconds.", (end - start).TotalSeconds);
|
||||
dumpLog.WriteLine("Average dump speed {0:F3} KiB/sec.",
|
||||
(double)BLOCK_SIZE * (double)(blocks + 1) / 1024 / (totalDuration / 1000));
|
||||
dumpLog.WriteLine("Average write speed {0:F3} KiB/sec.",
|
||||
(double)BLOCK_SIZE * (double)(blocks + 1) / 1024 / imageWriteDuration);
|
||||
|
||||
#region Error handling
|
||||
if(resume.BadBlocks.Count > 0 && !aborted)
|
||||
if(resume.BadBlocks.Count > 0 && !aborted && retryPasses > 0)
|
||||
{
|
||||
List<ulong> tmpList = new List<ulong>();
|
||||
|
||||
@@ -692,8 +692,7 @@ namespace DiscImageChef.Core.Devices.Dumping
|
||||
outputPlugin.WriteSector(readBuffer, badSector);
|
||||
dumpLog.WriteLine("Correctly retried block {0} in pass {1}.", badSector, pass);
|
||||
}
|
||||
else if(runningPersistent)
|
||||
outputPlugin.WriteSector(readBuffer, badSector);
|
||||
else if(runningPersistent) outputPlugin.WriteSector(readBuffer, badSector);
|
||||
}
|
||||
|
||||
if(pass < retryPasses && !aborted && resume.BadBlocks.Count > 0)
|
||||
|
||||
Reference in New Issue
Block a user