Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to basically extract file with sevenzipsharp

I will extract files to usb from iso file with sevenzipsharp. For this, I download sevenzipsharp from vs nuget package manager and I coded (actually I couldn't :) ) this code . I dont take any error but It isnt working. Where do I make mistakes? Please write details.

if (IntPtr.Size == 8) //x64
{
    SevenZip.SevenZipExtractor.SetLibraryPath(@"C:\Program Files\7-Zip\7z.dll");
}
else //x86
{
    SevenZip.SevenZipCompressor.SetLibraryPath(@"C:\Program Files (x86)\7-Zip\7z.dll");
}
using (var file = new SevenZipExtractor(sourcePath))
{
    file.ExtractArchive(outputPath);  
}

Thank you in advance

like image 586
Haydar ŞAHİN Avatar asked Oct 20 '25 04:10

Haydar ŞAHİN


1 Answers

For x86 you are doing SevenZip.SevenZipCompressor.SetLibraryPath where you probably meant to do SevenZip.SevenZipExtractor.SetLibraryPath.

like image 97
tomsv Avatar answered Oct 21 '25 17:10

tomsv



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!