Ejemplo n.º 1
0
        private void createWithoutExplictDestroyToolStripMenuItem_Click(object sender, EventArgs e)
        {
            LstK lstTemp = new LstK(KLST_FLAG.NONE);
            int  count   = 0;

            lstTemp.Count(ref count);
        }
Ejemplo n.º 2
0
        private static void Main()
        {
            int deviceIndex = 0;
            int deviceCount = 0;
            KLST_DEVINFO_HANDLE deviceInfo;
            LstK lst = new LstK(KLST_FLAG.NONE);

            lst.Count(ref deviceCount);
            while (lst.MoveNext(out deviceInfo))
            {
                // Write some information about the device.
                string displayLine = String.Format("{0} of {1}: {2}",
                                                   ++deviceIndex,
                                                   deviceCount,
                                                   deviceInfo.DeviceDesc);
                Console.WriteLine(displayLine);
                Console.WriteLine("- " + deviceInfo.DeviceID);
                Console.WriteLine();
            }

            if (deviceCount == 0)
            {
                Console.WriteLine("No devices found!\n");
            }

            lst.Free();
        }
Ejemplo n.º 3
0
 // Scan the current usb devices to check all connected.
 private void CheckConnections()
 {
     lock (UsbConnectionLock) {
         KLST_DEVINFO_HANDLE deviceInfo;
         LstK lst         = new LstK(KLST_FLAG.NONE);
         int  deviceCount = 0;
         lst.Count(ref deviceCount);
         while (lst.MoveNext(out deviceInfo))
         {
             LinkDevice d = LinkManager.Manager.FindDevice(UsbLinkDevice.GetDevIdFromHandle(deviceInfo));
             // Check if d is a suspended Acc with same SN but different V/P.
             if (d == null || ((d.State != ComponentState.Working) /*&& !UsbLinkDevice.CompareVidPid(d, deviceInfo)*/))
             {
                 if (UsbPermissionValidator.CheckAllowed(deviceInfo.Common.Vid, deviceInfo.Common.Pid))
                 {
                     UsbLinkDevice.TryOpeningDevice(deviceInfo);
                 }
             }
         }
         lst.Free();
     }
 }