コード例 #1
1
ファイル: frmDescompacta.cs プロジェクト: zezeufab/SisBackup
        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);
            }
        }
コード例 #2
0
 void zf_ExtractProgress(object sender, Zip.ExtractProgressEventArgs e)
 {
     Dispatcher.Invoke(new MyDelegate(() =>
     {
         progressBar.Value = e.BytesTransferred;
     }));
 }
コード例 #3
0
        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();
            }
        }
コード例 #4
0
ファイル: Events.cs プロジェクト: MORTAL2000/UnrealEngine4.26
        internal static ExtractProgressEventArgs ExtractAllCompleted(string archiveName, string extractLocation)
        {
            var x = new ExtractProgressEventArgs(archiveName, ZipProgressEventType.Extracting_AfterExtractAll);

            x._target = extractLocation;
            return(x);
        }
コード例 #5
0
ファイル: Form1.cs プロジェクト: pederjohnsen/Nimbus
 void zf_ExtractProgress(object sender, ExtractProgressEventArgs e)
 {
     if (e.EventType == ZipProgressEventType.Extracting_AfterExtractAll)
     {
         this.BeginInvoke(new MethodInvoker(Finish));
     }
 }
コード例 #6
0
        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);
        }
コード例 #7
0
ファイル: Events.cs プロジェクト: MORTAL2000/UnrealEngine4.26
        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);
        }
コード例 #8
0
        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);
        }
コード例 #9
0
        internal void OnExtractAllStarted(string path)
        {
            EventHandler <ExtractProgressEventArgs> ep = ExtractProgress;

            if (ep != null)
            {
                var e = ExtractProgressEventArgs.ExtractAllStarted(ArchiveNameForEvent,
                                                                   path);
                ep(this, e);
            }
        }
コード例 #10
0
 private void OnExtractAllStarted(string path)
 {
     if (ExtractProgress != null)
     {
         lock (LOCK)
         {
             var e = ExtractProgressEventArgs.ExtractAllStarted(ArchiveNameForEvent,
                                                                path);
             ExtractProgress(this, e);
         }
     }
 }
コード例 #11
0
ファイル: Events.cs プロジェクト: MORTAL2000/UnrealEngine4.26
        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);
        }
コード例 #12
0
ファイル: Events.cs プロジェクト: MORTAL2000/UnrealEngine4.26
        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);
        }
コード例 #13
0
        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;
                }
            }
        }
コード例 #14
0
        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);
        }
コード例 #15
0
 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;
             }
         }
     }
 }
コード例 #16
0
        // 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);
        }
コード例 #17
0
        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;
            }
        }
コード例 #18
0
        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();
            }
        }
コード例 #19
0
 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);
 }
コード例 #20
0
        // 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);
        }
コード例 #21
0
 // 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);
 }
コード例 #22
0
ファイル: Start.cs プロジェクト: SCullman/nvQuickSite
        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;
        }
コード例 #23
0
ファイル: ZipArchiveIterator.cs プロジェクト: huizh/xenadmin
 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;
     }
 }
コード例 #24
0
        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
        }
コード例 #25
0
ファイル: Streams.cs プロジェクト: mattleibow/Zip.Portable
 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;
     }
 }
コード例 #26
0
        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));
                }
            }
        }
コード例 #27
0
ファイル: Package.cs プロジェクト: Rukhlov/DataStudio
        // прогресс распаковки
        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);
                }
            }
        }
コード例 #28
0
ファイル: Pages.cs プロジェクト: yasutako/Serius-X
 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;
 }
コード例 #29
0
ファイル: ZipBase.cs プロジェクト: takeman/OpenTouryo
 /// <summary>ExtractProgressイベント ハンドラ</summary>
 protected void ExtractProgressEventHandler(Object sender, ExtractProgressEventArgs e)
 {
     //Debug.WriteLine("ExtractProgressEventHandler\r\n"
     //    + "sender:" + sender.ToString() + ", " + "e.ArchiveName:" + e.ArchiveName);
 }
コード例 #30
0
ファイル: ActionTutorial.cs プロジェクト: lgatto/proteowizard
        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));
                }
            }
        }
コード例 #31
0
ファイル: Events.cs プロジェクト: RainsSoft/Updater
 internal static ExtractProgressEventArgs ExtractAllStarted(string archiveName, string extractLocation)
 {
     var x = new ExtractProgressEventArgs(archiveName, ZipProgressEventType.Extracting_BeforeExtractAll);
     x._target = extractLocation;
     return x;
 }
コード例 #32
0
ファイル: Events.cs プロジェクト: RainsSoft/Updater
 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;
 }
コード例 #33
0
        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;
            }
        }
コード例 #34
0
ファイル: Program.cs プロジェクト: takeman/OpenTouryo
        /// <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;
                }
            }
        }
コード例 #35
0
ファイル: Zip.cs プロジェクト: andresperezpayeras/epubfixer
        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;
            }
        }
コード例 #36
0
ファイル: Form1.cs プロジェクト: DaHao/RSPdf
        /// <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;
                }
            }
        }
コード例 #37
0
ファイル: Unzip.cs プロジェクト: haoasqui/ONLYOFFICE-Server
        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);
        }
コード例 #38
0
ファイル: Zip64Tests.cs プロジェクト: mattleibow/Zip.Portable
        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;
            }
        }
コード例 #39
0
ファイル: Program.cs プロジェクト: runceel/OpenTouryo
        /// <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;
                }
            }
        }
コード例 #40
0
        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;
            }
        }
コード例 #41
0
 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;
         }
     }
 }
コード例 #42
0
ファイル: Events.cs プロジェクト: RainsSoft/Updater
 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;
 }
コード例 #43
0
 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;
     }
 }
コード例 #44
0
ファイル: Events.cs プロジェクト: RainsSoft/Updater
 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;
 }
コード例 #45
0
 // 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)
     {
         ;
     }
 }
コード例 #46
0
ファイル: mainForm.cs プロジェクト: C-Nedelcu/appmigrate
        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);
            }
        }
コード例 #47
0
 void zippie_ExtractProgress(object sender, Ionic.Zip.ExtractProgressEventArgs e)
 {
     log.Info(string.Format("Saved {0} from {1}", e.BytesTransferred, e.TotalBytesToTransfer));
 }
コード例 #48
0
 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;
     }
 }
コード例 #49
0
ファイル: UpdateForm.cs プロジェクト: gbrusella/oberon-bot
 /// <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;
     }
 }
コード例 #50
0
 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;
     }
 }
コード例 #51
0
ファイル: Zip.cs プロジェクト: Synpheros/eAdventure4Unity
 static void zip_ExtractProgress(object sender, ExtractProgressEventArgs e)
 {
     if(e.EventType == ZipProgressEventType.Extracting_AfterExtractEntry)
         progress = (float)e.EntriesExtracted / (float)e.EntriesTotal;
 }