0efb0b5e3e
pull/5940/head
2dust 2024-10-26 18:00:22 +08:00
parent 2f02c2970c
commit 88990b4828
3 changed files with 16 additions and 27 deletions

View File

@ -37,9 +37,9 @@ namespace ServiceLib.Handler
continue; continue;
} }
foreach (var vName in it.CoreExes) foreach (var name in it.CoreExes)
{ {
var exe = Utils.GetExeName(Utils.GetBinPath(vName, it.CoreType.ToString())); var exe = Utils.GetBinPath(Utils.GetExeName(name), it.CoreType.ToString());
if (File.Exists(exe)) if (File.Exists(exe))
{ {
await Utils.SetLinuxChmod(exe); await Utils.SetLinuxChmod(exe);
@ -134,17 +134,12 @@ namespace ServiceLib.Handler
{ {
continue; continue;
} }
foreach (string vName in it.CoreExes) foreach (var name in it.CoreExes)
{ {
var existing = Process.GetProcessesByName(vName); var path = Utils.GetBinPath(Utils.GetExeName(name), it.CoreType.ToString());
foreach (Process p in existing) var existing = Process.GetProcessesByName(name);
{ var pp = existing.FirstOrDefault(p => p.MainModule?.FileName != null && p.MainModule?.FileName.Contains(path) == true);
string? path = p.MainModule?.FileName; await KillProcess(pp);
if (path == Utils.GetExeName(Utils.GetBinPath(vName, it.CoreType.ToString())))
{
await KillProcess(p);
}
}
} }
} }
} }
@ -173,10 +168,9 @@ namespace ServiceLib.Handler
private string CoreFindExe(CoreInfo coreInfo) private string CoreFindExe(CoreInfo coreInfo)
{ {
string fileName = string.Empty; string fileName = string.Empty;
foreach (string name in coreInfo.CoreExes) foreach (var name in coreInfo.CoreExes)
{ {
string vName = Utils.GetExeName(name); var vName = Utils.GetBinPath(Utils.GetExeName(name), coreInfo.CoreType.ToString());
vName = Utils.GetBinPath(vName, coreInfo.CoreType.ToString());
if (File.Exists(vName)) if (File.Exists(vName))
{ {
fileName = vName; fileName = vName;

View File

@ -309,10 +309,9 @@ namespace ServiceLib.Services
{ {
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo(type); var coreInfo = CoreInfoHandler.Instance.GetCoreInfo(type);
string filePath = string.Empty; string filePath = string.Empty;
foreach (string name in coreInfo.CoreExes) foreach (var name in coreInfo.CoreExes)
{ {
string vName = Utils.GetExeName(name); var vName = Utils.GetBinPath(Utils.GetExeName(name), coreInfo.CoreType.ToString());
vName = Utils.GetBinPath(vName, coreInfo.CoreType.ToString());
if (File.Exists(vName)) if (File.Exists(vName))
{ {
filePath = vName; filePath = vName;

View File

@ -45,16 +45,12 @@ namespace ServiceLib.ViewModels
if (RuntimeInformation.ProcessArchitecture != Architecture.X86) if (RuntimeInformation.ProcessArchitecture != Architecture.X86)
{ {
if (Utils.IsWindows()) _checkUpdateItem.Add(new CheckUpdateItem()
{ {
_checkUpdateItem.Add(new CheckUpdateItem() IsSelected = false,
{ CoreType = _v2rayN,
IsSelected = false, Remarks = ResUI.menuCheckUpdate,
CoreType = _v2rayN, });
Remarks = ResUI.menuCheckUpdate,
});
}
_checkUpdateItem.Add(new CheckUpdateItem() _checkUpdateItem.Add(new CheckUpdateItem()
{ {
IsSelected = true, IsSelected = true,