1+ using System ;
12using System . IO ;
23using SabreTools . Models . PAK ;
34
@@ -89,8 +90,9 @@ public PAK(Models.PAK.File? model, Stream? data)
8990 /// Extract all files from the PAK to an output directory
9091 /// </summary>
9192 /// <param name="outputDirectory">Output directory to write to</param>
93+ /// <param name="includeDebug">True to include debug data, false otherwise</param>
9294 /// <returns>True if all files extracted, false otherwise</returns>
93- public bool ExtractAll ( string outputDirectory )
95+ public bool ExtractAll ( string outputDirectory , bool includeDebug )
9496 {
9597 // If we have no directory items
9698 if ( DirectoryItems == null || DirectoryItems . Length == 0 )
@@ -100,7 +102,7 @@ public bool ExtractAll(string outputDirectory)
100102 bool allExtracted = true ;
101103 for ( int i = 0 ; i < DirectoryItems . Length ; i ++ )
102104 {
103- allExtracted &= ExtractFile ( i , outputDirectory ) ;
105+ allExtracted &= ExtractFile ( i , outputDirectory , includeDebug ) ;
104106 }
105107
106108 return allExtracted ;
@@ -111,8 +113,9 @@ public bool ExtractAll(string outputDirectory)
111113 /// </summary>
112114 /// <param name="index">File index to extract</param>
113115 /// <param name="outputDirectory">Output directory to write to</param>
116+ /// <param name="includeDebug">True to include debug data, false otherwise</param>
114117 /// <returns>True if the file extracted, false otherwise</returns>
115- public bool ExtractFile ( int index , string outputDirectory )
118+ public bool ExtractFile ( int index , string outputDirectory , bool includeDebug )
116119 {
117120 // If we have no directory items
118121 if ( DirectoryItems == null || DirectoryItems . Length == 0 )
@@ -153,8 +156,9 @@ public bool ExtractFile(int index, string outputDirectory)
153156 fs . Write ( data , 0 , data . Length ) ;
154157 fs . Flush ( ) ;
155158 }
156- catch
159+ catch ( Exception ex )
157160 {
161+ if ( includeDebug ) Console . WriteLine ( ex ) ;
158162 return false ;
159163 }
160164
0 commit comments