mirror of
https://github.com/aaru-dps/Aaru.git
synced 2025-12-16 19:24:25 +00:00
[Refactor] Use static lambdas in LINQ queries for improved performance
This commit is contained in:
@@ -904,7 +904,7 @@ public partial class Dump
|
||||
|
||||
if(filesystems.Count > 0)
|
||||
{
|
||||
foreach(var filesystem in filesystems.Select(o => new
|
||||
foreach(var filesystem in filesystems.Select(static o => new
|
||||
{
|
||||
o.start,
|
||||
o.type
|
||||
|
||||
@@ -149,7 +149,7 @@ partial class Dump
|
||||
|
||||
var firstSectorToRead = (uint)i;
|
||||
|
||||
Track track = tracks.OrderBy(t => t.StartSector).LastOrDefault(t => i >= t.StartSector);
|
||||
Track track = tracks.OrderBy(static t => t.StartSector).LastOrDefault(t => i >= t.StartSector);
|
||||
|
||||
blocksToRead = 0;
|
||||
bool inData = nextData;
|
||||
@@ -799,9 +799,7 @@ partial class Dump
|
||||
}
|
||||
|
||||
if(supportsLongSectors)
|
||||
{
|
||||
outputFormat.WriteSectorsLong(data, i + r, false, 1, [sectorStatus]);
|
||||
}
|
||||
else
|
||||
{
|
||||
var cooked = new MemoryStream();
|
||||
@@ -856,7 +854,7 @@ partial class Dump
|
||||
|
||||
if(i > 0) i--;
|
||||
|
||||
foreach(Track aTrack in tracks.Where(aTrack => aTrack.Type == TrackType.Audio))
|
||||
foreach(Track aTrack in tracks.Where(static aTrack => aTrack.Type == TrackType.Audio))
|
||||
audioExtents.Add(aTrack.StartSector, aTrack.EndSector);
|
||||
|
||||
continue;
|
||||
@@ -1071,9 +1069,7 @@ partial class Dump
|
||||
}
|
||||
|
||||
if(supportsLongSectors)
|
||||
{
|
||||
outputFormat.WriteSectorsLong(data, i, false, blocksToRead, sectorStatus);
|
||||
}
|
||||
else
|
||||
{
|
||||
var cooked = new MemoryStream();
|
||||
@@ -1122,7 +1118,7 @@ partial class Dump
|
||||
|
||||
if(i > 0) i--;
|
||||
|
||||
foreach(Track aTrack in tracks.Where(aTrack => aTrack.Type == TrackType.Audio))
|
||||
foreach(Track aTrack in tracks.Where(static aTrack => aTrack.Type == TrackType.Audio))
|
||||
audioExtents.Add(aTrack.StartSector, aTrack.EndSector);
|
||||
|
||||
continue;
|
||||
|
||||
@@ -150,7 +150,7 @@ sealed partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
firstLba = (uint)tracks.Min(t => t.StartSector);
|
||||
firstLba = (uint)tracks.Min(static t => t.StartSector);
|
||||
|
||||
// Check subchannels support
|
||||
supportsPqSubchannel = SupportsPqSubchannel(_dev, UpdateStatus, firstLba) ||
|
||||
@@ -517,7 +517,7 @@ sealed partial class Dump
|
||||
}
|
||||
|
||||
if(!outputOptical.OpticalCapabilities.HasFlag(OpticalImageCapabilities.CanStoreAudioTracks) &&
|
||||
tracks.Any(track => track.Type == TrackType.Audio))
|
||||
tracks.Any(static track => track.Type == TrackType.Audio))
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(Localization.Core.Output_format_does_not_support_audio_tracks_cannot_continue);
|
||||
|
||||
@@ -525,8 +525,8 @@ sealed partial class Dump
|
||||
}
|
||||
|
||||
if(!outputOptical.OpticalCapabilities.HasFlag(OpticalImageCapabilities.CanStorePregaps) &&
|
||||
tracks.Where(track => track.Sequence != tracks.First(t => t.Session == track.Session).Sequence)
|
||||
.Any(track => track.Pregap > 0))
|
||||
tracks.Where(track => track.Sequence != tracks.First(t => t.Session == track.Session).Sequence)
|
||||
.Any(static track => track.Pregap > 0))
|
||||
{
|
||||
if(!_force)
|
||||
{
|
||||
@@ -658,14 +658,14 @@ sealed partial class Dump
|
||||
[
|
||||
new()
|
||||
{
|
||||
Sequence = (uint)(tracks.Any(t => t.Sequence == 1) ? 0 : 1),
|
||||
Sequence = (uint)(tracks.Any(static t => t.Sequence == 1) ? 0 : 1),
|
||||
Session = 1,
|
||||
Type = hiddenData ? TrackType.Data : TrackType.Audio,
|
||||
StartSector = 0,
|
||||
BytesPerSector = (int)sectorSize,
|
||||
RawBytesPerSector = (int)sectorSize,
|
||||
SubchannelType = subType,
|
||||
EndSector = tracks.First(t => t.Sequence >= 1).StartSector - 1
|
||||
EndSector = tracks.First(static t => t.Sequence >= 1).StartSector - 1
|
||||
}
|
||||
];
|
||||
|
||||
@@ -673,11 +673,11 @@ sealed partial class Dump
|
||||
tracks = trkList.ToArray();
|
||||
}
|
||||
|
||||
if(tracks.Any(t => t.Type == TrackType.Audio) && desiredSubchannel != MmcSubchannel.Raw)
|
||||
if(tracks.Any(static t => t.Type == TrackType.Audio) && desiredSubchannel != MmcSubchannel.Raw)
|
||||
UpdateStatus?.Invoke(Localization.Core.WARNING_If_disc_says_CDG_CDEG_CDMIDI_dump_will_be_incorrect);
|
||||
|
||||
// Check mode for tracks
|
||||
foreach(Track trk in tracks.Where(t => t.Type != TrackType.Audio))
|
||||
foreach(Track trk in tracks.Where(static t => t.Type != TrackType.Audio))
|
||||
{
|
||||
if(!readcd)
|
||||
{
|
||||
@@ -787,7 +787,7 @@ sealed partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
if(tracks.Any(t => t.Type == TrackType.Audio))
|
||||
if(tracks.Any(static t => t.Type == TrackType.Audio))
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(Localization.Core
|
||||
.Output_format_does_not_support_audio_tracks_not_continuing);
|
||||
@@ -796,7 +796,7 @@ sealed partial class Dump
|
||||
return;
|
||||
}
|
||||
|
||||
if(tracks.Any(t => t.Type != TrackType.CdMode1))
|
||||
if(tracks.Any(static t => t.Type != TrackType.CdMode1))
|
||||
{
|
||||
StoppingErrorMessage?.Invoke(Localization.Core
|
||||
.Output_format_only_supports_MODE_1_tracks_not_continuing);
|
||||
@@ -928,7 +928,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(static t => t.Sequence) == 1)
|
||||
{
|
||||
cdiWithHiddenTrack1 = true;
|
||||
dskType = MediaType.CDI;
|
||||
@@ -1084,9 +1084,8 @@ sealed partial class Dump
|
||||
foreach(int sub in _resume.BadSubchannels) subchannelExtents.Add(sub);
|
||||
|
||||
if(_resume.NextBlock < blocks)
|
||||
{
|
||||
for(ulong i = _resume.NextBlock; i < blocks; i++) subchannelExtents.Add((int)i);
|
||||
}
|
||||
for(ulong i = _resume.NextBlock; i < blocks; i++)
|
||||
subchannelExtents.Add((int)i);
|
||||
}
|
||||
|
||||
if(_resume.NextBlock > 0)
|
||||
@@ -1107,7 +1106,7 @@ sealed partial class Dump
|
||||
// Check offset
|
||||
if(_fixOffset)
|
||||
{
|
||||
if(tracks.All(t => t.Type != TrackType.Audio))
|
||||
if(tracks.All(static t => t.Type != TrackType.Audio))
|
||||
{
|
||||
// No audio tracks so no need to fix offset
|
||||
UpdateStatus.Invoke(Localization.Core.No_audio_tracks_disabling_offset_fix);
|
||||
@@ -1123,7 +1122,7 @@ sealed partial class Dump
|
||||
_fixOffset = false;
|
||||
}
|
||||
}
|
||||
else if(tracks.Any(t => t.Type == TrackType.Audio))
|
||||
else if(tracks.Any(static t => t.Type == TrackType.Audio))
|
||||
{
|
||||
UpdateStatus?.Invoke(Localization.Core
|
||||
.There_are_audio_tracks_and_offset_fixing_is_disabled_dump_may_not_be_correct);
|
||||
@@ -1153,7 +1152,7 @@ sealed partial class Dump
|
||||
UpdateStatus?.Invoke(Localization.Core.Drive_reading_offset_not_found_in_database);
|
||||
UpdateStatus?.Invoke(Localization.Core.Disc_offset_cannot_be_calculated);
|
||||
|
||||
if(tracks.Any(t => t.Type == TrackType.Audio))
|
||||
if(tracks.Any(static t => t.Type == TrackType.Audio))
|
||||
UpdateStatus?.Invoke(Localization.Core.Dump_may_not_be_correct);
|
||||
|
||||
if(_fixOffset) _fixOffset = false;
|
||||
@@ -1238,16 +1237,18 @@ sealed partial class Dump
|
||||
|
||||
// Try to read the first track pregap
|
||||
if(_dumpFirstTrackPregap && readcd)
|
||||
{
|
||||
ReadCdFirstTrackPregap(blockSize,
|
||||
ref currentSpeed,
|
||||
mediaTags,
|
||||
supportedSubchannel,
|
||||
ref totalDuration,
|
||||
outputOptical);
|
||||
}
|
||||
|
||||
audioExtents = new ExtentsULong();
|
||||
|
||||
foreach(Track audioTrack in tracks.Where(t => t.Type == TrackType.Audio))
|
||||
foreach(Track audioTrack in tracks.Where(static t => t.Type == TrackType.Audio))
|
||||
audioExtents.Add(audioTrack.StartSector, audioTrack.EndSector);
|
||||
|
||||
// Set speed
|
||||
@@ -1269,7 +1270,7 @@ sealed partial class Dump
|
||||
|
||||
if(dskType == MediaType.CDIREADY || cdiWithHiddenTrack1)
|
||||
{
|
||||
Track track0 = tracks.FirstOrDefault(t => t.Sequence is 0 or 1);
|
||||
Track track0 = tracks.FirstOrDefault(static t => t.Sequence is 0 or 1);
|
||||
|
||||
track0.Type = TrackType.CdMode2Formless;
|
||||
|
||||
@@ -1510,9 +1511,8 @@ sealed partial class Dump
|
||||
supportsLongSectors);
|
||||
|
||||
foreach(Tuple<ulong, ulong> leadoutExtent in leadOutExtents.ToArray())
|
||||
{
|
||||
for(ulong e = leadoutExtent.Item1; e <= leadoutExtent.Item2; e++) subchannelExtents.Remove((int)e);
|
||||
}
|
||||
for(ulong e = leadoutExtent.Item1; e <= leadoutExtent.Item2; e++)
|
||||
subchannelExtents.Remove((int)e);
|
||||
|
||||
if(subchannelExtents.Count > 0 && _retryPasses > 0 && _retrySubchannel)
|
||||
{
|
||||
@@ -1614,7 +1614,7 @@ sealed partial class Dump
|
||||
foreach(Track trk in tracks)
|
||||
{
|
||||
// Fix track starts in each session's first track
|
||||
if(tracks.Where(t => t.Session == trk.Session).MinBy(t => t.Sequence).Sequence == trk.Sequence)
|
||||
if(tracks.Where(t => t.Session == trk.Session).MinBy(static t => t.Sequence).Sequence == trk.Sequence)
|
||||
{
|
||||
if(trk.Sequence == 1) continue;
|
||||
|
||||
|
||||
@@ -139,7 +139,7 @@ partial class Dump
|
||||
|
||||
if(dcMode10?.Pages != null)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode10.Value.Pages.Where(modePage =>
|
||||
foreach(Modes.ModePage modePage in dcMode10.Value.Pages.Where(static modePage =>
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
@@ -149,10 +149,8 @@ partial class Dump
|
||||
{
|
||||
if(dcMode6.Value.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(static modePage =>
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
}
|
||||
@@ -467,9 +465,8 @@ partial class Dump
|
||||
|
||||
// MEDIUM ERROR, retry with ignore error below
|
||||
if(decSense is { ASC: 0x11 })
|
||||
{
|
||||
if(!sectorsNotEvenPartial.Contains(badSector)) sectorsNotEvenPartial.Add(badSector);
|
||||
}
|
||||
if(!sectorsNotEvenPartial.Contains(badSector))
|
||||
sectorsNotEvenPartial.Add(badSector);
|
||||
}
|
||||
|
||||
// Because one block has been partially used to fix the offset
|
||||
@@ -519,8 +516,7 @@ partial class Dump
|
||||
extents.Add(badSector);
|
||||
_mediaGraph?.PaintSectorGood(badSector);
|
||||
|
||||
UpdateStatus?.Invoke(string.Format(UI.Fixed_ECC_Q_for_sector_0,
|
||||
badSector));
|
||||
UpdateStatus?.Invoke(string.Format(UI.Fixed_ECC_Q_for_sector_0, badSector));
|
||||
|
||||
sectorsNotEvenPartial.Remove(badSector);
|
||||
}
|
||||
@@ -688,7 +684,8 @@ partial class Dump
|
||||
PulseProgress?.Invoke(string.Format(Localization.Core.Trying_to_get_partial_data_for_sector_0,
|
||||
badSector));
|
||||
|
||||
Track track = tracks.OrderBy(t => t.StartSector).LastOrDefault(t => badSector >= t.StartSector);
|
||||
Track track = tracks.OrderBy(static t => t.StartSector)
|
||||
.LastOrDefault(t => badSector >= t.StartSector);
|
||||
|
||||
if(readcd)
|
||||
{
|
||||
@@ -852,7 +849,7 @@ partial class Dump
|
||||
{
|
||||
var badSector = (uint)bs;
|
||||
|
||||
Track track = tracks.OrderBy(t => t.StartSector).LastOrDefault(t => badSector >= t.StartSector);
|
||||
Track track = tracks.OrderBy(static t => t.StartSector).LastOrDefault(t => badSector >= t.StartSector);
|
||||
|
||||
if(_aborted)
|
||||
{
|
||||
|
||||
@@ -251,7 +251,8 @@ partial class Dump
|
||||
var trackRetries = 0;
|
||||
|
||||
// First track of each session has at least 150 sectors of pregap and is not always readable
|
||||
if(tracks.Where(trk => trk.Session == track.Session).MinBy(trk => trk.Sequence).Sequence == track.Sequence)
|
||||
if(tracks.Where(trk => trk.Session == track.Session).MinBy(static trk => trk.Sequence).Sequence ==
|
||||
track.Sequence)
|
||||
{
|
||||
AaruLogging.Debug(PREGAP_MODULE_NAME, Localization.Core.Skipping_track_0, track.Sequence);
|
||||
|
||||
@@ -563,7 +564,7 @@ partial class Dump
|
||||
lba));
|
||||
}
|
||||
|
||||
if(subBuf.All(b => b == 0))
|
||||
if(subBuf.All(static b => b == 0))
|
||||
{
|
||||
inexactPositioning = true;
|
||||
|
||||
@@ -681,7 +682,8 @@ partial class Dump
|
||||
trk.Pregap = (ulong)pregaps[trk.Sequence];
|
||||
|
||||
// Do not reduce pregap, or starting position of session's first track
|
||||
if(tracks.Where(t => t.Session == trk.Session).MinBy(t => t.Sequence).Sequence == trk.Sequence) continue;
|
||||
if(tracks.Where(t => t.Session == trk.Session).MinBy(static t => t.Sequence).Sequence == trk.Sequence)
|
||||
continue;
|
||||
|
||||
if(dumping)
|
||||
{
|
||||
@@ -845,8 +847,8 @@ partial class Dump
|
||||
|
||||
if(!sense)
|
||||
subBuf = DeinterleaveQ(cmdBuf);
|
||||
else if(dbDev?.ATAPI?.RemovableMedias?.Any(d => d.SupportsPlextorReadCDDA == true) == true ||
|
||||
dbDev?.SCSI?.RemovableMedias?.Any(d => d.SupportsPlextorReadCDDA == true) == true ||
|
||||
else if(dbDev?.ATAPI?.RemovableMedias?.Any(static d => d.SupportsPlextorReadCDDA == true) == true ||
|
||||
dbDev?.SCSI?.RemovableMedias?.Any(static d => d.SupportsPlextorReadCDDA == true) == true ||
|
||||
dev.Manufacturer.Equals("plextor", StringComparison.InvariantCultureIgnoreCase))
|
||||
sense = dev.PlextorReadCdDa(out cmdBuf, out _, lba, 96, 1, PlextorSubchannel.All, dev.Timeout, out _);
|
||||
|
||||
|
||||
@@ -118,7 +118,7 @@ partial class Dump
|
||||
|
||||
if(track.Sequence == 0)
|
||||
{
|
||||
track = tracks.FirstOrDefault(t => (int)t.Sequence == 1);
|
||||
track = tracks.FirstOrDefault(static t => (int)t.Sequence == 1);
|
||||
trackStart = 0;
|
||||
pregap = track?.StartSector ?? 0;
|
||||
}
|
||||
|
||||
@@ -95,9 +95,9 @@ partial class Dump
|
||||
if(toc.HasValue)
|
||||
{
|
||||
FullTOC.TrackDataDescriptor[] sortedTracks =
|
||||
toc.Value.TrackDescriptors.OrderBy(track => track.POINT).ToArray();
|
||||
toc.Value.TrackDescriptors.OrderBy(static track => track.POINT).ToArray();
|
||||
|
||||
foreach(FullTOC.TrackDataDescriptor trk in sortedTracks.Where(trk => trk.ADR is 1 or 4))
|
||||
foreach(FullTOC.TrackDataDescriptor trk in sortedTracks.Where(static trk => trk.ADR is 1 or 4))
|
||||
{
|
||||
switch(trk.POINT)
|
||||
{
|
||||
@@ -190,8 +190,9 @@ partial class Dump
|
||||
|
||||
if(oldToc.HasValue)
|
||||
{
|
||||
foreach(TOC.CDTOCTrackDataDescriptor trk in oldToc.Value.TrackDescriptors.OrderBy(t => t.TrackNumber)
|
||||
.Where(trk => trk.ADR is 1 or 4))
|
||||
foreach(TOC.CDTOCTrackDataDescriptor trk in oldToc.Value.TrackDescriptors
|
||||
.OrderBy(static t => t.TrackNumber)
|
||||
.Where(static trk => trk.ADR is 1 or 4))
|
||||
{
|
||||
switch(trk.TrackNumber)
|
||||
{
|
||||
@@ -250,7 +251,7 @@ partial class Dump
|
||||
|
||||
if(!sense)
|
||||
{
|
||||
byte[] temp = new byte[8];
|
||||
var temp = new byte[8];
|
||||
|
||||
Array.Copy(cmdBuf, 0, temp, 0, 8);
|
||||
Array.Reverse(temp);
|
||||
|
||||
@@ -124,7 +124,7 @@ partial class Dump
|
||||
|
||||
PulseProgress?.Invoke(string.Format(Localization.Core.Trimming_sector_0, badSector));
|
||||
|
||||
Track track = tracks.OrderBy(t => t.StartSector).LastOrDefault(t => badSector >= t.StartSector);
|
||||
Track track = tracks.OrderBy(static t => t.StartSector).LastOrDefault(t => badSector >= t.StartSector);
|
||||
|
||||
byte sectorsToTrim = 1;
|
||||
var badSectorToRead = (uint)badSector;
|
||||
|
||||
@@ -124,15 +124,17 @@ partial class Dump
|
||||
|
||||
if(filesystems.Count > 0)
|
||||
{
|
||||
foreach(var filesystem in filesystems.Select(o => new
|
||||
foreach(var filesystem in filesystems.Select(static o => new
|
||||
{
|
||||
o.start,
|
||||
o.type
|
||||
})
|
||||
.Distinct())
|
||||
{
|
||||
AaruLogging.WriteLine(Localization.Core.Found_filesystem_0_at_sector_1,
|
||||
filesystem.type,
|
||||
filesystem.start);
|
||||
}
|
||||
}
|
||||
|
||||
sidecar.OpticalDiscs[0].Dimensions = Dimensions.FromMediaType(mediaType);
|
||||
|
||||
@@ -520,7 +520,7 @@ partial class Dump
|
||||
|
||||
if(dcMode6?.Pages != null)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage =>
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(static modePage =>
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
@@ -783,7 +783,7 @@ partial class Dump
|
||||
|
||||
if(filesystems.Count > 0)
|
||||
{
|
||||
foreach(var filesystem in filesystems.Select(o => new
|
||||
foreach(var filesystem in filesystems.Select(static o => new
|
||||
{
|
||||
o.start,
|
||||
o.type
|
||||
|
||||
@@ -432,7 +432,7 @@ public partial class Dump
|
||||
|
||||
if(dcMode10.HasValue)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode10.Value.Pages.Where(modePage =>
|
||||
foreach(Modes.ModePage modePage in dcMode10.Value.Pages.Where(static modePage =>
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
@@ -442,7 +442,7 @@ public partial class Dump
|
||||
{
|
||||
if(dcMode6.HasValue)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage =>
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(static modePage =>
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
@@ -713,7 +713,7 @@ public partial class Dump
|
||||
|
||||
if(filesystems.Count > 0)
|
||||
{
|
||||
foreach(var filesystem in filesystems.Select(o => new
|
||||
foreach(var filesystem in filesystems.Select(static o => new
|
||||
{
|
||||
o.start,
|
||||
o.type
|
||||
|
||||
@@ -457,7 +457,7 @@ public partial class Dump
|
||||
|
||||
if(dcMode6.HasValue)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage =>
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(static modePage =>
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
|
||||
@@ -283,9 +283,8 @@ partial class Dump
|
||||
Modes.DecodedMode? decMode = null;
|
||||
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue) decMode = Modes.DecodeMode10(cmdBuf, _dev.ScsiType);
|
||||
}
|
||||
if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue)
|
||||
decMode = Modes.DecodeMode10(cmdBuf, _dev.ScsiType);
|
||||
|
||||
UpdateStatus?.Invoke(Localization.Core.Requesting_MODE_SENSE_6);
|
||||
|
||||
@@ -313,9 +312,8 @@ partial class Dump
|
||||
if(sense || _dev.Error) sense = _dev.ModeSense(out cmdBuf, out senseBuf, 5, out duration);
|
||||
|
||||
if(!sense && !_dev.Error)
|
||||
{
|
||||
if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue) decMode = Modes.DecodeMode6(cmdBuf, _dev.ScsiType);
|
||||
}
|
||||
if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue)
|
||||
decMode = Modes.DecodeMode6(cmdBuf, _dev.ScsiType);
|
||||
|
||||
// TODO: Check partitions page
|
||||
if(decMode.HasValue)
|
||||
@@ -858,11 +856,11 @@ partial class Dump
|
||||
currentBlock = _resume.NextBlock;
|
||||
|
||||
currentTapeFile =
|
||||
outputTape.Files.FirstOrDefault(f => f.LastBlock == outputTape?.Files.Max(g => g.LastBlock));
|
||||
outputTape.Files.FirstOrDefault(f => f.LastBlock == outputTape?.Files.Max(static g => g.LastBlock));
|
||||
|
||||
currentTapePartition =
|
||||
outputTape.TapePartitions.FirstOrDefault(p => p.LastBlock ==
|
||||
outputTape?.TapePartitions.Max(g => g.LastBlock));
|
||||
outputTape?.TapePartitions.Max(static g => g.LastBlock));
|
||||
}
|
||||
|
||||
if(mode6Data != null) outputTape.WriteMediaTag(mode6Data, MediaTagType.SCSI_MODESENSE_6);
|
||||
@@ -1422,7 +1420,7 @@ partial class Dump
|
||||
|
||||
if(filesystems.Count > 0)
|
||||
{
|
||||
foreach(var filesystem in filesystems.Select(o => new
|
||||
foreach(var filesystem in filesystems.Select(static o => new
|
||||
{
|
||||
o.start,
|
||||
o.type
|
||||
|
||||
@@ -196,7 +196,7 @@ partial class Dump
|
||||
|
||||
// TODO: Fix this
|
||||
containsFloppyPage = decMode?.Pages?.Aggregate(containsFloppyPage,
|
||||
(current, modePage) =>
|
||||
static (current, modePage) =>
|
||||
current | modePage.Page == 0x05) ==
|
||||
true;
|
||||
}
|
||||
@@ -522,7 +522,7 @@ partial class Dump
|
||||
});
|
||||
}
|
||||
else
|
||||
tracks = tracks.OrderBy(t => t.Sequence).ToList();
|
||||
tracks = tracks.OrderBy(static t => t.Sequence).ToList();
|
||||
|
||||
ret = outputFormat.Create(_outputPath,
|
||||
dskType,
|
||||
@@ -725,8 +725,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(static s => s.DiscSize == DI.BluSize.Eighty) == true;
|
||||
|
||||
Spiral.DiscParameters discSpiralParameters = Spiral.DiscParametersFromMediaType(dskType, discIs80Mm);
|
||||
|
||||
@@ -780,7 +780,7 @@ partial class Dump
|
||||
(CopyrightType)cmi[0] == CopyrightType.CSS)
|
||||
{
|
||||
UpdateStatus?.Invoke(Localization.Core.Title_keys_dumping_is_enabled_This_will_be_very_slow);
|
||||
_resume.MissingTitleKeys ??= [..Enumerable.Range(0, (int)blocks).Select(n => (ulong)n)];
|
||||
_resume.MissingTitleKeys ??= [..Enumerable.Range(0, (int)blocks).Select(static n => (ulong)n)];
|
||||
}
|
||||
|
||||
if(_dev.ScsiType == PeripheralDeviceTypes.OpticalDevice)
|
||||
@@ -1361,7 +1361,7 @@ partial class Dump
|
||||
|
||||
if(filesystems.Count > 0)
|
||||
{
|
||||
foreach(var filesystem in filesystems.Select(o => new
|
||||
foreach(var filesystem in filesystems.Select(static o => new
|
||||
{
|
||||
o.start,
|
||||
o.type
|
||||
|
||||
@@ -102,7 +102,7 @@ partial class Dump
|
||||
|
||||
if(dcMode10?.Pages != null)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode10.Value.Pages.Where(modePage =>
|
||||
foreach(Modes.ModePage modePage in dcMode10.Value.Pages.Where(static modePage =>
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
@@ -112,10 +112,8 @@ partial class Dump
|
||||
{
|
||||
if(dcMode6.Value.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(static modePage =>
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
}
|
||||
@@ -449,7 +447,7 @@ partial class Dump
|
||||
|
||||
// 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(static k => k == 0))
|
||||
{
|
||||
outputFormat.WriteSectorTag([0, 0, 0, 0, 0], missingKey, false, SectorTagType.DvdSectorTitleKey);
|
||||
|
||||
|
||||
@@ -1089,8 +1089,9 @@ partial class Dump
|
||||
List<ulong> tmpList = [];
|
||||
|
||||
foreach(ulong ur in _resume.BadBlocks)
|
||||
for(ulong i = ur; i < ur + blocksToRead; i++)
|
||||
tmpList.Add(i);
|
||||
{
|
||||
for(ulong i = ur; i < ur + blocksToRead; i++) tmpList.Add(i);
|
||||
}
|
||||
|
||||
tmpList.Sort();
|
||||
|
||||
@@ -1135,7 +1136,7 @@ partial class Dump
|
||||
|
||||
if(dcMode10.HasValue)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode10.Value.Pages.Where(modePage =>
|
||||
foreach(Modes.ModePage modePage in dcMode10.Value.Pages.Where(static modePage =>
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
@@ -1145,7 +1146,7 @@ partial class Dump
|
||||
{
|
||||
if(dcMode6.HasValue)
|
||||
{
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(modePage =>
|
||||
foreach(Modes.ModePage modePage in dcMode6.Value.Pages.Where(static modePage =>
|
||||
modePage is { Page: 0x01, Subpage: 0x00 }))
|
||||
currentModePage = modePage;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user