Exemplo n.º 1
0
 private void IntEventArgsHandler(object sender, IntEventArgs e)
 {
     lock (_lockObject)
     {
         //SAB: Fix div zero
         if (_bytesCount == 0)
         {
             _bytesCount = 1;
         }
         var pold = (byte)((_bytesWrittenOld * 100) / _bytesCount);
         _bytesWritten += e.Value;
         byte pnow;
         if (_bytesCount < _bytesWritten) //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)));
         }
     }
 }
        private void IntEventArgsHandler(object sender, IntEventArgs e)
        {
            var lockObject = ((object)_files ?? _streams) ?? _fileStream;

            lock (lockObject)
            {
                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
                {
                    //Debug.WriteLine("Bytes written: " + _bytesWritten + " / " + _bytesCount);
                    pnow = (byte)((_bytesWritten * 100) / _bytesCount);
                }

                if (pnow > pold)
                {
                    //This appears to be only for amount of source file bytes written into 7z dll buffer and not actual
                    //progress.
                    _bytesWrittenOld = _bytesWritten;
                    OnCompressing(new ProgressEventArgs(pnow, (byte)(pnow - pold)));
                }
            }
        }
Exemplo n.º 3
0
        private void IntEventArgsHandler(object sender, IntEventArgs e)
        {
            var lockObject = ((object)_files ?? _streams) ?? _fileStream;

            lock (lockObject)
            {
                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)));
                }
            }
        }
Exemplo n.º 4
0
 private void OnBytesWritten(IntEventArgs e)
 {
     if (BytesWritten != null)
     {
         BytesWritten(this, e);
     }
 }
Exemplo n.º 5
0
 private void OnBytesRead(IntEventArgs e)
 {
     if (BytesRead != null)
     {
         BytesRead(this, e);
     }
 }
Exemplo n.º 6
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)));
            }
        }
 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;
             byte ddd = (byte)(e.Value);
             OnCompressing(new ProgressEventArgs(pnow, e.Value));
         }
     }
 }
        private void IntEventArgsHandler(object sender, IntEventArgs e)
        {
            // If _bytesCount is not set, we can't update the progress.
            if (_bytesCount == 0)
            {
                return;
            }


            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)));
            }
        }
Exemplo n.º 9
0
 private void IntEventArgsHandler(object sender, IntEventArgs e)
 {
     //zero 11-oct-2014 - first of all, its possible for _files to be null (if we're compressing streams)
     //second of all, if we're compressing streams, we cant possibly have _bytesCount anyway. so.. goodbye
     //lock (_files)
     //{
     //    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)));
     //    }
     //}
 }
Exemplo n.º 10
0
 private void OnBytesWritten(IntEventArgs e)
 {
     if (BytesWritten != null)
         BytesWritten(this, e);
 }
Exemplo n.º 11
0
 private void OnBytesRead(IntEventArgs e)
 {
     if (BytesRead != null)
         BytesRead(this, e);
 }
 /// <summary>
 /// Event proxy for FilesFound.
 /// </summary>
 /// <param name="sender">The sender of the event.</param>
 /// <param name="e">The event arguments.</param>
 private void FilesFoundEventProxy(object sender, IntEventArgs e)
 {
     OnEvent(FilesFound, e, false);
 }
 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;
             byte ddd = (byte)(e.Value);
             OnCompressing(new ProgressEventArgs(pnow, e.Value));
         }
     }
 }
Exemplo n.º 14
0
 private void OnBytesWritten(IntEventArgs e)
 {
     //Debug.WriteLine("OnBytesWritten: " + e.Value);
     BytesWritten?.Invoke(this, e);
 }
Exemplo n.º 15
0
 private void OnBytesRead(IntEventArgs e)
 {
     BytesRead?.Invoke(this, e);
 }
Exemplo n.º 16
0
 private void OnBytesWritten(IntEventArgs e)
 {
     BytesWritten?.Invoke(this, e);
 }
Exemplo n.º 17
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)));
     }
 }
Exemplo n.º 18
0
        private void IntEventArgsHandler(object sender, IntEventArgs e)
        {
					//zero 11-oct-2014 - first of all, its possible for _files to be null (if we're compressing streams)
					//second of all, if we're compressing streams, we cant possibly have _bytesCount anyway. so.. goodbye
						//lock (_files)
						//{
						//    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)));
						//    }
						//}
        }
Exemplo n.º 19
0
 private void IntEventArgsHandler(object sender, IntEventArgs e)
 {
     lock (_files) {
         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) return;
         _bytesWrittenOld = _bytesWritten;
         OnCompressing(new ProgressEventArgs(pnow, (byte) (pnow - pold)));
     }
 }