Crisis.Ionic.Zip.ExtractProgressEventArgs.ByteUpdate C# (CSharp) Method

ByteUpdate() static private method

static private ByteUpdate ( string archiveName, ZipEntry entry, System.Int64 bytesWritten, System.Int64 totalBytes ) : ExtractProgressEventArgs
archiveName string
entry ZipEntry
bytesWritten System.Int64
totalBytes System.Int64
return ExtractProgressEventArgs
        internal static ExtractProgressEventArgs ByteUpdate(string archiveName, ZipEntry entry, Int64 bytesWritten, Int64 totalBytes)
        {
            var x = new ExtractProgressEventArgs(archiveName, ZipProgressEventType.Extracting_EntryBytesWritten);
            x.ArchiveName = archiveName;
            x.CurrentEntry = entry;
            x.BytesTransferred = bytesWritten;
            x.TotalBytesToTransfer = totalBytes;
            return x;
        }

Usage Example

        // Can be called from within ZipEntry._ExtractOne.
        internal bool OnExtractBlock(ZipEntry entry, Int64 bytesWritten, Int64 totalBytesToWrite)
        {
            EventHandler <ExtractProgressEventArgs> ep = ExtractProgress;

            if (ep != null)
            {
                var e = ExtractProgressEventArgs.ByteUpdate(ArchiveNameForEvent, entry,
                                                            bytesWritten, totalBytesToWrite);
                ep(this, e);
                if (e.Cancel)
                {
                    _extractOperationCanceled = true;
                }
            }
            return(_extractOperationCanceled);
        }