更改try catch逻辑
This commit is contained in:
parent
3a3f866bf4
commit
c07715536c
12
Program.cs
12
Program.cs
@ -3,8 +3,6 @@ using CopyUSB.MyDB;
|
||||
using System.Diagnostics;
|
||||
using System.Management;
|
||||
|
||||
try
|
||||
{
|
||||
static string GetVolumeLabel(string driveName)
|
||||
{
|
||||
try
|
||||
@ -27,6 +25,8 @@ try
|
||||
|
||||
|
||||
managementEventWatcher.EventArrived += (s, e) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
/*Console.WriteLine("触发器被触发了");*/
|
||||
string driveName = e.NewEvent.Properties["DriveName"].Value.ToString();
|
||||
@ -110,6 +110,10 @@ try
|
||||
|
||||
/*Console.WriteLine($"元素个数{sortedList.Count()}");*/
|
||||
Debug.WriteLine("\n--------------Scaned and waiting--------------\n");
|
||||
}catch(Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.ToString());
|
||||
}
|
||||
};
|
||||
|
||||
managementEventWatcher.Start();
|
||||
@ -120,7 +124,3 @@ try
|
||||
Thread.Sleep(1000);
|
||||
/*Console.WriteLine("一次休眠周期");*/
|
||||
}
|
||||
}catch(Exception ex)
|
||||
{
|
||||
Debug.WriteLine(ex.ToString());
|
||||
}
|
Loading…
Reference in New Issue
Block a user