public Terminal( TerminalOpenEvent terminalOpen = null, ConsoleOutEvent onConsoleOutEvent = null ) { var chr = CharacterParser.Create(); var ansi = new AnsiParserEvents() { Input = (characters) => Debug.Write(new string(characters)) }; _ansiParser = new AnsiParser(events: ansi, utf8: chr.TryParseUtf8); var vt = new VTParserEvents() { EscapeSequence = _ansiParser.OnEscapeSequence, ControlSequence = _ansiParser.OnControlSequenceCommand, Execute = _ansiParser.OnExecute, OsCommand = _ansiParser.OnOsCommand, Print = _ansiParser.OnPrint }; _vtParser = new VTParser(events: vt, utf8: chr.TryParseUtf8, ascii: chr.TryParseAscii); onConsoleOutEvent?.Subscribe(OnConsoleOut); terminalOpen?.Publish(new TerminalOpenEventData( @"C:\windows\system32\cmd.exe", "", null, null )); }
public WinPtyPlugin( ConsoleOutEvent consoleOutEvent = null, TerminalOpenedEvent terminalOpened = null, TerminalClosedEvent terminalClosed = null, TerminalOpenEvent onTerminalOpen = null, TerminalCloseEvent onTerminalClose = null, ConsoleInEvent onConsoleInEvent = null) { _lib = Lib.Create(); _terminals = new ConcurrentDictionary <TerminalIdentifier, Pty>(); _consoleOutEvent = consoleOutEvent; _terminalOpened = terminalOpened; _terminalClosed = terminalClosed; onTerminalOpen?.Subscribe(OnTerminalOpen); onTerminalClose?.Subscribe(OnTerminalClose); onConsoleInEvent?.Subscribe(OnConsoleIn); }