mirror of
https://github.com/SabreTools/BinaryObjectScanner.git
synced 2026-05-19 13:33:13 +00:00
Don't reopen the stream unnecessarily
This commit is contained in:
@@ -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)
|
||||||
|
|||||||
@@ -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)
|
||||||
|
|||||||
Reference in New Issue
Block a user