Why doesn't ZipProgressEventType.Saving_AfterWriteEntry give me the BytesTransferred property?

Nov 5, 2009 at 11:03 PM
Edited Nov 5, 2009 at 11:17 PM

Is it normal? It returns always the zero value, so I think that it could be a bug.

This is my code:

void ZipSaveProgress(object sender, SaveProgressEventArgs e)
{
switch (e.EventType)
{
case ZipProgressEventType.Saving_AfterWriteEntry:
StepArchiveProgressBackup(e);
break;
case ZipProgressEventType.Saving_Completed:
BackupCompleted();
break;
}
}


private void StepArchiveProgressBackup(SaveProgressEventArgs e)
{
if (this.progressBar1.InvokeRequired)
this.progressBar1.Invoke(new BackupEntryProgress(this.StepArchiveProgressBackup), new object[] { e });
 else
{
this.progressBar1.Increment((int)(e.BytesTransferred));
//MessageBox.Show(e.CurrentEntry.FileName.ToString() + " " + (e.BytesTransferred).ToString() + " progressbar value: " + this.progressBar1.Value.ToString());

}
}


Thanks!

 

Coordinator
Nov 6, 2009 at 12:34 AM
Edited Nov 6, 2009 at 4:53 AM

Hey Alex,

the BytesTransferred is intended for use with the event type == ZipProgressEventType.Saving_EntryBytesRead.

If you want to know the size of the entry, either before or after comression, you have the CurrentEntry property on the SaveProgressEventArgs parameter.  Within CurrentEntry is CompressedSize and UncompressedSize.  Those will be accurate and up-to-date during an event call with the type == ZipProgressEventType.Saving_AfterWriteEntry.

 

Nov 6, 2009 at 9:56 AM

Yes, excuse me, but I didn't see the UncompressedSize property. Now all it's ok, many thanks!