using System; using System.Collections.Generic; using System.Linq; using System.Text; using ElmoMotionControlComponents.Drive.EASComponents.Locator; using ElmoMotionControlComponents.Drive.EASComponents; using DeviceUdpLocator; namespace DriveDotNetLocateDevices { class Program { static void Main(string[] args) { while (true) { Console.WriteLine("1. Locate UDP, 2. Locate USB, 3. Locate RS232"); int result = int.Parse(Console.ReadLine()); switch (result) { case 1: { IList> devices = DriveLocator.GetUDPDevices(); if (devices.Count > 0) { foreach (var d in devices) { var ipinfo = d.Value; Console.WriteLine(ipinfo.IPCommInfo.Address + " , " + ipinfo.IPCommInfo.HostAddress); } } else Console.WriteLine("No devices found"); break; } case 2: { IList devices = DriveLocator.GetUSBDevices(); if(devices.Count>0) { foreach (var d in devices) Console.WriteLine(d.SerialCommInfo.ComPort); } else Console.WriteLine("No devices found"); break; } case 3: { IList devices = DriveLocator.GetRS232Devices(); if(devices.Count>0) { foreach (var d in devices) Console.WriteLine(d.SerialCommInfo.ComPort + " , " + d.SerialCommInfo.Baudrate); } else Console.WriteLine("No devices found"); break; } } } } } }