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:
2023-10-04 17:34:40 +01:00
parent bc8bf7a2dc
commit 7363a5d9c5
453 changed files with 7241 additions and 7126 deletions

View File

@@ -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)
{