mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
Redo Reformat and cleanup.
Rider EAP was having a bug interpreting .editorconfig that didn't generate the code style as we wanted. This is now done with Rider-stable.
This commit is contained in:
@@ -182,8 +182,7 @@ public partial class Dump
|
||||
_dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision,
|
||||
_private, _force);
|
||||
|
||||
if(currentTry == null ||
|
||||
extents == null)
|
||||
if(currentTry == null || extents == null)
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Could_not_process_resume_file_not_continuing);
|
||||
|
||||
@@ -249,7 +248,8 @@ public partial class Dump
|
||||
_dumpLog.WriteLine(outputFormat.ErrorMessage);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing +
|
||||
Environment.NewLine + outputFormat.ErrorMessage);
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -316,19 +316,15 @@ public partial class Dump
|
||||
if(blocks - i < blocksToRead)
|
||||
blocksToRead = (byte)(blocks - i);
|
||||
|
||||
if(currentSpeed > maxSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed > maxSpeed && currentSpeed > 0)
|
||||
maxSpeed = currentSpeed;
|
||||
|
||||
if(currentSpeed < minSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed < minSpeed && currentSpeed > 0)
|
||||
minSpeed = currentSpeed;
|
||||
|
||||
UpdateProgress?.
|
||||
Invoke(
|
||||
string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks,
|
||||
ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)blocks);
|
||||
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)blocks);
|
||||
|
||||
bool error = ataReader.ReadBlocks(out cmdBuf, i, blocksToRead, out duration, out _, out _);
|
||||
|
||||
@@ -401,19 +397,18 @@ public partial class Dump
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalDuration.Milliseconds()).
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalDuration.Milliseconds()).
|
||||
Humanize());
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Average_write_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(imageWriteDuration.Seconds()).Humanize()));
|
||||
Per(imageWriteDuration.Seconds()).
|
||||
Humanize()));
|
||||
|
||||
#region Trimming
|
||||
|
||||
if(_resume.BadBlocks.Count > 0 &&
|
||||
!_aborted &&
|
||||
_trim &&
|
||||
newTrim)
|
||||
if(_resume.BadBlocks.Count > 0 && !_aborted && _trim && newTrim)
|
||||
{
|
||||
_trimStopwatch.Restart();
|
||||
UpdateStatus?.Invoke(Localization.Core.Trimming_skipped_sectors);
|
||||
@@ -463,9 +458,7 @@ public partial class Dump
|
||||
|
||||
#region Error handling
|
||||
|
||||
if(_resume.BadBlocks.Count > 0 &&
|
||||
!_aborted &&
|
||||
_retryPasses > 0)
|
||||
if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0)
|
||||
{
|
||||
var pass = 1;
|
||||
var forward = true;
|
||||
@@ -489,10 +482,8 @@ public partial class Dump
|
||||
{
|
||||
PulseProgress?.Invoke(_persistent
|
||||
? string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Retrying_sector_0_pass_1_recovering_partial_data_forward,
|
||||
badSector, pass)
|
||||
Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_forward,
|
||||
badSector, pass)
|
||||
: string.
|
||||
Format(Localization.Core.Retrying_sector_0_pass_1_forward,
|
||||
badSector, pass));
|
||||
@@ -501,10 +492,8 @@ public partial class Dump
|
||||
{
|
||||
PulseProgress?.Invoke(_persistent
|
||||
? string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Retrying_sector_0_pass_1_recovering_partial_data_reverse,
|
||||
badSector, pass)
|
||||
Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_reverse,
|
||||
badSector, pass)
|
||||
: string.
|
||||
Format(Localization.Core.Retrying_sector_0_pass_1_reverse,
|
||||
badSector, pass));
|
||||
@@ -533,9 +522,7 @@ public partial class Dump
|
||||
outputFormat.WriteSector(cmdBuf, badSector);
|
||||
}
|
||||
|
||||
if(pass < _retryPasses &&
|
||||
!_aborted &&
|
||||
_resume.BadBlocks.Count > 0)
|
||||
if(pass < _retryPasses && !_aborted && _resume.BadBlocks.Count > 0)
|
||||
{
|
||||
pass++;
|
||||
forward = !forward;
|
||||
@@ -601,18 +588,17 @@ public partial class Dump
|
||||
break;
|
||||
}
|
||||
|
||||
if(currentSpeed > maxSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed > maxSpeed && currentSpeed > 0)
|
||||
maxSpeed = currentSpeed;
|
||||
|
||||
if(currentSpeed < minSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed < minSpeed && currentSpeed > 0)
|
||||
minSpeed = currentSpeed;
|
||||
|
||||
PulseProgress?.
|
||||
Invoke(string.Format(Localization.Core.Reading_cylinder_0_head_1_sector_2_3, cy, hd,
|
||||
sc,
|
||||
ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).
|
||||
ByteSize.FromMegabytes(currentSpeed).
|
||||
Per(_oneSecond).
|
||||
Humanize()));
|
||||
|
||||
bool error =
|
||||
@@ -627,8 +613,7 @@ public partial class Dump
|
||||
mhddLog.Write(currentBlock, duration);
|
||||
ibgLog.Write(currentBlock, currentSpeed * 1024);
|
||||
|
||||
outputFormat.WriteSector(cmdBuf,
|
||||
(ulong)((cy * heads + hd) * sectors + (sc - 1)));
|
||||
outputFormat.WriteSector(cmdBuf, (ulong)((cy * heads + hd) * sectors + (sc - 1)));
|
||||
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
extents.Add(currentBlock);
|
||||
@@ -692,11 +677,13 @@ public partial class Dump
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalDuration.Milliseconds()).
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalDuration.Milliseconds()).
|
||||
Humanize());
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Average_write_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).Per(imageWriteDuration.Seconds()).
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(imageWriteDuration.Seconds()).
|
||||
Humanize());
|
||||
}
|
||||
|
||||
@@ -714,7 +701,8 @@ public partial class Dump
|
||||
|
||||
if(!outputFormat.SetImageInfo(metadata))
|
||||
{
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine +
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata +
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
}
|
||||
|
||||
@@ -745,12 +733,10 @@ public partial class Dump
|
||||
|
||||
outputFormat.WriteMediaTag(ataIdentify, MediaTagType.ATA_IDENTIFY);
|
||||
|
||||
if(_dev.IsUsb &&
|
||||
_dev.UsbDescriptors != null)
|
||||
if(_dev.IsUsb && _dev.UsbDescriptors != null)
|
||||
outputFormat.WriteMediaTag(_dev.UsbDescriptors, MediaTagType.USB_Descriptors);
|
||||
|
||||
if(_dev.IsPcmcia &&
|
||||
_dev.Cis != null)
|
||||
if(_dev.IsPcmcia && _dev.Cis != null)
|
||||
outputFormat.WriteMediaTag(_dev.Cis, MediaTagType.PCMCIA_CIS);
|
||||
|
||||
if(_metadata)
|
||||
@@ -791,8 +777,7 @@ public partial class Dump
|
||||
sidecar = _preSidecar;
|
||||
}
|
||||
|
||||
if(_dev.IsUsb &&
|
||||
_dev.UsbDescriptors != null)
|
||||
if(_dev.IsUsb && _dev.UsbDescriptors != null)
|
||||
{
|
||||
_dumpLog.WriteLine(Localization.Core.Reading_USB_descriptors);
|
||||
UpdateStatus?.Invoke(Localization.Core.Reading_USB_descriptors);
|
||||
@@ -810,8 +795,7 @@ public partial class Dump
|
||||
};
|
||||
}
|
||||
|
||||
if(_dev.IsPcmcia &&
|
||||
_dev.Cis != null)
|
||||
if(_dev.IsPcmcia && _dev.Cis != null)
|
||||
{
|
||||
_dumpLog.WriteLine(Localization.Core.Reading_PCMCIA_CIS);
|
||||
UpdateStatus?.Invoke(Localization.Core.Reading_PCMCIA_CIS);
|
||||
@@ -900,7 +884,8 @@ public partial class Dump
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalChkDuration.Milliseconds()).Humanize());
|
||||
Per(totalChkDuration.Milliseconds()).
|
||||
Humanize());
|
||||
|
||||
List<(ulong start, string type)> filesystems = new();
|
||||
|
||||
@@ -915,10 +900,11 @@ public partial class Dump
|
||||
if(filesystems.Count > 0)
|
||||
{
|
||||
foreach(var filesystem in filesystems.Select(o => new
|
||||
{
|
||||
o.start,
|
||||
o.type
|
||||
}).Distinct())
|
||||
{
|
||||
o.start,
|
||||
o.type
|
||||
}).
|
||||
Distinct())
|
||||
{
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Found_filesystem_0_at_sector_1,
|
||||
filesystem.type, filesystem.start));
|
||||
@@ -944,9 +930,7 @@ public partial class Dump
|
||||
|
||||
sidecar.BlockMedias[0].Size = blocks * blockSize;
|
||||
|
||||
if(cylinders > 0 &&
|
||||
heads > 0 &&
|
||||
sectors > 0)
|
||||
if(cylinders > 0 && heads > 0 && sectors > 0)
|
||||
{
|
||||
sidecar.BlockMedias[0].Cylinders = cylinders;
|
||||
sidecar.BlockMedias[0].Heads = heads;
|
||||
@@ -969,18 +953,17 @@ public partial class Dump
|
||||
UpdateStatus?.Invoke("");
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.Format(
|
||||
Localization.Core.
|
||||
Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalDuration.Milliseconds()).Humanize()));
|
||||
Per(totalDuration.Milliseconds()).
|
||||
Humanize()));
|
||||
|
||||
if(maxSpeed > 0)
|
||||
{
|
||||
|
||||
@@ -59,7 +59,10 @@ partial class Dump
|
||||
if(sector?.Length != 2352)
|
||||
return false;
|
||||
|
||||
byte[] syncMark = { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 };
|
||||
byte[] syncMark =
|
||||
{
|
||||
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00
|
||||
};
|
||||
|
||||
var testMark = new byte[12];
|
||||
Array.Copy(sector, 0, testMark, 0, 12);
|
||||
@@ -79,7 +82,10 @@ partial class Dump
|
||||
if(sector?.Length != 2352)
|
||||
return false;
|
||||
|
||||
byte[] syncMark = { 0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00 };
|
||||
byte[] syncMark =
|
||||
{
|
||||
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x00
|
||||
};
|
||||
|
||||
var testMark = new byte[12];
|
||||
|
||||
@@ -202,19 +208,15 @@ partial class Dump
|
||||
}
|
||||
}
|
||||
|
||||
if(currentSpeed > maxSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed > maxSpeed && currentSpeed > 0)
|
||||
maxSpeed = currentSpeed;
|
||||
|
||||
if(currentSpeed < minSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed < minSpeed && currentSpeed > 0)
|
||||
minSpeed = currentSpeed;
|
||||
|
||||
UpdateProgress?.
|
||||
Invoke(
|
||||
string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks,
|
||||
ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)blocks);
|
||||
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)blocks);
|
||||
|
||||
sense = _dev.ReadCd(out cmdBuf, out senseBuf, firstSectorToRead, blockSize, blocksToRead,
|
||||
MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true,
|
||||
@@ -230,10 +232,8 @@ partial class Dump
|
||||
for(uint r = 0; r < _maximumReadable; r++)
|
||||
{
|
||||
UpdateProgress?.
|
||||
Invoke(
|
||||
string.Format(Localization.Core.Reading_sector_0_of_1_2, i + r, blocks,
|
||||
ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i + r, (long)blocks);
|
||||
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i + r, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i + r, (long)blocks);
|
||||
|
||||
sense = _dev.ReadCd(out cmdBuf, out senseBuf, (uint)(i + r), blockSize, (uint)sectorsForOffset + 1,
|
||||
MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true,
|
||||
@@ -241,8 +241,7 @@ partial class Dump
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
mhddLog.Write(i + r, cmdDuration);
|
||||
ibgLog.Write(i + r, currentSpeed * 1024);
|
||||
@@ -325,8 +324,7 @@ partial class Dump
|
||||
|
||||
_speedStopwatch.Restart();
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
if(cdiReadyReadAsAudio)
|
||||
{
|
||||
|
||||
@@ -159,12 +159,10 @@ partial class Dump
|
||||
{
|
||||
if(j > (ulong)lastSector)
|
||||
{
|
||||
if(!failedCrossingLeadOut &&
|
||||
!inData)
|
||||
if(!failedCrossingLeadOut && !inData)
|
||||
blocksToRead += (uint)sectorsForOffset;
|
||||
|
||||
if(sectorsForOffset > 0 &&
|
||||
!inData)
|
||||
if(sectorsForOffset > 0 && !inData)
|
||||
crossingLeadOut = true;
|
||||
|
||||
break;
|
||||
@@ -194,12 +192,10 @@ partial class Dump
|
||||
}
|
||||
}
|
||||
|
||||
if(track.Sequence != 0 &&
|
||||
i + blocksToRead - (ulong)sectorsForOffset > track.EndSector + 1)
|
||||
if(track.Sequence != 0 && i + blocksToRead - (ulong)sectorsForOffset > track.EndSector + 1)
|
||||
blocksToRead = (uint)(track.EndSector + 1 - i + (ulong)sectorsForOffset);
|
||||
|
||||
if(blocksToRead == 1 &&
|
||||
!inData)
|
||||
if(blocksToRead == 1 && !inData)
|
||||
blocksToRead += (uint)sectorsForOffset;
|
||||
|
||||
if(blocksToRead == 0)
|
||||
@@ -269,23 +265,17 @@ partial class Dump
|
||||
crossingLeadOut = false;
|
||||
}
|
||||
|
||||
if(currentSpeed > maxSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed > maxSpeed && currentSpeed > 0)
|
||||
maxSpeed = currentSpeed;
|
||||
|
||||
if(currentSpeed < minSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed < minSpeed && currentSpeed > 0)
|
||||
minSpeed = currentSpeed;
|
||||
|
||||
UpdateProgress?.
|
||||
Invoke(
|
||||
string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks,
|
||||
ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)blocks);
|
||||
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)blocks);
|
||||
|
||||
if(crossingLeadOut &&
|
||||
failedCrossingLeadOut &&
|
||||
blocksToRead > 1)
|
||||
if(crossingLeadOut && failedCrossingLeadOut && blocksToRead > 1)
|
||||
blocksToRead--;
|
||||
|
||||
if(_supportsPlextorD8 && !inData)
|
||||
@@ -396,8 +386,7 @@ partial class Dump
|
||||
DecodedSense? decSense = Sense.Decode(senseBuf);
|
||||
|
||||
// Try to workaround firmware
|
||||
if(decSense is { ASC: 0x11, ASCQ: 0x05 } ||
|
||||
decSense?.ASC == 0x64)
|
||||
if(decSense is { ASC: 0x11, ASCQ: 0x05 } || decSense?.ASC == 0x64)
|
||||
{
|
||||
sense = _dev.ReadCd(out cmdBuf, out _, firstSectorToRead, blockSize, blocksToRead,
|
||||
MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders,
|
||||
@@ -435,19 +424,15 @@ partial class Dump
|
||||
double elapsed;
|
||||
|
||||
// Overcome the track mode change drive error
|
||||
if(inData &&
|
||||
!nextData &&
|
||||
sense)
|
||||
if(inData && !nextData && sense)
|
||||
{
|
||||
_speedStopwatch.Restart();
|
||||
|
||||
for(uint r = 0; r < blocksToRead; r++)
|
||||
{
|
||||
UpdateProgress?.
|
||||
Invoke(
|
||||
string.Format(Localization.Core.Reading_sector_0_of_1_2, i + r, blocks,
|
||||
ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i + r, (long)blocks);
|
||||
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i + r, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i + r, (long)blocks);
|
||||
|
||||
if(_supportsPlextorD8)
|
||||
{
|
||||
@@ -504,8 +489,7 @@ partial class Dump
|
||||
out cmdDuration);
|
||||
}
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
mhddLog.Write(i + r, cmdDuration);
|
||||
ibgLog.Write(i + r, currentSpeed * 1024);
|
||||
@@ -655,8 +639,7 @@ partial class Dump
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
if(crossingLeadOut && failedCrossingLeadOut)
|
||||
{
|
||||
@@ -665,9 +648,7 @@ partial class Dump
|
||||
}
|
||||
|
||||
// Because one block has been partially used to fix the offset
|
||||
if(_fixOffset &&
|
||||
!inData &&
|
||||
offsetBytes != 0)
|
||||
if(_fixOffset && !inData && offsetBytes != 0)
|
||||
{
|
||||
FixOffsetData(offsetBytes, sectorSize, sectorsForOffset, supportedSubchannel, ref blocksToRead,
|
||||
subSize, ref cmdBuf, blockSize, failedCrossingLeadOut);
|
||||
|
||||
@@ -362,9 +362,9 @@ sealed partial class Dump
|
||||
// Check if subchannel is BCD
|
||||
if(supportedSubchannel != MmcSubchannel.None)
|
||||
{
|
||||
sense = _dev.ReadCd(out cmdBuf, out _, (firstLba / 75 + 1) * 75 + 35, blockSize, 1,
|
||||
MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders, true, true,
|
||||
MmcErrorField.None, supportedSubchannel, _dev.Timeout, out _);
|
||||
sense = _dev.ReadCd(out cmdBuf, out _, (firstLba / 75 + 1) * 75 + 35, blockSize, 1, MmcSectorTypes.AllTypes,
|
||||
false, false, true, MmcHeaderCodes.AllHeaders, true, true, MmcErrorField.None,
|
||||
supportedSubchannel, _dev.Timeout, out _);
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
@@ -471,8 +471,7 @@ sealed partial class Dump
|
||||
ResumeSupport.Process(true, true, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial, _dev.PlatformId,
|
||||
ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision, _private, _force);
|
||||
|
||||
if(currentTry == null ||
|
||||
extents == null)
|
||||
if(currentTry == null || extents == null)
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Could_not_process_resume_file_not_continuing);
|
||||
|
||||
@@ -482,8 +481,7 @@ sealed partial class Dump
|
||||
// Read media tags
|
||||
ReadCdTags(ref dskType, mediaTags, out sessions, out firstTrackLastSession);
|
||||
|
||||
if(!outputOptical.OpticalCapabilities.HasFlag(OpticalImageCapabilities.CanStoreSessions) &&
|
||||
sessions > 1)
|
||||
if(!outputOptical.OpticalCapabilities.HasFlag(OpticalImageCapabilities.CanStoreSessions) && sessions > 1)
|
||||
{
|
||||
// TODO: Disabled until 6.0
|
||||
/*if(!_force)
|
||||
@@ -578,8 +576,7 @@ sealed partial class Dump
|
||||
tracks = trkList.ToArray();
|
||||
}
|
||||
|
||||
if(tracks.Any(t => t.Type == TrackType.Audio) &&
|
||||
desiredSubchannel != MmcSubchannel.Raw)
|
||||
if(tracks.Any(t => t.Type == TrackType.Audio) && desiredSubchannel != MmcSubchannel.Raw)
|
||||
{
|
||||
_dumpLog.WriteLine(Localization.Core.WARNING_If_disc_says_CDG_CDEG_CDMIDI_dump_will_be_incorrect);
|
||||
|
||||
@@ -789,8 +786,7 @@ sealed partial class Dump
|
||||
_maximumReadable /= 2;
|
||||
}
|
||||
|
||||
if(!_dev.Error ||
|
||||
_maximumReadable == 1)
|
||||
if(!_dev.Error || _maximumReadable == 1)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -805,8 +801,7 @@ sealed partial class Dump
|
||||
|
||||
var cdiWithHiddenTrack1 = false;
|
||||
|
||||
if(dskType is MediaType.CDIREADY &&
|
||||
tracks.Min(t => t.Sequence) == 1)
|
||||
if(dskType is MediaType.CDIREADY && tracks.Min(t => t.Sequence) == 1)
|
||||
{
|
||||
cdiWithHiddenTrack1 = true;
|
||||
dskType = MediaType.CDI;
|
||||
@@ -843,7 +838,8 @@ sealed partial class Dump
|
||||
_dumpLog.WriteLine(outputOptical.ErrorMessage);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing +
|
||||
Environment.NewLine + outputOptical.ErrorMessage);
|
||||
Environment.NewLine +
|
||||
outputOptical.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -879,14 +875,14 @@ sealed partial class Dump
|
||||
// Send track list to output plugin. This may fail if subchannel is set but unsupported.
|
||||
ret = outputOptical.SetTracks(tracks.ToList());
|
||||
|
||||
if(!ret &&
|
||||
desiredSubchannel == MmcSubchannel.None)
|
||||
if(!ret && desiredSubchannel == MmcSubchannel.None)
|
||||
{
|
||||
_dumpLog.WriteLine(Localization.Core.Error_sending_tracks_to_output_image_not_continuing);
|
||||
_dumpLog.WriteLine(outputOptical.ErrorMessage);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Error_sending_tracks_to_output_image_not_continuing +
|
||||
Environment.NewLine + outputOptical.ErrorMessage);
|
||||
Environment.NewLine +
|
||||
outputOptical.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -930,7 +926,10 @@ sealed partial class Dump
|
||||
_dumpLog.WriteLine(Localization.Core.Setting_flags_for_track_0, track.Sequence);
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Setting_flags_for_track_0, track.Sequence));
|
||||
|
||||
outputOptical.WriteSectorTag(new[] { kvp.Value }, kvp.Key, SectorTagType.CdTrackFlags);
|
||||
outputOptical.WriteSectorTag(new[]
|
||||
{
|
||||
kvp.Value
|
||||
}, kvp.Key, SectorTagType.CdTrackFlags);
|
||||
}
|
||||
|
||||
// Set MCN
|
||||
@@ -938,9 +937,7 @@ sealed partial class Dump
|
||||
{
|
||||
sense = _dev.ReadMcn(out mcn, out _, out _, _dev.Timeout, out _);
|
||||
|
||||
if(!sense &&
|
||||
mcn != null &&
|
||||
mcn != "0000000000000")
|
||||
if(!sense && mcn != null && mcn != "0000000000000")
|
||||
{
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Found_Media_Catalogue_Number_0, mcn));
|
||||
_dumpLog.WriteLine(Localization.Core.Found_Media_Catalogue_Number_0, mcn);
|
||||
@@ -966,8 +963,7 @@ sealed partial class Dump
|
||||
}
|
||||
}
|
||||
|
||||
if(supportedSubchannel != MmcSubchannel.None &&
|
||||
desiredSubchannel != MmcSubchannel.None)
|
||||
if(supportedSubchannel != MmcSubchannel.None && desiredSubchannel != MmcSubchannel.None)
|
||||
{
|
||||
subchannelExtents = new HashSet<int>();
|
||||
|
||||
@@ -1123,8 +1119,7 @@ sealed partial class Dump
|
||||
}
|
||||
}
|
||||
|
||||
if(!_fixOffset ||
|
||||
tracks.All(t => t.Type != TrackType.Audio))
|
||||
if(!_fixOffset || tracks.All(t => t.Type != TrackType.Audio))
|
||||
{
|
||||
offsetBytes = 0;
|
||||
sectorsForOffset = 0;
|
||||
@@ -1335,9 +1330,7 @@ sealed partial class Dump
|
||||
ref totalDuration, subLog, desiredSubchannel, tracks, isrcs, ref mcn, subchannelExtents,
|
||||
smallestPregapLbaPerTrack);
|
||||
|
||||
if(dskType is MediaType.CDR or MediaType.CDRW &&
|
||||
_resume.BadBlocks.Count > 0 &&
|
||||
_ignoreCdrRunOuts > 0)
|
||||
if(dskType is MediaType.CDR or MediaType.CDRW && _resume.BadBlocks.Count > 0 && _ignoreCdrRunOuts > 0)
|
||||
{
|
||||
HandleCdrRunOutSectors(blocks, desiredSubchannel, extents, subchannelExtents, subLog, supportsLongSectors,
|
||||
trackFlags, tracks);
|
||||
@@ -1353,9 +1346,7 @@ sealed partial class Dump
|
||||
subchannelExtents.Remove((int)e);
|
||||
}
|
||||
|
||||
if(subchannelExtents.Count > 0 &&
|
||||
_retryPasses > 0 &&
|
||||
_retrySubchannel)
|
||||
if(subchannelExtents.Count > 0 && _retryPasses > 0 && _retrySubchannel)
|
||||
{
|
||||
RetrySubchannel(readcd, subSize, supportedSubchannel, ref totalDuration, subLog, desiredSubchannel, tracks,
|
||||
isrcs, ref mcn, subchannelExtents, smallestPregapLbaPerTrack);
|
||||
@@ -1414,7 +1405,8 @@ sealed partial class Dump
|
||||
|
||||
if(!outputOptical.SetImageInfo(metadata))
|
||||
{
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine +
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata +
|
||||
Environment.NewLine +
|
||||
outputOptical.ErrorMessage);
|
||||
}
|
||||
|
||||
@@ -1433,8 +1425,7 @@ sealed partial class Dump
|
||||
_dumpLog.WriteLine(Localization.Core.Setting_ISRC_for_track_0_to_1, isrc.Key, isrc.Value);
|
||||
}
|
||||
|
||||
if(mcn != null &&
|
||||
outputOptical.WriteMediaTag(Encoding.ASCII.GetBytes(mcn), MediaTagType.CD_MCN))
|
||||
if(mcn != null && outputOptical.WriteMediaTag(Encoding.ASCII.GetBytes(mcn), MediaTagType.CD_MCN))
|
||||
{
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Setting_disc_Media_Catalogue_Number_to_0, mcn));
|
||||
_dumpLog.WriteLine(Localization.Core.Setting_disc_Media_Catalogue_Number_to_0, mcn);
|
||||
@@ -1454,9 +1445,7 @@ sealed partial class Dump
|
||||
continue;
|
||||
}
|
||||
|
||||
if(trk.Indexes.TryGetValue(0, out int idx0) &&
|
||||
trk.Indexes.TryGetValue(1, out int idx1) &&
|
||||
idx0 == idx1)
|
||||
if(trk.Indexes.TryGetValue(0, out int idx0) && trk.Indexes.TryGetValue(1, out int idx1) && idx0 == idx1)
|
||||
trk.Indexes.Remove(0);
|
||||
}
|
||||
|
||||
@@ -1492,17 +1481,17 @@ sealed partial class Dump
|
||||
UpdateStatus?.Invoke("");
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.Format(
|
||||
Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalDuration.Milliseconds()).Humanize()));
|
||||
Per(totalDuration.Milliseconds()).
|
||||
Humanize()));
|
||||
|
||||
if(maxSpeed > 0)
|
||||
{
|
||||
|
||||
@@ -95,9 +95,7 @@ partial class Dump
|
||||
_ => PlextorSubchannel.None
|
||||
};
|
||||
|
||||
if(_resume.BadBlocks.Count <= 0 ||
|
||||
_aborted ||
|
||||
_retryPasses <= 0)
|
||||
if(_resume.BadBlocks.Count <= 0 || _aborted || _retryPasses <= 0)
|
||||
return;
|
||||
|
||||
var pass = 1;
|
||||
@@ -127,7 +125,7 @@ partial class Dump
|
||||
if(dcMode10?.Pages != null)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode10.Value.Pages.Where(modePage =>
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
}
|
||||
@@ -138,8 +136,10 @@ partial class Dump
|
||||
|
||||
if(dcMode6?.Pages != null)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage =>
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage => modePage is
|
||||
{
|
||||
Page: 0x01, Subpage: 0x00
|
||||
}))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
}
|
||||
@@ -227,10 +227,8 @@ partial class Dump
|
||||
{
|
||||
PulseProgress?.Invoke(runningPersistent
|
||||
? string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Retrying_sector_0_pass_1_recovering_partial_data_forward,
|
||||
badSector, pass)
|
||||
Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_forward,
|
||||
badSector, pass)
|
||||
: string.Format(Localization.Core.Retrying_sector_0_pass_1_forward, badSector,
|
||||
pass));
|
||||
}
|
||||
@@ -238,10 +236,8 @@ partial class Dump
|
||||
{
|
||||
PulseProgress?.Invoke(runningPersistent
|
||||
? string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Retrying_sector_0_pass_1_recovering_partial_data_reverse,
|
||||
badSector, pass)
|
||||
Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_reverse,
|
||||
badSector, pass)
|
||||
: string.Format(Localization.Core.Retrying_sector_0_pass_1_reverse, badSector,
|
||||
pass));
|
||||
}
|
||||
@@ -251,9 +247,7 @@ partial class Dump
|
||||
byte sectorsToReRead = 1;
|
||||
var badSectorToReRead = (uint)badSector;
|
||||
|
||||
if(_fixOffset &&
|
||||
audioExtents.Contains(badSector) &&
|
||||
offsetBytes != 0)
|
||||
if(_fixOffset && audioExtents.Contains(badSector) && offsetBytes != 0)
|
||||
{
|
||||
if(offsetBytes < 0)
|
||||
{
|
||||
@@ -286,8 +280,7 @@ partial class Dump
|
||||
DecodedSense? decSense = Sense.Decode(senseBuf);
|
||||
|
||||
// Try to workaround firmware
|
||||
if(decSense is { ASC: 0x11, ASCQ: 0x05 } ||
|
||||
decSense?.ASC == 0x64)
|
||||
if(decSense is { ASC: 0x11, ASCQ: 0x05 } || decSense?.ASC == 0x64)
|
||||
{
|
||||
sense = _dev.ReadCd(out cmdBuf, out _, badSectorToReRead, blockSize, sectorsToReRead,
|
||||
MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders,
|
||||
@@ -309,8 +302,7 @@ partial class Dump
|
||||
DecodedSense? decSense = Sense.Decode(senseBuf);
|
||||
|
||||
// Try to workaround firmware
|
||||
if(decSense is { ASC: 0x11, ASCQ: 0x05 } ||
|
||||
decSense?.ASC == 0x64)
|
||||
if(decSense is { ASC: 0x11, ASCQ: 0x05 } || decSense?.ASC == 0x64)
|
||||
{
|
||||
sense = _dev.ReadCd(out cmdBuf, out _, badSectorToReRead, blockSize, sectorsToReRead,
|
||||
MmcSectorTypes.Cdda, false, false, false, MmcHeaderCodes.None, true,
|
||||
@@ -343,9 +335,7 @@ partial class Dump
|
||||
}
|
||||
|
||||
// Because one block has been partially used to fix the offset
|
||||
if(_fixOffset &&
|
||||
audioExtents.Contains(badSector) &&
|
||||
offsetBytes != 0)
|
||||
if(_fixOffset && audioExtents.Contains(badSector) && offsetBytes != 0)
|
||||
{
|
||||
uint blocksToRead = sectorsToReRead;
|
||||
|
||||
@@ -353,8 +343,7 @@ partial class Dump
|
||||
ref cmdBuf, blockSize, false);
|
||||
}
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
_resume.BadBlocks.Remove(badSector);
|
||||
extents.Add(badSector);
|
||||
@@ -406,9 +395,7 @@ partial class Dump
|
||||
}
|
||||
}
|
||||
|
||||
if(pass < _retryPasses &&
|
||||
!_aborted &&
|
||||
_resume.BadBlocks.Count > 0)
|
||||
if(pass < _retryPasses && !_aborted && _resume.BadBlocks.Count > 0)
|
||||
{
|
||||
pass++;
|
||||
forward = !forward;
|
||||
@@ -546,7 +533,10 @@ partial class Dump
|
||||
var md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
Pages = new[] { currentModePage.Value }
|
||||
Pages = new[]
|
||||
{
|
||||
currentModePage.Value
|
||||
}
|
||||
};
|
||||
|
||||
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
|
||||
@@ -586,8 +576,7 @@ partial class Dump
|
||||
PlextorSubchannel supportedPlextorSubchannel;
|
||||
var outputOptical = _outputPlugin as IWritableOpticalImage;
|
||||
|
||||
if(supportedSubchannel == MmcSubchannel.None ||
|
||||
desiredSubchannel == MmcSubchannel.None)
|
||||
if(supportedSubchannel == MmcSubchannel.None || desiredSubchannel == MmcSubchannel.None)
|
||||
return;
|
||||
|
||||
supportedPlextorSubchannel = supportedSubchannel switch
|
||||
@@ -677,9 +666,7 @@ partial class Dump
|
||||
_dumpLog.WriteLine(Localization.Core.Correctly_retried_sector_0_subchannel_in_pass_1, badSector, pass);
|
||||
}
|
||||
|
||||
if(pass < _retryPasses &&
|
||||
!_aborted &&
|
||||
subchannelExtents.Count > 0)
|
||||
if(pass < _retryPasses && !_aborted && subchannelExtents.Count > 0)
|
||||
{
|
||||
pass++;
|
||||
forward = !forward;
|
||||
|
||||
@@ -114,12 +114,10 @@ partial class Dump
|
||||
|
||||
double cmdDuration = 0;
|
||||
|
||||
if(currentSpeed > maxSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed > maxSpeed && currentSpeed > 0)
|
||||
maxSpeed = currentSpeed;
|
||||
|
||||
if(currentSpeed < minSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed < minSpeed && currentSpeed > 0)
|
||||
minSpeed = currentSpeed;
|
||||
|
||||
PulseProgress?.Invoke(string.Format(Localization.Core.Reading_sector_0_at_lead_out_1, i,
|
||||
@@ -151,8 +149,7 @@ partial class Dump
|
||||
else if(read6)
|
||||
sense = _dev.Read6(out cmdBuf, out senseBuf, (uint)i, blockSize, 1, _dev.Timeout, out cmdDuration);
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
mhddLog.Write(i, cmdDuration);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
@@ -295,12 +292,10 @@ partial class Dump
|
||||
|
||||
double cmdDuration = 0;
|
||||
|
||||
if(currentSpeed > maxSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed > maxSpeed && currentSpeed > 0)
|
||||
maxSpeed = currentSpeed;
|
||||
|
||||
if(currentSpeed < minSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed < minSpeed && currentSpeed > 0)
|
||||
minSpeed = currentSpeed;
|
||||
|
||||
PulseProgress?.Invoke(string.Format(Localization.Core.Reading_sector_0_at_lead_out_1, i,
|
||||
@@ -332,8 +327,7 @@ partial class Dump
|
||||
else if(read6)
|
||||
sense = _dev.Read6(out cmdBuf, out senseBuf, (uint)i, blockSize, 1, _dev.Timeout, out cmdDuration);
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
mhddLog.Write(i, cmdDuration, _maximumReadable);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
|
||||
@@ -98,8 +98,7 @@ partial class Dump
|
||||
|
||||
// ReSharper restore IntVariableOverflowInUncheckedContext
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
firstTrackPregapMs.Write(cmdBuf, 0, (int)blockSize);
|
||||
gotFirstTrackPregap = true;
|
||||
@@ -163,8 +162,7 @@ partial class Dump
|
||||
Dictionary<uint, int> pregaps = new();
|
||||
inexactPositioning = false;
|
||||
|
||||
if(!supportsPqSubchannel &&
|
||||
!supportsRwSubchannel)
|
||||
if(!supportsPqSubchannel && !supportsRwSubchannel)
|
||||
return;
|
||||
|
||||
// Check if subchannel is BCD
|
||||
@@ -220,9 +218,7 @@ partial class Dump
|
||||
continue;
|
||||
}
|
||||
|
||||
if(t > 0 &&
|
||||
tracks[t - 1].Type == tracks[t].Type &&
|
||||
dumping)
|
||||
if(t > 0 && tracks[t - 1].Type == tracks[t].Type && dumping)
|
||||
{
|
||||
AaruConsole.DebugWriteLine(PREGAP_MODULE_NAME, Localization.Core.Skipping_track_0, track.Sequence);
|
||||
|
||||
@@ -331,9 +327,7 @@ partial class Dump
|
||||
|
||||
posQ = subBuf[7] * 60 * 75 + subBuf[8] * 75 + subBuf[9] - 150;
|
||||
|
||||
if(subBuf[1] != track.Sequence - 1 ||
|
||||
subBuf[2] == 0 ||
|
||||
posQ != lba)
|
||||
if(subBuf[1] != track.Sequence - 1 || subBuf[2] == 0 || posQ != lba)
|
||||
break;
|
||||
|
||||
pregaps[track.Sequence] = 0;
|
||||
@@ -347,8 +341,7 @@ partial class Dump
|
||||
// Calculate pregap
|
||||
lba = (int)track.StartSector - 150;
|
||||
|
||||
while(lba > (int)previousTrack.StartSector &&
|
||||
lba <= (int)track.StartSector)
|
||||
while(lba > (int)previousTrack.StartSector && lba <= (int)track.StartSector)
|
||||
{
|
||||
// Some drives crash if you try to read just before the previous read, so seek away first
|
||||
if(!forward)
|
||||
@@ -463,17 +456,13 @@ partial class Dump
|
||||
{
|
||||
dumpLog?.
|
||||
WriteLine(string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Could_not_read_subchannel_for_this_track_supposing_0_sectors,
|
||||
pregaps[track.Sequence]));
|
||||
Format(Localization.Core.Could_not_read_subchannel_for_this_track_supposing_0_sectors,
|
||||
pregaps[track.Sequence]));
|
||||
|
||||
updateStatus?.
|
||||
Invoke(string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Could_not_read_subchannel_for_this_track_supposing_0_sectors,
|
||||
pregaps[track.Sequence]));
|
||||
Format(Localization.Core.Could_not_read_subchannel_for_this_track_supposing_0_sectors,
|
||||
pregaps[track.Sequence]));
|
||||
}
|
||||
|
||||
break;
|
||||
@@ -547,8 +536,7 @@ partial class Dump
|
||||
}
|
||||
|
||||
// Same track, but not pregap
|
||||
if(subBuf[1] == track.Sequence &&
|
||||
subBuf[2] > 0)
|
||||
if(subBuf[1] == track.Sequence && subBuf[2] > 0)
|
||||
{
|
||||
lba--;
|
||||
forward = false;
|
||||
@@ -568,8 +556,8 @@ partial class Dump
|
||||
|
||||
if(diff != 0)
|
||||
{
|
||||
AaruConsole.DebugWriteLine(PREGAP_MODULE_NAME,
|
||||
Localization.Core.Invalid_Q_position_for_LBA_0_got_1, lba, posQ);
|
||||
AaruConsole.DebugWriteLine(PREGAP_MODULE_NAME, Localization.Core.Invalid_Q_position_for_LBA_0_got_1,
|
||||
lba, posQ);
|
||||
|
||||
inexactPositioning = true;
|
||||
}
|
||||
@@ -626,8 +614,7 @@ partial class Dump
|
||||
// Minus five, to ensure dumping will fix if there is a pregap LBA 0
|
||||
var red = 5;
|
||||
|
||||
while(trk.Pregap > 0 &&
|
||||
red > 0)
|
||||
while(trk.Pregap > 0 && red > 0)
|
||||
{
|
||||
trk.Pregap--;
|
||||
red--;
|
||||
|
||||
@@ -100,8 +100,7 @@ partial class Dump
|
||||
continue;
|
||||
}
|
||||
|
||||
if(track.Type != TrackType.Audio &&
|
||||
track.Type != TrackType.Data)
|
||||
if(track.Type != TrackType.Audio && track.Type != TrackType.Data)
|
||||
{
|
||||
SectorBuilder sb = new();
|
||||
sb.ReconstructPrefix(ref sector, track.Type, (long)s);
|
||||
|
||||
@@ -91,8 +91,7 @@ partial class Dump
|
||||
{
|
||||
DiscInformation.StandardDiscInformation? discInfo = DiscInformation.Decode000b(cmdBuf);
|
||||
|
||||
if(discInfo.HasValue &&
|
||||
mediaType == MediaType.CD)
|
||||
if(discInfo.HasValue && mediaType == MediaType.CD)
|
||||
{
|
||||
mediaType = discInfo.Value.DiscType switch
|
||||
{
|
||||
@@ -107,8 +106,7 @@ partial class Dump
|
||||
UpdateStatus?.Invoke(Localization.Core.Reading_PMA);
|
||||
sense = _dev.ReadPma(out cmdBuf, out _, _dev.Timeout, out _);
|
||||
|
||||
if(!sense &&
|
||||
PMA.Decode(cmdBuf).HasValue)
|
||||
if(!sense && PMA.Decode(cmdBuf).HasValue)
|
||||
{
|
||||
tmpBuf = new byte[cmdBuf.Length - 4];
|
||||
Array.Copy(cmdBuf, 4, tmpBuf, 0, cmdBuf.Length - 4);
|
||||
|
||||
@@ -114,8 +114,7 @@ partial class Dump
|
||||
? TrackType.Data
|
||||
: TrackType.Audio,
|
||||
StartSector =
|
||||
(ulong)(trk.PHOUR * 3600 * 75 + trk.PMIN * 60 * 75 + trk.PSEC * 75 + trk.PFRAME -
|
||||
150),
|
||||
(ulong)(trk.PHOUR * 3600 * 75 + trk.PMIN * 60 * 75 + trk.PSEC * 75 + trk.PFRAME - 150),
|
||||
BytesPerSector = (int)sectorSize,
|
||||
RawBytesPerSector = (int)sectorSize
|
||||
});
|
||||
@@ -185,8 +184,7 @@ partial class Dump
|
||||
|
||||
TOC.CDTOC? oldToc = TOC.Decode(cmdBuf);
|
||||
|
||||
if((sense || !oldToc.HasValue) &&
|
||||
!force)
|
||||
if((sense || !oldToc.HasValue) && !force)
|
||||
{
|
||||
dumpLog?.WriteLine(Localization.Core.
|
||||
Could_not_read_TOC_if_you_want_to_continue_use_force_and_will_try_from_LBA_0_to_360000);
|
||||
|
||||
@@ -99,10 +99,7 @@ partial class Dump
|
||||
_ => PlextorSubchannel.None
|
||||
};
|
||||
|
||||
if(_resume.BadBlocks.Count <= 0 ||
|
||||
_aborted ||
|
||||
!_trim ||
|
||||
!newTrim)
|
||||
if(_resume.BadBlocks.Count <= 0 || _aborted || !_trim || !newTrim)
|
||||
return;
|
||||
|
||||
UpdateStatus?.Invoke(Localization.Core.Trimming_skipped_sectors);
|
||||
@@ -133,9 +130,7 @@ partial class Dump
|
||||
byte sectorsToTrim = 1;
|
||||
var badSectorToRead = (uint)badSector;
|
||||
|
||||
if(_fixOffset &&
|
||||
audioExtents.Contains(badSector) &&
|
||||
offsetBytes != 0)
|
||||
if(_fixOffset && audioExtents.Contains(badSector) && offsetBytes != 0)
|
||||
{
|
||||
if(offsetBytes < 0)
|
||||
{
|
||||
@@ -166,8 +161,7 @@ partial class Dump
|
||||
DecodedSense? decSense = Sense.Decode(senseBuf);
|
||||
|
||||
// Try to workaround firmware
|
||||
if(decSense is { ASC: 0x11, ASCQ: 0x05 } ||
|
||||
decSense?.ASC == 0x64)
|
||||
if(decSense is { ASC: 0x11, ASCQ: 0x05 } || decSense?.ASC == 0x64)
|
||||
{
|
||||
sense = _dev.ReadCd(out cmdBuf, out _, badSectorToRead, blockSize, sectorsToTrim,
|
||||
MmcSectorTypes.AllTypes, false, false, true, MmcHeaderCodes.AllHeaders,
|
||||
@@ -233,8 +227,7 @@ partial class Dump
|
||||
continue;
|
||||
}
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
_resume.BadBlocks.Remove(badSector);
|
||||
extents.Add(badSector);
|
||||
@@ -242,9 +235,7 @@ partial class Dump
|
||||
}
|
||||
|
||||
// Because one block has been partially used to fix the offset
|
||||
if(_fixOffset &&
|
||||
audioExtents.Contains(badSector) &&
|
||||
offsetBytes != 0)
|
||||
if(_fixOffset && audioExtents.Contains(badSector) && offsetBytes != 0)
|
||||
{
|
||||
uint blocksToRead = sectorsToTrim;
|
||||
|
||||
@@ -281,8 +272,7 @@ partial class Dump
|
||||
|
||||
outputOptical.SetTracks(tracks.ToList());
|
||||
|
||||
if(track.StartSector != trkStartBefore &&
|
||||
!_resume.BadBlocks.Contains(track.StartSector))
|
||||
if(track.StartSector != trkStartBefore && !_resume.BadBlocks.Contains(track.StartSector))
|
||||
{
|
||||
_resume.BadBlocks.Add(track.StartSector);
|
||||
|
||||
|
||||
@@ -230,7 +230,8 @@ public partial class Dump
|
||||
_ctx = AaruContext.Create(Settings.Settings.MainDbPath);
|
||||
|
||||
// Search for device in main database
|
||||
_dbDev = _ctx.Devices.FirstOrDefault(d => d.Manufacturer == _dev.Manufacturer && d.Model == _dev.Model &&
|
||||
_dbDev = _ctx.Devices.FirstOrDefault(d => d.Manufacturer == _dev.Manufacturer &&
|
||||
d.Model == _dev.Model &&
|
||||
d.Revision == _dev.FirmwareRevision);
|
||||
|
||||
if(_dbDev is null)
|
||||
@@ -293,8 +294,7 @@ public partial class Dump
|
||||
_errorLog.Close();
|
||||
_dumpLog.Close();
|
||||
|
||||
if(_resume == null ||
|
||||
!_doResume)
|
||||
if(_resume == null || !_doResume)
|
||||
return;
|
||||
|
||||
_resume.LastWriteDate = DateTime.UtcNow;
|
||||
|
||||
@@ -163,10 +163,7 @@ public partial class Dump
|
||||
break;
|
||||
}
|
||||
|
||||
if(!sfcFound &&
|
||||
!genesisFound &&
|
||||
!smsFound &&
|
||||
!n64Found)
|
||||
if(!sfcFound && !genesisFound && !smsFound && !n64Found)
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.No_cartridge_found_not_dumping);
|
||||
_dumpLog.WriteLine(Localization.Core.No_cartridge_found_not_dumping);
|
||||
@@ -177,17 +174,11 @@ public partial class Dump
|
||||
var cluster = BitConverter.ToUInt16(buffer, romPos + 0x1A);
|
||||
var romSize = BitConverter.ToUInt32(buffer, romPos + 0x1C);
|
||||
|
||||
MediaType mediaType = gbaFound
|
||||
? MediaType.GameBoyAdvanceGamePak
|
||||
: gbFound || gbcFound
|
||||
? MediaType.GameBoyGamePak
|
||||
: n64Found
|
||||
? MediaType.N64GamePak
|
||||
: smsFound
|
||||
? MediaType.MasterSystemCartridge
|
||||
: genesisFound
|
||||
? MediaType.MegaDriveCartridge
|
||||
: MediaType.SNESGamePak;
|
||||
MediaType mediaType = gbaFound ? MediaType.GameBoyAdvanceGamePak :
|
||||
gbFound || gbcFound ? MediaType.GameBoyGamePak :
|
||||
n64Found ? MediaType.N64GamePak :
|
||||
smsFound ? MediaType.MasterSystemCartridge :
|
||||
genesisFound ? MediaType.MegaDriveCartridge : MediaType.SNESGamePak;
|
||||
|
||||
uint blocksToRead = 64;
|
||||
double totalDuration = 0;
|
||||
@@ -196,8 +187,7 @@ public partial class Dump
|
||||
double minSpeed = double.MaxValue;
|
||||
byte[] senseBuf;
|
||||
|
||||
if(_outputPlugin is not IByteAddressableImage outputBai ||
|
||||
!outputBai.SupportedMediaTypes.Contains(mediaType))
|
||||
if(_outputPlugin is not IByteAddressableImage outputBai || !outputBai.SupportedMediaTypes.Contains(mediaType))
|
||||
{
|
||||
_dumpLog.WriteLine(Localization.Core.The_specified_format_does_not_support_the_inserted_cartridge);
|
||||
|
||||
@@ -257,7 +247,8 @@ public partial class Dump
|
||||
_dumpLog.WriteLine(outputBai.ErrorMessage);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing +
|
||||
Environment.NewLine + outputBai.ErrorMessage);
|
||||
Environment.NewLine +
|
||||
outputBai.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -285,19 +276,15 @@ public partial class Dump
|
||||
if(romSectors - i < blocksToRead)
|
||||
blocksToRead = (uint)(romSectors - i);
|
||||
|
||||
if(currentSpeed > maxSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed > maxSpeed && currentSpeed > 0)
|
||||
maxSpeed = currentSpeed;
|
||||
|
||||
if(currentSpeed < minSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed < minSpeed && currentSpeed > 0)
|
||||
minSpeed = currentSpeed;
|
||||
|
||||
UpdateProgress?.
|
||||
Invoke(
|
||||
string.Format(Localization.Core.Reading_byte_0_of_1_2, i * 512, romSize,
|
||||
ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i * 512, romSize);
|
||||
Invoke(string.Format(Localization.Core.Reading_byte_0_of_1_2, i * 512, romSize, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i * 512, romSize);
|
||||
|
||||
sense = _dev.Read10(out readBuffer, out senseBuf, 0, false, true, false, false, (uint)(startSector + i),
|
||||
512, 0, (ushort)blocksToRead, _dev.Timeout, out double cmdDuration);
|
||||
@@ -306,8 +293,7 @@ public partial class Dump
|
||||
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
outputBai.WriteBytes(readBuffer, 0, readBuffer.Length, out _);
|
||||
imageWriteDuration += _writeStopwatch.Elapsed.TotalSeconds;
|
||||
@@ -341,30 +327,24 @@ public partial class Dump
|
||||
|
||||
_speedStopwatch.Stop();
|
||||
|
||||
if(romRemaining > 0 &&
|
||||
!_aborted)
|
||||
if(romRemaining > 0 && !_aborted)
|
||||
{
|
||||
if(currentSpeed > maxSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed > maxSpeed && currentSpeed > 0)
|
||||
maxSpeed = currentSpeed;
|
||||
|
||||
if(currentSpeed < minSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed < minSpeed && currentSpeed > 0)
|
||||
minSpeed = currentSpeed;
|
||||
|
||||
UpdateProgress?.
|
||||
Invoke(
|
||||
string.Format(Localization.Core.Reading_byte_0_of_1_2, romSectors * 512, romSize,
|
||||
ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)romSectors * 512, romSize);
|
||||
Invoke(string.Format(Localization.Core.Reading_byte_0_of_1_2, romSectors * 512, romSize, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)romSectors * 512, romSize);
|
||||
|
||||
sense = _dev.Read10(out readBuffer, out senseBuf, 0, false, true, false, false, romSectors, 512, 0, 1,
|
||||
_dev.Timeout, out double cmdDuration);
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
_writeStopwatch.Restart();
|
||||
outputBai.WriteBytes(readBuffer, 0, (int)romRemaining, out _);
|
||||
@@ -401,11 +381,13 @@ public partial class Dump
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Average_dump_speed_0,
|
||||
ByteSize.FromBytes(512 * (romSectors + 1)).Per(totalDuration.Milliseconds()).
|
||||
ByteSize.FromBytes(512 * (romSectors + 1)).
|
||||
Per(totalDuration.Milliseconds()).
|
||||
Humanize()));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Average_write_speed_0,
|
||||
ByteSize.FromBytes(512 * (romSectors + 1)).Per(imageWriteDuration.Seconds()).
|
||||
ByteSize.FromBytes(512 * (romSectors + 1)).
|
||||
Per(imageWriteDuration.Seconds()).
|
||||
Humanize()));
|
||||
|
||||
var metadata = new CommonTypes.Structs.ImageInfo
|
||||
@@ -416,7 +398,8 @@ public partial class Dump
|
||||
|
||||
if(!outputBai.SetImageInfo(metadata))
|
||||
{
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine +
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata +
|
||||
Environment.NewLine +
|
||||
outputBai.ErrorMessage);
|
||||
}
|
||||
|
||||
@@ -452,16 +435,16 @@ public partial class Dump
|
||||
UpdateStatus?.Invoke("");
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.Format(
|
||||
Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
|
||||
ByteSize.FromBytes(512 * (romSectors + 1)).Per(totalDuration.Milliseconds()).
|
||||
ByteSize.FromBytes(512 * (romSectors + 1)).
|
||||
Per(totalDuration.Milliseconds()).
|
||||
Humanize()));
|
||||
|
||||
if(maxSpeed > 0)
|
||||
|
||||
@@ -212,8 +212,7 @@ partial class Dump
|
||||
sense = _dev.ModeSense6(out cmdBuf, out _, false, ScsiModeSensePageControl.Current, 0x00, _dev.Timeout,
|
||||
out _);
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
decMode = Modes.DecodeMode6(cmdBuf, PeripheralDeviceTypes.MultiMediaDevice);
|
||||
}
|
||||
else
|
||||
@@ -239,8 +238,7 @@ partial class Dump
|
||||
sense = _dev.ModeSense10(out cmdBuf, out _, false, false, ScsiModeSensePageControl.Current,
|
||||
0x00, 0x00, _dev.Timeout, out _);
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
decMode = Modes.DecodeMode10(cmdBuf, PeripheralDeviceTypes.MultiMediaDevice);
|
||||
}
|
||||
else
|
||||
@@ -387,8 +385,7 @@ partial class Dump
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
if(DMI.IsXbox(cmdBuf) ||
|
||||
DMI.IsXbox360(cmdBuf))
|
||||
if(DMI.IsXbox(cmdBuf) || DMI.IsXbox360(cmdBuf))
|
||||
{
|
||||
if(DMI.IsXbox(cmdBuf))
|
||||
dskType = MediaType.XGD;
|
||||
@@ -558,11 +555,9 @@ partial class Dump
|
||||
{
|
||||
UpdateStatus?.
|
||||
Invoke(string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Drive_reports_0_copy_protection_not_yet_supported_dump_incorrect,
|
||||
(CSS_CPRM.DecodeLeadInCopyright(cmdBuf)?.CopyrightType ??
|
||||
CopyrightType.NoProtection).ToString()));
|
||||
Format(Localization.Core.Drive_reports_0_copy_protection_not_yet_supported_dump_incorrect,
|
||||
(CSS_CPRM.DecodeLeadInCopyright(cmdBuf)?.CopyrightType ??
|
||||
CopyrightType.NoProtection).ToString()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -889,8 +884,7 @@ partial class Dump
|
||||
|
||||
CSS_CPRM.LeadInCopyright? cpy = CSS_CPRM.DecodeLeadInCopyright(tmp);
|
||||
|
||||
if(cpy.HasValue &&
|
||||
cpy.Value.CopyrightType != CopyrightType.NoProtection)
|
||||
if(cpy.HasValue && cpy.Value.CopyrightType != CopyrightType.NoProtection)
|
||||
sidecar.OpticalDiscs[0].CopyProtection = cpy.Value.CopyrightType.ToString();
|
||||
|
||||
break;
|
||||
|
||||
@@ -103,7 +103,8 @@ partial class Dump
|
||||
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalChkDuration.Milliseconds()).
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalChkDuration.Milliseconds()).
|
||||
Humanize());
|
||||
|
||||
if(_preSidecar != null)
|
||||
@@ -127,10 +128,11 @@ partial class Dump
|
||||
if(filesystems.Count > 0)
|
||||
{
|
||||
foreach(var filesystem in filesystems.Select(o => new
|
||||
{
|
||||
o.start,
|
||||
o.type
|
||||
}).Distinct())
|
||||
{
|
||||
o.start,
|
||||
o.type
|
||||
}).
|
||||
Distinct())
|
||||
_dumpLog.WriteLine(Localization.Core.Found_filesystem_0_at_sector_1, filesystem.type, filesystem.start);
|
||||
}
|
||||
|
||||
|
||||
@@ -89,9 +89,7 @@ partial class Dump
|
||||
|
||||
sense = _dev.ModeSense6(out byte[] cmdBuf, out _, true, ScsiModeSensePageControl.Current, 0x3F, 5, out _);
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error &&
|
||||
Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue)
|
||||
if(!sense && !_dev.Error && Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue)
|
||||
decMode = Modes.DecodeMode6(cmdBuf, _dev.ScsiType);
|
||||
|
||||
if(decMode.HasValue)
|
||||
@@ -171,20 +169,17 @@ partial class Dump
|
||||
|
||||
sense = _dev.MiniDiscGetType(out cmdBuf, out _, _dev.Timeout, out _);
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
mediaTags.Add(MediaTagType.MiniDiscType, cmdBuf);
|
||||
|
||||
sense = _dev.MiniDiscD5(out cmdBuf, out _, _dev.Timeout, out _);
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
mediaTags.Add(MediaTagType.MiniDiscD5, cmdBuf);
|
||||
|
||||
sense = _dev.MiniDiscReadDataTOC(out cmdBuf, out _, _dev.Timeout, out _);
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
mediaTags.Add(MediaTagType.MiniDiscDTOC, cmdBuf);
|
||||
|
||||
var utocMs = new MemoryStream();
|
||||
@@ -243,7 +238,8 @@ partial class Dump
|
||||
_dumpLog.WriteLine(outputFormat.ErrorMessage);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing +
|
||||
Environment.NewLine + outputFormat.ErrorMessage);
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -273,11 +269,9 @@ partial class Dump
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Setting_geometry_to_0_cylinders_1_heads_2_sectors_per_track,
|
||||
rigidPage.Value.Cylinders, rigidPage.Value.Heads,
|
||||
(uint)(blocks / (rigidPage.Value.Cylinders * rigidPage.Value.Heads))));
|
||||
Format(Localization.Core.Setting_geometry_to_0_cylinders_1_heads_2_sectors_per_track,
|
||||
rigidPage.Value.Cylinders, rigidPage.Value.Heads,
|
||||
(uint)(blocks / (rigidPage.Value.Cylinders * rigidPage.Value.Heads))));
|
||||
|
||||
outputFormat.SetGeometry(rigidPage.Value.Cylinders, rigidPage.Value.Heads,
|
||||
(uint)(blocks / (rigidPage.Value.Cylinders * rigidPage.Value.Heads)));
|
||||
@@ -300,11 +294,9 @@ partial class Dump
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Setting_geometry_to_0_cylinders_1_heads_2_sectors_per_track,
|
||||
flexiblePage.Value.Cylinders, flexiblePage.Value.Heads,
|
||||
flexiblePage.Value.SectorsPerTrack));
|
||||
Format(Localization.Core.Setting_geometry_to_0_cylinders_1_heads_2_sectors_per_track,
|
||||
flexiblePage.Value.Cylinders, flexiblePage.Value.Heads,
|
||||
flexiblePage.Value.SectorsPerTrack));
|
||||
|
||||
outputFormat.SetGeometry(flexiblePage.Value.Cylinders, flexiblePage.Value.Heads,
|
||||
flexiblePage.Value.SectorsPerTrack);
|
||||
@@ -324,8 +316,7 @@ partial class Dump
|
||||
_dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision,
|
||||
_private, _force);
|
||||
|
||||
if(currentTry == null ||
|
||||
extents == null)
|
||||
if(currentTry == null || extents == null)
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Could_not_process_resume_file_not_continuing);
|
||||
|
||||
@@ -375,27 +366,22 @@ partial class Dump
|
||||
if(blocks - i < blocksToRead)
|
||||
blocksToRead = (uint)(blocks - i);
|
||||
|
||||
if(currentSpeed > maxSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed > maxSpeed && currentSpeed > 0)
|
||||
maxSpeed = currentSpeed;
|
||||
|
||||
if(currentSpeed < minSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed < minSpeed && currentSpeed > 0)
|
||||
minSpeed = currentSpeed;
|
||||
|
||||
UpdateProgress?.
|
||||
Invoke(
|
||||
string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks,
|
||||
ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)blocks);
|
||||
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)blocks);
|
||||
|
||||
sense = _dev.Read6(out readBuffer, out _, (uint)i, blockSize, (byte)blocksToRead, _dev.Timeout,
|
||||
out double cmdDuration);
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
mhddLog.Write(i, cmdDuration, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
@@ -478,10 +464,7 @@ partial class Dump
|
||||
|
||||
#region Trimming
|
||||
|
||||
if(_resume.BadBlocks.Count > 0 &&
|
||||
!_aborted &&
|
||||
_trim &&
|
||||
newTrim)
|
||||
if(_resume.BadBlocks.Count > 0 && !_aborted && _trim && newTrim)
|
||||
{
|
||||
_trimStopwatch.Restart();
|
||||
UpdateStatus?.Invoke(Localization.Core.Trimming_skipped_sectors);
|
||||
@@ -528,9 +511,7 @@ partial class Dump
|
||||
|
||||
#region Error handling
|
||||
|
||||
if(_resume.BadBlocks.Count > 0 &&
|
||||
!_aborted &&
|
||||
_retryPasses > 0)
|
||||
if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0)
|
||||
{
|
||||
var pass = 1;
|
||||
var forward = true;
|
||||
@@ -553,7 +534,7 @@ partial class Dump
|
||||
if(dcMode6?.Pages != null)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage =>
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
}
|
||||
@@ -649,10 +630,8 @@ partial class Dump
|
||||
{
|
||||
PulseProgress?.Invoke(runningPersistent
|
||||
? string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Retrying_sector_0_pass_1_recovering_partial_data_forward,
|
||||
badSector, pass)
|
||||
Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_forward,
|
||||
badSector, pass)
|
||||
: string.Format(Localization.Core.Retrying_sector_0_pass_1_forward,
|
||||
badSector, pass));
|
||||
}
|
||||
@@ -660,10 +639,8 @@ partial class Dump
|
||||
{
|
||||
PulseProgress?.Invoke(runningPersistent
|
||||
? string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Retrying_sector_0_pass_1_recovering_partial_data_reverse,
|
||||
badSector, pass)
|
||||
Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_reverse,
|
||||
badSector, pass)
|
||||
: string.Format(Localization.Core.Retrying_sector_0_pass_1_reverse,
|
||||
badSector, pass));
|
||||
}
|
||||
@@ -673,8 +650,7 @@ partial class Dump
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
_resume.BadBlocks.Remove(badSector);
|
||||
extents.Add(badSector);
|
||||
@@ -690,9 +666,7 @@ partial class Dump
|
||||
outputFormat.WriteSector(readBuffer, badSector);
|
||||
}
|
||||
|
||||
if(pass < _retryPasses &&
|
||||
!_aborted &&
|
||||
_resume.BadBlocks.Count > 0)
|
||||
if(pass < _retryPasses && !_aborted && _resume.BadBlocks.Count > 0)
|
||||
{
|
||||
pass++;
|
||||
forward = !forward;
|
||||
@@ -709,7 +683,10 @@ partial class Dump
|
||||
var md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
Pages = new[] { currentModePage.Value }
|
||||
Pages = new[]
|
||||
{
|
||||
currentModePage.Value
|
||||
}
|
||||
};
|
||||
|
||||
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
|
||||
@@ -741,7 +718,8 @@ partial class Dump
|
||||
|
||||
if(!outputFormat.SetImageInfo(metadata))
|
||||
{
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine +
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata +
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
}
|
||||
|
||||
@@ -813,7 +791,8 @@ partial class Dump
|
||||
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalChkDuration.Milliseconds()).
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalChkDuration.Milliseconds()).
|
||||
Humanize());
|
||||
|
||||
if(_preSidecar != null)
|
||||
@@ -835,10 +814,11 @@ partial class Dump
|
||||
if(filesystems.Count > 0)
|
||||
{
|
||||
foreach(var filesystem in filesystems.Select(o => new
|
||||
{
|
||||
o.start,
|
||||
o.type
|
||||
}).Distinct())
|
||||
{
|
||||
o.start,
|
||||
o.type
|
||||
}).
|
||||
Distinct())
|
||||
{
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Found_filesystem_0_at_sector_1,
|
||||
filesystem.type, filesystem.start));
|
||||
@@ -853,8 +833,7 @@ partial class Dump
|
||||
sidecar.BlockMedias[0].MediaType = xmlType.type;
|
||||
sidecar.BlockMedias[0].MediaSubType = xmlType.subType;
|
||||
|
||||
if(!_dev.IsRemovable ||
|
||||
_dev.IsUsb)
|
||||
if(!_dev.IsRemovable || _dev.IsUsb)
|
||||
{
|
||||
if(_dev.Type == DeviceType.ATAPI)
|
||||
sidecar.BlockMedias[0].Interface = "ATAPI";
|
||||
@@ -896,17 +875,17 @@ partial class Dump
|
||||
UpdateStatus?.Invoke("");
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.Format(
|
||||
Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalDuration.Milliseconds()).Humanize()));
|
||||
Per(totalDuration.Milliseconds()).
|
||||
Humanize()));
|
||||
|
||||
if(maxSpeed > 0)
|
||||
{
|
||||
|
||||
@@ -138,7 +138,8 @@ public partial class Dump
|
||||
_dumpLog.WriteLine(outputFormat.ErrorMessage);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing +
|
||||
Environment.NewLine + outputFormat.ErrorMessage);
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -153,8 +154,7 @@ public partial class Dump
|
||||
_dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision,
|
||||
_private, _force);
|
||||
|
||||
if(currentTry == null ||
|
||||
extents == null)
|
||||
if(currentTry == null || extents == null)
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Could_not_process_resume_file_not_continuing);
|
||||
|
||||
@@ -202,27 +202,22 @@ public partial class Dump
|
||||
if(blocks - i < blocksToRead)
|
||||
blocksToRead = (uint)(blocks - i);
|
||||
|
||||
if(currentSpeed > maxSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed > maxSpeed && currentSpeed > 0)
|
||||
maxSpeed = currentSpeed;
|
||||
|
||||
if(currentSpeed < minSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed < minSpeed && currentSpeed > 0)
|
||||
minSpeed = currentSpeed;
|
||||
|
||||
UpdateProgress?.
|
||||
Invoke(
|
||||
string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks,
|
||||
ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, blocks);
|
||||
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, blocks);
|
||||
|
||||
sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, true, false, false, (uint)i, blockSize, 0,
|
||||
blocksToRead, false, _dev.Timeout, out double cmdDuration);
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
mhddLog.Write(i, cmdDuration, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
@@ -307,10 +302,7 @@ public partial class Dump
|
||||
|
||||
#region Trimming
|
||||
|
||||
if(_resume.BadBlocks.Count > 0 &&
|
||||
!_aborted &&
|
||||
_trim &&
|
||||
newTrim)
|
||||
if(_resume.BadBlocks.Count > 0 && !_aborted && _trim && newTrim)
|
||||
{
|
||||
_trimStopwatch.Restart();
|
||||
UpdateStatus?.Invoke(Localization.Core.Trimming_skipped_sectors);
|
||||
@@ -359,9 +351,7 @@ public partial class Dump
|
||||
|
||||
#region Error handling
|
||||
|
||||
if(_resume.BadBlocks.Count > 0 &&
|
||||
!_aborted &&
|
||||
_retryPasses > 0)
|
||||
if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0)
|
||||
{
|
||||
var pass = 1;
|
||||
var forward = true;
|
||||
@@ -389,7 +379,7 @@ public partial class Dump
|
||||
if(dcMode10.HasValue)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode10.Value.Pages.Where(modePage =>
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
}
|
||||
@@ -401,7 +391,7 @@ public partial class Dump
|
||||
if(dcMode6.HasValue)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage =>
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
}
|
||||
@@ -496,10 +486,8 @@ public partial class Dump
|
||||
{
|
||||
PulseProgress?.Invoke(runningPersistent
|
||||
? string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Retrying_sector_0_pass_1_recovering_partial_data_forward,
|
||||
badSector, pass)
|
||||
Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_forward,
|
||||
badSector, pass)
|
||||
: string.Format(Localization.Core.Retrying_sector_0_pass_1_forward,
|
||||
badSector, pass));
|
||||
}
|
||||
@@ -507,10 +495,8 @@ public partial class Dump
|
||||
{
|
||||
PulseProgress?.Invoke(runningPersistent
|
||||
? string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Retrying_sector_0_pass_1_recovering_partial_data_reverse,
|
||||
badSector, pass)
|
||||
Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_reverse,
|
||||
badSector, pass)
|
||||
: string.Format(Localization.Core.Retrying_sector_0_pass_1_reverse,
|
||||
badSector, pass));
|
||||
}
|
||||
@@ -523,8 +509,7 @@ public partial class Dump
|
||||
if(sense || _dev.Error)
|
||||
_errorLog?.WriteLine(badSector, _dev.Error, _dev.LastError, senseBuf);
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
_resume.BadBlocks.Remove(badSector);
|
||||
extents.Add(badSector);
|
||||
@@ -540,9 +525,7 @@ public partial class Dump
|
||||
outputFormat.WriteSector(readBuffer, badSector);
|
||||
}
|
||||
|
||||
if(pass < _retryPasses &&
|
||||
!_aborted &&
|
||||
_resume.BadBlocks.Count > 0)
|
||||
if(pass < _retryPasses && !_aborted && _resume.BadBlocks.Count > 0)
|
||||
{
|
||||
pass++;
|
||||
forward = !forward;
|
||||
@@ -559,7 +542,10 @@ public partial class Dump
|
||||
var md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
Pages = new[] { currentModePage.Value }
|
||||
Pages = new[]
|
||||
{
|
||||
currentModePage.Value
|
||||
}
|
||||
};
|
||||
|
||||
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
|
||||
@@ -589,7 +575,8 @@ public partial class Dump
|
||||
|
||||
if(!outputFormat.SetImageInfo(metadata))
|
||||
{
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine +
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata +
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
}
|
||||
|
||||
@@ -663,7 +650,8 @@ public partial class Dump
|
||||
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalChkDuration.Milliseconds()).
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalChkDuration.Milliseconds()).
|
||||
Humanize());
|
||||
|
||||
if(_preSidecar != null)
|
||||
@@ -685,10 +673,11 @@ public partial class Dump
|
||||
if(filesystems.Count > 0)
|
||||
{
|
||||
foreach(var filesystem in filesystems.Select(o => new
|
||||
{
|
||||
o.start,
|
||||
o.type
|
||||
}).Distinct())
|
||||
{
|
||||
o.start,
|
||||
o.type
|
||||
}).
|
||||
Distinct())
|
||||
{
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Found_filesystem_0_at_sector_1,
|
||||
filesystem.type, filesystem.start));
|
||||
@@ -733,17 +722,17 @@ public partial class Dump
|
||||
UpdateStatus?.Invoke("");
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.Format(
|
||||
Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalDuration.Milliseconds()).Humanize()));
|
||||
Per(totalDuration.Milliseconds()).
|
||||
Humanize()));
|
||||
|
||||
if(maxSpeed > 0)
|
||||
{
|
||||
|
||||
@@ -146,7 +146,8 @@ public partial class Dump
|
||||
_dumpLog.WriteLine(outputOptical.ErrorMessage);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing +
|
||||
Environment.NewLine + outputOptical.ErrorMessage);
|
||||
Environment.NewLine +
|
||||
outputOptical.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -175,8 +176,7 @@ public partial class Dump
|
||||
_dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision,
|
||||
_private, _force);
|
||||
|
||||
if(currentTry == null ||
|
||||
extents == null)
|
||||
if(currentTry == null || extents == null)
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Could_not_process_resume_file_not_continuing);
|
||||
|
||||
@@ -224,19 +224,15 @@ public partial class Dump
|
||||
if(blocks - i < blocksToRead)
|
||||
blocksToRead = (uint)(blocks - i);
|
||||
|
||||
if(currentSpeed > maxSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed > maxSpeed && currentSpeed > 0)
|
||||
maxSpeed = currentSpeed;
|
||||
|
||||
if(currentSpeed < minSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed < minSpeed && currentSpeed > 0)
|
||||
minSpeed = currentSpeed;
|
||||
|
||||
UpdateProgress?.
|
||||
Invoke(
|
||||
string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks,
|
||||
ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)blocks);
|
||||
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)blocks);
|
||||
|
||||
sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, true, false, false, (uint)(umdStart + i * 4),
|
||||
512, 0, blocksToRead * 4, false, _dev.Timeout, out double cmdDuration);
|
||||
@@ -245,8 +241,7 @@ public partial class Dump
|
||||
|
||||
_writeStopwatch.Restart();
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
mhddLog.Write(i, cmdDuration, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
@@ -328,10 +323,7 @@ public partial class Dump
|
||||
|
||||
#region Trimming
|
||||
|
||||
if(_resume.BadBlocks.Count > 0 &&
|
||||
!_aborted &&
|
||||
_trim &&
|
||||
newTrim)
|
||||
if(_resume.BadBlocks.Count > 0 && !_aborted && _trim && newTrim)
|
||||
{
|
||||
_trimStopwatch.Restart();
|
||||
_dumpLog.WriteLine(Localization.Core.Trimming_skipped_sectors);
|
||||
@@ -378,9 +370,7 @@ public partial class Dump
|
||||
|
||||
#region Error handling
|
||||
|
||||
if(_resume.BadBlocks.Count > 0 &&
|
||||
!_aborted &&
|
||||
_retryPasses > 0)
|
||||
if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0)
|
||||
{
|
||||
var pass = 1;
|
||||
var forward = true;
|
||||
@@ -403,7 +393,7 @@ public partial class Dump
|
||||
if(dcMode6.HasValue)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage =>
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
}
|
||||
@@ -497,10 +487,8 @@ public partial class Dump
|
||||
{
|
||||
PulseProgress?.Invoke(runningPersistent
|
||||
? string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Retrying_sector_0_pass_1_recovering_partial_data_forward,
|
||||
badSector, pass)
|
||||
Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_forward,
|
||||
badSector, pass)
|
||||
: string.Format(Localization.Core.Retrying_sector_0_pass_1_forward,
|
||||
badSector, pass));
|
||||
}
|
||||
@@ -508,10 +496,8 @@ public partial class Dump
|
||||
{
|
||||
PulseProgress?.Invoke(runningPersistent
|
||||
? string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Retrying_sector_0_pass_1_recovering_partial_data_reverse,
|
||||
badSector, pass)
|
||||
Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_reverse,
|
||||
badSector, pass)
|
||||
: string.Format(Localization.Core.Retrying_sector_0_pass_1_reverse,
|
||||
badSector, pass));
|
||||
}
|
||||
@@ -525,8 +511,7 @@ public partial class Dump
|
||||
if(sense || _dev.Error)
|
||||
_errorLog?.WriteLine(badSector, _dev.Error, _dev.LastError, senseBuf);
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
_resume.BadBlocks.Remove(badSector);
|
||||
extents.Add(badSector);
|
||||
@@ -542,9 +527,7 @@ public partial class Dump
|
||||
outputOptical.WriteSector(readBuffer, badSector);
|
||||
}
|
||||
|
||||
if(pass < _retryPasses &&
|
||||
!_aborted &&
|
||||
_resume.BadBlocks.Count > 0)
|
||||
if(pass < _retryPasses && !_aborted && _resume.BadBlocks.Count > 0)
|
||||
{
|
||||
pass++;
|
||||
forward = !forward;
|
||||
@@ -561,7 +544,10 @@ public partial class Dump
|
||||
var md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
Pages = new[] { currentModePage.Value }
|
||||
Pages = new[]
|
||||
{
|
||||
currentModePage.Value
|
||||
}
|
||||
};
|
||||
|
||||
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
|
||||
@@ -592,7 +578,8 @@ public partial class Dump
|
||||
|
||||
if(!outputOptical.SetImageInfo(metadata))
|
||||
{
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine +
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata +
|
||||
Environment.NewLine +
|
||||
outputOptical.ErrorMessage);
|
||||
}
|
||||
|
||||
@@ -626,17 +613,17 @@ public partial class Dump
|
||||
UpdateStatus?.Invoke("");
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.Format(
|
||||
Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalDuration.Milliseconds()).Humanize()));
|
||||
Per(totalDuration.Milliseconds()).
|
||||
Humanize()));
|
||||
|
||||
if(maxSpeed > 0)
|
||||
{
|
||||
|
||||
@@ -84,8 +84,7 @@ static class ResumeSupport
|
||||
throw new InvalidOperationException(Localization.Core.Resume_specifies_not_tape_but_device_is_tape);
|
||||
}
|
||||
|
||||
if(resume.Removable != removable &&
|
||||
!force)
|
||||
if(resume.Removable != removable && !force)
|
||||
{
|
||||
if(resume.Removable)
|
||||
{
|
||||
@@ -97,60 +96,47 @@ static class ResumeSupport
|
||||
Resume_specifies_non_removable_but_device_is_removable);
|
||||
}
|
||||
|
||||
if(!isTape &&
|
||||
resume.LastBlock != blocks - 1 &&
|
||||
!force)
|
||||
if(!isTape && resume.LastBlock != blocks - 1 && !force)
|
||||
{
|
||||
throw new
|
||||
InvalidOperationException(string.Format(
|
||||
Localization.Core.
|
||||
Resume_file_different_number_of_blocks_not_continuing,
|
||||
resume.LastBlock + 1, blocks));
|
||||
InvalidOperationException(string.Format(Localization.Core.Resume_file_different_number_of_blocks_not_continuing,
|
||||
resume.LastBlock + 1, blocks));
|
||||
}
|
||||
|
||||
foreach(DumpHardware oldTry in resume.Tries)
|
||||
{
|
||||
if(!removable &&
|
||||
!force)
|
||||
if(!removable && !force)
|
||||
{
|
||||
if(oldTry.Manufacturer != manufacturer)
|
||||
{
|
||||
throw new
|
||||
InvalidOperationException(string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Resume_file_different_manufacturer_not_continuing,
|
||||
oldTry.Manufacturer, manufacturer));
|
||||
Format(Localization.Core.Resume_file_different_manufacturer_not_continuing,
|
||||
oldTry.Manufacturer, manufacturer));
|
||||
}
|
||||
|
||||
if(oldTry.Model != model)
|
||||
{
|
||||
throw new
|
||||
InvalidOperationException(string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Resume_file_different_model_not_continuing,
|
||||
oldTry.Model, model));
|
||||
Format(Localization.Core.Resume_file_different_model_not_continuing,
|
||||
oldTry.Model, model));
|
||||
}
|
||||
|
||||
if(oldTry.Serial != serial)
|
||||
{
|
||||
throw new
|
||||
InvalidOperationException(string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Resume_file_different_serial_number_not_continuing,
|
||||
oldTry.Serial, serial));
|
||||
Format(Localization.Core.Resume_file_different_serial_number_not_continuing,
|
||||
oldTry.Serial, serial));
|
||||
}
|
||||
|
||||
if(oldTry.Firmware != firmware)
|
||||
{
|
||||
throw new
|
||||
InvalidOperationException(string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Resume_file_different_firmware_revision_not_continuing,
|
||||
oldTry.Firmware, firmware));
|
||||
Format(Localization.Core.Resume_file_different_firmware_revision_not_continuing,
|
||||
oldTry.Firmware, firmware));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -162,8 +148,11 @@ static class ResumeSupport
|
||||
oldTry.Software.Version != Version.GetVersion())
|
||||
continue;
|
||||
|
||||
if(removable && (oldTry.Manufacturer != manufacturer || oldTry.Model != model ||
|
||||
oldTry.Serial != serial || oldTry.Firmware != firmware))
|
||||
if(removable &&
|
||||
(oldTry.Manufacturer != manufacturer ||
|
||||
oldTry.Model != model ||
|
||||
oldTry.Serial != serial ||
|
||||
oldTry.Firmware != firmware))
|
||||
continue;
|
||||
|
||||
currentTry = oldTry;
|
||||
|
||||
@@ -78,14 +78,14 @@ partial class Dump
|
||||
|
||||
InitProgress?.Invoke();
|
||||
|
||||
if(decSense.HasValue &&
|
||||
decSense.Value.SenseKey != SenseKeys.NoSense)
|
||||
if(decSense.HasValue && decSense.Value.SenseKey != SenseKeys.NoSense)
|
||||
{
|
||||
_dumpLog.WriteLine(Localization.Core.Device_not_ready_Sense, decSense.Value.SenseKey, decSense.Value.ASC,
|
||||
decSense.Value.ASCQ);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Drive_has_status_error_please_correct_Sense_follows +
|
||||
Environment.NewLine + decSense.Value.Description);
|
||||
Environment.NewLine +
|
||||
decSense.Value.Description);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -120,7 +120,8 @@ partial class Dump
|
||||
decSense.Value.ASC != 0x00))
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Drive_could_not_rewind_please_correct_Sense_follows +
|
||||
Environment.NewLine + decSense.Value.Description);
|
||||
Environment.NewLine +
|
||||
decSense.Value.Description);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Drive_could_not_rewind_please_correct_Sense_follows);
|
||||
|
||||
@@ -141,12 +142,12 @@ partial class Dump
|
||||
decSense = Sense.Decode(senseBuf);
|
||||
|
||||
if(decSense.HasValue &&
|
||||
(decSense.Value.ASC == 0x20 && decSense.Value.ASCQ != 0x00 || decSense.Value.ASC != 0x20 &&
|
||||
decSense.Value.SenseKey !=
|
||||
SenseKeys.IllegalRequest))
|
||||
(decSense.Value.ASC == 0x20 && decSense.Value.ASCQ != 0x00 ||
|
||||
decSense.Value.ASC != 0x20 && decSense.Value.SenseKey != SenseKeys.IllegalRequest))
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Could_not_get_position_Sense_follows +
|
||||
Environment.NewLine + decSense.Value.Description);
|
||||
Environment.NewLine +
|
||||
decSense.Value.Description);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Could_not_get_position_Sense_follows);
|
||||
|
||||
@@ -170,7 +171,8 @@ partial class Dump
|
||||
if(sense)
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Drive_could_not_rewind_please_correct_Sense_follows +
|
||||
Environment.NewLine + decSense?.Description);
|
||||
Environment.NewLine +
|
||||
decSense?.Description);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Drive_could_not_rewind_please_correct_Sense_follows);
|
||||
|
||||
@@ -196,7 +198,8 @@ partial class Dump
|
||||
decSense.Value.ASC != 0x00))
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Drive_could_not_rewind_please_correct_Sense_follows +
|
||||
Environment.NewLine + decSense.Value.Description);
|
||||
Environment.NewLine +
|
||||
decSense.Value.Description);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Drive_could_not_rewind_please_correct_Sense_follows);
|
||||
|
||||
@@ -213,7 +216,8 @@ partial class Dump
|
||||
decSense = Sense.Decode(senseBuf);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Drive_could_not_rewind_please_correct_Sense_follows +
|
||||
Environment.NewLine + decSense?.Description);
|
||||
Environment.NewLine +
|
||||
decSense?.Description);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Drive_could_not_rewind_please_correct_Sense_follows);
|
||||
|
||||
@@ -248,8 +252,7 @@ partial class Dump
|
||||
sense = _dev.ModeSense10(out cmdBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F, 0xFF, 5,
|
||||
out duration);
|
||||
|
||||
if(!sense ||
|
||||
_dev.Error)
|
||||
if(!sense || _dev.Error)
|
||||
{
|
||||
sense = _dev.ModeSense10(out cmdBuf, out senseBuf, false, true, ScsiModeSensePageControl.Current, 0x3F,
|
||||
0x00, 5, out duration);
|
||||
@@ -257,8 +260,7 @@ partial class Dump
|
||||
|
||||
Modes.DecodedMode? decMode = null;
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue)
|
||||
decMode = Modes.DecodeMode10(cmdBuf, _dev.ScsiType);
|
||||
@@ -278,8 +280,7 @@ partial class Dump
|
||||
if(sense || _dev.Error)
|
||||
sense = _dev.ModeSense(out cmdBuf, out senseBuf, 5, out duration);
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue)
|
||||
decMode = Modes.DecodeMode6(cmdBuf, _dev.ScsiType);
|
||||
@@ -365,9 +366,10 @@ partial class Dump
|
||||
|
||||
if(!eom)
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(
|
||||
Localization.Core.Drive_could_not_return_back_Sense_follows +
|
||||
Environment.NewLine + decSense.Value.Description);
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.
|
||||
Drive_could_not_return_back_Sense_follows +
|
||||
Environment.NewLine +
|
||||
decSense.Value.Description);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Drive_could_not_return_back_Sense_follows);
|
||||
|
||||
@@ -382,15 +384,15 @@ partial class Dump
|
||||
transferLen = 1;
|
||||
|
||||
sense = _dev.Read6(out cmdBuf, out senseBuf, false, fixedLen, transferLen, blockSize,
|
||||
_dev.Timeout,
|
||||
out duration);
|
||||
_dev.Timeout, out duration);
|
||||
|
||||
if(sense)
|
||||
{
|
||||
decSense = Sense.Decode(senseBuf);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Drive_could_not_read_Sense_follows +
|
||||
Environment.NewLine + decSense.Value.Description);
|
||||
Environment.NewLine +
|
||||
decSense.Value.Description);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Drive_could_not_read_Sense_follows);
|
||||
|
||||
@@ -426,8 +428,8 @@ partial class Dump
|
||||
|
||||
transferLen = blockSize;
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(
|
||||
Localization.Core.Blocksize_changed_to_0_bytes_at_block_1,
|
||||
UpdateStatus?.
|
||||
Invoke(string.Format(Localization.Core.Blocksize_changed_to_0_bytes_at_block_1,
|
||||
blockSize, currentBlock));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Blocksize_changed_to_0_bytes_at_block_1, blockSize,
|
||||
@@ -444,7 +446,8 @@ partial class Dump
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.
|
||||
Drive_could_not_go_back_one_block_Sense_follows +
|
||||
Environment.NewLine + decSense.Value.Description);
|
||||
Environment.NewLine +
|
||||
decSense.Value.Description);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Drive_could_not_go_back_one_block_Sense_follows);
|
||||
|
||||
@@ -458,7 +461,8 @@ partial class Dump
|
||||
}
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Drive_could_not_read_Sense_follows +
|
||||
Environment.NewLine + decSense.Value.Description);
|
||||
Environment.NewLine +
|
||||
decSense.Value.Description);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Drive_could_not_read_Sense_follows);
|
||||
|
||||
@@ -469,7 +473,8 @@ partial class Dump
|
||||
}
|
||||
default:
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Drive_could_not_read_Sense_follows +
|
||||
Environment.NewLine + decSense.Value.Description);
|
||||
Environment.NewLine +
|
||||
decSense.Value.Description);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Drive_could_not_read_Sense_follows);
|
||||
|
||||
@@ -503,7 +508,8 @@ partial class Dump
|
||||
if(!eom)
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Drive_could_not_return_back_Sense_follows +
|
||||
Environment.NewLine + decSense.Value.Description);
|
||||
Environment.NewLine +
|
||||
decSense.Value.Description);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Drive_could_not_return_back_Sense_follows);
|
||||
|
||||
@@ -521,8 +527,7 @@ partial class Dump
|
||||
_dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision,
|
||||
_private, _force, true);
|
||||
|
||||
if(currentTry == null ||
|
||||
extents == null)
|
||||
if(currentTry == null || extents == null)
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Could_not_process_resume_file_not_continuing);
|
||||
|
||||
@@ -772,7 +777,8 @@ partial class Dump
|
||||
decSense.Value.ASC != 0x00))
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Drive_could_not_rewind_please_correct_Sense_follows +
|
||||
Environment.NewLine + decSense.Value.Description);
|
||||
Environment.NewLine +
|
||||
decSense.Value.Description);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Drive_could_not_rewind_please_correct_Sense_follows);
|
||||
|
||||
@@ -792,7 +798,8 @@ partial class Dump
|
||||
_dumpLog.WriteLine(outputTape.ErrorMessage);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Error_setting_output_image_in_tape_mode_not_continuing +
|
||||
Environment.NewLine + outputTape.ErrorMessage);
|
||||
Environment.NewLine +
|
||||
outputTape.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -806,7 +813,8 @@ partial class Dump
|
||||
_dumpLog.WriteLine(outputTape.ErrorMessage);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing +
|
||||
Environment.NewLine + outputTape.ErrorMessage);
|
||||
Environment.NewLine +
|
||||
outputTape.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -828,8 +836,7 @@ partial class Dump
|
||||
FirstBlock = currentBlock
|
||||
};
|
||||
|
||||
if((canLocate || canLocateLong) &&
|
||||
_resume.NextBlock > 0)
|
||||
if((canLocate || canLocateLong) && _resume.NextBlock > 0)
|
||||
{
|
||||
currentBlock = _resume.NextBlock;
|
||||
|
||||
@@ -905,12 +912,10 @@ partial class Dump
|
||||
continue;
|
||||
}
|
||||
|
||||
if(currentSpeed > maxSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed > maxSpeed && currentSpeed > 0)
|
||||
maxSpeed = currentSpeed;
|
||||
|
||||
if(currentSpeed < minSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed < minSpeed && currentSpeed > 0)
|
||||
minSpeed = currentSpeed;
|
||||
|
||||
PulseProgress?.Invoke(string.Format(Localization.Core.Reading_block_0_1, currentBlock,
|
||||
@@ -921,9 +926,7 @@ partial class Dump
|
||||
|
||||
totalDuration += duration;
|
||||
|
||||
if(sense &&
|
||||
senseBuf?.Length != 0 &&
|
||||
!ArrayHelpers.ArrayIsNullOrEmpty(senseBuf))
|
||||
if(sense && senseBuf?.Length != 0 && !ArrayHelpers.ArrayIsNullOrEmpty(senseBuf))
|
||||
{
|
||||
decSense = Sense.Decode(senseBuf);
|
||||
|
||||
@@ -945,9 +948,7 @@ partial class Dump
|
||||
Sense.DecodeDescriptor04(desc04, out filemark, out eom, out ili);
|
||||
}
|
||||
|
||||
if(decSense.Value is { ASC: 0x00, ASCQ: 0x00 } &&
|
||||
ili &&
|
||||
valid)
|
||||
if(decSense.Value is { ASC: 0x00, ASCQ: 0x00 } && ili && valid)
|
||||
{
|
||||
blockSize = (uint)((int)blockSize - BitConverter.ToInt32(BitConverter.GetBytes(information), 0));
|
||||
|
||||
@@ -969,7 +970,8 @@ partial class Dump
|
||||
decSense = Sense.Decode(senseBuf);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Drive_could_not_go_back_one_block_Sense_follows +
|
||||
Environment.NewLine + decSense.Value.Description);
|
||||
Environment.NewLine +
|
||||
decSense.Value.Description);
|
||||
|
||||
outputTape.Close();
|
||||
_dumpLog.WriteLine(Localization.Core.Drive_could_not_go_back_one_block_Sense_follows);
|
||||
@@ -1042,10 +1044,8 @@ partial class Dump
|
||||
if(decSense is null)
|
||||
{
|
||||
StoppingErrorMessage?.
|
||||
Invoke(string.Format(
|
||||
Localization.Core.
|
||||
Drive_could_not_read_block_0_Sense_cannot_be_decoded_look_at_log_for_dump,
|
||||
currentBlock));
|
||||
Invoke(string.Format(Localization.Core.Drive_could_not_read_block_0_Sense_cannot_be_decoded_look_at_log_for_dump,
|
||||
currentBlock));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Drive_could_not_read_block_0_Sense_bytes_follow,
|
||||
currentBlock));
|
||||
@@ -1148,10 +1148,7 @@ partial class Dump
|
||||
|
||||
#region Error handling
|
||||
|
||||
if(_resume.BadBlocks.Count > 0 &&
|
||||
!_aborted &&
|
||||
_retryPasses > 0 &&
|
||||
(canLocate || canLocateLong))
|
||||
if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0 && (canLocate || canLocateLong))
|
||||
{
|
||||
var pass = 1;
|
||||
var forward = false;
|
||||
@@ -1183,10 +1180,8 @@ partial class Dump
|
||||
{
|
||||
PulseProgress?.Invoke(runningPersistent
|
||||
? string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Retrying_sector_0_pass_1_recovering_partial_data_forward,
|
||||
badBlock, pass)
|
||||
Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_forward,
|
||||
badBlock, pass)
|
||||
: string.Format(Localization.Core.Retrying_sector_0_pass_1_forward,
|
||||
badBlock, pass));
|
||||
}
|
||||
@@ -1194,10 +1189,8 @@ partial class Dump
|
||||
{
|
||||
PulseProgress?.Invoke(runningPersistent
|
||||
? string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Retrying_sector_0_pass_1_recovering_partial_data_reverse,
|
||||
badBlock, pass)
|
||||
Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_reverse,
|
||||
badBlock, pass)
|
||||
: string.Format(Localization.Core.Retrying_sector_0_pass_1_reverse,
|
||||
badBlock, pass));
|
||||
}
|
||||
@@ -1287,8 +1280,7 @@ partial class Dump
|
||||
|
||||
totalDuration += duration;
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
_resume.BadBlocks.Remove(badBlock);
|
||||
extents.Add(badBlock);
|
||||
@@ -1303,9 +1295,7 @@ partial class Dump
|
||||
outputTape.WriteSector(cmdBuf, badBlock);
|
||||
}
|
||||
|
||||
if(pass < _retryPasses &&
|
||||
!_aborted &&
|
||||
_resume.BadBlocks.Count > 0)
|
||||
if(pass < _retryPasses && !_aborted && _resume.BadBlocks.Count > 0)
|
||||
{
|
||||
pass++;
|
||||
forward = !forward;
|
||||
@@ -1345,7 +1335,8 @@ partial class Dump
|
||||
|
||||
if(!outputTape.SetImageInfo(metadata))
|
||||
{
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine +
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata +
|
||||
Environment.NewLine +
|
||||
outputTape.ErrorMessage);
|
||||
}
|
||||
|
||||
@@ -1425,7 +1416,8 @@ partial class Dump
|
||||
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalChkDuration.Milliseconds()).
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalChkDuration.Milliseconds()).
|
||||
Humanize());
|
||||
|
||||
if(_preSidecar != null)
|
||||
@@ -1447,10 +1439,11 @@ partial class Dump
|
||||
if(filesystems.Count > 0)
|
||||
{
|
||||
foreach(var filesystem in filesystems.Select(o => new
|
||||
{
|
||||
o.start,
|
||||
o.type
|
||||
}).Distinct())
|
||||
{
|
||||
o.start,
|
||||
o.type
|
||||
}).
|
||||
Distinct())
|
||||
{
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Found_filesystem_0_at_sector_1,
|
||||
filesystem.type, filesystem.start));
|
||||
@@ -1468,8 +1461,7 @@ partial class Dump
|
||||
sidecar.BlockMedias[0].MediaSubType = xmlType.subType;
|
||||
|
||||
// TODO: Implement device firmware revision
|
||||
if(!_dev.IsRemovable ||
|
||||
_dev.IsUsb)
|
||||
if(!_dev.IsRemovable || _dev.IsUsb)
|
||||
{
|
||||
if(_dev.Type == DeviceType.ATAPI)
|
||||
sidecar.BlockMedias[0].Interface = "ATAPI";
|
||||
@@ -1509,17 +1501,17 @@ partial class Dump
|
||||
UpdateStatus?.Invoke("");
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.Format(
|
||||
Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalDuration.Milliseconds()).Humanize()));
|
||||
Per(totalDuration.Milliseconds()).
|
||||
Humanize()));
|
||||
|
||||
if(maxSpeed > 0)
|
||||
{
|
||||
|
||||
@@ -91,29 +91,22 @@ partial class Dump
|
||||
if(blocks - i < blocksToRead)
|
||||
blocksToRead = (uint)(blocks - i);
|
||||
|
||||
if(currentSpeed > maxSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed > maxSpeed && currentSpeed > 0)
|
||||
maxSpeed = currentSpeed;
|
||||
|
||||
if(currentSpeed < minSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed < minSpeed && currentSpeed > 0)
|
||||
minSpeed = currentSpeed;
|
||||
|
||||
UpdateProgress?.
|
||||
Invoke(
|
||||
string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks,
|
||||
ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)blocks);
|
||||
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)blocks);
|
||||
|
||||
sense = scsiReader.ReadBlocks(out buffer, i, blocksToRead, out double cmdDuration, out _, out _);
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
if(Settings.Settings.Current.EnableDecryption &&
|
||||
discKey != null &&
|
||||
_titleKeys)
|
||||
if(Settings.Settings.Current.EnableDecryption && discKey != null && _titleKeys)
|
||||
{
|
||||
for(ulong j = 0; j < blocksToRead; j++)
|
||||
{
|
||||
@@ -137,8 +130,10 @@ partial class Dump
|
||||
|
||||
if(titleKey.HasValue)
|
||||
{
|
||||
outputFormat.WriteSectorTag(new[] { titleKey.Value.CMI }, i + j,
|
||||
SectorTagType.DvdSectorCmi);
|
||||
outputFormat.WriteSectorTag(new[]
|
||||
{
|
||||
titleKey.Value.CMI
|
||||
}, i + j, SectorTagType.DvdSectorCmi);
|
||||
}
|
||||
else
|
||||
continue;
|
||||
@@ -147,11 +142,15 @@ partial class Dump
|
||||
if((titleKey.Value.CMI & 0x80) >> 7 == 0)
|
||||
{
|
||||
// The CMI indicates this sector is not encrypted.
|
||||
outputFormat.WriteSectorTag(new byte[] { 0, 0, 0, 0, 0 }, i + j,
|
||||
SectorTagType.DvdSectorTitleKey);
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
}, i + j, SectorTagType.DvdSectorTitleKey);
|
||||
|
||||
outputFormat.WriteSectorTag(new byte[] { 0, 0, 0, 0, 0 }, i + j,
|
||||
SectorTagType.DvdTitleKeyDecrypted);
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
}, i + j, SectorTagType.DvdTitleKeyDecrypted);
|
||||
|
||||
_resume.MissingTitleKeys.Remove(i + j);
|
||||
|
||||
@@ -162,11 +161,15 @@ partial class Dump
|
||||
// not encrypted even if the CMI says it is.
|
||||
if(titleKey.Value.Key.All(k => k == 0))
|
||||
{
|
||||
outputFormat.WriteSectorTag(new byte[] { 0, 0, 0, 0, 0 }, i + j,
|
||||
SectorTagType.DvdSectorTitleKey);
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
}, i + j, SectorTagType.DvdSectorTitleKey);
|
||||
|
||||
outputFormat.WriteSectorTag(new byte[] { 0, 0, 0, 0, 0 }, i + j,
|
||||
SectorTagType.DvdTitleKeyDecrypted);
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
}, i + j, SectorTagType.DvdTitleKeyDecrypted);
|
||||
|
||||
_resume.MissingTitleKeys.Remove(i + j);
|
||||
|
||||
|
||||
@@ -111,15 +111,13 @@ partial class Dump
|
||||
{
|
||||
mediaTags = new Dictionary<MediaTagType, byte[]>();
|
||||
|
||||
if(_dev.IsUsb &&
|
||||
_dev.UsbDescriptors != null)
|
||||
if(_dev.IsUsb && _dev.UsbDescriptors != null)
|
||||
mediaTags.Add(MediaTagType.USB_Descriptors, null);
|
||||
|
||||
if(_dev.Type == DeviceType.ATAPI)
|
||||
mediaTags.Add(MediaTagType.ATAPI_IDENTIFY, null);
|
||||
|
||||
if(_dev.IsPcmcia &&
|
||||
_dev.Cis != null)
|
||||
if(_dev.IsPcmcia && _dev.Cis != null)
|
||||
mediaTags.Add(MediaTagType.PCMCIA_CIS, null);
|
||||
|
||||
sense = _dev.ScsiInquiry(out byte[] cmdBuf, out _);
|
||||
@@ -137,15 +135,13 @@ partial class Dump
|
||||
sense = _dev.ModeSense10(out cmdBuf, out _, false, true, ScsiModeSensePageControl.Current, 0x3F, 0xFF,
|
||||
5, out _);
|
||||
|
||||
if(!sense ||
|
||||
_dev.Error)
|
||||
if(!sense || _dev.Error)
|
||||
{
|
||||
sense = _dev.ModeSense10(out cmdBuf, out _, false, true, ScsiModeSensePageControl.Current, 0x3F,
|
||||
0x00, 5, out _);
|
||||
}
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue)
|
||||
{
|
||||
@@ -169,8 +165,7 @@ partial class Dump
|
||||
if(sense || _dev.Error)
|
||||
sense = _dev.ModeSense(out cmdBuf, out _, 5, out _);
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue)
|
||||
{
|
||||
@@ -189,7 +184,8 @@ partial class Dump
|
||||
// TODO: Fix this
|
||||
containsFloppyPage = decMode.Value.Pages?.Aggregate(containsFloppyPage,
|
||||
(current, modePage) =>
|
||||
current | modePage.Page == 0x05) == true;
|
||||
current | modePage.Page == 0x05) ==
|
||||
true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -231,8 +227,7 @@ partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
if(blocks != 0 &&
|
||||
blockSize != 0)
|
||||
if(blocks != 0 && blockSize != 0)
|
||||
{
|
||||
blocks++;
|
||||
|
||||
@@ -367,7 +362,8 @@ partial class Dump
|
||||
_dumpLog.WriteLine(outputFormat.ErrorMessage);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing +
|
||||
Environment.NewLine + outputFormat.ErrorMessage);
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -402,8 +398,7 @@ partial class Dump
|
||||
{
|
||||
writeSingleOpticalTrack = false;
|
||||
|
||||
if(discInformation?.Sessions > 1 &&
|
||||
!canStoreNotCdSessions)
|
||||
if(discInformation?.Sessions > 1 && !canStoreNotCdSessions)
|
||||
{
|
||||
if(_force)
|
||||
{
|
||||
@@ -525,7 +520,8 @@ partial class Dump
|
||||
_dumpLog.WriteLine(outputFormat.ErrorMessage);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing +
|
||||
Environment.NewLine + outputFormat.ErrorMessage);
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -554,7 +550,8 @@ partial class Dump
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.
|
||||
Error_sending_tracks_to_output_image_not_continuing +
|
||||
Environment.NewLine + opticalPlugin.ErrorMessage);
|
||||
Environment.NewLine +
|
||||
opticalPlugin.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -610,11 +607,9 @@ partial class Dump
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Setting_geometry_to_0_cylinders_1_heads_2_sectors_per_track,
|
||||
rigidPage.Value.Cylinders, rigidPage.Value.Heads,
|
||||
(uint)(blocks / (rigidPage.Value.Cylinders * rigidPage.Value.Heads))));
|
||||
Format(Localization.Core.Setting_geometry_to_0_cylinders_1_heads_2_sectors_per_track,
|
||||
rigidPage.Value.Cylinders, rigidPage.Value.Heads,
|
||||
(uint)(blocks / (rigidPage.Value.Cylinders * rigidPage.Value.Heads))));
|
||||
|
||||
outputFormat.SetGeometry(rigidPage.Value.Cylinders, rigidPage.Value.Heads,
|
||||
(uint)(blocks / (rigidPage.Value.Cylinders * rigidPage.Value.Heads)));
|
||||
@@ -637,11 +632,9 @@ partial class Dump
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Setting_geometry_to_0_cylinders_1_heads_2_sectors_per_track,
|
||||
flexiblePage.Value.Cylinders, flexiblePage.Value.Heads,
|
||||
flexiblePage.Value.SectorsPerTrack));
|
||||
Format(Localization.Core.Setting_geometry_to_0_cylinders_1_heads_2_sectors_per_track,
|
||||
flexiblePage.Value.Cylinders, flexiblePage.Value.Heads,
|
||||
flexiblePage.Value.SectorsPerTrack));
|
||||
|
||||
outputFormat.SetGeometry(flexiblePage.Value.Cylinders, flexiblePage.Value.Heads,
|
||||
flexiblePage.Value.SectorsPerTrack);
|
||||
@@ -665,7 +658,8 @@ partial class Dump
|
||||
_dumpLog.WriteLine(outputFormat.ErrorMessage);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing +
|
||||
Environment.NewLine + outputFormat.ErrorMessage);
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -705,8 +699,8 @@ partial class Dump
|
||||
bool discIs80Mm =
|
||||
mediaTags?.TryGetValue(MediaTagType.DVD_PFI, out byte[] pfiBytes) == true &&
|
||||
PFI.Decode(pfiBytes, dskType)?.DiscSize == DVDSize.Eighty ||
|
||||
mediaTags?.TryGetValue(MediaTagType.BD_DI, out byte[] diBytes) == true && DI.
|
||||
Decode(diBytes)?.Units?.Any(s => s.DiscSize == DI.BluSize.Eighty) == true;
|
||||
mediaTags?.TryGetValue(MediaTagType.BD_DI, out byte[] diBytes) == true &&
|
||||
DI.Decode(diBytes)?.Units?.Any(s => s.DiscSize == DI.BluSize.Eighty) == true;
|
||||
|
||||
Spiral.DiscParameters discSpiralParameters = Spiral.DiscParametersFromMediaType(dskType, discIs80Mm);
|
||||
|
||||
@@ -724,8 +718,7 @@ partial class Dump
|
||||
_mediaGraph?.PaintSectorsBad(_resume.BadBlocks);
|
||||
}
|
||||
|
||||
if(currentTry == null ||
|
||||
extents == null)
|
||||
if(currentTry == null || extents == null)
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Could_not_process_resume_file_not_continuing);
|
||||
|
||||
@@ -786,9 +779,7 @@ partial class Dump
|
||||
ReadSbcData(blocks, blocksToRead, blockSize, currentTry, extents, ref currentSpeed, ref minSpeed,
|
||||
ref maxSpeed, ref totalDuration, scsiReader, mhddLog, ibgLog, ref imageWriteDuration,
|
||||
ref newTrim, ref dvdDecrypt,
|
||||
mediaTags.TryGetValue(MediaTagType.DVD_DiscKey_Decrypted, out byte[] tag)
|
||||
? tag
|
||||
: null);
|
||||
mediaTags.TryGetValue(MediaTagType.DVD_DiscKey_Decrypted, out byte[] tag) ? tag : null);
|
||||
}
|
||||
|
||||
_dumpStopwatch.Stop();
|
||||
@@ -821,10 +812,7 @@ partial class Dump
|
||||
|
||||
#region Trimming
|
||||
|
||||
if(_resume.BadBlocks.Count > 0 &&
|
||||
!_aborted &&
|
||||
_trim &&
|
||||
newTrim)
|
||||
if(_resume.BadBlocks.Count > 0 && !_aborted && _trim && newTrim)
|
||||
{
|
||||
_trimStopwatch.Restart();
|
||||
UpdateStatus?.Invoke(Localization.Core.Trimming_skipped_sectors);
|
||||
@@ -850,9 +838,7 @@ partial class Dump
|
||||
|
||||
#region Error handling
|
||||
|
||||
if(_resume.BadBlocks.Count > 0 &&
|
||||
!_aborted &&
|
||||
_retryPasses > 0)
|
||||
if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0)
|
||||
RetrySbcData(scsiReader, currentTry, extents, ref totalDuration, blankExtents);
|
||||
|
||||
if(_resume.MissingTitleKeys?.Count > 0 &&
|
||||
@@ -884,7 +870,8 @@ partial class Dump
|
||||
// Cannot write tag to image
|
||||
StoppingErrorMessage?.Invoke(string.Format(Localization.Core.Cannot_write_tag_0, tag.Key));
|
||||
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Cannot_write_tag_0, tag.Key) + Environment.NewLine +
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Cannot_write_tag_0, tag.Key) +
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
return;
|
||||
@@ -892,23 +879,21 @@ partial class Dump
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!_dev.IsRemovable ||
|
||||
_dev.IsUsb)
|
||||
if(!_dev.IsRemovable || _dev.IsUsb)
|
||||
{
|
||||
if(_dev.IsUsb &&
|
||||
_dev.UsbDescriptors != null)
|
||||
if(_dev.IsUsb && _dev.UsbDescriptors != null)
|
||||
{
|
||||
UpdateStatus?.Invoke(Localization.Core.Reading_USB_descriptors);
|
||||
_dumpLog.WriteLine(Localization.Core.Reading_USB_descriptors);
|
||||
ret = outputFormat.WriteMediaTag(_dev.UsbDescriptors, MediaTagType.USB_Descriptors);
|
||||
|
||||
if(!ret &&
|
||||
!_force)
|
||||
if(!ret && !_force)
|
||||
{
|
||||
_dumpLog.WriteLine(Localization.Core.Cannot_write_USB_descriptors);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_USB_descriptors +
|
||||
Environment.NewLine + outputFormat.ErrorMessage);
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -929,13 +914,13 @@ partial class Dump
|
||||
|
||||
ret = outputFormat.WriteMediaTag(cmdBuf, MediaTagType.ATAPI_IDENTIFY);
|
||||
|
||||
if(!ret &&
|
||||
!_force)
|
||||
if(!ret && !_force)
|
||||
{
|
||||
_dumpLog.WriteLine(Localization.Core.Cannot_write_ATAPI_IDENTIFY_PACKET_DEVICE);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_ATAPI_IDENTIFY_PACKET_DEVICE +
|
||||
Environment.NewLine + outputFormat.ErrorMessage);
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -950,12 +935,12 @@ partial class Dump
|
||||
_dumpLog.WriteLine(Localization.Core.Requesting_SCSI_INQUIRY);
|
||||
ret = outputFormat.WriteMediaTag(cmdBuf, MediaTagType.SCSI_INQUIRY);
|
||||
|
||||
if(!ret &&
|
||||
!_force)
|
||||
if(!ret && !_force)
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_SCSI_INQUIRY);
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Cannot_write_SCSI_INQUIRY + Environment.NewLine +
|
||||
_dumpLog.WriteLine(Localization.Core.Cannot_write_SCSI_INQUIRY +
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
return;
|
||||
@@ -967,27 +952,25 @@ partial class Dump
|
||||
sense = _dev.ModeSense10(out cmdBuf, out _, false, true, ScsiModeSensePageControl.Current, 0x3F,
|
||||
0xFF, 5, out _);
|
||||
|
||||
if(!sense ||
|
||||
_dev.Error)
|
||||
if(!sense || _dev.Error)
|
||||
{
|
||||
sense = _dev.ModeSense10(out cmdBuf, out _, false, true, ScsiModeSensePageControl.Current, 0x3F,
|
||||
0x00, 5, out _);
|
||||
}
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue)
|
||||
{
|
||||
ret = outputFormat.WriteMediaTag(cmdBuf, MediaTagType.SCSI_MODESENSE_10);
|
||||
|
||||
if(!ret &&
|
||||
!_force)
|
||||
if(!ret && !_force)
|
||||
{
|
||||
_dumpLog.WriteLine(Localization.Core.Cannot_write_SCSI_MODE_SENSE_10);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_SCSI_MODE_SENSE_10 +
|
||||
Environment.NewLine + outputFormat.ErrorMessage);
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1009,20 +992,19 @@ partial class Dump
|
||||
if(sense || _dev.Error)
|
||||
sense = _dev.ModeSense(out cmdBuf, out _, 5, out _);
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue)
|
||||
{
|
||||
ret = outputFormat.WriteMediaTag(cmdBuf, MediaTagType.SCSI_MODESENSE_6);
|
||||
|
||||
if(!ret &&
|
||||
!_force)
|
||||
if(!ret && !_force)
|
||||
{
|
||||
_dumpLog.WriteLine(Localization.Core.Cannot_write_SCSI_MODE_SENSE_6);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_SCSI_MODE_SENSE_6 +
|
||||
Environment.NewLine + outputFormat.ErrorMessage);
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1051,7 +1033,8 @@ partial class Dump
|
||||
|
||||
if(!outputFormat.SetImageInfo(metadata))
|
||||
{
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine +
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata +
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
}
|
||||
|
||||
@@ -1139,11 +1122,9 @@ partial class Dump
|
||||
}
|
||||
|
||||
// All USB flash drives report as removable, even if the media is not removable
|
||||
if(!_dev.IsRemovable ||
|
||||
_dev.IsUsb)
|
||||
if(!_dev.IsRemovable || _dev.IsUsb)
|
||||
{
|
||||
if(_dev.IsUsb &&
|
||||
_dev.UsbDescriptors != null)
|
||||
if(_dev.IsUsb && _dev.UsbDescriptors != null)
|
||||
{
|
||||
if(outputFormat.SupportedMediaTags.Contains(MediaTagType.USB_Descriptors))
|
||||
{
|
||||
@@ -1241,15 +1222,13 @@ partial class Dump
|
||||
sense = _dev.ModeSense10(out cmdBuf, out _, false, true, ScsiModeSensePageControl.Current,
|
||||
0x3F, 0xFF, 5, out _);
|
||||
|
||||
if(!sense ||
|
||||
_dev.Error)
|
||||
if(!sense || _dev.Error)
|
||||
{
|
||||
sense = _dev.ModeSense10(out cmdBuf, out _, false, true,
|
||||
ScsiModeSensePageControl.Current, 0x3F, 0x00, 5, out _);
|
||||
}
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue)
|
||||
{
|
||||
@@ -1280,8 +1259,7 @@ partial class Dump
|
||||
if(sense || _dev.Error)
|
||||
sense = _dev.ModeSense(out cmdBuf, out _, 5, out _);
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue)
|
||||
{
|
||||
@@ -1312,10 +1290,11 @@ partial class Dump
|
||||
if(filesystems.Count > 0)
|
||||
{
|
||||
foreach(var filesystem in filesystems.Select(o => new
|
||||
{
|
||||
o.start,
|
||||
o.type
|
||||
}).Distinct())
|
||||
{
|
||||
o.start,
|
||||
o.type
|
||||
}).
|
||||
Distinct())
|
||||
{
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Found_filesystem_0_at_sector_1,
|
||||
filesystem.type, filesystem.start));
|
||||
@@ -1333,8 +1312,7 @@ partial class Dump
|
||||
sidecar.BlockMedias[0].MediaSubType = xmlType.subType;
|
||||
|
||||
// TODO: Implement device firmware revision
|
||||
if(!_dev.IsRemovable ||
|
||||
_dev.IsUsb)
|
||||
if(!_dev.IsRemovable || _dev.IsUsb)
|
||||
{
|
||||
if(_dev.Type == DeviceType.ATAPI)
|
||||
sidecar.BlockMedias[0].Interface = "ATAPI";
|
||||
@@ -1377,17 +1355,17 @@ partial class Dump
|
||||
UpdateStatus?.Invoke("");
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.Format(
|
||||
Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalDuration.Milliseconds())).Humanize());
|
||||
Per(totalDuration.Milliseconds())).
|
||||
Humanize());
|
||||
|
||||
if(maxSpeed > 0)
|
||||
{
|
||||
|
||||
@@ -89,7 +89,7 @@ partial class Dump
|
||||
if(dcMode10?.Pages != null)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode10.Value.Pages.Where(modePage =>
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
}
|
||||
@@ -100,8 +100,10 @@ partial class Dump
|
||||
|
||||
if(dcMode6?.Pages != null)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage =>
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage => modePage is
|
||||
{
|
||||
Page: 0x01, Subpage: 0x00
|
||||
}))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
}
|
||||
@@ -249,10 +251,8 @@ partial class Dump
|
||||
{
|
||||
PulseProgress?.Invoke(runningPersistent
|
||||
? string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Retrying_sector_0_pass_1_recovering_partial_data_forward,
|
||||
badSector, pass)
|
||||
Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_forward,
|
||||
badSector, pass)
|
||||
: string.Format(Localization.Core.Retrying_sector_0_pass_1_forward, badSector,
|
||||
pass));
|
||||
}
|
||||
@@ -260,10 +260,8 @@ partial class Dump
|
||||
{
|
||||
PulseProgress?.Invoke(runningPersistent
|
||||
? string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Retrying_sector_0_pass_1_recovering_partial_data_reverse,
|
||||
badSector, pass)
|
||||
Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_reverse,
|
||||
badSector, pass)
|
||||
: string.Format(Localization.Core.Retrying_sector_0_pass_1_reverse, badSector,
|
||||
pass));
|
||||
}
|
||||
@@ -301,9 +299,7 @@ partial class Dump
|
||||
outputFormat.WriteSector(buffer, badSector);
|
||||
}
|
||||
|
||||
if(pass < _retryPasses &&
|
||||
!_aborted &&
|
||||
_resume.BadBlocks.Count > 0)
|
||||
if(pass < _retryPasses && !_aborted && _resume.BadBlocks.Count > 0)
|
||||
{
|
||||
pass++;
|
||||
forward = !forward;
|
||||
@@ -320,7 +316,10 @@ partial class Dump
|
||||
var md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
Pages = new[] { currentModePage.Value }
|
||||
Pages = new[]
|
||||
{
|
||||
currentModePage.Value
|
||||
}
|
||||
};
|
||||
|
||||
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
|
||||
@@ -384,17 +383,24 @@ partial class Dump
|
||||
if(!titleKey.HasValue)
|
||||
continue;
|
||||
|
||||
outputFormat.WriteSectorTag(new[] { titleKey.Value.CMI }, missingKey, SectorTagType.DvdSectorCmi);
|
||||
outputFormat.WriteSectorTag(new[]
|
||||
{
|
||||
titleKey.Value.CMI
|
||||
}, missingKey, SectorTagType.DvdSectorCmi);
|
||||
|
||||
// If the CMI bit is 1, the sector is using copy protection, else it is not
|
||||
// If the decoded title key is zeroed, there should be no copy protection
|
||||
if((titleKey.Value.CMI & 0x80) >> 7 == 0 ||
|
||||
titleKey.Value.Key.All(k => k == 0))
|
||||
if((titleKey.Value.CMI & 0x80) >> 7 == 0 || titleKey.Value.Key.All(k => k == 0))
|
||||
{
|
||||
outputFormat.WriteSectorTag(new byte[] { 0, 0, 0, 0, 0 }, missingKey, SectorTagType.DvdSectorTitleKey);
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
}, missingKey, SectorTagType.DvdSectorTitleKey);
|
||||
|
||||
outputFormat.WriteSectorTag(new byte[] { 0, 0, 0, 0, 0 }, missingKey,
|
||||
SectorTagType.DvdTitleKeyDecrypted);
|
||||
outputFormat.WriteSectorTag(new byte[]
|
||||
{
|
||||
0, 0, 0, 0, 0
|
||||
}, missingKey, SectorTagType.DvdTitleKeyDecrypted);
|
||||
|
||||
_resume.MissingTitleKeys.Remove(missingKey);
|
||||
|
||||
@@ -421,9 +427,7 @@ partial class Dump
|
||||
}
|
||||
}
|
||||
|
||||
if(pass < _retryPasses &&
|
||||
!_aborted &&
|
||||
_resume.MissingTitleKeys.Count > 0)
|
||||
if(pass < _retryPasses && !_aborted && _resume.MissingTitleKeys.Count > 0)
|
||||
{
|
||||
pass++;
|
||||
forward = !forward;
|
||||
|
||||
@@ -67,8 +67,7 @@ partial class Dump
|
||||
|
||||
DecodedSense? decodedSense = Sense.Decode(buffer);
|
||||
|
||||
if(_dev.LastError != 0 ||
|
||||
decodedSense?.SenseKey == SenseKeys.IllegalRequest)
|
||||
if(_dev.LastError != 0 || decodedSense?.SenseKey == SenseKeys.IllegalRequest)
|
||||
{
|
||||
UpdateStatus?.Invoke(Localization.Core.The_current_environment_doesn_t_support_the_medium_scan_command);
|
||||
|
||||
@@ -77,8 +76,7 @@ partial class Dump
|
||||
}
|
||||
|
||||
// TODO: Find a place where MEDIUM SCAN works properly
|
||||
else if(buffer?.Length > 0 &&
|
||||
!ArrayHelpers.ArrayIsNullOrEmpty(buffer))
|
||||
else if(buffer?.Length > 0 && !ArrayHelpers.ArrayIsNullOrEmpty(buffer))
|
||||
AaruConsole.WriteLine(Localization.Core.MEDIUM_SCAN_github_plead_message);
|
||||
|
||||
changingCounter = false;
|
||||
@@ -115,11 +113,8 @@ partial class Dump
|
||||
c = (uint)(blocks - b);
|
||||
|
||||
UpdateProgress?.
|
||||
Invoke(
|
||||
written
|
||||
? string.Format(Localization.Core.Scanning_for_0_written_blocks_starting_in_block_1, c, b)
|
||||
: string.Format(Localization.Core.Scanning_for_0_blank_blocks_starting_in_block_1, c, b),
|
||||
b, (long)blocks);
|
||||
Invoke(written ? string.Format(Localization.Core.Scanning_for_0_written_blocks_starting_in_block_1, c, b) : string.Format(Localization.Core.Scanning_for_0_blank_blocks_starting_in_block_1, c, b),
|
||||
b, (long)blocks);
|
||||
|
||||
conditionMet = _dev.MediumScan(out _, written, false, false, false, false, b, c, c, out _, out _,
|
||||
uint.MaxValue, out _);
|
||||
@@ -205,25 +200,20 @@ partial class Dump
|
||||
if(extent.Item2 + 1 - i < blocksToRead)
|
||||
blocksToRead = (uint)(extent.Item2 + 1 - i);
|
||||
|
||||
if(currentSpeed > maxSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed > maxSpeed && currentSpeed > 0)
|
||||
maxSpeed = currentSpeed;
|
||||
|
||||
if(currentSpeed < minSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed < minSpeed && currentSpeed > 0)
|
||||
minSpeed = currentSpeed;
|
||||
|
||||
UpdateProgress?.
|
||||
Invoke(
|
||||
string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks,
|
||||
ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)blocks);
|
||||
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)blocks);
|
||||
|
||||
sense = scsiReader.ReadBlocks(out buffer, i, blocksToRead, out double cmdDuration, out _, out _);
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
mhddLog.Write(i, cmdDuration, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
|
||||
@@ -84,8 +84,7 @@ partial class Dump
|
||||
continue;
|
||||
}
|
||||
|
||||
if((sense || _dev.Error) &&
|
||||
!recoveredError)
|
||||
if((sense || _dev.Error) && !recoveredError)
|
||||
continue;
|
||||
|
||||
_resume.BadBlocks.Remove(badSector);
|
||||
|
||||
@@ -226,8 +226,9 @@ public partial class Dump
|
||||
}
|
||||
else
|
||||
{
|
||||
supportsCmd23 = Decoders.SecureDigital.Decoders.DecodeSCR(scr)?.CommandSupport.
|
||||
HasFlag(CommandSupport.SetBlockCount) ?? false;
|
||||
supportsCmd23 = Decoders.SecureDigital.Decoders.DecodeSCR(scr)?.
|
||||
CommandSupport.HasFlag(CommandSupport.SetBlockCount) ??
|
||||
false;
|
||||
|
||||
mediaTags.Add(MediaTagType.SD_SCR, null);
|
||||
}
|
||||
@@ -298,8 +299,7 @@ public partial class Dump
|
||||
if(error)
|
||||
blocksToRead /= 2;
|
||||
|
||||
if(!error ||
|
||||
blocksToRead == 1)
|
||||
if(!error || blocksToRead == 1)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -315,9 +315,7 @@ public partial class Dump
|
||||
}
|
||||
}
|
||||
|
||||
if(_useBufferedReads &&
|
||||
blocksToRead > 1 &&
|
||||
!supportsCmd23)
|
||||
if(_useBufferedReads && blocksToRead > 1 && !supportsCmd23)
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
@@ -326,8 +324,7 @@ public partial class Dump
|
||||
if(error)
|
||||
blocksToRead /= 2;
|
||||
|
||||
if(!error ||
|
||||
blocksToRead == 1)
|
||||
if(!error || blocksToRead == 1)
|
||||
break;
|
||||
|
||||
// Device is in timeout, reopen to reset
|
||||
@@ -344,9 +341,7 @@ public partial class Dump
|
||||
}
|
||||
}
|
||||
|
||||
if(!_useBufferedReads &&
|
||||
blocksToRead > 1 &&
|
||||
!supportsCmd23)
|
||||
if(!_useBufferedReads && blocksToRead > 1 && !supportsCmd23)
|
||||
{
|
||||
while(true)
|
||||
{
|
||||
@@ -360,8 +355,7 @@ public partial class Dump
|
||||
if(_dev.LastError == 110)
|
||||
_dev.ReOpen();
|
||||
|
||||
if(!error ||
|
||||
blocksToRead == 1)
|
||||
if(!error || blocksToRead == 1)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -423,8 +417,7 @@ public partial class Dump
|
||||
ResumeSupport.Process(true, false, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial, _dev.PlatformId,
|
||||
ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision, _private, _force);
|
||||
|
||||
if(currentTry == null ||
|
||||
extents == null)
|
||||
if(currentTry == null || extents == null)
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Could_not_process_resume_file_not_continuing);
|
||||
|
||||
@@ -472,7 +465,8 @@ public partial class Dump
|
||||
_dumpLog.WriteLine(outputFormat.ErrorMessage);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing +
|
||||
Environment.NewLine + outputFormat.ErrorMessage);
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -509,12 +503,12 @@ public partial class Dump
|
||||
: MediaTagType.MMC_CID);
|
||||
|
||||
// Cannot write CID to image
|
||||
if(!ret &&
|
||||
!_force)
|
||||
if(!ret && !_force)
|
||||
{
|
||||
_dumpLog.WriteLine(Localization.Core.Cannot_write_CID_to_output_image);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_CID_to_output_image + Environment.NewLine +
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_CID_to_output_image +
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
return;
|
||||
@@ -530,12 +524,12 @@ public partial class Dump
|
||||
: MediaTagType.MMC_CSD);
|
||||
|
||||
// Cannot write CSD to image
|
||||
if(!ret &&
|
||||
!_force)
|
||||
if(!ret && !_force)
|
||||
{
|
||||
_dumpLog.WriteLine(Localization.Core.Cannot_write_CSD_to_output_image);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_CSD_to_output_image + Environment.NewLine +
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_CSD_to_output_image +
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
return;
|
||||
@@ -547,13 +541,13 @@ public partial class Dump
|
||||
ret = outputFormat.WriteMediaTag(ecsd, MediaTagType.MMC_ExtendedCSD);
|
||||
|
||||
// Cannot write Extended CSD to image
|
||||
if(!ret &&
|
||||
!_force)
|
||||
if(!ret && !_force)
|
||||
{
|
||||
_dumpLog.WriteLine(Localization.Core.Cannot_write_Extended_CSD_to_output_image);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_Extended_CSD_to_output_image +
|
||||
Environment.NewLine + outputFormat.ErrorMessage);
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -568,12 +562,12 @@ public partial class Dump
|
||||
: MediaTagType.MMC_OCR);
|
||||
|
||||
// Cannot write OCR to image
|
||||
if(!ret &&
|
||||
!_force)
|
||||
if(!ret && !_force)
|
||||
{
|
||||
_dumpLog.WriteLine(Localization.Core.Cannot_write_OCR_to_output_image);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_OCR_to_output_image + Environment.NewLine +
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_OCR_to_output_image +
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
return;
|
||||
@@ -585,12 +579,12 @@ public partial class Dump
|
||||
ret = outputFormat.WriteMediaTag(scr, MediaTagType.SD_SCR);
|
||||
|
||||
// Cannot write SCR to image
|
||||
if(!ret &&
|
||||
!_force)
|
||||
if(!ret && !_force)
|
||||
{
|
||||
_dumpLog.WriteLine(Localization.Core.Cannot_write_SCR_to_output_image);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_SCR_to_output_image + Environment.NewLine +
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Cannot_write_SCR_to_output_image +
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
return;
|
||||
@@ -646,19 +640,15 @@ public partial class Dump
|
||||
if(blocks - i < blocksToRead)
|
||||
blocksToRead = (byte)(blocks - i);
|
||||
|
||||
if(currentSpeed > maxSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed > maxSpeed && currentSpeed > 0)
|
||||
maxSpeed = currentSpeed;
|
||||
|
||||
if(currentSpeed < minSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed < minSpeed && currentSpeed > 0)
|
||||
minSpeed = currentSpeed;
|
||||
|
||||
UpdateProgress?.
|
||||
Invoke(
|
||||
string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks,
|
||||
ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)blocks);
|
||||
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)blocks);
|
||||
|
||||
if(blocksToRead == 1)
|
||||
{
|
||||
@@ -757,10 +747,7 @@ public partial class Dump
|
||||
|
||||
#region Trimming
|
||||
|
||||
if(_resume.BadBlocks.Count > 0 &&
|
||||
!_aborted &&
|
||||
_trim &&
|
||||
newTrim)
|
||||
if(_resume.BadBlocks.Count > 0 && !_aborted && _trim && newTrim)
|
||||
{
|
||||
_trimStopwatch.Restart();
|
||||
UpdateStatus?.Invoke(Localization.Core.Trimming_skipped_sectors);
|
||||
@@ -814,9 +801,7 @@ public partial class Dump
|
||||
|
||||
#region Error handling
|
||||
|
||||
if(_resume.BadBlocks.Count > 0 &&
|
||||
!_aborted &&
|
||||
_retryPasses > 0)
|
||||
if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0)
|
||||
{
|
||||
var pass = 1;
|
||||
var forward = true;
|
||||
@@ -865,9 +850,7 @@ public partial class Dump
|
||||
_dumpLog.WriteLine(Localization.Core.Correctly_retried_block_0_in_pass_1, badSector, pass);
|
||||
}
|
||||
|
||||
if(pass < _retryPasses &&
|
||||
!_aborted &&
|
||||
_resume.BadBlocks.Count > 0)
|
||||
if(pass < _retryPasses && !_aborted && _resume.BadBlocks.Count > 0)
|
||||
{
|
||||
pass++;
|
||||
forward = !forward;
|
||||
@@ -897,7 +880,8 @@ public partial class Dump
|
||||
|
||||
if(!outputFormat.SetImageInfo(metadata))
|
||||
{
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine +
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata +
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
}
|
||||
|
||||
@@ -971,7 +955,8 @@ public partial class Dump
|
||||
_sidecarStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second));
|
||||
|
||||
_dumpLog.WriteLine(Localization.Core.Average_checksum_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).Per(totalChkDuration.Milliseconds()).
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalChkDuration.Milliseconds()).
|
||||
Humanize());
|
||||
|
||||
(string type, string subType) xmlType = (null, null);
|
||||
@@ -1023,17 +1008,17 @@ public partial class Dump
|
||||
UpdateStatus?.Invoke("");
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.Format(
|
||||
Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalDuration.Milliseconds()).Humanize()));
|
||||
Per(totalDuration.Milliseconds()).
|
||||
Humanize()));
|
||||
|
||||
if(maxSpeed > 0)
|
||||
{
|
||||
|
||||
@@ -205,11 +205,11 @@ partial class Dump
|
||||
Array.Copy(readBuffer, 4, tmpBuf, 0, readBuffer.Length - 4);
|
||||
mediaTags.Add(MediaTagType.DVD_PFI, tmpBuf);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Video_partition_total_size_0_sectors,
|
||||
totalSize);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Video_partition_total_size_0_sectors, totalSize);
|
||||
|
||||
ulong l0Video = (PFI.Decode(readBuffer, MediaType.DVDROM)?.Layer0EndPSN ?? 0) -
|
||||
(PFI.Decode(readBuffer, MediaType.DVDROM)?.DataAreaStartPSN ?? 0) + 1;
|
||||
(PFI.Decode(readBuffer, MediaType.DVDROM)?.DataAreaStartPSN ?? 0) +
|
||||
1;
|
||||
|
||||
ulong l1Video = totalSize - l0Video + 1;
|
||||
UpdateStatus?.Invoke(Localization.Core.Reading_Disc_Manufacturing_Information);
|
||||
@@ -236,19 +236,22 @@ partial class Dump
|
||||
UpdateStatus?.Invoke(Localization.Core.Video_partition_is_too_big_did_lock_work_Trying_cold_values);
|
||||
_dumpLog.WriteLine(Localization.Core.Video_partition_is_too_big_did_lock_work_Trying_cold_values);
|
||||
|
||||
totalSize = (ulong)((coldReadCapacity[0] << 24) + (coldReadCapacity[1] << 16) + (coldReadCapacity[2] << 8) +
|
||||
coldReadCapacity[3]) & 0xFFFFFFFF;
|
||||
totalSize = (ulong)((coldReadCapacity[0] << 24) +
|
||||
(coldReadCapacity[1] << 16) +
|
||||
(coldReadCapacity[2] << 8) +
|
||||
coldReadCapacity[3]) &
|
||||
0xFFFFFFFF;
|
||||
|
||||
tmpBuf = new byte[coldPfi.Length - 4];
|
||||
Array.Copy(coldPfi, 4, tmpBuf, 0, coldPfi.Length - 4);
|
||||
mediaTags.Remove(MediaTagType.DVD_PFI);
|
||||
mediaTags.Add(MediaTagType.DVD_PFI, tmpBuf);
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Video_partition_total_size_0_sectors,
|
||||
totalSize);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Video_partition_total_size_0_sectors, totalSize);
|
||||
|
||||
l0Video = (PFI.Decode(coldPfi, MediaType.DVDROM)?.Layer0EndPSN ?? 0) -
|
||||
(PFI.Decode(coldPfi, MediaType.DVDROM)?.DataAreaStartPSN ?? 0) + 1;
|
||||
(PFI.Decode(coldPfi, MediaType.DVDROM)?.DataAreaStartPSN ?? 0) +
|
||||
1;
|
||||
|
||||
l1Video = totalSize - l0Video + 1;
|
||||
|
||||
@@ -291,10 +294,10 @@ partial class Dump
|
||||
|
||||
ulong gameSize =
|
||||
((ulong)((readBuffer[0] << 24) + (readBuffer[1] << 16) + (readBuffer[2] << 8) + readBuffer[3]) &
|
||||
0xFFFFFFFF) + 1;
|
||||
0xFFFFFFFF) +
|
||||
1;
|
||||
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Game_partition_total_size_0_sectors,
|
||||
gameSize);
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Game_partition_total_size_0_sectors, gameSize);
|
||||
|
||||
// Get middle zone size
|
||||
AaruConsole.DebugWriteLine(MODULE_NAME, Localization.Core.Getting_middle_zone_size);
|
||||
@@ -453,8 +456,7 @@ partial class Dump
|
||||
if(sense || _dev.Error)
|
||||
blocksToRead /= 2;
|
||||
|
||||
if(!_dev.Error ||
|
||||
blocksToRead == 1)
|
||||
if(!_dev.Error || blocksToRead == 1)
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -513,7 +515,8 @@ partial class Dump
|
||||
_dumpLog.WriteLine(outputFormat.ErrorMessage);
|
||||
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Error_creating_output_image_not_continuing +
|
||||
Environment.NewLine + outputFormat.ErrorMessage);
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -529,8 +532,7 @@ partial class Dump
|
||||
ResumeSupport.Process(true, true, totalSize, _dev.Manufacturer, _dev.Model, _dev.Serial, _dev.PlatformId,
|
||||
ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision, _private, _force);
|
||||
|
||||
if(currentTry == null ||
|
||||
extents == null)
|
||||
if(currentTry == null || extents == null)
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Could_not_process_resume_file_not_continuing);
|
||||
|
||||
if(_createGraph)
|
||||
@@ -606,7 +608,8 @@ partial class Dump
|
||||
else
|
||||
{
|
||||
extentStart = (xboxSs.Value.Layer0EndPSN + 1) * 2 -
|
||||
((xboxSs.Value.Extents[e].StartPSN ^ 0xFFFFFF) + 1) - 0x30000;
|
||||
((xboxSs.Value.Extents[e].StartPSN ^ 0xFFFFFF) + 1) -
|
||||
0x30000;
|
||||
}
|
||||
|
||||
if(xboxSs.Value.Extents[e].EndPSN <= xboxSs.Value.Layer0EndPSN)
|
||||
@@ -614,7 +617,8 @@ partial class Dump
|
||||
else
|
||||
{
|
||||
extentEnd = (xboxSs.Value.Layer0EndPSN + 1) * 2 -
|
||||
((xboxSs.Value.Extents[e].EndPSN ^ 0xFFFFFF) + 1) - 0x30000;
|
||||
((xboxSs.Value.Extents[e].EndPSN ^ 0xFFFFFF) + 1) -
|
||||
0x30000;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -644,27 +648,22 @@ partial class Dump
|
||||
if(extentStart - i < blocksToRead)
|
||||
blocksToRead = (uint)(extentStart - i);
|
||||
|
||||
if(currentSpeed > maxSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed > maxSpeed && currentSpeed > 0)
|
||||
maxSpeed = currentSpeed;
|
||||
|
||||
if(currentSpeed < minSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed < minSpeed && currentSpeed > 0)
|
||||
minSpeed = currentSpeed;
|
||||
|
||||
UpdateProgress?.
|
||||
Invoke(
|
||||
string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks,
|
||||
ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)totalSize);
|
||||
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, i, blocks, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)i, (long)totalSize);
|
||||
|
||||
sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, (uint)i, blockSize, 0,
|
||||
blocksToRead, false, _dev.Timeout, out cmdDuration);
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
mhddLog.Write(i, cmdDuration, blocksToRead);
|
||||
ibgLog.Write(i, currentSpeed * 1024);
|
||||
@@ -704,8 +703,10 @@ partial class Dump
|
||||
i += _skip - blocksToRead;
|
||||
|
||||
string[] senseLines = Sense.PrettifySense(senseBuf).
|
||||
Split(new[] { Environment.NewLine },
|
||||
StringSplitOptions.RemoveEmptyEntries);
|
||||
Split(new[]
|
||||
{
|
||||
Environment.NewLine
|
||||
}, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
foreach(string senseLine in senseLines)
|
||||
_dumpLog.WriteLine(senseLine);
|
||||
@@ -790,10 +791,8 @@ partial class Dump
|
||||
blocksToRead = (uint)(middleZone - 1 - middle);
|
||||
|
||||
UpdateProgress?.
|
||||
Invoke(
|
||||
string.Format(Localization.Core.Reading_sector_0_of_1_2, middle + currentSector, totalSize,
|
||||
ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)(middle + currentSector), (long)totalSize);
|
||||
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, middle + currentSector, totalSize, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)(middle + currentSector), (long)totalSize);
|
||||
|
||||
mhddLog.Write(middle + currentSector, cmdDuration, blocksToRead);
|
||||
ibgLog.Write(middle + currentSector, currentSpeed * 1024);
|
||||
@@ -853,27 +852,22 @@ partial class Dump
|
||||
if(l0Video + l1Video - l1 < blocksToRead)
|
||||
blocksToRead = (uint)(l0Video + l1Video - l1);
|
||||
|
||||
if(currentSpeed > maxSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed > maxSpeed && currentSpeed > 0)
|
||||
maxSpeed = currentSpeed;
|
||||
|
||||
if(currentSpeed < minSpeed &&
|
||||
currentSpeed > 0)
|
||||
if(currentSpeed < minSpeed && currentSpeed > 0)
|
||||
minSpeed = currentSpeed;
|
||||
|
||||
UpdateProgress?.
|
||||
Invoke(
|
||||
string.Format(Localization.Core.Reading_sector_0_of_1_2, currentSector, totalSize,
|
||||
ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)currentSector, (long)totalSize);
|
||||
Invoke(string.Format(Localization.Core.Reading_sector_0_of_1_2, currentSector, totalSize, ByteSize.FromMegabytes(currentSpeed).Per(_oneSecond).Humanize()),
|
||||
(long)currentSector, (long)totalSize);
|
||||
|
||||
sense = _dev.Read12(out readBuffer, out senseBuf, 0, false, false, false, false, (uint)l1, blockSize, 0,
|
||||
blocksToRead, false, _dev.Timeout, out cmdDuration);
|
||||
|
||||
totalDuration += cmdDuration;
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
mhddLog.Write(currentSector, cmdDuration, blocksToRead);
|
||||
ibgLog.Write(currentSector, currentSpeed * 1024);
|
||||
@@ -907,7 +901,10 @@ partial class Dump
|
||||
l1 += _skip - blocksToRead;
|
||||
|
||||
string[] senseLines = Sense.PrettifySense(senseBuf).
|
||||
Split(new[] { Environment.NewLine }, StringSplitOptions.RemoveEmptyEntries);
|
||||
Split(new[]
|
||||
{
|
||||
Environment.NewLine
|
||||
}, StringSplitOptions.RemoveEmptyEntries);
|
||||
|
||||
foreach(string senseLine in senseLines)
|
||||
_dumpLog.WriteLine(senseLine);
|
||||
@@ -984,10 +981,7 @@ partial class Dump
|
||||
|
||||
#region Trimming
|
||||
|
||||
if(_resume.BadBlocks.Count > 0 &&
|
||||
!_aborted &&
|
||||
_trim &&
|
||||
newTrim)
|
||||
if(_resume.BadBlocks.Count > 0 && !_aborted && _trim && newTrim)
|
||||
{
|
||||
_trimStopwatch.Restart();
|
||||
UpdateStatus?.Invoke(Localization.Core.Trimming_skipped_sectors);
|
||||
@@ -1040,9 +1034,7 @@ partial class Dump
|
||||
|
||||
#region Error handling
|
||||
|
||||
if(_resume.BadBlocks.Count > 0 &&
|
||||
!_aborted &&
|
||||
_retryPasses > 0)
|
||||
if(_resume.BadBlocks.Count > 0 && !_aborted && _retryPasses > 0)
|
||||
{
|
||||
List<ulong> tmpList = new();
|
||||
|
||||
@@ -1083,7 +1075,7 @@ partial class Dump
|
||||
if(dcMode10.HasValue)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode10.Value.Pages.Where(modePage =>
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
}
|
||||
@@ -1095,7 +1087,7 @@ partial class Dump
|
||||
if(dcMode6.HasValue)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage =>
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
}
|
||||
@@ -1181,10 +1173,8 @@ partial class Dump
|
||||
{
|
||||
PulseProgress?.Invoke(runningPersistent
|
||||
? string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Retrying_sector_0_pass_1_recovering_partial_data_forward,
|
||||
badSector, pass)
|
||||
Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_forward,
|
||||
badSector, pass)
|
||||
: string.Format(Localization.Core.Retrying_sector_0_pass_1_forward,
|
||||
badSector, pass));
|
||||
}
|
||||
@@ -1192,10 +1182,8 @@ partial class Dump
|
||||
{
|
||||
PulseProgress?.Invoke(runningPersistent
|
||||
? string.
|
||||
Format(
|
||||
Localization.Core.
|
||||
Retrying_sector_0_pass_1_recovering_partial_data_reverse,
|
||||
badSector, pass)
|
||||
Format(Localization.Core.Retrying_sector_0_pass_1_recovering_partial_data_reverse,
|
||||
badSector, pass)
|
||||
: string.Format(Localization.Core.Retrying_sector_0_pass_1_reverse,
|
||||
badSector, pass));
|
||||
}
|
||||
@@ -1208,8 +1196,7 @@ partial class Dump
|
||||
if(sense || _dev.Error)
|
||||
_errorLog?.WriteLine(currentSector, _dev.Error, _dev.LastError, senseBuf);
|
||||
|
||||
if(!sense &&
|
||||
!_dev.Error)
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
_resume.BadBlocks.Remove(badSector);
|
||||
extents.Add(badSector);
|
||||
@@ -1225,9 +1212,7 @@ partial class Dump
|
||||
outputFormat.WriteSector(readBuffer, badSector);
|
||||
}
|
||||
|
||||
if(pass < _retryPasses &&
|
||||
!_aborted &&
|
||||
_resume.BadBlocks.Count > 0)
|
||||
if(pass < _retryPasses && !_aborted && _resume.BadBlocks.Count > 0)
|
||||
{
|
||||
pass++;
|
||||
forward = !forward;
|
||||
@@ -1244,7 +1229,10 @@ partial class Dump
|
||||
var md = new Modes.DecodedMode
|
||||
{
|
||||
Header = new Modes.ModeHeader(),
|
||||
Pages = new[] { currentModePage.Value }
|
||||
Pages = new[]
|
||||
{
|
||||
currentModePage.Value
|
||||
}
|
||||
};
|
||||
|
||||
md6 = Modes.EncodeMode6(md, _dev.ScsiType);
|
||||
@@ -1284,7 +1272,8 @@ partial class Dump
|
||||
_dumpLog.WriteLine(string.Format(Localization.Core.Cannot_write_tag_0, tag.Key));
|
||||
|
||||
StoppingErrorMessage?.Invoke(string.Format(Localization.Core.Cannot_write_tag_0, tag.Key) +
|
||||
Environment.NewLine + outputFormat.ErrorMessage);
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
|
||||
return;
|
||||
}
|
||||
@@ -1306,7 +1295,8 @@ partial class Dump
|
||||
|
||||
if(!outputFormat.SetImageInfo(metadata))
|
||||
{
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine +
|
||||
ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata +
|
||||
Environment.NewLine +
|
||||
outputFormat.ErrorMessage);
|
||||
}
|
||||
|
||||
@@ -1355,17 +1345,17 @@ partial class Dump
|
||||
UpdateStatus?.Invoke("");
|
||||
|
||||
UpdateStatus?.
|
||||
Invoke(string.Format(
|
||||
Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
Invoke(string.Format(Localization.Core.Took_a_total_of_0_1_processing_commands_2_checksumming_3_writing_4_closing,
|
||||
_dumpStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second),
|
||||
totalDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
totalChkDuration.Milliseconds().Humanize(minUnit: TimeUnit.Second),
|
||||
imageWriteDuration.Seconds().Humanize(minUnit: TimeUnit.Second),
|
||||
_imageCloseStopwatch.Elapsed.Humanize(minUnit: TimeUnit.Second)));
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(Localization.Core.Average_speed_0,
|
||||
ByteSize.FromBytes(blockSize * (blocks + 1)).
|
||||
Per(totalDuration.Milliseconds()).Humanize()));
|
||||
Per(totalDuration.Milliseconds()).
|
||||
Humanize()));
|
||||
|
||||
if(maxSpeed > 0)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user