Exemple #1
0
        private ListEntry itemise(ManagementBaseObject p)
        {
            var result = new ListEntry
            {
                Port    = p["DeviceID"].ToString(),
                Caption = p.Properties["Caption"].ToString()
            };

            Regex r = new Regex("USB\\\\VID_([0-9A-F]+)&PID_([0-9A-F]+)");
            Match m = r.Match(p["PNPDeviceId"].ToString());

            if (m.Success)
            {
                var vid = Convert.ToUInt32(m.Groups[1].ToString(), 16);
                var pid = Convert.ToUInt32(m.Groups[2].ToString(), 16);
                result.VID = vid;
                result.PID = pid;
                if (vid == 0x0483)
                {
                    result.Caption = $"{desc(pid, p)} ({p["DeviceID"].ToString()})";
                }
            }
            return(result);
        }
Exemple #2
0
        public override bool Equals(object obj)
        {
            ListEntry other = obj as ListEntry;

            return(other.VID == this.VID && other.PID == this.PID);
        }