예제 #1
0
        private void OnUpdate()
        {
            var           numChanges = 0;
            PendingChange change;

            while (_pendingChanges.TryDequeue(out change))
            {
                Guid quickInfoId;
                if (_logFiles.TryGetValue(change.LogFile, out quickInfoId))
                {
                    LogLine?previousLine;
                    _lastMatchingLines.TryGetValue(quickInfoId, out previousLine);

                    var matchingLine = GetMatchingLine(change.LogFile, change.Section, previousLine);
                    _lastMatchingLines[quickInfoId] = matchingLine;
                }

                ++numChanges;
                if (numChanges % 20 == 0)
                {
                    _currentResult = CreateResult(_lastMatchingLines);
                }
            }

            if (numChanges > 0)
            {
                _currentResult = CreateResult(_lastMatchingLines);
            }
        }
예제 #2
0
        /// <summary>
        ///     Creates a new result from the given currently matched lines.
        /// </summary>
        /// <remarks>
        ///     Only those results where a line has been found will be part of the returned result.
        /// </remarks>
        /// <param name="lastMatchingLines"></param>
        /// <returns></returns>
        private static QuickInfoResult CreateResult(IReadOnlyDictionary <Guid, LogLine?> lastMatchingLines)
        {
            var result = new QuickInfoResult(lastMatchingLines.Count);

            foreach (var pair in lastMatchingLines)
            {
                var quickInfo = CreateResult(pair.Value);
                if (quickInfo != null)
                {
                    result.QuickInfos.Add(pair.Key, quickInfo);
                }
            }
            return(result);
        }