C#中的USB检测|控制台应用程序|

时间:2018-08-28 03:37:21

标签: c# usb

我目前在如何检测USB是否已连接到我的计算机上遇到了麻烦,然后它将提醒我控制台。到目前为止,如果您能帮助我,它仅在表单上不能在Console上运行,那太好了!

try
{
      //This Section Encrypts Your Computer
      Console.WriteLine("Please wait while we decrypt your data...");
      Thread.Sleep(3000); // 3 seconds
      var user = WindowsIdentity.GetCurrent().User;
      string plainText = (user.ToString());
      string password = "Eubjmn8x!";
      DesEncrypt testEncrypt = new DesEncrypt();
      string encText = testEncrypt.EncryptString(plainText, password);
      // Encryption ends here
}
catch (Exception ex)
{
      Console.WriteLine("Error: ", ex.ToString());
}

0 个答案:

没有答案