Hello,
we have update Xceed Zip from V3.6 to V4.3. We pack a folder into a new zip file with optional split the new file.
The code below works fine with the old version, but when I try it with the new version I get an ItemDoesNotExistException when I call the EndUpdate Method in the finally block. If a do not use the split option, it is also ok.
Kind regards
Thomas
static void Main(string[] args)
{
Xceed.Zip.Licenser.LicenseKey = "license key";
ZipEvents events = new ZipEvents();
AbstractFile zipFile = new DiskFile("Test.zip");
if (zipFile.Exists)
zipFile.Delete();
AbstractFolder sourceFolder = new DiskFolder(@"C:\Program Files\Xceed Components\Xceed Zip for .NET 4.3");
ZipArchive zip = new ZipArchive(events, null, zipFile);
events.ItemProgression += events_ItemProgression;
zip.BeginUpdate(events, null);
try
{
// Allow this zip file to span.
//zip.AllowSpanning = true;
zip.DefaultCompressionLevel = Xceed.Compression.CompressionLevel.Normal;
//if (this.splitArchive)
//{
zip.SplitNameFormat = SplitNameFormat.PkZip;
zip.SplitSize = 1048576;
//}
// Zip this folder's contents
sourceFolder.CopyTo(events, null, zip, true);
}
catch (FileSystemIOException ioEx)
{
Console.WriteLine(ioEx.ToString());
}
catch (Exception ex)
{
Console.WriteLine(ex.ToString());
}
finally
{
// Complete the batch modification of this zip file.
zip.EndUpdate(events, null);
events.ItemProgression -= events_ItemProgression;
}
}
static void events_ItemProgression(object sender, ItemProgressionEventArgs e)
{
Console.Write(".");
}