/// <summary> /// Gets an array of serial port names for the current computer. /// </summary> /// <returns>An array of serial port names for the current computer.</returns> public string[] GetPortNames() { #if NETSTANDARD15 throw new NotImplementedException("GetPortNames"); #else PortDescription[] ports; try { ports = m_Dll.serial_getports(m_Handle); } catch (System.EntryPointNotFoundException) { // libnserial is version < 1.1.0 ports = null; } if (ports == null) { return(System.IO.Ports.SerialPort.GetPortNames()); } string[] portNames = new string[ports.Length]; for (int i = 0; i < ports.Length; i++) { portNames[i] = ports[i].Port; } return(portNames); #endif }
/// <summary> /// Gets an array of serial port names for the current computer. /// </summary> /// <returns>An array of serial port names for the current computer.</returns> public string[] GetPortNames() { PortDescription[] ports; try { ports = m_Dll.serial_getports(m_Handle); } catch (System.EntryPointNotFoundException) { // libnserial is version < 1.1.0 ports = null; } if (ports == null) return System.IO.Ports.SerialPort.GetPortNames(); string[] portNames = new string[ports.Length]; for (int i = 0; i < ports.Length; i++) { portNames[i] = ports[i].Port; } return portNames; }