Esempio n. 1
0
 public override string ToString()
 {
     return("VID = " + Vid.ToString("X4") +
            " PID = " + Pid.ToString("X4") +
            " Product: " + Product +
            " Path " + Path);
 }
Esempio n. 2
0
            /// <summary>
            /// Short string general information about this device.
            /// </summary>
            public override string ToString()
            {
                string __desc = Description.Truncate(25);

                if (Description == "")
                {
                    __desc = Type.Truncate(25);
                }
                return($"V/PID: {Vid.ToString("X4")}-{Pid.ToString("X4")} [{__desc}] SN: {Serial}"
                       .Truncate(Const.DEV_STR_MAX_LEN));
            }
 ///<summary>
 ///Returns a <see cref="T:System.String"/> that represents the current <see cref="UsbSymbolicName"/>.
 ///</summary>
 ///
 ///<returns>
 ///A <see cref="System.String"/> that represents the current <see cref="UsbSymbolicName"/>.
 ///</returns>
 public override string ToString()
 {
     object[] o = new object[] { FullName, Vid.ToString("X4"), Pid.ToString("X4"), SerialNumber, ClassGuid };
     return(string.Format("FullName:{0}\r\nVid:0x{1}\r\nPid:0x{2}\r\nSerialNumber:{3}\r\nClassGuid:{4}\r\n", o));
 }
Esempio n. 4
0
 /// <summary>
 /// Short string general information about this device.
 /// </summary>
 public override string ToString()
 {
     return($"V/PID: {Vid.ToString("X4")}-{Pid.ToString("X4")} [{Manufacturer.Truncate(25)}] SN: {Serial}"
            .Truncate(Const.DEV_STR_MAX_LEN));
 }
Esempio n. 5
0
 /// <summary>
 /// Short string general information about this device.
 /// </summary>
 public override string ToString()
 {
     return($"V/PID: {Vid.ToString("X4")}-{Pid.ToString("X4")}".Truncate(Const.DEV_STR_MAX_LEN));
 }
        private void Search(Object o)
        {
            ManagementScope            connectionScope = new ManagementScope();
            SelectQuery                mosQuery        = new SelectQuery($@"SELECT * FROM Win32_PnPEntity where DeviceID like '%VID_{Vid.ToString("X4")}&PID_{Pid.ToString("X4")}%'");
            ManagementObjectSearcher   searcher        = new ManagementObjectSearcher(connectionScope, mosQuery);
            ManagementObjectCollection results         = searcher.Get();

            ManagementObjectCollection.ManagementObjectEnumerator enumerator = results.GetEnumerator();

            DeviceCount = results.Count;
            if (DeviceCount > 0)
            {
                enumerator.MoveNext();
                InitDevice((ManagementObject)enumerator.Current);
            }

            if (DeviceCount == 0 && !String.IsNullOrWhiteSpace(DeviceId))
            {
                Disconnect();
            }
        }