Use LINQ's MinBy and MaxBy.

This commit is contained in:
2022-11-14 01:04:32 +00:00
parent 84a5efe216
commit 15b36ff898
4 changed files with 5 additions and 6 deletions

View File

@@ -1338,7 +1338,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).OrderBy(t => t.Sequence).FirstOrDefault().Sequence ==
if(tracks.Where(t => t.Session == trk.Session).MinBy(t => t.Sequence).Sequence ==
trk.Sequence)
{
if(trk.Sequence == 1)

View File

@@ -201,7 +201,7 @@ 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).OrderBy(trk => trk.Sequence).FirstOrDefault().
if(tracks.Where(trk => trk.Session == track.Session).MinBy(trk => trk.Sequence).
Sequence == track.Sequence)
{
AaruConsole.DebugWriteLine("Pregap calculator", "Skipping track {0}", track.Sequence);
@@ -587,7 +587,7 @@ 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).OrderBy(t => t.Sequence).FirstOrDefault().Sequence ==
if(tracks.Where(t => t.Session == trk.Session).MinBy(t => t.Sequence).Sequence ==
trk.Sequence)
continue;