Example #1
0
 public static void StartUSBMonitor()
 {
     while (true)
     {
         if (!USBMonitor.LookForUSB() && Convert.ToBoolean(RegistryControls.GetRegistryValue("IgnoreUSB")))
         {
             LockWorkStation();
         }
         Thread.Sleep(3000);
     }
 }
Example #2
0
        public static bool LookForUSB()
        {
            string usbSerialNumber = RegistryControls.GetRegistryValue("SerialNumber") as string;
            Dictionary <string, string> usbList = USBControls.DeviceList();

            if (usbList.Select(x => x.Value).Any(x => x.Contains(usbSerialNumber)))
            {
                return(true);
            }
            return(false);
        }