@@ -150,10 +150,16 @@ public bool Extract(string outputDirectory, bool includeDebug)
150150 // Display warning in debug runs
151151 if ( includeDebug ) Console . WriteLine ( "WARNING: LZX and Quantum compression schemes are not supported so some files may be skipped!" ) ;
152152
153+ // Do not ignore previous links by default
154+ bool ignorePrev = false ;
155+
153156 // Open the full set if possible
154157 var cabinet = this ;
155158 if ( Filename != null )
159+ {
156160 cabinet = OpenSet ( Filename ) ;
161+ ignorePrev = true ;
162+ }
157163
158164 // If the archive is invalid
159165 if ( cabinet ? . Folders == null || cabinet . Folders . Length == 0 )
@@ -163,10 +169,19 @@ public bool Extract(string outputDirectory, bool includeDebug)
163169 {
164170 // Loop through the folders
165171 bool allExtracted = true ;
166- for ( int f = 0 ; f < cabinet . Folders . Length ; f ++ )
172+ while ( true )
167173 {
168- var folder = cabinet . Folders [ f ] ;
169- allExtracted &= cabinet . ExtractFolder ( Filename , outputDirectory , folder , f , includeDebug ) ;
174+ // Loop through the current folders
175+ for ( int f = 0 ; f < cabinet . Folders . Length ; f ++ )
176+ {
177+ var folder = cabinet . Folders [ f ] ;
178+ allExtracted &= cabinet . ExtractFolder ( Filename , outputDirectory , folder , f , ignorePrev , includeDebug ) ;
179+ }
180+
181+ // Move to the next cabinet, if possible
182+ cabinet = cabinet . Next ;
183+ if ( cabinet ? . Folders == null || cabinet . Folders . Length == 0 )
184+ break ;
170185 }
171186
172187 return allExtracted ;
@@ -185,12 +200,14 @@ public bool Extract(string outputDirectory, bool includeDebug)
185200 /// <param name="outputDirectory">Path to the output directory</param>
186201 /// <param name="folder">Folder containing the blocks to decompress</param>
187202 /// <param name="folderIndex">Index of the folder in the cabinet</param>
203+ /// <param name="ignorePrev">True to ignore previous links, false otherwise</param>
188204 /// <param name="includeDebug">True to include debug data, false otherwise</param>
189205 /// <returns>True if all files extracted, false otherwise</returns>
190206 private bool ExtractFolder ( string ? filename ,
191207 string outputDirectory ,
192208 CFFOLDER ? folder ,
193209 int folderIndex ,
210+ bool ignorePrev ,
194211 bool includeDebug )
195212 {
196213 // Decompress the blocks, if possible
@@ -200,7 +217,7 @@ private bool ExtractFolder(string? filename,
200217
201218 // Loop through the files
202219 bool allExtracted = true ;
203- var files = GetFiles ( folderIndex ) ;
220+ var files = GetFiles ( folderIndex , ignorePrev ) ;
204221 for ( int i = 0 ; i < files . Length ; i ++ )
205222 {
206223 var file = files [ i ] ;
0 commit comments