protected virtual void OnTextFound(TextFoundEventArgs e) { if (TextFound != null) { TextFound(this, e); } }
public void Execute(string target) { using (StreamReader sr = new StreamReader(_filename)) { string line; while ((line = sr.ReadLine()) != null) { if (line.TrimStart().StartsWith(target)) { TextFoundEventArgs e = new TextFoundEventArgs(line); OnTextFound(e); } } } }
static void tf_TextFound(object sender, TextFoundEventArgs e) { Console.WriteLine(e.Line); }