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))); } } }
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))); } } }
private void OnBytesWritten(IntEventArgs e) { if (BytesWritten != null) { BytesWritten(this, e); } }
private void OnBytesRead(IntEventArgs e) { if (BytesRead != null) { BytesRead(this, e); } }
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))); } }
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))); // } //} }
private void OnBytesWritten(IntEventArgs e) { if (BytesWritten != null) BytesWritten(this, e); }
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)); } } }
private void OnBytesWritten(IntEventArgs e) { //Debug.WriteLine("OnBytesWritten: " + e.Value); BytesWritten?.Invoke(this, e); }
private void OnBytesRead(IntEventArgs e) { BytesRead?.Invoke(this, e); }
private void OnBytesWritten(IntEventArgs e) { BytesWritten?.Invoke(this, e); }
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))); } }