Subscribe to the Inserted and Removed events to be notified when a USB drive is plugged in or unplugged, or when a USB device is connected or disconnected. Usb.Events is a .NET Standard 2.0 library and uses WMI on Windows, libudev on Linux and IOKit on macOS.
MIT License
95
stars
23
forks
source link
Use Polymorphism to simplify UsbEventWatcher type #40
The UsbEventWatcher type has a lot of checks for OS and a few checks for DEBUG flags. This code can be eliminated by using polymorphism to create specific types that implement IUsbEventWatcher, then instantiating the proper concrete type depending on the OS.
The UsbEventWatcher type has a lot of checks for OS and a few checks for DEBUG flags. This code can be eliminated by using polymorphism to create specific types that implement IUsbEventWatcher, then instantiating the proper concrete type depending on the OS.