Update UpgradeApp.cs

pull/5940/head
2dust 2024-10-26 17:55:08 +08:00
parent 9738f90970
commit ade789c6d4
1 changed files with 7 additions and 4 deletions

View File

@ -11,7 +11,7 @@ namespace AmazTool
Console.WriteLine(fileName); Console.WriteLine(fileName);
Console.WriteLine("In progress, please wait...(正在进行中,请等待)"); Console.WriteLine("In progress, please wait...(正在进行中,请等待)");
Thread.Sleep(5000); Thread.Sleep(9000);
if (!File.Exists(fileName)) if (!File.Exists(fileName))
{ {
@ -25,7 +25,7 @@ namespace AmazTool
var path = GetPath(V2rayN); var path = GetPath(V2rayN);
Console.WriteLine(path); Console.WriteLine(path);
var existing = Process.GetProcessesByName(V2rayN); var existing = Process.GetProcessesByName(V2rayN);
var pp = existing.FirstOrDefault(p => p.MainModule?.FileName != null && p.MainModule?.FileName == path); var pp = existing.FirstOrDefault(p => p.MainModule?.FileName != null && p.MainModule?.FileName.Contains(path) == true);
pp?.Kill(); pp?.Kill();
pp?.WaitForExit(1000); pp?.WaitForExit(1000);
} }
@ -54,6 +54,8 @@ namespace AmazTool
continue; continue;
} }
Console.WriteLine(entry.FullName);
var lst = entry.FullName.Split(splitKey); var lst = entry.FullName.Split(splitKey);
if (lst.Length == 1) continue; if (lst.Length == 1) continue;
string fullName = string.Join(splitKey, lst[1..lst.Length]); string fullName = string.Join(splitKey, lst[1..lst.Length]);
@ -78,12 +80,12 @@ namespace AmazTool
catch (Exception ex) catch (Exception ex)
{ {
Console.WriteLine("Upgrade Failed(升级失败)." + ex.StackTrace); Console.WriteLine("Upgrade Failed(升级失败)." + ex.StackTrace);
return; //return;
} }
if (sb.Length > 0) if (sb.Length > 0)
{ {
Console.WriteLine("Upgrade Failed(升级失败)." + sb.ToString()); Console.WriteLine("Upgrade Failed(升级失败)." + sb.ToString());
return; //return;
} }
Console.WriteLine("Start v2rayN, please wait...(正在重启,请等待)"); Console.WriteLine("Start v2rayN, please wait...(正在重启,请等待)");
@ -92,6 +94,7 @@ namespace AmazTool
{ {
StartInfo = new() StartInfo = new()
{ {
UseShellExecute = true,
FileName = V2rayN, FileName = V2rayN,
WorkingDirectory = StartupPath() WorkingDirectory = StartupPath()
} }