public override void LineIsProcessed(Guid resultId) { Log.Trace(string.Format("{0}: ({1}) is processed.", LogContext.LogType, resultId)); if (_lineInProcess.ResultId != resultId) { throw new InvalidOperationException("Result ids does not match."); } string filePath; _changedFiles.TryPeek(out filePath); if (_lineInProcess.FilePath != filePath) { throw new InvalidOperationException("File paths does not match."); } var positionKey = GetPositionKey(filePath); using (var fs = new TextFileLineReader(filePath, _encoding)) { fs.Position = LogContext.Storage.Get <long>(positionKey); if (_lineInProcess.Position >= fs.Length) { _changedFiles.TryDequeue(out filePath); } } LogContext.Storage.Insert(positionKey, _lineInProcess.Position); _lineInProcess = null; }
private void SetLineInProcess(Guid resultId, string filePath, long position) { _lineInProcess = new LineInProcess { ResultId = resultId, FilePath = filePath, Position = position }; }