@@ -38,7 +38,7 @@ public bool Extract(Stream? stream, string file, string outDir, bool includeDebu
3838
3939 // Loop through and extract all files
4040 Directory . CreateDirectory ( outDir ) ;
41- ExtractAll ( cfb , outDir ) ;
41+ ExtractAll ( cfb , outDir , includeDebug ) ;
4242
4343 return true ;
4444 }
@@ -49,8 +49,9 @@ public bool Extract(Stream? stream, string file, string outDir, bool includeDebu
4949 /// Extract all files from the CFB to an output directory
5050 /// </summary>
5151 /// <param name="outputDirectory">Output directory to write to</param>
52+ /// <param name="includeDebug">True to include debug data, false otherwise</param>
5253 /// <returns>True if all files extracted, false otherwise</returns>
53- private static bool ExtractAll ( SabreTools . Serialization . Wrappers . CFB ? cfb , string outputDirectory )
54+ private static bool ExtractAll ( SabreTools . Serialization . Wrappers . CFB ? cfb , string outputDirectory , bool includeDebug )
5455 {
5556 // If we have no files
5657 if ( cfb ? . Model ? . DirectoryEntries == null || cfb . Model . DirectoryEntries . Length == 0 )
@@ -60,7 +61,7 @@ private static bool ExtractAll(SabreTools.Serialization.Wrappers.CFB? cfb, strin
6061 bool allExtracted = true ;
6162 for ( int i = 0 ; i < cfb . Model . DirectoryEntries . Length ; i ++ )
6263 {
63- allExtracted &= ExtractEntry ( cfb , i , outputDirectory ) ;
64+ allExtracted &= ExtractEntry ( cfb , i , outputDirectory , includeDebug ) ;
6465 }
6566
6667 return allExtracted ;
@@ -71,8 +72,9 @@ private static bool ExtractAll(SabreTools.Serialization.Wrappers.CFB? cfb, strin
7172 /// </summary>
7273 /// <param name="index">Entry index to extract</param>
7374 /// <param name="outputDirectory">Output directory to write to</param>
75+ /// <param name="includeDebug">True to include debug data, false otherwise</param>
7476 /// <returns>True if the file extracted, false otherwise</returns>
75- private static bool ExtractEntry ( SabreTools . Serialization . Wrappers . CFB cfb , int index , string outputDirectory )
77+ private static bool ExtractEntry ( SabreTools . Serialization . Wrappers . CFB cfb , int index , string outputDirectory , bool includeDebug )
7678 {
7779 // If we have no entries
7880 if ( cfb ? . Model ? . DirectoryEntries == null || cfb . Model . DirectoryEntries . Length == 0 )
@@ -131,8 +133,9 @@ private static bool ExtractEntry(SabreTools.Serialization.Wrappers.CFB cfb, int
131133 fs . Write ( data ) ;
132134 fs . Flush ( ) ;
133135 }
134- catch
136+ catch ( Exception ex )
135137 {
138+ if ( includeDebug ) Console . Error . WriteLine ( ex ) ;
136139 return false ;
137140 }
138141
0 commit comments