02-03-2019, 02:23 AM
I found the easiest code to compress and decompress using 7z dll in Google. I hope someone can convert C# code into QM code, thanks in advance.
Compression and decompression using 7Z in C#
1. Add a reference to the solution: SevenZipSharp.dll
2. Copy and paste two dll files: 7z.dll 7z64.dll and modify the attribute "copy to output directory" to "if
New copy"
Compression and decompression using 7Z in C#
1. Add a reference to the solution: SevenZipSharp.dll
2. Copy and paste two dll files: 7z.dll 7z64.dll and modify the attribute "copy to output directory" to "if
New copy"
//Test compression
var zip = new SevenZipCompressor();
zip.CompressionLevel=CompressionLevel.High;
zip.CompressDirectory(@"c:\doc", @"c:\arch.7z");
//Test decompression
using (var tmp = new SevenZipExtractor(@"c:\arch.7z"))
{
for (var i = 0; i < tmp.ArchiveFileData.Count; i++)
{
tmp.ExtractFiles(@"C:\cygwin\", tmp.ArchiveFileData[i].Index);
}
}