void ParseAndDisplay(IEnumerable<LogEntry> result, SearchTypeId searchTypeId, string searchPhrase, LogSearchParameters searchParams)
        {
            List<SingleSearchMatch> matches = new List<SingleSearchMatch>();

            result = FilterResults(result, searchParams);

            List<string> results = new List<string>();
            int currentLineBeginIndex = 0;
            var pattern = searchTypeId == SearchTypeId.RegexEscapedCaseIns
                ? ("(?i)" + Regex.Escape(searchPhrase))
                : searchPhrase;

            foreach (var logEntry in result)
            {
                // restoring entry as string, so legacy code can be used without major rewrite
                var line = RestoreLogEntry(logEntry);
                results.Add(line);

                if (!string.IsNullOrWhiteSpace(searchPhrase))
                {
                    MatchCollection matchcollection = Regex.Matches(line, pattern);
                    foreach (Match match in matchcollection)
                    {
                        long matchStart = currentLineBeginIndex + match.Index;
                        long matchLength = match.Length;

                        matches.Add(new SingleSearchMatch(matchStart, matchLength, BuildDateForMatch(line)));
                    }
                }
                currentLineBeginIndex += line.Length + 1; // richtextbox seems to always add 1-length eol ??
            }

            lastMatches = matches;

            buttonCommitSearch.Text = "Loading results...";

            labelAllResults.Text = "All results: " + results.Count;

            richTextBoxAllLines.Visible = false;
            listBoxAllResults.Visible = false;
            labelWorking.Show();
            this.Refresh();

            richTextBoxAllLines.Clear();
            listBoxAllResults.Items.Clear();
            richTextBoxAllLines.Lines = results.ToArray();
            if (matches.Any())
            {
                bool tooManyToProcess = false;
                bool tooManyToHighlight = false;
                if (results.Count > 20000)
                    tooManyToProcess = true;
                if (results.Count > 5000)
                    tooManyToHighlight = true;
                if (!tooManyToProcess)
                {
                    foreach (var searchmatch in matches)
                    {
                        string matchDesc = "";
                        matchDesc += searchmatch.MatchDate;
                        if (!tooManyToHighlight)
                        {
                            richTextBoxAllLines.Select((int)searchmatch.BeginCharPos, (int)searchmatch.LenghtChars);
                            richTextBoxAllLines.SelectionBackColor = Color.LightBlue;
                        }
                        listBoxAllResults.Items.Add(matchDesc);
                        Application.DoEvents();
                    }
                }
                else
                {
                    listBoxAllResults.Items.Add("too many matches");
                    listBoxAllResults.Items.Add("narrow the search");
                }
            }
        }
        void ParseAndDisplay(IEnumerable <LogEntry> result, SearchTypeId searchTypeId, string searchPhrase, LogSearchParameters searchParams)
        {
            List <SingleSearchMatch> matches = new List <SingleSearchMatch>();

            result = FilterResults(result, searchParams);

            List <string> results = new List <string>();
            int           currentLineBeginIndex = 0;
            var           pattern = searchTypeId == SearchTypeId.RegexEscapedCaseIns
                ? ("(?i)" + Regex.Escape(searchPhrase))
                : searchPhrase;

            foreach (var logEntry in result)
            {
                // restoring entry as string, so legacy code can be used without major rewrite
                var line = RestoreLogEntry(logEntry);
                results.Add(line);

                if (!string.IsNullOrWhiteSpace(searchPhrase))
                {
                    MatchCollection matchcollection = Regex.Matches(line, pattern);
                    foreach (Match match in matchcollection)
                    {
                        long matchStart  = currentLineBeginIndex + match.Index;
                        long matchLength = match.Length;

                        matches.Add(new SingleSearchMatch(matchStart, matchLength, BuildDateForMatch(line)));
                    }
                }
                currentLineBeginIndex += line.Length + 1; // richtextbox seems to always add 1-length eol ??
            }

            lastMatches = matches;

            buttonCommitSearch.Text = "Loading results...";

            labelAllResults.Text = "All results: " + matches.Count;

            richTextBoxAllLines.Visible = false;
            listBoxAllResults.Visible   = false;
            labelWorking.Show();
            this.Refresh();

            richTextBoxAllLines.Clear();
            listBoxAllResults.Items.Clear();
            richTextBoxAllLines.Lines = results.ToArray();
            if (matches.Any())
            {
                bool tooManyToProcess   = false;
                bool tooManyToHighlight = false;
                if (matches.Count > 20000)
                {
                    tooManyToProcess = true;
                }
                if (matches.Count > 5000)
                {
                    tooManyToHighlight = true;
                }
                if (!tooManyToProcess)
                {
                    foreach (var searchmatch in matches)
                    {
                        string matchDesc = "";
                        matchDesc += searchmatch.MatchDate;
                        if (!tooManyToHighlight)
                        {
                            richTextBoxAllLines.Select((int)searchmatch.BeginCharPos, (int)searchmatch.LenghtChars);
                            richTextBoxAllLines.SelectionBackColor = Color.LightBlue;
                        }
                        listBoxAllResults.Items.Add(matchDesc);
                        Application.DoEvents();
                    }
                }
                else
                {
                    listBoxAllResults.Items.Add("too many matches");
                    listBoxAllResults.Items.Add("narrow the search");
                }
            }
        }