public static List <Device> GetDevice() { List <Device> deviceList = new List <Device>(); foreach (string str in ComPortCtrl.getDevicesQc()) { deviceList.Add(new Device() { Name = str, DeviceCtrl = new SerialPortDevice() }); } foreach (string str in GetScriptDevice()) { deviceList.Add(new Device() { Name = str, DeviceCtrl = new ScriptDevice() }); } return(deviceList); }
// Token: 0x0600022F RID: 559 RVA: 0x00016448 File Offset: 0x00014648 public static List <Device> GetDevice() { List <Device> list = new List <Device>(); string a = MiAppConfig.Get("chip"); if (a == "MTK") { using (List <string> .Enumerator enumerator = UsbDevice.MtkDevice.GetEnumerator()) { while (enumerator.MoveNext()) { string text = enumerator.Current; int index = int.Parse(text.ToLower().Replace("com", "")); list.Add(new Device { Index = index, Name = text, DeviceCtrl = new MTKDevice() }); } return(list); } } string[] devicesQc = ComPortCtrl.getDevicesQc(); foreach (string text2 in devicesQc) { int num = int.Parse(text2.ToLower().Replace("com", "")); list.Add(new Device { Index = num, Name = text2, DeviceCtrl = new SerialPortDevice() }); } List <TreeViewUsbItem> allUsbDevices = TreeViewUsbItem.AllUsbDevices; Log.w("GetScriptDevices"); List <UsbNodeConnectionInformation> scriptDevices = UsbDevice.GetScriptDevices(allUsbDevices); List <string> list2 = UsbDevice.GetScriptDevice().ToList <string>(); foreach (string text3 in list2) { int num = UsbDevice.GetDeviceIndex(text3); int num2 = 5; while (num <= 0 && num2-- >= 0) { if (num2 < 4) { Thread.Sleep(200); } num = UsbDevice.GetDeviceIndex(text3); } list.Add(new Device { Index = num, Name = text3, DeviceCtrl = new ScriptDevice() }); } foreach (UsbNodeConnectionInformation usbNodeConnectionInformation in scriptDevices) { if (!string.IsNullOrEmpty(usbNodeConnectionInformation.DeviceDescriptor.SerialNumber) && list2.IndexOf(usbNodeConnectionInformation.DeviceDescriptor.SerialNumber) < 0) { int num = UsbDevice.GetDeviceIndex(usbNodeConnectionInformation.DeviceDescriptor.SerialNumber); int num3 = 10; while (num <= 0 && num3-- >= 0) { if (num3 < 9) { Thread.Sleep(200); } num = UsbDevice.GetDeviceIndex(usbNodeConnectionInformation.DeviceDescriptor.SerialNumber); } list.Add(new Device { Index = num, Name = usbNodeConnectionInformation.DeviceDescriptor.SerialNumber, DeviceCtrl = new ScriptDevice() }); } } return(list); }