'Declaration Public ReadOnly Property PendingActionCount As Long
'Usage Dim instance As GZipArchive Dim value As Long value = instance.PendingActionCount
public long PendingActionCount {get;}
'Declaration Public ReadOnly Property PendingActionCount As Long
'Usage Dim instance As GZipArchive Dim value As Long value = instance.PendingActionCount
public long PendingActionCount {get;}
A pending actions typically refers to a batch update started by a call to GZipArchive.BeginUpdate. It can also refer to open streams on one of the archive's items.
The count is incremented when an action is started and decremented when that action is completed. So methods like GZipArchive.BeginUpdate, GZippedFile.OpenRead, and GZippedFile.OpenWrite increment the count. Methods like GZipArchive.EndUpdate and Stream.Close decrement the count.
When the count is at zero, it means all batched updates on the archive have been written and the archive is rebuilt and is now in an unmodified state.
In most cases, for optimization reasons, the archive is only rebuilt when the pending action count reaches zero, typically when GZipArchive.EndUpdate is called.
This property is meant as a debugging aid to make sure no actions are incomplete when an application has finished modifying an archive. For example, a call to GZipArchive.EndUpdate might be expected to rebuild the archive. But if a Stream from a GZippedFile is left open during the update, GZipArchive.EndUpdate will do nothing since the pending action count won't reach zero with the call.
If this property returns a value greater than zero after a call to the last nested GZipArchive.EndUpdate, it usually means there is a logic error in the application and not all resources have been returned to the archive. This will lead to corrupted archives.
Dim gzipFile As AbstractFile = New DiskFile("PendingActionCountExample.gzip") If gzipFile.Exists Then gzipFile.Delete() End If Dim gzip As New ZipArchive(gzipFile) gzip.BeginUpdate() Dim file As AbstractFile = gzip.GetFile("SomeFile.dat") Dim stream As Stream = file.CreateWrite() ' EndUpdate() will do nothing since 'stream' is still open gzip.EndUpdate() ' Assert() will fail here because of the logic error System.Diagnostics.Debug.Assert(gzip.PendingActionCount <= 0)
AbstractFile gzipFile = new DiskFile( "PendingActionCountExample.gzip" ); if( gzipFile.Exists ) gzipFile.Delete(); ZipArchive gzip = new ZipArchive( gzipFile ); gzip.BeginUpdate(); AbstractFile file = gzip.GetFile( "SomeFile.dat" ); Stream stream = file.CreateWrite(); // EndUpdate() will do nothing since 'stream' is still open gzip.EndUpdate(); // Assert() will fail here because of the logic error System.Diagnostics.Debug.Assert( gzip.PendingActionCount <= 0 );
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