using RJCP.IO.Ports; using System.Collections.Generic; namespace SerialTestApp; internal class Program { public static bool QuitRequested { get; private set; } static void Main(string[] args) { while (QuitRequested == false) { Console.WriteLine($"----- SERIAL PROTOCOL TEST APP -----"); Console.WriteLine($"Command list:"); Console.WriteLine($"l = list ports"); Console.WriteLine($"c = connect"); Console.WriteLine($"q = quit"); var key = Console.ReadKey(); switch (key.Key) { // list com ports case ConsoleKey.L: string[] ports = SerialPortStream.GetPortNames(); Console.WriteLine($"Following ports were found: {Environment.NewLine}"); foreach (var port in ports) { Console.WriteLine($"-- {port}"); } break; case ConsoleKey.Q: QuitRequested = true; break; default: Console.WriteLine($"{Environment.NewLine}Did not recognize key.. {Environment.NewLine}"); break; } } } }