// Token: 0x06000237 RID: 567 RVA: 0x00016C24 File Offset: 0x00014E24 private static TreeViewUsbItem GetLastChild(TreeViewUsbItem item, string[] deviceSn, ref List <UsbNodeConnectionInformation> outItems) { if (item.Children != null && item.Children.Count > 0) { List <TreeViewUsbItem> children = item.Children; using (List <TreeViewUsbItem> .Enumerator enumerator = children.GetEnumerator()) { while (enumerator.MoveNext()) { TreeViewUsbItem item2 = enumerator.Current; UsbDevice.GetLastChild(item2, deviceSn, ref outItems); } return(item); } } try { UsbNodeConnectionInformation item3 = (UsbNodeConnectionInformation)item.Data; if (item.Data != null && deviceSn.ToList <string>().Contains(item3.DeviceDescriptor.SerialNumber)) { outItems.Add(item3); } } catch (Exception ex) { MessageBox.Show(ex.Message); Log.w(ex.Message + " " + ex.StackTrace); } return(item); }
// Token: 0x06000235 RID: 565 RVA: 0x00016980 File Offset: 0x00014B80 private static void GetAndroidDevices(TreeViewUsbItem item, ref List <UsbNodeConnectionInformation> outItems) { try { if (item.Children != null && item.Children.Count > 0) { List <TreeViewUsbItem> children = item.Children; using (List <TreeViewUsbItem> .Enumerator enumerator = children.GetEnumerator()) { while (enumerator.MoveNext()) { TreeViewUsbItem item2 = enumerator.Current; UsbDevice.GetAndroidDevices(item2, ref outItems); } goto IL_1DF; } } UsbNodeConnectionInformation item3 = (UsbNodeConnectionInformation)item.Data; if (item3.DeviceDescriptor.Manufacturer != null && (item3.DeviceDescriptor.Product.ToLower() == "android" || item3.DeviceDescriptor.Product.ToLower() == "fastboot" || item3.DeviceDescriptor.Product.ToLower() == "intel android ad" || item3.DeviceDescriptor.Manufacturer.ToLower().IndexOf("xiaomi inc") >= 0 || Convert.ToInt32(item3.DeviceDescriptor.idVendor).ToString("x4") == "8087" || Convert.ToInt32(item3.DeviceDescriptor.idVendor).ToString("x4") == "0955" || Convert.ToInt32(item3.DeviceDescriptor.idVendor).ToString("x4").ToLower() == "05c6" || Convert.ToInt32(item3.DeviceDescriptor.idVendor).ToString("x4").ToLower() == "18d1" || Convert.ToInt32(item3.DeviceDescriptor.idVendor).ToString("x4") == "2717")) { outItems.Add(item3); } IL_1DF :; } catch (Exception ex) { Log.w(ex.Message + " " + ex.StackTrace); } }
// Token: 0x060000CC RID: 204 RVA: 0x0000B8C0 File Offset: 0x00009AC0 private static List <TreeViewUsbItem> AddHubNode(string HubPath, string HubNodeName) { UsbNodeInformation[] usbNodeInformation = USB.GetUsbNodeInformation(HubPath); if (usbNodeInformation != null) { TreeViewUsbItem treeViewUsbItem = new TreeViewUsbItem(); if (string.IsNullOrEmpty(usbNodeInformation[0].Name)) { treeViewUsbItem.Name = HubNodeName; } else { treeViewUsbItem.Name = usbNodeInformation[0].Name; } treeViewUsbItem.Data = usbNodeInformation[0]; if (usbNodeInformation[0].NodeType == USB_HUB_NODE.UsbHub) { treeViewUsbItem.Children = TreeViewUsbItem.AddPortNode(HubPath, usbNodeInformation[0].NumberOfPorts); } else { treeViewUsbItem.Children = null; } return(new List <TreeViewUsbItem>(1) { treeViewUsbItem }); } return(null); }
// Token: 0x060000CD RID: 205 RVA: 0x0000B968 File Offset: 0x00009B68 private static List <TreeViewUsbItem> AddPortNode(string HubPath, int NumberOfPorts) { UsbNodeConnectionInformation[] usbNodeConnectionInformation = USB.GetUsbNodeConnectionInformation(HubPath, NumberOfPorts); if (usbNodeConnectionInformation != null) { List <TreeViewUsbItem> list = new List <TreeViewUsbItem>(NumberOfPorts); foreach (UsbNodeConnectionInformation usbNodeConnectionInformation2 in usbNodeConnectionInformation) { TreeViewUsbItem treeViewUsbItem = new TreeViewUsbItem(); treeViewUsbItem.Name = string.Concat(new object[] { "[Port", usbNodeConnectionInformation2.ConnectionIndex, "]", usbNodeConnectionInformation2.ConnectionStatus }); treeViewUsbItem.Data = usbNodeConnectionInformation2; treeViewUsbItem.Children = null; if (usbNodeConnectionInformation2.ConnectionStatus == USB_CONNECTION_STATUS.DeviceConnected) { TreeViewUsbItem.ConnectedDevices++; if (!string.IsNullOrEmpty(usbNodeConnectionInformation2.DeviceDescriptor.Product)) { treeViewUsbItem.Name = treeViewUsbItem.Name + ": " + usbNodeConnectionInformation2.DeviceDescriptor.Product; } if (usbNodeConnectionInformation2.DeviceIsHub) { string externalHubPath = USB.GetExternalHubPath(usbNodeConnectionInformation2.DevicePath, usbNodeConnectionInformation2.ConnectionIndex); UsbNodeInformation[] usbNodeInformation = USB.GetUsbNodeInformation(externalHubPath); if (usbNodeInformation != null) { treeViewUsbItem.Data = new ExternalHubInfo { NodeInfo = usbNodeInformation[0], NodeConnectionInfo = usbNodeConnectionInformation2 }; if (usbNodeInformation[0].NodeType == USB_HUB_NODE.UsbHub) { treeViewUsbItem.Children = TreeViewUsbItem.AddPortNode(externalHubPath, usbNodeInformation[0].NumberOfPorts); foreach (TreeViewUsbItem treeViewUsbItem2 in treeViewUsbItem.Children) { try { if (treeViewUsbItem2 != null && treeViewUsbItem2.Data != null) { UsbNodeConnectionInformation usbNodeConnectionInformation3 = (UsbNodeConnectionInformation)treeViewUsbItem2.Data; int connectionIndex = usbNodeConnectionInformation2.ConnectionIndex; usbNodeConnectionInformation3.ConnectionIndex = Convert.ToInt32(connectionIndex.ToString() + usbNodeConnectionInformation3.ConnectionIndex.ToString()); treeViewUsbItem2.Data = usbNodeConnectionInformation3; treeViewUsbItem2.Name = string.Concat(new object[] { "[Port", usbNodeConnectionInformation3.ConnectionIndex, "]", usbNodeConnectionInformation2.ConnectionStatus }); } } catch (Exception ex) { Log.w(ex.Message + ":" + ex.StackTrace); } } } if (string.IsNullOrEmpty(usbNodeConnectionInformation2.DeviceDescriptor.Product) && !string.IsNullOrEmpty(usbNodeInformation[0].Name)) { treeViewUsbItem.Name = treeViewUsbItem.Name + ": " + usbNodeInformation[0].Name; } } TreeViewUsbItem.ConnectedHubs++; } } list.Add(treeViewUsbItem); } return(list); } return(null); }