private void App_ConsoleOutput(object sender, ConsoleOutputEventArgs e) { if (e.Line == "") { return; } if (e.Line.Substring(0, 2) == "->") { string[] strlst = e.Line.Substring(2).Split(new char[] { '|' }, StringSplitOptions.RemoveEmptyEntries); var action = Events.Where(x => x.Key == strlst[0]); if (action.Any()) { try { var act = action.SingleOrDefault(); act.Value(strlst.Skip(1).ToArray()); } catch (Exception ex) { System.Console.WriteLine(ex.Message); } } } else { if (OnStatus != null) { OnStatus(this, e.Line); } } }
protected virtual void OnConsoleOutput(ConsoleOutputEventArgs e) { if (e.Line == null) { return; } Trace.TraceInformation("{0}> {1}", e.IsError ? "stderr" : "stdout", e.Line); var handler = ConsoleOutput; if (handler != null) { handler(this, e); } }