SharpLibZip is required. The Code is as follows:
Zip. cs Public class Zip
{
/// <Summary>
/// Compressed folder
/// </Summary>
/// <Param name = "dirPath"> path of the compressed folder </param>
/// <Param name = "fileName"> generated zip file path </param>
/// <Param name = "level"> compression level 0-9 0: storage level 9: maximum compression </param>
/// <Param name = "bufferSize"> buffer size of the file to be read </param>
Public void CompressDirectory (string dirPath, string fileName, int level, int bufferSize)
{
Byte [] buffer = new byte [bufferSize];
Using (ZipOutputStream s = new ZipOutputStream (File. Create (fileName )))
{
S. SetLevel (level );
CompressDirectory (dirPath, dirPath, s, buffer );
S. Finish ();
S. Close ();
}
}
/// <Summary>
/// Compressed folder
/// </Summary>
/// <Param name = "root"> compressed folder path </param>
/// <Param name = "path"> path of the folder to be compressed </param>
/// <Param name = "s"> </param>
//