Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

asp.net mvc throw "libraryFilePath not set" #53

Merged
merged 1 commit into from
Aug 26, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 11 additions & 7 deletions SevenZipExtractor/ArchiveFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public ArchiveFile(string archiveFilePath, string libraryFilePath = null)
this.archive = this.sevenZipHandle.CreateInArchive(Formats.FormatGuidMapping[format]);
this.archiveStream = new InStreamWrapper(File.OpenRead(archiveFilePath));
}

public ArchiveFile(Stream archiveStream, SevenZipFormat? format = null, string libraryFilePath = null)
{
this.libraryFilePath = libraryFilePath;
Expand Down Expand Up @@ -75,9 +75,9 @@ public ArchiveFile(Stream archiveStream, SevenZipFormat? format = null, string l
this.archiveStream = new InStreamWrapper(archiveStream);
}

public void Extract(string outputFolder, bool overwrite = false)
public void Extract(string outputFolder, bool overwrite = false)
{
this.Extract(entry =>
this.Extract(entry =>
{
string fileName = Path.Combine(outputFolder, entry.FileName);

Expand All @@ -86,7 +86,7 @@ public void Extract(string outputFolder, bool overwrite = false)
return fileName;
}

if (!File.Exists(fileName) || overwrite)
if (!File.Exists(fileName) || overwrite)
{
return fileName;
}
Expand All @@ -95,11 +95,11 @@ public void Extract(string outputFolder, bool overwrite = false)
});
}

public void Extract(Func<Entry, string> getOutputPath)
public void Extract(Func<Entry, string> getOutputPath)
{
IList<Stream> fileStreams = new List<Stream>();

try
try
{
foreach (Entry entry in Entries)
{
Expand Down Expand Up @@ -132,7 +132,7 @@ public void Extract(Func<Entry, string> getOutputPath)
}
finally
{
foreach (Stream stream in fileStreams)
foreach (Stream stream in fileStreams)
{
if (stream != null)
{
Expand Down Expand Up @@ -260,6 +260,10 @@ private void InitializeAndValidateLibrary()
{
this.libraryFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin", "7z-" + currentArchitecture + ".dll");
}
else if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin", currentArchitecture, "7z.dll")))
{
this.libraryFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "bin", currentArchitecture, "7z.dll");
}
else if (File.Exists(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, currentArchitecture, "7z.dll")))
{
this.libraryFilePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, currentArchitecture, "7z.dll");
Expand Down