From 1cb42eabfa6ab58e6a1fac06c57cd20fe0220e13 Mon Sep 17 00:00:00 2001 From: Edward Wright Date: Tue, 4 Jun 2019 21:56:59 -0400 Subject: [PATCH] added "-list" command-line argument to list available ports --- SimplySerial/SimplySerial.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/SimplySerial/SimplySerial.cs b/SimplySerial/SimplySerial.cs index 1f238e8..b43f555 100644 --- a/SimplySerial/SimplySerial.cs +++ b/SimplySerial/SimplySerial.cs @@ -149,6 +149,18 @@ namespace SimplySerial ExitProgram(silent: true); } + // list available ports + else if (argument[0].StartsWith("l")) + { + Console.WriteLine("\nAvailable Ports:"); + foreach (string potentialPort in SerialPort.GetPortNames()) + { + Console.WriteLine(" {0}", potentialPort); + } + Console.WriteLine(""); + ExitProgram(silent: true); + } + // quiet (no output to console other than comes in via serial) else if (argument[0].StartsWith("q")) {