Do anyone know how to check progress of entries extraction that are inside folder of zip? In my case user can select folders to extract, and i want to make 2 progress bars, one for overall process (step is the completition of extraction one of selected directories) and second for extracting from subfolder. I know there is progress of whole zip, but what when i want to extract just some of content, or I'm focused on progress of ZipEntry, not whole zip.
I have a saving process, but it appears to mirror the handling of extracting. If you change the below to handle ExtractProgress, it should be very similar.
Here is my handling of the SaveProgress event where I'm tracking both the total progress and the current file progress when saving a zip file:
private void _archive_SaveProgress(object sender, SaveProgressEventArgs e)
{
switch (e.EventType)
{
case ZipProgressEventType.Saving_BeforeWriteEntry:
if (e.EntriesTotal > 0)
{
// Update the view with the total percentage progress.
int totalPercentage = (e.EntriesSaved / e.EntriesTotal) * 100m;
View.SavingStatus(e.CurrentEntry.FileName, 0, totalPercentage);
}
break;
case ZipProgressEventType.Saving_EntryBytesRead:
int filePercentage = 0;
if (e.BytesTransferred == 0)
{
filePercentage = 0;
}
else
{
filePercentage = (new decimal(e.BytesTransferred) / new decimal(e.TotalBytesToTransfer)) * 100m;
}
// Update the view with the current file percentage.
View.SavingStatus("Archiving file " + e.CurrentEntry.FileName + "...", filePercentage, -1);
break;
case ZipProgressEventType.Saving_Completed:
View.SavingStatus("Archive creation complete, saving data changes...", 100, 100);
break;
}
}
The first part of the case statement is handling the progress of the entire zip save and the second case statement is handling the current file. In this case, calling View.SavingStatus updates a label with the current status text and updates two progress bars on the interface.