// 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);
 }