@@ -318,7 +318,7 @@ private static CompressionType GetCompressionType(CFFOLDER folder)
318318 GetData ( folder ) ;
319319
320320 // Get all files for the folder
321- var files = GetFiles ( filename , folderIndex ) ;
321+ var files = GetFiles ( folderIndex , skipPrev ) ;
322322 if ( files . Length == 0 )
323323 return folder . DataBlocks ;
324324
@@ -389,12 +389,12 @@ public void GetData(CFFOLDER folder)
389389 }
390390
391391 /// <summary>
392- /// Get all files for the current folder index
392+ /// Get all files for the current folder, plus connected spanned folders.
393393 /// </summary>
394394 /// <param name="folderIndex">Index of the folder in the cabinet</param>
395395 /// <param name="ignorePrev">True to ignore previous links, false otherwise</param>
396396 /// <returns>Array of all files for the folder</returns>
397- private CFFILE [ ] GetFiles ( string ? filename , int folderIndex , bool ignorePrev = false , bool skipPrev = false , bool skipNext = false )
397+ private CFFILE [ ] GetSpannedFiles ( string ? filename , int folderIndex , bool ignorePrev = false , bool skipPrev = false , bool skipNext = false )
398398 {
399399 // Ignore invalid archives
400400 if ( Files == null )
@@ -435,7 +435,7 @@ private CFFILE[] GetFiles(string? filename, int folderIndex, bool ignorePrev = f
435435 if ( Prev ? . Header != null && Prev . Folders != null )
436436 {
437437 int prevFolderIndex = Prev . FolderCount - 1 ;
438- prevFiles = Prev . GetFiles ( filename , prevFolderIndex , skipNext : true ) ?? [ ] ;
438+ prevFiles = Prev . GetSpannedFiles ( filename , prevFolderIndex , skipNext : true ) ?? [ ] ;
439439 }
440440 }
441441
@@ -451,7 +451,7 @@ private CFFILE[] GetFiles(string? filename, int folderIndex, bool ignorePrev = f
451451 if ( Next ? . Header != null && Next . Folders != null )
452452 {
453453 var nextFolder = Next . Folders [ 0 ] ;
454- nextFiles = Next . GetFiles ( filename , 0 , skipPrev : true ) ?? [ ] ;
454+ nextFiles = Next . GetSpannedFiles ( filename , 0 , skipPrev : true ) ?? [ ] ;
455455 }
456456 }
457457
@@ -465,7 +465,7 @@ private CFFILE[] GetFiles(string? filename, int folderIndex, bool ignorePrev = f
465465 /// <param name="folderIndex">Index of the folder in the cabinet</param>
466466 /// <param name="ignorePrev">True to ignore previous links, false otherwise</param>
467467 /// <returns>Array of all files for the folder</returns>
468- private CFFILE [ ] GetFilesOld ( int folderIndex , bool ignorePrev = false )
468+ private CFFILE [ ] GetFiles ( int folderIndex , bool ignorePrev = false )
469469 {
470470 // Ignore invalid archives
471471 if ( Files == null )
0 commit comments