Example #1
0
 /// <summary>
 /// Sets the progress
 /// </summary>
 /// <param name="inSize">The processed input size</param>
 /// <param name="outSize">The processed output size</param>
 public void SetProgress(long inSize, long outSize)
 {
     if (Working != null)
     {
         float newPercentDone = (inSize + 0.0f) / _inSize;
         float delta          = newPercentDone - _oldPercentDone;
         if (delta * 100 < 1.0)
         {
             delta = 0;
         }
         else
         {
             _oldPercentDone = newPercentDone;
         }
         Working(this, new ProgressEventArgs(
                     PercentDoneEventArgs.ProducePercentDone(newPercentDone),
                     delta > 0 ? PercentDoneEventArgs.ProducePercentDone(delta) : (byte)0));
     }
 }
Example #2
0
 /// <summary>
 /// Raises events for the GetStream method.
 /// </summary>
 /// <param name="index">The current item index.</param>
 /// <returns>True if not cancelled; otherwise, false.</returns>
 private bool EventsForGetStream(uint index)
 {
     if (!FastCompression)
     {
         if (_fileStream != null)
         {
             _fileStream.BytesRead += IntEventArgsHandler;
         }
         _doneRate += 1.0f / _actualFilesCount;
         var fiea = new FileNameEventArgs(_files != null? _files[index].Name : _entries[index],
                                          PercentDoneEventArgs.ProducePercentDone(_doneRate));
         OnFileCompression(fiea);
         if (fiea.Cancel)
         {
             Canceled = true;
             return(false);
         }
     }
     return(true);
 }