Skip to content

Commit

Permalink
Use file instead of stream for 7z SFX
Browse files Browse the repository at this point in the history
  • Loading branch information
TheRogueArchivist committed Sep 26, 2024
1 parent 116f0ee commit e66f7f3
Showing 1 changed file with 1 addition and 6 deletions.
7 changes: 1 addition & 6 deletions BinaryObjectScanner/Packer/SevenZipSFX.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,13 @@ public class SevenZipSFX : IExtractablePortableExecutable, IPortableExecutableCh
if (!File.Exists(file))
return null;

using var stream = File.Open(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);

if (stream == null)
return null;

#if NET462_OR_GREATER || NETCOREAPP
try
{
// Create a temp output directory
string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
Directory.CreateDirectory(tempPath);
using (SevenZipArchive sevenZipFile = SevenZipArchive.Open(stream, new ReaderOptions() { LookForHeader = true }))
using (SevenZipArchive sevenZipFile = SevenZipArchive.Open(file, new ReaderOptions() { LookForHeader = true }))
{
foreach (var entry in sevenZipFile.Entries)
{
Expand Down

0 comments on commit e66f7f3

Please sign in to comment.