From ade789c6d49a1dc5af0f3956acf958714b0243d9 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Sat, 26 Oct 2024 17:55:08 +0800 Subject: [PATCH] Update UpgradeApp.cs --- v2rayN/AmazTool/UpgradeApp.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/v2rayN/AmazTool/UpgradeApp.cs b/v2rayN/AmazTool/UpgradeApp.cs index a6acf64b..31de6a6d 100644 --- a/v2rayN/AmazTool/UpgradeApp.cs +++ b/v2rayN/AmazTool/UpgradeApp.cs @@ -11,7 +11,7 @@ namespace AmazTool Console.WriteLine(fileName); Console.WriteLine("In progress, please wait...(正在进行中,请等待)"); - Thread.Sleep(5000); + Thread.Sleep(9000); if (!File.Exists(fileName)) { @@ -25,7 +25,7 @@ namespace AmazTool var path = GetPath(V2rayN); Console.WriteLine(path); 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?.WaitForExit(1000); } @@ -54,6 +54,8 @@ namespace AmazTool continue; } + Console.WriteLine(entry.FullName); + var lst = entry.FullName.Split(splitKey); if (lst.Length == 1) continue; string fullName = string.Join(splitKey, lst[1..lst.Length]); @@ -78,12 +80,12 @@ namespace AmazTool catch (Exception ex) { Console.WriteLine("Upgrade Failed(升级失败)." + ex.StackTrace); - return; + //return; } if (sb.Length > 0) { Console.WriteLine("Upgrade Failed(升级失败)." + sb.ToString()); - return; + //return; } Console.WriteLine("Start v2rayN, please wait...(正在重启,请等待)"); @@ -92,6 +94,7 @@ namespace AmazTool { StartInfo = new() { + UseShellExecute = true, FileName = V2rayN, WorkingDirectory = StartupPath() }