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.
Add basic null checks when disposing the Windows specific objects.
In the Test application, the event registration is wrapped in a method that disposes the UsbEventWatcher.
The PR has been tested on Windows 10 and Ubuntu 20.04. It would be a good idea to test it in on other platforms as well (Mac, other Linux)
Simple fix for #14.
Add basic null checks when disposing the Windows specific objects. In the Test application, the event registration is wrapped in a method that disposes the
UsbEventWatcher
.The PR has been tested on Windows 10 and Ubuntu 20.04. It would be a good idea to test it in on other platforms as well (Mac, other Linux)