Port of NetConsole to .NET with C#