It was necessary to make an installer-unpacker archive with my own hands. It doesn't matter why with your own hands. But never before have I done applications unpacking archives. Read about 7z.dll (or 7-zip.dll?). In general, I did not understand which one to use and how.
2 answers
You can run 7zip with the necessary parameters:
var processStartInfo = new ProcessStartInfo(); processStartInfo.FileName = @"C:\Program Files\7-Zip\7z.exe"; processStartInfo.Arguments = @"e C:\test.7z"; Process.Start(processStartInfo);
An example is taken from here.
|
In order to use 7z.dll you need a wrapper in mind of the SevenZipSharp library:
if (IntPtr.Size == 8) { //x64 SevenZip.SevenZipExtractor.SetLibraryPath(@"C:\Program Files\7-Zip\7z.dll"); } else { //x86 SevenZip.SevenZipExtractor.SetLibraryPath(@"C:\Program Files (x86)\7-Zip\7z.dll"); } using (var file = new SevenZipExtractor(pathToArchive)) { file.ExtractArchive(outputPath); }
|