Esempio n. 1
0
        public void Remove(IntPtr hDev, USBEventArgs e)
        {
            if (_alreadyDisposed)
            {
                throw new ObjectDisposedException("");
            }

            // Can't use foreach here, as we're modifying Items within the loop
            for (byte i = 0; i < Count; i++)
            {
                USBDevice tmp = (USBDevice)Items[i];
                if (hDev.Equals(tmp._hDevice))
                {
                    e.Device       = null;
                    e.FriendlyName = tmp.FriendlyName;
                    e.Manufacturer = tmp.Manufacturer;
                    e.Product      = tmp.Product;
                    e.VendorID     = tmp.VendorID;
                    e.ProductID    = tmp.ProductID;
                    e.SerialNum    = tmp.SerialNumber;

                    Items.Remove(tmp);
                    tmp.Dispose();
                }
            }
        }
Esempio n. 2
0
        public void Remove(IntPtr hDev)
        {
            if (_alreadyDisposed)
            {
                throw new ObjectDisposedException("");
            }

            // Can't use foreach here, as we're modifying Items within the loop
            for (byte i = 0; i < Count; i++)
            {
                USBDevice tmp = (USBDevice)Items[i];
                if (hDev.Equals(tmp._hDevice))
                {
                    Items.Remove(tmp);
                    tmp.Dispose();
                }
            }
        }