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:
@@ -194,7 +194,7 @@ public sealed class Acorn : IPartition
|
||||
|
||||
IcsTable table = Marshal.ByteArrayToStructureLittleEndian<IcsTable>(sector);
|
||||
|
||||
foreach(IcsEntry entry in table.entries.Where(entry => entry.size != 0))
|
||||
foreach(IcsEntry entry in table.entries.Where(static entry => entry.size != 0))
|
||||
{
|
||||
// FileCore partition
|
||||
Partition part;
|
||||
|
||||
@@ -110,7 +110,7 @@ public sealed class DEC : IPartition
|
||||
Sequence = counter,
|
||||
Scheme = Name
|
||||
})
|
||||
.Where(part => part.Size > 0))
|
||||
.Where(static part => part.Size > 0))
|
||||
{
|
||||
partitions.Add(part);
|
||||
counter++;
|
||||
|
||||
@@ -186,8 +186,8 @@ public sealed class GuidPartitionTable : IPartition
|
||||
|
||||
ulong pSeq = 0;
|
||||
|
||||
foreach(Entry entry in entries.Where(entry => entry.partitionType != Guid.Empty &&
|
||||
entry.partitionId != Guid.Empty))
|
||||
foreach(Entry entry in entries.Where(static entry => entry.partitionType != Guid.Empty &&
|
||||
entry.partitionId != Guid.Empty))
|
||||
{
|
||||
AaruLogging.Debug(MODULE_NAME, "entry.partitionType = {0}", entry.partitionType);
|
||||
AaruLogging.Debug(MODULE_NAME, "entry.partitionId = {0}", entry.partitionId);
|
||||
|
||||
@@ -74,9 +74,9 @@ public sealed class Plan9 : IPartition
|
||||
// While all of Plan9 is supposedly UTF-8, it uses ASCII strcmp for reading its partition table
|
||||
string[] really = StringHandlers.CToString(sector).Split('\n');
|
||||
|
||||
foreach(string[] tokens in really.TakeWhile(part => part.Length >= 5 && part[..5] == "part ")
|
||||
.Select(part => part.Split(' '))
|
||||
.TakeWhile(tokens => tokens.Length == 4))
|
||||
foreach(string[] tokens in really.TakeWhile(static part => part.Length >= 5 && part[..5] == "part ")
|
||||
.Select(static part => part.Split(' '))
|
||||
.TakeWhile(static tokens => tokens.Length == 4))
|
||||
{
|
||||
if(!ulong.TryParse(tokens[2], out ulong start) || !ulong.TryParse(tokens[3], out ulong end)) break;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user