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:
@@ -84,8 +84,8 @@ public sealed partial class Cdrdao
|
||||
{
|
||||
get
|
||||
{
|
||||
Track firstTrack = Tracks.First(t => t.Sequence == Tracks.Min(m => m.Sequence));
|
||||
Track lastTrack = Tracks.First(t => t.Sequence == Tracks.Max(m => m.Sequence));
|
||||
Track firstTrack = Tracks.First(t => t.Sequence == Tracks.Min(static m => m.Sequence));
|
||||
Track lastTrack = Tracks.First(t => t.Sequence == Tracks.Max(static m => m.Sequence));
|
||||
|
||||
return
|
||||
[
|
||||
@@ -160,13 +160,13 @@ public sealed partial class Cdrdao
|
||||
{
|
||||
aaruTrack.Indexes[0] = -150;
|
||||
|
||||
foreach(KeyValuePair<int, ulong> idx in cdrTrack.Indexes.OrderBy(i => i.Key))
|
||||
foreach(KeyValuePair<int, ulong> idx in cdrTrack.Indexes.OrderBy(static i => i.Key))
|
||||
aaruTrack.Indexes[(ushort)idx.Key] = (int)idx.Value;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
foreach(KeyValuePair<int, ulong> idx in cdrTrack.Indexes.OrderBy(i => i.Key))
|
||||
foreach(KeyValuePair<int, ulong> idx in cdrTrack.Indexes.OrderBy(static i => i.Key))
|
||||
aaruTrack.Indexes[(ushort)idx.Key] = (int)idx.Value;
|
||||
}
|
||||
|
||||
|
||||
@@ -501,14 +501,13 @@ public sealed partial class Cdrdao
|
||||
}
|
||||
|
||||
if(_writingTracks != null && _writingStreams != null)
|
||||
{
|
||||
foreach(FileStream oldTrack in _writingStreams.Select(t => t.Value).Distinct()) oldTrack.Close();
|
||||
}
|
||||
foreach(FileStream oldTrack in _writingStreams.Select(static t => t.Value).Distinct())
|
||||
oldTrack.Close();
|
||||
|
||||
ulong currentOffset = 0;
|
||||
_writingTracks = [];
|
||||
|
||||
foreach(Track track in tracks.OrderBy(t => t.Sequence))
|
||||
foreach(Track track in tracks.OrderBy(static t => t.Sequence))
|
||||
{
|
||||
if(track.SubchannelType is TrackSubchannelType.Q16 or TrackSubchannelType.Q16Interleaved)
|
||||
{
|
||||
@@ -582,12 +581,12 @@ public sealed partial class Cdrdao
|
||||
_writingStreams.First().Value.Close();
|
||||
}
|
||||
|
||||
bool data = _writingTracks.Count(t => t.Type != TrackType.Audio) > 0;
|
||||
bool data = _writingTracks.Count(static t => t.Type != TrackType.Audio) > 0;
|
||||
|
||||
bool mode2 =
|
||||
_writingTracks.Count(t => t.Type is TrackType.CdMode2Form1
|
||||
or TrackType.CdMode2Form2
|
||||
or TrackType.CdMode2Formless) >
|
||||
_writingTracks.Count(static t => t.Type is TrackType.CdMode2Form1
|
||||
or TrackType.CdMode2Form2
|
||||
or TrackType.CdMode2Formless) >
|
||||
0;
|
||||
|
||||
if(mode2)
|
||||
@@ -654,7 +653,8 @@ public sealed partial class Cdrdao
|
||||
(ulong)(track.RawBytesPerSector +
|
||||
(track.SubchannelType != TrackSubchannelType.None ? 96 : 0)));
|
||||
|
||||
foreach(KeyValuePair<ushort, int> index in track.Indexes.OrderBy(i => i.Key).Where(i => i.Key > 1))
|
||||
foreach(KeyValuePair<ushort, int> index in track.Indexes.OrderBy(static i => i.Key)
|
||||
.Where(static i => i.Key > 1))
|
||||
{
|
||||
msf = LbaToMsf((ulong)index.Value - (track.Pregap + track.StartSector));
|
||||
|
||||
|
||||
Reference in New Issue
Block a user