Exemple #1
0
 public static string tryFindDevicePort()
 {
     Console.WriteLine("No port specified. Attempting to find device 04D8:FFEE (IceWerx)...");
     if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
     {
         return(Win32SerialInfo.tryFind());
     }
     else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
     {
         return(OsxSerialInfo.tryFind());
     }
     else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
     {
         return(LinuxSerialInfo.tryFind());
     }
     else
     {
         Console.WriteLine("Platform not supported.");
     }
     return(null);
 }
Exemple #2
0
 public static void enumerate()
 {
     Console.WriteLine("Legend: [?] Unknown Device, [x] Not IceWerx, [v] IceWerx");
     if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
     {
         Win32SerialInfo.enumerate();
     }
     else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
     {
         OsxSerialInfo.enumerate();
     }
     else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
     {
         LinuxSerialInfo.enumerate();
     }
     else
     {
         Console.WriteLine("Platform not supported.");
         foreach (var s in SerialPort.GetPortNames())
         {
             Console.WriteLine(s);
         }
     }
 }