public void SaveProgress(object sender, ExtractProgressEventArgs e) { try { if (this.InvokeRequired) { this.Invoke(new Action<Object, ExtractProgressEventArgs>(SaveProgress), new Object[] {sender, e}); } else { if (e.EventType == ZipProgressEventType.Extracting_BeforeExtractEntry) { windows7ProgressBar1.Maximum = int.Parse((e.EntriesTotal).ToString()); windows7ProgressBar1.Value = int.Parse(e.EntriesExtracted.ToString()); } else if (e.EventType == ZipProgressEventType.Extracting_EntryBytesWritten) { label2.Text= e.CurrentEntry.ToString().Split(':')[2]; } this.Update(); Application.DoEvents(); } } catch (Exception erro) { MessageBox.Show(erro.Message); } }
void zf_ExtractProgress(object sender, Zip.ExtractProgressEventArgs e) { Dispatcher.Invoke(new MyDelegate(() => { progressBar.Value = e.BytesTransferred; })); }
private void StepEntryProgress(ExtractProgressEventArgs e) { if (this.progressBar2.InvokeRequired) { this.progressBar2.Invoke(new ExtractEntryProgress(this.StepEntryProgress), new object[] { e }); } else { if (this.progressBar2.Maximum == 1) { // reset Int64 max = e.TotalBytesToTransfer; _progress2MaxFactor = 0; while (max > System.Int32.MaxValue) { max /= 2; _progress2MaxFactor++; } this.progressBar2.Maximum = (int)max; this.lblStatus.Text = String.Format("Extracting {0}/{1}: {2} ...", this.progressBar1.Value, zip.Entries.Count, e.CurrentEntry.FileName); } int xferred = (int)(e.BytesTransferred >> _progress2MaxFactor); this.progressBar2.Value = (xferred >= this.progressBar2.Maximum) ? this.progressBar2.Maximum : xferred; this.Update(); } }
internal static ExtractProgressEventArgs ExtractAllCompleted(string archiveName, string extractLocation) { var x = new ExtractProgressEventArgs(archiveName, ZipProgressEventType.Extracting_AfterExtractAll); x._target = extractLocation; return(x); }
void zf_ExtractProgress(object sender, ExtractProgressEventArgs e) { if (e.EventType == ZipProgressEventType.Extracting_AfterExtractAll) { this.BeginInvoke(new MethodInvoker(Finish)); } }
internal static ExtractProgressEventArgs ExtractAllStarted(string archiveName, string extractLocation, bool wantOverwrite) { var x = new ExtractProgressEventArgs(archiveName, ZipProgressEventType.Extracting_BeforeExtractAll); x._overwrite = wantOverwrite; x._target = extractLocation; return(x); }
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); }
internal static ExtractProgressEventArgs AfterExtractEntry(string archiveName, ZipEntry entry, string extractLocation, bool wantOverwrite) { var x = new ExtractProgressEventArgs(); x.ArchiveName = archiveName; x.EventType = ZipProgressEventType.Extracting_AfterExtractEntry; x.CurrentEntry = entry; x._target = extractLocation; x._overwrite = wantOverwrite; return(x); }
internal void OnExtractAllStarted(string path) { EventHandler <ExtractProgressEventArgs> ep = ExtractProgress; if (ep != null) { var e = ExtractProgressEventArgs.ExtractAllStarted(ArchiveNameForEvent, path); ep(this, e); } }
private void OnExtractAllStarted(string path) { if (ExtractProgress != null) { lock (LOCK) { var e = ExtractProgressEventArgs.ExtractAllStarted(ArchiveNameForEvent, path); ExtractProgress(this, e); } } }
internal static ExtractProgressEventArgs ExtractExisting(string archiveName, ZipEntry entry, string extractLocation) { var x = new ExtractProgressEventArgs { ArchiveName = archiveName, EventType = ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite, CurrentEntry = entry, _target = extractLocation, }; return(x); }
internal static ExtractProgressEventArgs AfterExtractEntry(string archiveName, ZipEntry entry, string extractLocation) { var x = new ExtractProgressEventArgs { ArchiveName = archiveName, EventType = ZipProgressEventType.Extracting_AfterExtractEntry, CurrentEntry = entry, _target = extractLocation, }; return(x); }
internal void OnExtractEntry(int current, bool before, ZipEntry currentEntry, string path) { EventHandler <ExtractProgressEventArgs> ep = ExtractProgress; if (ep != null) { var e = new ExtractProgressEventArgs(ArchiveNameForEvent, before, _entries.Count, current, currentEntry, path); ep(this, e); if (e.Cancel) { _extractOperationCanceled = true; } } }
internal bool OnExtractExisting(ZipEntry entry, string path) { EventHandler <ExtractProgressEventArgs> ep = ExtractProgress; if (ep != null) { var e = ExtractProgressEventArgs.ExtractExisting(ArchiveNameForEvent, entry, path); ep(this, e); if (e.Cancel) { _extractOperationCanceled = true; } } return(_extractOperationCanceled); }
private void OnExtractEntry(int current, bool before, ZipEntry currentEntry, string path) { if (ExtractProgress != null) { lock (LOCK) { var e = new ExtractProgressEventArgs(ArchiveNameForEvent, before, _entries.Count, current, currentEntry, path); ExtractProgress(this, e); if (e.Cancel) { _extractOperationCanceled = true; } } } }
// 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); }
private void ExtractProgress(object sender, ExtractProgressEventArgs e) { if (e.EventType == ZipProgressEventType.Extracting_EntryBytesWritten) { StepEntryProgress(e); } else if (e.EventType == ZipProgressEventType.Extracting_AfterExtractEntry) { StepArchiveProgress(e); } if (_setCancel) { e.Cancel = true; } }
private void StepArchiveProgress(ExtractProgressEventArgs e) { if (this.progressBar1.InvokeRequired) { this.progressBar2.Invoke(new ExtractEntryProgress(this.StepArchiveProgress), new object[] { e }); } else { this.progressBar1.PerformStep(); // reset the progress bar for the entry: this.progressBar2.Value = this.progressBar2.Maximum = 1; this.lblStatus.Text = ""; this.Update(); } }
internal bool OnExtractExisting(ZipEntry entry, string path) { if (ExtractProgress != null) { lock (LOCK) { var e = ExtractProgressEventArgs.ExtractExisting(ArchiveNameForEvent, entry, path); ExtractProgress(this, e); if (e.Cancel) { _extractOperationCanceled = true; } } } return(_extractOperationCanceled); }
// Can be called from within ZipEntry.InternalExtract. internal bool OnSingleEntryExtract(ZipEntry entry, string path, bool before) { EventHandler <ExtractProgressEventArgs> ep = ExtractProgress; if (ep != null) { var e = (before) ? ExtractProgressEventArgs.BeforeExtractEntry(ArchiveNameForEvent, entry, path) : ExtractProgressEventArgs.AfterExtractEntry(ArchiveNameForEvent, entry, path); ep(this, e); if (e.Cancel) { _extractOperationCanceled = true; } } return(_extractOperationCanceled); }
// Can be called from within ZipEntry.InternalExtract. internal bool OnSingleEntryExtract(ZipEntry entry, string path, bool before) { if (ExtractProgress != null) { lock (LOCK) { var e = (before) ? ExtractProgressEventArgs.BeforeExtractEntry(ArchiveNameForEvent, entry, path) : ExtractProgressEventArgs.AfterExtractEntry(ArchiveNameForEvent, entry, path); ExtractProgress(this, e); if (e.Cancel) { _extractOperationCanceled = true; } } } return(_extractOperationCanceled); }
void myZip_ExtractProgress(object sender, Ionic.Zip.ExtractProgressEventArgs e) { System.Windows.Forms.Application.DoEvents(); if (total != e.TotalBytesToTransfer) { sum += total - lastVal + e.BytesTransferred; total = e.TotalBytesToTransfer; lblProgressStatus.Text = "Copying: " + e.CurrentEntry.FileName; } else { sum += e.BytesTransferred - lastVal; } lastVal = e.BytesTransferred; progressBar.Value = (Int32)sum; }
void zipFile_ExtractProgress(object sender, ExtractProgressEventArgs e) { switch (e.EventType) { case ZipProgressEventType.Extracting_EntryBytesWritten: { EventHandler<ExtractProgressChangedEventArgs> handler = CurrentFileExtractProgressChanged; if (handler != null) handler(this, new ExtractProgressChangedEventArgs(e.BytesTransferred, e.TotalBytesToTransfer)); } break; case ZipProgressEventType.Extracting_AfterExtractEntry: { EventHandler<EventArgs> handler = CurrentFileExtractCompleted; if (handler != null) handler(this, e); } break; } }
private void zip_ExtractProgress(object sender, ExtractProgressEventArgs e) { #region Calculate process percentile ratio for all transferred bytes try { if (e.TotalBytesToTransfer > 0) { totalTransferredPercentForCurrentEntry = e.BytesTransferred * 100 / e.TotalBytesToTransfer; if (e.TotalBytesToTransfer == e.BytesTransferred) // in this condition that going to next file entry { totalTransferredPercentForAllEntry += ((double)e.TotalBytesToTransfer * 100) / (double)this.TotalFilesSizeBytes; if (totalTransferredPercentForAllEntry == 100) this.ReportOccurrence(this, new ReportEventArgs("ZipEncryption", "Extract Operate for " + e.ArchiveName + " has been completed.")); } } } catch { } #endregion }
void Streams_ExtractProgress(object sender, ExtractProgressEventArgs e) { switch (e.EventType) { case ZipProgressEventType.Extracting_AfterExtractEntry: _numExtracted++; if ((_numExtracted % 512) == 0) _txrx.Send("pb 1 value " + _numExtracted); else if ((_numExtracted % 256) == 0) _txrx.Send(String.Format("status extract {0}/{1} {2:N0}%", _numExtracted, _numFilesToExtract, _numExtracted / (0.01 *_numFilesToExtract))); break; } }
private void SrmDocumentSharing_ExtractProgress(object sender, ExtractProgressEventArgs e) { if (ProgressMonitor != null) { if (ProgressMonitor.IsCanceled) { e.Cancel = true; return; } int progressValue = (int)Math.Round((ExtractedSize + e.BytesTransferred) * 100.0 / ExpectedSize); if (progressValue != _progressStatus.PercentComplete) { var message = (e.CurrentEntry != null ? string.Format(Resources.SrmDocumentSharing_SrmDocumentSharing_ExtractProgress_Extracting__0__, e.CurrentEntry.FileName) : DefaultMessage); ProgressMonitor.UpdateProgress(_progressStatus = _progressStatus.ChangeMessage(message).ChangePercentComplete(progressValue)); } } }
// прогресс распаковки void ExtractingProgress(object sender, ExtractProgressEventArgs e) { if (requireCancellation == true) { e.Cancel = true; return; } if (e.EventType == ZipProgressEventType.Extracting_EntryBytesWritten) { if (requireCancellation == false) { long total = e.TotalBytesToTransfer; long value = e.BytesTransferred; int persent = (int)(100 * value / total); PostOnCurrentEntryBytesProgress(persent); } } else if (e.EventType == ZipProgressEventType.Extracting_BeforeExtractEntry) { if (requireCancellation == false) { PostOnTotalProgress(entriesExtracted, entriesExtractedTotal, e.CurrentEntry.FileName); } } }
void zip_ExtractProgress(object sender, ExtractProgressEventArgs e) { if (n2 == e.EntriesExtracted) return; if (e.EntriesTotal == 0) return; if (e.EntriesExtracted % 5 != 0) return; str_m += e.EntriesExtracted + "/" + e.EntriesTotal + "\n"; n2 = e.EntriesExtracted; }
/// <summary>ExtractProgressイベント ハンドラ</summary> protected void ExtractProgressEventHandler(Object sender, ExtractProgressEventArgs e) { //Debug.WriteLine("ExtractProgressEventHandler\r\n" // + "sender:" + sender.ToString() + ", " + "e.ArchiveName:" + e.ArchiveName); }
private void TutorialFile_ExtractProgress(object sender, ExtractProgressEventArgs e, ILongWaitBroker waitBroker) { if (waitBroker != null) { if (waitBroker.IsCanceled) { e.Cancel = true; return; } int progressValue = (int)Math.Round((ExtractedSize + e.BytesTransferred) * 100.0 / ExpectedSize); if (progressValue != WaitBroker.ProgressValue) { waitBroker.ProgressValue = progressValue; waitBroker.Message = (string.Format(Resources.SrmDocumentSharing_SrmDocumentSharing_ExtractProgress_Extracting__0__, e.CurrentEntry.FileName)); } } }
internal static ExtractProgressEventArgs ExtractAllStarted(string archiveName, string extractLocation) { var x = new ExtractProgressEventArgs(archiveName, ZipProgressEventType.Extracting_BeforeExtractAll); x._target = extractLocation; return x; }
internal static ExtractProgressEventArgs BeforeExtractEntry(string archiveName, ZipEntry entry, string extractLocation) { var x = new ExtractProgressEventArgs { ArchiveName = archiveName, EventType = ZipProgressEventType.Extracting_BeforeExtractEntry, CurrentEntry = entry, _target = extractLocation, }; return x; }
void LF_ExtractProgress(object sender, ExtractProgressEventArgs e) { switch (e.EventType) { case ZipProgressEventType.Extracting_BeforeExtractEntry: if (!_pb1Set) { _txrx.Send(String.Format("pb 1 max {0}", _numFilesToExtract)); _pb1Set = true; } _pb2Set = false; _epCycles=0; break; case ZipProgressEventType.Extracting_EntryBytesWritten: _epCycles++; if ((_epCycles % 32) == 0) { if (!_pb2Set) { _txrx.Send(String.Format("pb 2 max {0}", e.TotalBytesToTransfer)); _pb2Set = true; } _txrx.Send(String.Format("status Extracting {0} :: [{1}/{2}mb] ({3:N0}%)", e.CurrentEntry.FileName, e.BytesTransferred/(1024*1024), e.TotalBytesToTransfer/(1024*1024), ((double)e.BytesTransferred / (0.01 * e.TotalBytesToTransfer)) )); string msg = String.Format("pb 2 value {0}", e.BytesTransferred); _txrx.Send(msg); } if (maxBytesXferred < e.BytesTransferred) maxBytesXferred = e.BytesTransferred; break; case ZipProgressEventType.Extracting_AfterExtractEntry: _txrx.Send("pb 1 step"); break; } }
/// <summary>上書き確認デリゲート</summary> public static void MyExtractProgressEventHandler(Object sender, ExtractProgressEventArgs e) { if (e.EventType == ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite) { // 展開するファイル名 string filePath = Path.Combine( e.ExtractLocation, e.CurrentEntry.FileName.Replace('/', '\\')); // ダイアログを表示する //DialogResult res = MessageBox.Show( // "'" + filePath + "'はすでに存在します。\r\n" + // "'はい'で上書き 'いいえ'で何もしない 'キャンセル'で中止", // "上書きの確認", // MessageBoxButtons.YesNoCancel, // MessageBoxIcon.Question); //For internationalization, Replaced all the Japanese language to ResourceMgr.GetString() method call DialogResult res = MessageBox.Show( "'" + filePath + ResourceMgr.GetString("M0009")+ "\r\n" + ResourceMgr.GetString("M0010"), ResourceMgr.GetString("M0011"), MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (res == DialogResult.Yes) { // 上書きする e.CurrentEntry.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently; } else if (res == DialogResult.No) { // 上書きしない e.CurrentEntry.ExtractExistingFile = ExtractExistingFileAction.DoNotOverwrite; } else if (res == DialogResult.Cancel) { // 展開を中止する e.Cancel = true; } } }
void zip_ExtractProgress(object sender, ExtractProgressEventArgs e) { if (e.EventType == ZipProgressEventType.Extracting_EntryBytesWritten) { New = e.BytesTransferred; Progress.Transferred += New - Old; Old = e.BytesTransferred; if (ExtractProgress != null) { ExtractProgress(e.CurrentEntry, Progress); } } else if (e.EventType == ZipProgressEventType.Extracting_AfterExtractEntry) { Old = 0; } }
/// <summary> /// 事件:處理重覆檔案 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> void Zips_ExtractProgress(object sender, ExtractProgressEventArgs e) { if (e.EventType == ZipProgressEventType.Extracting_BeforeExtractEntry) { txtMSG.Text += e.CurrentEntry.FileName + "開始解壓" + Environment.NewLine; } if (e.EventType == ZipProgressEventType.Extracting_AfterExtractEntry) { txtMSG.Text += e.CurrentEntry.FileName + "解壓縮完畢……" + Environment.NewLine; } if (e.EventType == ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite) { ZipEntry entry = e.CurrentEntry; string MSG = entry.FileName + Environment.NewLine + "檔案已存在,是否覆蓋?"; if (MessageBox.Show(MSG, "詢問視窗", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.OK) { entry.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently; } else { entry.ExtractExistingFile = ExtractExistingFileAction.DoNotOverwrite; } } }
private void OnExtractProgress(object sender, ExtractProgressEventArgs e) { if (e == null || e.CurrentEntry == null) return; _files.Add(new TaskItem(e.CurrentEntry.FileName)); Log.LogMessage(Resources.UnzipExtracted, e.CurrentEntry.FileName); }
void Zip64ExtractProgress(object sender, ExtractProgressEventArgs e) { switch (e.EventType) { case ZipProgressEventType.Extracting_BeforeExtractEntry: if (!_pb1Set) { _txrx.Send(String.Format("pb 1 max {0}", _numFilesToExtract)); _pb1Set = true; } _pb2Set = false; _epCycles = 0; break; case ZipProgressEventType.Extracting_EntryBytesWritten: _epCycles++; if ((_epCycles % 512) == 0) { if (!_pb2Set) { _txrx.Send(String.Format("pb 2 max {0}", e.TotalBytesToTransfer)); _pb2Set = true; } _txrx.Send(String.Format("status {0} entry {1}/{2} :: {3} :: {4}/{5}mb :: {6:N0}%", verb, _numExtracted, _numFilesToExtract, e.CurrentEntry.FileName, e.BytesTransferred/(1024*1024), e.TotalBytesToTransfer/(1024*1024), ((double)e.BytesTransferred) / (0.01 * e.TotalBytesToTransfer) )); string msg = String.Format("pb 2 value {0}", e.BytesTransferred); _txrx.Send(msg); } break; case ZipProgressEventType.Extracting_AfterExtractEntry: _numExtracted++; if (_numFilesToExtract < 1024 || (_numExtracted % 128) == 0) { _txrx.Send("test " + _testTitle); // just in case it was missed while (_numExtracted > _numFilesToExtract) _numExtracted--; _txrx.Send("pb 1 value " + _numExtracted); if (_numExtracted == _numFilesToExtract) { _txrx.Send("status All done " + verb); } else { _txrx.Send(String.Format("status {0} entry {1}/{2} {3:N0}%", verb, _numExtracted, _numFilesToExtract, _numExtracted / (0.01 *_numFilesToExtract))); } } break; } }
/// <summary>上書き確認デリゲート</summary> public static void MyExtractProgressEventHandler(Object sender, ExtractProgressEventArgs e) { if (e.EventType == ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite) { // 展開するファイル名 string filePath = Path.Combine( e.ExtractLocation, e.CurrentEntry.FileName.Replace('/', '\\')); // ダイアログを表示する DialogResult res = MessageBox.Show( "'" + filePath + "'はすでに存在します。\r\n" + "'はい'で上書き 'いいえ'で何もしない 'キャンセル'で中止", "上書きの確認", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question); if (res == DialogResult.Yes) { // 上書きする e.CurrentEntry.ExtractExistingFile = ExtractExistingFileAction.OverwriteSilently; } else if (res == DialogResult.No) { // 上書きしない e.CurrentEntry.ExtractExistingFile = ExtractExistingFileAction.DoNotOverwrite; } else if (res == DialogResult.Cancel) { // 展開を中止する e.Cancel = true; } } }
void ExtractProgress(object sender, ExtractProgressEventArgs e) { switch (e.EventType) { case ZipProgressEventType.Extracting_AfterExtractEntry: _progressEventCalls++; TestContext.WriteLine("Extracted: {0} ({1}/{2})", e.CurrentEntry.FileName, e.EntriesExtracted, e.EntriesTotal); // synthetic cancellation if (_cancelIndex == _progressEventCalls) { e.Cancel = true; TestContext.WriteLine("Cancelling..."); } break; case ZipProgressEventType.Extracting_EntryBytesWritten: maxBytesXferred = e.BytesTransferred; break; default: break; } }
private void OnExtractEntry(int current, bool before, ZipEntry currentEntry, string path) { if (ExtractProgress != null) { lock (LOCK) { var e = new ExtractProgressEventArgs(ArchiveNameForEvent, before, _entries.Count, current, currentEntry, path); ExtractProgress(this, e); if (e.Cancel) _extractOperationCanceled = true; } } }
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; }
private void zf_ExtractProgress(object sender, ExtractProgressEventArgs e) { switch (e.EventType) { case ZipProgressEventType.Extracting_BeforeExtractEntry: break; case ZipProgressEventType.Extracting_AfterExtractEntry: this.SetPercent(100 * e.EntriesExtracted / e.EntriesTotal); break; case ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite: e.CurrentEntry.ExtractExistingFile = ((e.CurrentEntry.ModifiedTime > new FileInfo(e.CurrentEntry.FileName).LastWriteTime) ? ExtractExistingFileAction.OverwriteSilently : ExtractExistingFileAction.DoNotOverwrite); return; default: return; } }
internal static ExtractProgressEventArgs ExtractExisting(string archiveName, ZipEntry entry, string extractLocation) { var x = new ExtractProgressEventArgs { ArchiveName = archiveName, EventType = ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite, CurrentEntry = entry, _target = extractLocation, }; return x; }
// called by the ZipFile class progressContributionSingleFile event void EvHandlerExtractProgress(object sender, ExtractProgressEventArgs e) { if (isAborted) throw new Exception("UnzipTask aborted."); try { if (e.EventType.Equals(ZipProgressEventType.Extracting_EntryBytesWritten)) { bytesDoneWithinFile = e.BytesTransferred; } } catch(Exception) { ; } }
void zip_ExtractProgress(object sender, ExtractProgressEventArgs e) { // Do we want to cancel? if (ProgressForm.WantCancel) { e.Cancel = true; return; } // Occurs when a file was extracted from the zip if (e.EventType == ZipProgressEventType.Extracting_BeforeExtractEntry) { float fpercent = ((float)e.EntriesExtracted) / ((float)e.EntriesTotal) * ((float)100.0); int percent = (int)Math.Floor(fpercent); percent++; appWorker.ReportProgress(percent * -1, "Extracting " + e.CurrentEntry.FileName); } }
void zippie_ExtractProgress(object sender, Ionic.Zip.ExtractProgressEventArgs e) { log.Info(string.Format("Saved {0} from {1}", e.BytesTransferred, e.TotalBytesToTransfer)); }
void OverwriteDecider(object sender, ExtractProgressEventArgs e) { switch (e.EventType) { case ZipProgressEventType.Extracting_ExtractEntryWouldOverwrite: // randomly choose whether to overwrite or not e.CurrentEntry.ExtractExistingFile = (_rnd.Next(2) == 0) ? ExtractExistingFileAction.DoNotOverwrite : ExtractExistingFileAction.OverwriteSilently; break; } }
/// <summary> /// Updates the progress bar with extraction progress. /// </summary> /// <param name="sender">Sender.</param> /// <param name="e">Event args</param> private void UpdateProgress(object sender, ExtractProgressEventArgs e) { if (e.EventType == ZipProgressEventType.Extracting_EntryBytesWritten) { // Calculate the download progress in percentage PercentProgress = Convert.ToInt32((e.BytesTransferred * 100) / e.TotalBytesToTransfer); // Make progress on the progress bar progressBar.Value = PercentProgress; } }
private void OnExtractEntry(int current, bool before, ZipEntry currentEntry, string path) { EventHandler<ExtractProgressEventArgs> ep = ExtractProgress; if (ep != null) { var e = new ExtractProgressEventArgs(ArchiveNameForEvent, before, _entries.Count, current, currentEntry, path); ep(this, e); if (e.Cancel) _extractOperationCanceled = true; } }
static void zip_ExtractProgress(object sender, ExtractProgressEventArgs e) { if(e.EventType == ZipProgressEventType.Extracting_AfterExtractEntry) progress = (float)e.EntriesExtracted / (float)e.EntriesTotal; }