C1.C1Zip Namespace > C1ZipFile Class : OpenBatch Method |
By default, C1ZipFile opens and closes the zip file automatically whenever entries are added or removed.
This can cause delays in systems that have certain types of anti-virus software installed, or in situations where you want to add a large number of relatively small entries. In these cases, use the OpenBatch and CloseBatch methods to keep the zip file open until the entire operation is concluded.
Use a finally clause to ensure that the CloseBatch method is called even if an exception occurs.
C1ZipFile zip = new C1ZipFile(); zip.Open(myzipfile); try { zip.OpenBatch(); foreach (string fileName in Directory.GetFiles(path, "*.*")) zip.Entries.Add(fileName); } finally { zip.CloseBatch(); }
Target Platforms: Windows 7, Windows Vista SP1 or later, Windows XP SP3, Windows Server 2008 (Server Core not supported), Windows Server 2008 R2 (Server Core supported with SP1 or later), Windows Server 2003 SP2