Reduce more Linq steps

This commit is contained in:
Matt Nadareski
2024-11-12 16:29:47 -05:00
parent c2d0b71d22
commit 90fc16b888
2 changed files with 3 additions and 6 deletions

View File

@@ -304,8 +304,7 @@ namespace SabreTools.Serialization.Deserializers
// Get the full list of unique string offsets
var stringOffsets = resourceTable.ResourceTypes
.Where(rt => rt != null)
.Where(rt => !rt!.IsIntegerType() && rt!.TypeID != 0)
.Where(rt => rt != null && rt.TypeID != 0 && !rt.IsIntegerType())
.Select(rt => rt!.TypeID)
.Union(resourceTable.ResourceTypes
.Where(rt => rt != null && rt!.TypeID != 0)

View File

@@ -1053,8 +1053,7 @@ namespace SabreTools.Serialization.Deserializers
if (importTable.ImportLookupTables != null && importLookupTables.Count > 0)
{
var addresses = importTable.ImportLookupTables
.Where(kvp => kvp.Value != null)
.SelectMany(kvp => kvp.Value!)
.SelectMany(kvp => kvp.Value ?? [])
.Where(ilte => ilte != null)
.Select(ilte => (int)ilte!.HintNameTableRVA.ConvertVirtualAddress(sections));
hintNameTableEntryAddresses.AddRange(addresses);
@@ -1064,8 +1063,7 @@ namespace SabreTools.Serialization.Deserializers
if (importTable.ImportAddressTables != null && importTable.ImportAddressTables.Count > 0)
{
var addresses = importTable.ImportAddressTables
.Where(kvp => kvp.Value != null)
.SelectMany(kvp => kvp.Value!)
.SelectMany(kvp => kvp.Value ?? [])
.Where(iate => iate != null)
.Select(iate => (int)iate!.HintNameTableRVA.ConvertVirtualAddress(sections));
hintNameTableEntryAddresses.AddRange(addresses);