public List<GrepResults> RunQuery() { System.Console.WriteLine("Running Query"); string[] lines = System.IO.File.ReadAllLines(_fileName); int lineCount = 1; foreach (var line in lines) { if (System.Text.RegularExpressions.Regex.IsMatch(line, _pattern)) { GrepResults result = new GrepResults(lineCount, _pattern, line, _fileName); Results.Add(result); System.Console.WriteLine("Query Results pattern: {0}\nline {1}: {2}", _pattern, lineCount, line); } lineCount++; } System.Console.WriteLine("Query Complete, results found<{0}>", Results.Count); //TODO: do the real printouts of individual results here, after processing return Results; }
public List <GrepResults> RunQuery() { System.Console.WriteLine("Running Query"); string[] lines = System.IO.File.ReadAllLines(_fileName); int lineCount = 1; foreach (var line in lines) { if (System.Text.RegularExpressions.Regex.IsMatch(line, _pattern)) { GrepResults result = new GrepResults(lineCount, _pattern, line, _fileName); Results.Add(result); System.Console.WriteLine("Query Results pattern: {0}\nline {1}: {2}", _pattern, lineCount, line); } lineCount++; } System.Console.WriteLine("Query Complete, results found<{0}>", Results.Count); //TODO: do the real printouts of individual results here, after processing return(Results); }