Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to achieve 7z format compression?
#13
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. Smile

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"

Code:
Copy      Help
//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);
               }
           }


Messages In This Thread

Forum Jump:


Users browsing this thread: 3 Guest(s)