Browse Source

Bug fix

0efb0b5e3e
pull/5940/head
2dust 4 weeks ago
parent
commit
88990b4828
  1. 24
      v2rayN/ServiceLib/Handler/CoreHandler.cs
  2. 5
      v2rayN/ServiceLib/Services/UpdateService.cs
  3. 14
      v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs

24
v2rayN/ServiceLib/Handler/CoreHandler.cs

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

5
v2rayN/ServiceLib/Services/UpdateService.cs

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

14
v2rayN/ServiceLib/ViewModels/CheckUpdateViewModel.cs

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

Loading…
Cancel
Save