Пример #1
0
        // Expects a CIM_USBDevice object
        // http://msdn.microsoft.com/en-us/library/aa388649%28v=vs.85%29.aspx
        internal UsbDevice(ManagementObject o)
        {
            Uuid      = o.Str("DeviceID");
            UsbDevice = this;

            // Parse the vendor and product IDs out; best way I could find; patches welcome
            VendorId  = Int32.Parse(Uuid.Substring(Uuid.IndexOf("VID_") + 4, 4), NumberStyles.HexNumber);
            ProductId = Int32.Parse(Uuid.Substring(Uuid.IndexOf("PID_") + 4, 4), NumberStyles.HexNumber);
        }