Ejemplo n.º 1
0
        public override uint Write(byte[] data, uint size)
        {
            var rv = base.Write(data, size);
              Flush(rv);
              Written += rv;

              if (ProgressHandler != null) {
            progress -= Math.Min(rv, progress);
            if (progress == 0) {
              if (ProgressHandler != null) {
            var eventArgs = new ExtractProgressEventArgs(file, Written, fileSize);
            ProgressHandler(this, eventArgs);
            if (!eventArgs.ContinueOperation) {
              throw new IOException("User canceled");
            }
              }
              progress = BUFFER_SIZE;
            }
              }
              return rv;
        }
Ejemplo n.º 2
0
 private void OnExtractProgress(object sender, ExtractProgressEventArgs e)
 {
     var progress = (float)((double)e.Written / e.Total);
     var fn = e.File.Name;
     owner.BeginInvoke(
       new SetStatus(status =>
     {
       Item.SubStatus = status;
     }),
       String.Format(CultureInfo.CurrentCulture, "{0:0%} - {1}", progress, fn)
     );
     e.ContinueOperation = !owner.aborted;
 }