TerminalControl rewriten by me in C#