@@ -38,7 +38,7 @@ public bool Extract(Stream? stream, string file, string outDir, bool includeDebu
38
38
39
39
// Loop through and extract all files
40
40
Directory . CreateDirectory ( outDir ) ;
41
- ExtractAll ( cfb , outDir ) ;
41
+ ExtractAll ( cfb , outDir , includeDebug ) ;
42
42
43
43
return true ;
44
44
}
@@ -49,8 +49,9 @@ public bool Extract(Stream? stream, string file, string outDir, bool includeDebu
49
49
/// Extract all files from the CFB to an output directory
50
50
/// </summary>
51
51
/// <param name="outputDirectory">Output directory to write to</param>
52
+ /// <param name="includeDebug">True to include debug data, false otherwise</param>
52
53
/// <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 )
54
55
{
55
56
// If we have no files
56
57
if ( cfb ? . Model ? . DirectoryEntries == null || cfb . Model . DirectoryEntries . Length == 0 )
@@ -60,7 +61,7 @@ private static bool ExtractAll(SabreTools.Serialization.Wrappers.CFB? cfb, strin
60
61
bool allExtracted = true ;
61
62
for ( int i = 0 ; i < cfb . Model . DirectoryEntries . Length ; i ++ )
62
63
{
63
- allExtracted &= ExtractEntry ( cfb , i , outputDirectory ) ;
64
+ allExtracted &= ExtractEntry ( cfb , i , outputDirectory , includeDebug ) ;
64
65
}
65
66
66
67
return allExtracted ;
@@ -71,8 +72,9 @@ private static bool ExtractAll(SabreTools.Serialization.Wrappers.CFB? cfb, strin
71
72
/// </summary>
72
73
/// <param name="index">Entry index to extract</param>
73
74
/// <param name="outputDirectory">Output directory to write to</param>
75
+ /// <param name="includeDebug">True to include debug data, false otherwise</param>
74
76
/// <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 )
76
78
{
77
79
// If we have no entries
78
80
if ( cfb ? . Model ? . DirectoryEntries == null || cfb . Model . DirectoryEntries . Length == 0 )
@@ -131,8 +133,9 @@ private static bool ExtractEntry(SabreTools.Serialization.Wrappers.CFB cfb, int
131
133
fs . Write ( data ) ;
132
134
fs . Flush ( ) ;
133
135
}
134
- catch
136
+ catch ( Exception ex )
135
137
{
138
+ if ( includeDebug ) Console . Error . WriteLine ( ex ) ;
136
139
return false ;
137
140
}
138
141
0 commit comments