@@ -19,10 +19,8 @@ public class BFPK : IExtractable
1919 if ( ! File . Exists ( file ) )
2020 return null ;
2121
22- using ( var fs = File . Open ( file , FileMode . Open , FileAccess . Read , FileShare . Read ) )
23- {
24- return Extract ( fs , file , includeDebug ) ;
25- }
22+ using var fs = File . Open ( file , FileMode . Open , FileAccess . Read , FileShare . Read ) ;
23+ return Extract ( fs , file , includeDebug ) ;
2624 }
2725
2826 /// <inheritdoc/>
@@ -111,18 +109,18 @@ public static bool ExtractFile(SabreTools.Serialization.Wrappers.BFPK item, int
111109
112110 // Create the output path
113111 string filePath = Path . Combine ( outputDirectory , file . Name ?? $ "file{ index } ") ;
114- using ( FileStream fs = File . OpenWrite ( filePath ) )
115- {
116- // Read the data block
117- var data = item . ReadFromDataSource ( offset , compressedSize ) ;
118- if ( data == null )
119- return false ;
112+ using FileStream fs = File . OpenWrite ( filePath ) ;
120113
121- // If we have uncompressed data
122- if ( compressedSize == file . UncompressedSize )
123- {
124- fs . Write ( data , 0 , compressedSize ) ;
125- }
114+ // Read the data block
115+ var data = item . ReadFromDataSource ( offset , compressedSize ) ;
116+ if ( data == null )
117+ return false ;
118+
119+ // If we have uncompressed data
120+ if ( compressedSize == file . UncompressedSize )
121+ {
122+ fs . Write ( data , 0 , compressedSize ) ;
123+ }
126124#if NET462_OR_GREATER || NETCOREAPP
127125 else
128126 {
@@ -131,7 +129,6 @@ public static bool ExtractFile(SabreTools.Serialization.Wrappers.BFPK item, int
131129 zs . CopyTo ( fs ) ;
132130 }
133131#endif
134- }
135132
136133 return true ;
137134 }
0 commit comments