private void OnSizeOfFileChanged(long lastSizeOfFile, long currentSizeOfFile) { if (SizeOfFileChanged != null) { var args = new SizeOfFileEventArgs(lastSizeOfFile, currentSizeOfFile); _log.Debug("Raising event SizeOfFileChanged..."); try { SizeOfFileChanged(this, args); } catch (Exception e) { _log.Error(e.ToString()); } _log.Debug(".. Event SizeOfFileChanged is raised"); } }
private void SizeOfFileChangedHandler(object sender, SizeOfFileEventArgs e) { NewContentIsAvailable = true; if (e.CurrentSizeOfFile == 0) { EmptyPage(); OnPageLoaded(); return; } if (e.CurrentSizeOfFile > e.LastSizeOfFile) { Log.Debug("size of file increased"); IList <string> tail = _stream.GetEndOfFile(e.LastSizeOfFile, RejectionList); OnTailUpdated(tail); } else if (e.CurrentSizeOfFile < e.LastSizeOfFile) { Log.Debug("size of file decreased"); _stream.SetPosition(_currentPage.OffsetStart, SeekOrigin.Begin); FillCurrentPage(_currentPage.OffsetStart); OnPageLoaded(); } }