Skip to content

Commit

Permalink
Merge pull request #53 from CupSunshine/master
Browse files Browse the repository at this point in the history
asp.net mvc throw "libraryFilePath not set"
  • Loading branch information
adoconnection authored Aug 26, 2021
2 parents 18c2454 + 9b4a0bc commit 745ce4f
Showing 1 changed file with 11 additions and 7 deletions.
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

0 comments on commit 745ce4f

Please sign in to comment.