|
1 | 1 | using System; |
| 2 | +using System.Collections.Generic; |
2 | 3 | using System.IO; |
3 | 4 | using SabreTools.Data.Models.MicrosoftCabinet; |
4 | 5 | using SabreTools.IO.Extensions; |
@@ -189,6 +190,9 @@ public bool Extract(string outputDirectory, bool includeDebug) |
189 | 190 | } |
190 | 191 | cabinet = cabinet.Next; |
191 | 192 | cabinet?.Prev = null; |
| 193 | + |
| 194 | + // TODO: already-extracted data isn't being cleared from memory, at least not nearly enough. |
| 195 | + |
192 | 196 | if (cabinet?.Folders == null || cabinet.Folders.Length == 0) |
193 | 197 | break; |
194 | 198 | } |
@@ -226,13 +230,29 @@ private bool ExtractFolder(string? filename, |
226 | 230 |
|
227 | 231 | // Loop through the files |
228 | 232 | bool allExtracted = true; |
229 | | - var files = GetSpannedFiles(filename, folderIndex, ignorePrev); |
| 233 | + var filterFiles = GetSpannedFiles(filename, folderIndex, ignorePrev); |
| 234 | + List<CFFILE> fileList = []; |
| 235 | + |
| 236 | + // Filtering, add debug output eventually |
| 237 | + for (int i = 0; i < filterFiles.Length; i++) |
| 238 | + { |
| 239 | + var file = filterFiles[i]; |
| 240 | + |
| 241 | + if (file.FolderIndex == FolderIndex.CONTINUED_PREV_AND_NEXT || |
| 242 | + file.FolderIndex == FolderIndex.CONTINUED_FROM_PREV) |
| 243 | + { |
| 244 | + // debug output for inconsistencies would go here |
| 245 | + continue; |
| 246 | + } |
| 247 | + |
| 248 | + fileList.Add(file); |
| 249 | + } |
| 250 | + |
| 251 | + CFFILE[] files = fileList.ToArray(); |
230 | 252 | blockStream.SeekIfPossible(0, SeekOrigin.Begin); |
231 | 253 | for (int i = 0; i < files.Length; i++) |
232 | 254 | { |
233 | 255 | var file = files[i]; |
234 | | - if (file.FolderIndex == FolderIndex.CONTINUED_PREV_AND_NEXT || file.FolderIndex == FolderIndex.CONTINUED_FROM_PREV) |
235 | | - continue; |
236 | 256 |
|
237 | 257 | allExtracted &= ExtractFiles(outputDirectory, blockStream, file, includeDebug); |
238 | 258 | } |
|
0 commit comments