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

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

View File

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

View File

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

View File

@@ -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;

View File

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

View File

@@ -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--;

View File

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

View File

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

View File

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

View File

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