public override void Process(Message msg) { if (ExecProcess == null) { base.Process(msg); } else { if (ExecProcess.HasExited) { Exit(); return; } if (msg.Type == MessageType.TextMessage) { var text = msg.Text; text = Ext.TgNormalizeStr(text); switch (text) { case CancelCmd: Exit(); return; case DetachCmd: Detach(); return; default: text = Ext.ExpandCmd(text, CancelCmd); text = Ext.ExpandCmd(text, DetachCmd); break; } ExecProcess.StandardInput.WriteLineAsync(text).Wait(); ExecProcess.StandardInput.Flush(); } } }