diff --git a/SabreTools.Serialization/Wrappers/BFPK.Extraction.cs b/SabreTools.Serialization/Wrappers/BFPK.Extraction.cs index 71c89492..25ccbfc4 100644 --- a/SabreTools.Serialization/Wrappers/BFPK.Extraction.cs +++ b/SabreTools.Serialization/Wrappers/BFPK.Extraction.cs @@ -82,7 +82,7 @@ namespace SabreTools.Serialization.Wrappers // Read the data block var data = ReadRangeFromSource(offset, compressedSize); - if (data == null) + if (data.Length == 0) return false; // If we have uncompressed data diff --git a/SabreTools.Serialization/Wrappers/BSP.Extraction.cs b/SabreTools.Serialization/Wrappers/BSP.Extraction.cs index a61cf128..04fa90b4 100644 --- a/SabreTools.Serialization/Wrappers/BSP.Extraction.cs +++ b/SabreTools.Serialization/Wrappers/BSP.Extraction.cs @@ -44,7 +44,7 @@ namespace SabreTools.Serialization.Wrappers // Read the data var lump = Lumps[index]; var data = ReadRangeFromSource(lump.Offset, lump.Length); - if (data == null) + if (data.Length == 0) return false; // Create the filename diff --git a/SabreTools.Serialization/Wrappers/CFB.cs b/SabreTools.Serialization/Wrappers/CFB.cs index d15fe341..7092b972 100644 --- a/SabreTools.Serialization/Wrappers/CFB.cs +++ b/SabreTools.Serialization/Wrappers/CFB.cs @@ -201,7 +201,7 @@ namespace SabreTools.Serialization.Wrappers // Try to read the sector data var sectorData = ReadRangeFromSource(sectorDataOffset, (int)SectorSize); - if (sectorData == null) + if (sectorData.Length == 0) return null; // Add the sector data to the output diff --git a/SabreTools.Serialization/Wrappers/GCF.Extraction.cs b/SabreTools.Serialization/Wrappers/GCF.Extraction.cs index 5096d398..de3ce2b9 100644 --- a/SabreTools.Serialization/Wrappers/GCF.Extraction.cs +++ b/SabreTools.Serialization/Wrappers/GCF.Extraction.cs @@ -95,7 +95,7 @@ namespace SabreTools.Serialization.Wrappers { int readSize = (int)Math.Min(BlockSize, fileSize); var data = ReadRangeFromSource((int)dataBlockOffsets[i], readSize); - if (data == null) + if (data.Length == 0) return false; fs.Write(data, 0, data.Length); diff --git a/SabreTools.Serialization/Wrappers/InstallShieldArchiveV3.Extraction.cs b/SabreTools.Serialization/Wrappers/InstallShieldArchiveV3.Extraction.cs index 5a4c6363..9c837613 100644 --- a/SabreTools.Serialization/Wrappers/InstallShieldArchiveV3.Extraction.cs +++ b/SabreTools.Serialization/Wrappers/InstallShieldArchiveV3.Extraction.cs @@ -73,7 +73,7 @@ namespace SabreTools.Serialization.Wrappers // Read the compressed data directly var compressedData = ReadRangeFromSource((int)fileOffset, (int)fileSize); - if (compressedData == null) + if (compressedData.Length == 0) return false; // If the compressed and uncompressed sizes match diff --git a/SabreTools.Serialization/Wrappers/LZKWAJ.Extraction.cs b/SabreTools.Serialization/Wrappers/LZKWAJ.Extraction.cs index 236695a6..06a0dcd7 100644 --- a/SabreTools.Serialization/Wrappers/LZKWAJ.Extraction.cs +++ b/SabreTools.Serialization/Wrappers/LZKWAJ.Extraction.cs @@ -17,7 +17,7 @@ namespace SabreTools.Serialization.Wrappers // Read in the data as an array byte[]? contents = ReadRangeFromSource(DataOffset, (int)compressedSize); - if (contents == null) + if (contents.Length == 0) return false; // Get the decompressor diff --git a/SabreTools.Serialization/Wrappers/LZQBasic.Extraction.cs b/SabreTools.Serialization/Wrappers/LZQBasic.Extraction.cs index 195645cc..558cf214 100644 --- a/SabreTools.Serialization/Wrappers/LZQBasic.Extraction.cs +++ b/SabreTools.Serialization/Wrappers/LZQBasic.Extraction.cs @@ -17,7 +17,7 @@ namespace SabreTools.Serialization.Wrappers // Read in the data as an array byte[]? contents = ReadRangeFromSource(12, (int)compressedSize); - if (contents == null) + if (contents.Length == 0) return false; // Get the decompressor diff --git a/SabreTools.Serialization/Wrappers/LZSZDD.Extraction.cs b/SabreTools.Serialization/Wrappers/LZSZDD.Extraction.cs index 89ca44de..b0a4ef10 100644 --- a/SabreTools.Serialization/Wrappers/LZSZDD.Extraction.cs +++ b/SabreTools.Serialization/Wrappers/LZSZDD.Extraction.cs @@ -26,7 +26,7 @@ namespace SabreTools.Serialization.Wrappers // Read in the data as an array byte[]? contents = ReadRangeFromSource(14, (int)compressedSize); - if (contents == null) + if (contents.Length == 0) return false; // Get the decompressor diff --git a/SabreTools.Serialization/Wrappers/PAK.Extraction.cs b/SabreTools.Serialization/Wrappers/PAK.Extraction.cs index eaf7ad5d..eb84833d 100644 --- a/SabreTools.Serialization/Wrappers/PAK.Extraction.cs +++ b/SabreTools.Serialization/Wrappers/PAK.Extraction.cs @@ -43,7 +43,7 @@ namespace SabreTools.Serialization.Wrappers // Read the item data var directoryItem = DirectoryItems[index]; var data = ReadRangeFromSource((int)directoryItem.ItemOffset, (int)directoryItem.ItemLength); - if (data == null) + if (data.Length == 0) return false; // If we have an invalid output directory diff --git a/SabreTools.Serialization/Wrappers/PFF.Extraction.cs b/SabreTools.Serialization/Wrappers/PFF.Extraction.cs index 001e6acc..a1877f2b 100644 --- a/SabreTools.Serialization/Wrappers/PFF.Extraction.cs +++ b/SabreTools.Serialization/Wrappers/PFF.Extraction.cs @@ -69,7 +69,7 @@ namespace SabreTools.Serialization.Wrappers // Read the data block var data = ReadRangeFromSource(offset, size); - if (data == null) + if (data.Length == 0) return false; // Write the data -- TODO: Compressed data? diff --git a/SabreTools.Serialization/Wrappers/PortableExecutable.cs b/SabreTools.Serialization/Wrappers/PortableExecutable.cs index 709decd6..b01f45c3 100644 --- a/SabreTools.Serialization/Wrappers/PortableExecutable.cs +++ b/SabreTools.Serialization/Wrappers/PortableExecutable.cs @@ -1173,7 +1173,7 @@ namespace SabreTools.Serialization.Wrappers try { entryData = ReadRangeFromSource((int)address, (int)size); - if (entryData == null || entryData.Length < 4) + if (entryData.Length < 4) continue; } catch (EndOfStreamException) @@ -1871,10 +1871,10 @@ namespace SabreTools.Serialization.Wrappers return _sectionData[index]; // Populate the raw section data based on the source - byte[]? sectionData = ReadRangeFromSource((int)address, (int)size); + var sectionData = ReadRangeFromSource((int)address, (int)size); - // Cache and return the section data, even if null - _sectionData[index] = sectionData ?? []; + // Cache and return the section data + _sectionData[index] = sectionData; return sectionData; } @@ -2032,10 +2032,10 @@ namespace SabreTools.Serialization.Wrappers return null; // Populate the raw table data based on the source - byte[]? tableData = ReadRangeFromSource((int)address, (int)size); + var tableData = ReadRangeFromSource((int)address, (int)size); - // Cache and return the table data, even if null - _tableData[index] = tableData ?? []; + // Cache and return the table data + _tableData[index] = tableData; return tableData; } diff --git a/SabreTools.Serialization/Wrappers/SGA.Extraction.cs b/SabreTools.Serialization/Wrappers/SGA.Extraction.cs index 391cce5e..686ccfcb 100644 --- a/SabreTools.Serialization/Wrappers/SGA.Extraction.cs +++ b/SabreTools.Serialization/Wrappers/SGA.Extraction.cs @@ -83,7 +83,7 @@ namespace SabreTools.Serialization.Wrappers // Read the compressed data directly var compressedData = ReadRangeFromSource((int)fileOffset, (int)fileSize); - if (compressedData == null) + if (compressedData.Length == 0) return false; // If the compressed and uncompressed sizes match diff --git a/SabreTools.Serialization/Wrappers/VBSP.Extraction.cs b/SabreTools.Serialization/Wrappers/VBSP.Extraction.cs index c057698f..04127f6e 100644 --- a/SabreTools.Serialization/Wrappers/VBSP.Extraction.cs +++ b/SabreTools.Serialization/Wrappers/VBSP.Extraction.cs @@ -44,7 +44,7 @@ namespace SabreTools.Serialization.Wrappers // Read the data var lump = Lumps[index]; var data = ReadRangeFromSource(lump.Offset, lump.Length); - if (data == null) + if (data.Length == 0) return false; // If we have an invalid output directory diff --git a/SabreTools.Serialization/Wrappers/WAD3.Extraction.cs b/SabreTools.Serialization/Wrappers/WAD3.Extraction.cs index ad82bc23..c8beb6f5 100644 --- a/SabreTools.Serialization/Wrappers/WAD3.Extraction.cs +++ b/SabreTools.Serialization/Wrappers/WAD3.Extraction.cs @@ -43,7 +43,7 @@ namespace SabreTools.Serialization.Wrappers // Read the data -- TODO: Handle uncompressed lumps (see BSP.ExtractTexture) var lump = DirEntries[index]; var data = ReadRangeFromSource((int)lump.Offset, (int)lump.Length); - if (data == null) + if (data.Length == 0) return false; // If we have an invalid output directory diff --git a/SabreTools.Serialization/Wrappers/XZP.Extraction.cs b/SabreTools.Serialization/Wrappers/XZP.Extraction.cs index 52f6848a..bf0fa5d5 100644 --- a/SabreTools.Serialization/Wrappers/XZP.Extraction.cs +++ b/SabreTools.Serialization/Wrappers/XZP.Extraction.cs @@ -52,7 +52,7 @@ namespace SabreTools.Serialization.Wrappers // Load the item data var data = ReadRangeFromSource((int)directoryEntry.EntryOffset, (int)directoryEntry.EntryLength); - if (data == null) + if (data.Length == 0) return false; // If we have an invalid output directory