Don't reopen the stream unnecessarily

This commit is contained in:
Matt Nadareski
2025-09-06 10:58:46 -04:00
parent 168231cc94
commit 3a5e7004a3
2 changed files with 4 additions and 14 deletions

View File

@@ -46,14 +46,9 @@ namespace BinaryObjectScanner.FileType
} }
/// <inheritdoc/> /// <inheritdoc/>
/// <remarks>Uses the already-generated wrapper</remarks>
public bool Extract(string file, string outDir, bool includeDebug) public bool Extract(string file, string outDir, bool includeDebug)
{ => Extract(null, file, outDir, includeDebug);
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
/// <inheritdoc/> /// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug) public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)

View File

@@ -46,14 +46,9 @@ namespace BinaryObjectScanner.FileType
} }
/// <inheritdoc/> /// <inheritdoc/>
/// <remarks>Uses the already-generated wrapper</remarks>
public bool Extract(string file, string outDir, bool includeDebug) public bool Extract(string file, string outDir, bool includeDebug)
{ => Extract(null, file, outDir, includeDebug);
if (!File.Exists(file))
return false;
using var fs = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
return Extract(fs, file, outDir, includeDebug);
}
/// <inheritdoc/> /// <inheritdoc/>
public bool Extract(Stream? stream, string file, string outDir, bool includeDebug) public bool Extract(Stream? stream, string file, string outDir, bool includeDebug)