diff options
author | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2023-01-15 19:12:47 +0300 |
---|---|---|
committer | Alexey 'Cluster' Avdyukhin <clusterrr@clusterrr.com> | 2023-01-15 19:12:47 +0300 |
commit | f0eabaf6bf4f7da30d1a6e59581976df8fc550f4 (patch) | |
tree | 156730bb3c80a234e37f3641bee22fde3f97b2d6 | |
parent | 832a2dffcf48a363c16fb4e5381a7a200293e60b (diff) |
Port autodetect error message fix
-rw-r--r-- | FamicomDumperConnection/SerialClient.cs | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/FamicomDumperConnection/SerialClient.cs b/FamicomDumperConnection/SerialClient.cs index 844f71d..e855a78 100644 --- a/FamicomDumperConnection/SerialClient.cs +++ b/FamicomDumperConnection/SerialClient.cs @@ -88,15 +88,18 @@ namespace com.clusterrr.Communication break; } } - if (!found) throw new IOException($"Can't autodetect serial port, try to specify it manually"); - if (myFtdiDevice.GetCOMPort(out string portName) != FTDI.FT_STATUS.FT_OK) - throw new IOException($"Failed to get FTDI serial port name (error {ftStatus})"); - myFtdiDevice.Close(); - Console.WriteLine($"Autodetected virtual serial port: {portName}"); - OpenPortByName(portName, baudRate, timeout); - return; + if (found) + { + if (myFtdiDevice.GetCOMPort(out string portName) != FTDI.FT_STATUS.FT_OK) + throw new IOException($"Failed to get FTDI serial port name (error {ftStatus})"); + myFtdiDevice.Close(); + Console.WriteLine($"Autodetected virtual serial port: {portName}"); + OpenPortByName(portName, baudRate, timeout); + return; + } } } // FTDI OK + throw new IOException($"Can't autodetect serial port, try to specify it manually"); } // not COM } // Windows else |