AxisSocket.AxisSocket.getControllers C# (CSharp) Method

getControllers() public static method

public static getControllers ( ) : LibUsbDotNet.UsbDevice[]
return LibUsbDotNet.UsbDevice[]
        public static UsbDevice[] getControllers()
        {
            List<UsbDevice> controllersL = new List<UsbDevice>();
            //UsbDevice[] controllers = new UsbDevice[4];
            UsbDevice[] devices = new UsbDevice[20];

            UsbRegDeviceList allDevices = UsbDevice.AllDevices;
            Console.WriteLine("numDevices: " + allDevices.Count);
            int i = 0;
            foreach (UsbRegistry usbRegistry in allDevices)
            {
                //Console.WriteLine("device"+i);
                if (usbRegistry.Open(out devices[i]))
                {
                    Console.WriteLine(devices[i].Info.ToString());
                    if (devices[i].Info.ToString().Contains("PLAYSTATION"))
                    {
                        /*int index = 0;
                        for (int j = 0; j < 4; j++)
                        {
                            if (controllers[j] == null)
                            {
                                index = j;
                                break;
                            }
                        }
                        controllers[index] = devices[i];*/
                        controllersL.Add(devices[i]);
                    }
                }
                i++;
            }

            return controllersL.ToArray();
        }