示例#1
0
        static void Test1()
        {
            while (true)
            {
                var searchDevice  = "VID_2022&PID_0139&MI_00";
                var awUsbReconfig = new AnywhereUsbReconfig("192.168.11.122");
                awUsbReconfig.LoadConfig();

                for (int i = 1; i < AnywhereUsbReconfig.GROUP_COUNT; ++i)
                {
                    Console.WriteLine("Port {0} has group {1}", i, awUsbReconfig.GetParam(i));
                }

                var usbDeviceLookup = new UsbDeviceLookup();
                usbDeviceLookup.Test();

                usbDeviceLookup.WaitForConnection(searchDevice);

                Console.WriteLine("Enter port:");
                var portString = Console.ReadLine();
                Console.WriteLine("Enter group:");
                var groupString = Console.ReadLine();

                if (!String.IsNullOrEmpty(portString) && !String.IsNullOrEmpty(groupString))
                {
                    var portInt  = Convert.ToInt32(portString);
                    var groupInt = Convert.ToInt32(groupString);

                    awUsbReconfig.SetParam(portInt, groupInt);

                    awUsbReconfig.SaveConfig();
                }
            }
        }
示例#2
0
        public bool Execute(IExecutionControl executionControl)
        {
            Console.WriteLine("Disconnecting device {0}", device);
            var usbDeviceLookup = new UsbDeviceLookup();

            usbDeviceLookup.Test();
            if (!usbDeviceLookup.WaitForDisconnection(device))
            {
                return(false);
            }

            return(true);
        }