Usage example

Mar 15, 2009 at 8:03 PM
Hi,

could anyone show to use this class for beginner? any simple example to compress files and directory or a file :)

It'll help a lot, Thank you



Mar 15, 2009 at 8:23 PM
Strange of you to ask this, considering the source contains a console application designed just to show a simple example on how to use the library =/

Anyway, if you're lazy to check it, here goes.
Add the library dll to your project + 7z.dll or 7za.dll from 7zip's website.

using SevenZip;

// To decompress:
using (SevenZipExtractor sze = new SevenZipExtractor("Archive.zip")) 
sze.ExtractArchive("C:\\output"); 
}

// To compress:
SevenZipCompressor szc = new SevenZipCompressor();
szc.CompressDirectory("C:\\files\\", "outpit.zip", OutArchiveFormat.Zip);