diff --git a/SabreTools.Serialization/Readers/MicrosoftCabinet.cs b/SabreTools.Serialization/Readers/MicrosoftCabinet.cs
index 25d2fdc2..0e66fdba 100644
--- a/SabreTools.Serialization/Readers/MicrosoftCabinet.cs
+++ b/SabreTools.Serialization/Readers/MicrosoftCabinet.cs
@@ -203,13 +203,13 @@ namespace SabreTools.Serialization.Readers
dataBlock.Checksum = data.ReadUInt32LittleEndian();
dataBlock.CompressedSize = data.ReadUInt16LittleEndian();
dataBlock.UncompressedSize = data.ReadUInt16LittleEndian();
-
+
if (dataReservedSize > 0)
data.SeekIfPossible(dataReservedSize, SeekOrigin.Current);
if (dataBlock.CompressedSize > 0)
data.SeekIfPossible(dataBlock.CompressedSize, SeekOrigin.Current);
-
+
return dataBlock;
}
diff --git a/SabreTools.Serialization/Wrappers/MicrosoftCabinet.Extraction.cs b/SabreTools.Serialization/Wrappers/MicrosoftCabinet.Extraction.cs
index 8831b0d8..f1923c34 100644
--- a/SabreTools.Serialization/Wrappers/MicrosoftCabinet.Extraction.cs
+++ b/SabreTools.Serialization/Wrappers/MicrosoftCabinet.Extraction.cs
@@ -178,19 +178,18 @@ namespace SabreTools.Serialization.Wrappers
if (f == 0 && (cabinet.Files[0].FolderIndex == FolderIndex.CONTINUED_PREV_AND_NEXT
|| cabinet.Files[0].FolderIndex == FolderIndex.CONTINUED_FROM_PREV))
continue;
-
+
var folder = cabinet.Folders[f];
allExtracted &= cabinet.ExtractFolder(Filename, outputDirectory, folder, f, ignorePrev, includeDebug);
}
// Move to the next cabinet, if possible
Array.ForEach(cabinet.Folders, folder => folder.DataBlocks = []);
-
+
cabinet = cabinet.Next;
cabinet?.Prev = null;
-
+
// TODO: already-extracted data isn't being cleared from memory, at least not nearly enough.
-
if (cabinet?.Folders == null || cabinet.Folders.Length == 0)
break;
}
@@ -203,7 +202,7 @@ namespace SabreTools.Serialization.Wrappers
return false;
}
}
-
+
///
/// Extract the contents of a single folder
///
@@ -242,22 +241,21 @@ namespace SabreTools.Serialization.Wrappers
// debug output for inconsistencies would go here
continue;
}
-
+
fileList.Add(file);
}
-
+
CFFILE[] files = fileList.ToArray();
blockStream.SeekIfPossible(0, SeekOrigin.Begin);
for (int i = 0; i < files.Length; i++)
{
var file = files[i];
-
allExtracted &= ExtractFiles(outputDirectory, blockStream, file, includeDebug);
}
return allExtracted;
}
-
+
// TODO: this will apparently improve memory usage/performance, but it's not clear if this implementation is enough for that to happen
///
/// Extract the contents of a single file, intended to be used with all files in a straight shot
diff --git a/SabreTools.Serialization/Wrappers/MicrosoftCabinet.cs b/SabreTools.Serialization/Wrappers/MicrosoftCabinet.cs
index 78743500..5a8c678b 100644
--- a/SabreTools.Serialization/Wrappers/MicrosoftCabinet.cs
+++ b/SabreTools.Serialization/Wrappers/MicrosoftCabinet.cs
@@ -363,7 +363,7 @@ namespace SabreTools.Serialization.Wrappers
// Return all found blocks in order
return [.. prevBlocks, .. folder.DataBlocks, .. nextBlocks];
}
-
+
///
/// Loads in all the datablocks for the current folder.
///
@@ -390,9 +390,8 @@ namespace SabreTools.Serialization.Wrappers
offset += folder.DataBlocks[i].CompressedSize;
}
}
-
}
-
+
///
/// Get all files for the current folder, plus connected spanned folders.
///
@@ -423,7 +422,7 @@ namespace SabreTools.Serialization.Wrappers
int fileFolder = GetFolderIndex(f);
return fileFolder == folderIndex;
});
-
+
// Check if the folder spans in either direction
bool spanPrev = Array.Exists(files, f => f.FolderIndex == FolderIndex.CONTINUED_FROM_PREV || f.FolderIndex == FolderIndex.CONTINUED_PREV_AND_NEXT);
bool spanNext = Array.Exists(files, f => f.FolderIndex == FolderIndex.CONTINUED_TO_NEXT || f.FolderIndex == FolderIndex.CONTINUED_PREV_AND_NEXT);
@@ -443,7 +442,7 @@ namespace SabreTools.Serialization.Wrappers
prevFiles = Prev.GetSpannedFiles(filename, prevFolderIndex, skipNext: true) ?? [];
}
}
-
+
// If the folder spans forward and Next is not being skipped
CFFILE[] nextFiles = [];
if (!skipNext && spanNext)
@@ -459,7 +458,7 @@ namespace SabreTools.Serialization.Wrappers
nextFiles = Next.GetSpannedFiles(filename, 0, skipPrev: true) ?? [];
}
}
-
+
// Return all found files in order
return [.. prevFiles, .. files, .. nextFiles];
}