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:
@@ -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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user