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; OnCompressing(new ProgressEventArgs(pnow, (byte)(pnow - pold))); } } }