Quantcast
Channel: SharpDevelop Community
Viewing all articles
Browse latest Browse all 1764

Get a compressed size of the files before adding the files to existing zip

$
0
0

Hi ,

I need to get a compressed size of the files before adding the files to existing zip. Is that possible in ICSharpZip Lib?

For eg: In the below code, before zipFile.Add() I need to find the compressed size.

 

string[ files = Directory.GetFiles(fullPath);

string folderPath = Path.GetDirectoryName(fullPath);

SharpZip.ZipFile zipFile = new SharpZip.ZipFile(zipFileName);

 zipFile.NameTransform = new ZipNameTransform(folderPath);

 // Must call BeginUpdate to start, and CommitUpdate at the end.

 zipFile.BeginUpdate();

 foreach (string file in files)

 {

 string fileName = Directory.GetFiles(folderPath, Path.GetFileName(file)).FirstOrDefault();

 zipFile.Add(fileName, SharpZip.CompressionMethod.Deflated);

}

zipFile.CommitUpdate();

zipFile.Close(); 

 

Please help us.  I am facing critical performance problem in production environment while calculating compressed file size.

 

Thanks in advance!!!

Ravichandran


Viewing all articles
Browse latest Browse all 1764

Trending Articles