Beispiel #1
0
 private void OnBytesWritten(IntEventArgs e)
 {
     if (BytesWritten != null)
     {
         BytesWritten(this, e);
     }
 }
Beispiel #2
0
 private void OnBytesRead(IntEventArgs e)
 {
     if (BytesRead != null)
     {
         BytesRead(this, e);
     }
 }
Beispiel #3
0
        private void IntEventArgsHandler(object sender, IntEventArgs e)
        {
            var pold = (int)((_bytesWrittenOld * 100) / _bytesCount);

            _bytesWritten += e.Value;
            var pnow = (int)((_bytesWritten * 100) / _bytesCount);

            if (pnow > pold)
            {
                if (pnow > 100)
                {
                    pold = pnow = 0;
                }
                _bytesWrittenOld = _bytesWritten;
                OnExtracting(new ProgressEventArgs((byte)pnow, (byte)(pnow - pold)));
            }
        }
Beispiel #4
0
 private void IntEventArgsHandler(object sender, IntEventArgs e)
 {
     lock (this)
     {
         var pold = (byte)((_bytesWrittenOld * 100) / _bytesCount);
         _bytesWritten += e.Value;
         byte pnow;
         if (_bytesCount < _bytesWritten) //Holy shit, this check for ZIP is golden
         {
             pnow = 100;
         }
         else
         {
             pnow = (byte)((_bytesWritten * 100) / _bytesCount);
         }
         if (pnow > pold)
         {
             _bytesWrittenOld = _bytesWritten;
             OnCompressing(new ProgressEventArgs(pnow, (byte)(pnow - pold)));
         }
     }
 }