public FoundInFileEventArgs(FoundInFileInfo f) : base() { Value = f; }
private void searchFile(string searchText, string contents, string path) { int line = 0; int index1 = 0; int index2 = 0; try { while (index2 >= 0) { index2 = contents.IndexOf(searchText, index1, _comparisonType); if (index2 >= 0) { line += getLinesFromIndexToIndex(contents, index1, index2); if (FoundInFile != null) { int linestart = contents.LastIndexOf('\n', index2) + 1; int lineend = contents.IndexOf('\n', index2); if (lineend < 0) lineend = contents.Length - 1; string foundText = contents.Substring(linestart, lineend - linestart).Trim(); FoundInFileInfo f = new FoundInFileInfo(searchText, foundText, path, line, index2 - linestart); _foundItems.Add(f); if (++_foundCount % 20 == 0) _backgroundWorker.ReportProgress(_foundCount); } index1 = index2 + 1; } } } catch (Exception ex) { Debug.WriteLine(ex.Message); } }