mirror of https://github.com/2dust/v2rayN
Adding OSPlatform Processing
parent
b57cdd31bd
commit
6f3e4b3682
|
@ -5,6 +5,7 @@ using System.Net;
|
||||||
using System.Net.NetworkInformation;
|
using System.Net.NetworkInformation;
|
||||||
using System.Net.Sockets;
|
using System.Net.Sockets;
|
||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
using System.Security.Cryptography;
|
using System.Security.Cryptography;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
|
@ -703,6 +704,18 @@ namespace ServiceLib.Common
|
||||||
return systemHosts;
|
return systemHosts;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetExeName(string name)
|
||||||
|
{
|
||||||
|
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
||||||
|
{
|
||||||
|
return $"{name}.exe";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
#endregion 杂项
|
#endregion 杂项
|
||||||
|
|
||||||
#region TempPath
|
#region TempPath
|
||||||
|
|
|
@ -116,7 +116,7 @@ namespace ServiceLib.Handler
|
||||||
foreach (Process p in existing)
|
foreach (Process p in existing)
|
||||||
{
|
{
|
||||||
string? path = p.MainModule?.FileName;
|
string? path = p.MainModule?.FileName;
|
||||||
if (path == $"{Utils.GetBinPath(vName, it.coreType.ToString())}.exe")
|
if (path == Utils.GetExeName(Utils.GetBinPath(vName, it.coreType.ToString())))
|
||||||
{
|
{
|
||||||
KillProcess(p);
|
KillProcess(p);
|
||||||
}
|
}
|
||||||
|
@ -151,7 +151,7 @@ namespace ServiceLib.Handler
|
||||||
string fileName = string.Empty;
|
string fileName = string.Empty;
|
||||||
foreach (string name in coreInfo.coreExes)
|
foreach (string name in coreInfo.coreExes)
|
||||||
{
|
{
|
||||||
string vName = $"{name}.exe";
|
string vName = Utils.GetExeName(name);
|
||||||
vName = Utils.GetBinPath(vName, coreInfo.coreType.ToString());
|
vName = Utils.GetBinPath(vName, coreInfo.coreType.ToString());
|
||||||
if (File.Exists(vName))
|
if (File.Exists(vName))
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue