private void AddResult(ParseResultUnit result) { lock (ResultsLock) { Results.Add(result.Filepath, result); ProcessedFileCount++; var percentage = GetPercentage(ProcessedFileCount, TotalFileCount); var timestamps = result.TimestampGroups; OnLogProcessed(Id, result.Filepath, percentage, State, timestamps); } }
private void ParseFileContent(FileStringUnit fileContent) { var targetDate = TargetDate; var result = new ParseResultUnit(fileContent.Filepath); using (StringReader sr = new StringReader(fileContent.Content)) { int lineNumber = 0; while (sr.Peek() != -1) { lineNumber++; var line = sr.ReadLine().Trim(); var match = TimestampCaptureRegex.Match(line); if (!match.Success) { continue; } DateTime parsedDate; if (!DateTime.TryParse(match.Value, out parsedDate) || targetDate.Date != parsedDate.Date) { continue; } var messageValue = line.Remove(0, match.Value.Length).Trim(':'); var messageKey = OnMessageKeyRequested(messageValue); result.AddLine(parsedDate, lineNumber, messageKey); } } fileContent.Clear(); if (result.Count == 0) { FileSet.Remove(fileContent.Filepath); } AddResult(result); }