private void ViewSelectedContext() { List <FileContext> MatchFiles = new List <FileContext>(); string Title = "Context"; string SearchString = txtSearchString.Text; string tempSearch = chkFilterMatchCase.Checked ? SearchString : SearchString.ToUpper(); int C = 0; int MC = 0; foreach (DataGridViewRow Row in grdResults.Rows) { string FilePath = Path.Combine(Row.Cells["Path"].Value.ToString(), Row.Cells["Name"].Value.ToString()); int[] MatchLines = new int[0]; if (chkSearchRegex.Checked) { MatchLines = GetFileContextsRegex(FilePath); } else { MatchLines = GetFileContexts(FilePath); } MatchFiles.Add(GetContexts(MatchLines, FilePath, properties.ContextSize)); MC += MatchLines.Length; lblStatus.Text = string.Format("{0} files searched; {1} total matches", ++C, MC); } TextViewer TV = new TextViewer(properties); TV.ShowContexts(Title, MatchFiles, tempSearch, chkSearchRegex.Checked); }
private void ViewSelectedContext() { var matchFiles = new List <FileContext>(); const string title = "Context"; var searchString = txtSearchString.Text; var c = 0; var mc = 0; foreach (DataGridViewRow row in grdResults.Rows) { if (!row.Visible) { continue; } var filePath = Path.Combine(row.Cells["Directory"].Value.ToString(), row.Cells["Name"].Value.ToString()); var matchLines = chkSearchRegex.Checked ? GetFileContextsRegex(filePath) : GetFileContexts(filePath); matchFiles.Add(GetContexts(matchLines, filePath, _properties.ContextSize)); mc += matchLines.Length; // ReSharper disable once LocalizableElement lblStatus.Text = $"{++c} files searched; {mc} total matches"; } var tv = new TextViewer(); tv.ShowContexts(title, matchFiles, searchString, chkSearchRegex.Checked); }