mirror of https://github.com/2dust/v2rayN
Adding OSPlatform Processing
parent
ae3ab15245
commit
54c16cad7d
|
@ -495,29 +495,6 @@ namespace ServiceLib.Common
|
||||||
|
|
||||||
#region 测速
|
#region 测速
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// 取得本机 IP Address
|
|
||||||
/// </summary>
|
|
||||||
/// <returns></returns>
|
|
||||||
//public static List<string> GetHostIPAddress()
|
|
||||||
//{
|
|
||||||
// List<string> lstIPAddress = new List<string>();
|
|
||||||
// try
|
|
||||||
// {
|
|
||||||
// IPHostEntry IpEntry = Dns.GetHostEntry(Dns.GetHostName());
|
|
||||||
// foreach (IPAddress ipa in IpEntry.AddressList)
|
|
||||||
// {
|
|
||||||
// if (ipa.AddressFamily == AddressFamily.InterNetwork)
|
|
||||||
// lstIPAddress.Add(ipa.ToString());
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// catch (Exception ex)
|
|
||||||
// {
|
|
||||||
// SaveLog(ex.Message, ex);
|
|
||||||
// }
|
|
||||||
// return lstIPAddress;
|
|
||||||
//}
|
|
||||||
|
|
||||||
public static void SetSecurityProtocol(bool enableSecurityProtocolTls13)
|
public static void SetSecurityProtocol(bool enableSecurityProtocolTls13)
|
||||||
{
|
{
|
||||||
if (enableSecurityProtocolTls13)
|
if (enableSecurityProtocolTls13)
|
||||||
|
@ -708,7 +685,7 @@ namespace ServiceLib.Common
|
||||||
|
|
||||||
public static string GetExeName(string name)
|
public static string GetExeName(string name)
|
||||||
{
|
{
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
if (IsWindows())
|
||||||
{
|
{
|
||||||
return $"{name}.exe";
|
return $"{name}.exe";
|
||||||
}
|
}
|
||||||
|
@ -718,6 +695,12 @@ namespace ServiceLib.Common
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static bool IsWindows() => RuntimeInformation.IsOSPlatform(OSPlatform.Windows);
|
||||||
|
|
||||||
|
public static bool IsLinux() => RuntimeInformation.IsOSPlatform(OSPlatform.Linux);
|
||||||
|
|
||||||
|
public static bool IsOSX() => RuntimeInformation.IsOSPlatform(OSPlatform.OSX);
|
||||||
|
|
||||||
#endregion 杂项
|
#endregion 杂项
|
||||||
|
|
||||||
#region TempPath
|
#region TempPath
|
||||||
|
|
|
@ -54,7 +54,7 @@ namespace ServiceLib.Handler
|
||||||
|
|
||||||
public void AddProcess(IntPtr processHandle)
|
public void AddProcess(IntPtr processHandle)
|
||||||
{
|
{
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
if (Utils.IsWindows())
|
||||||
{
|
{
|
||||||
_processJob ??= new();
|
_processJob ??= new();
|
||||||
_processJob?.AddProcess(processHandle);
|
_processJob?.AddProcess(processHandle);
|
||||||
|
|
|
@ -444,7 +444,7 @@ namespace ServiceLib.Handler
|
||||||
|
|
||||||
private string? GetUrlFromCore(CoreInfo? coreInfo)
|
private string? GetUrlFromCore(CoreInfo? coreInfo)
|
||||||
{
|
{
|
||||||
if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
|
if (Utils.IsWindows())
|
||||||
{
|
{
|
||||||
return RuntimeInformation.ProcessArchitecture switch
|
return RuntimeInformation.ProcessArchitecture switch
|
||||||
{
|
{
|
||||||
|
@ -454,7 +454,7 @@ namespace ServiceLib.Handler
|
||||||
_ => null,
|
_ => null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
else if (Utils.IsLinux())
|
||||||
{
|
{
|
||||||
return RuntimeInformation.ProcessArchitecture switch
|
return RuntimeInformation.ProcessArchitecture switch
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue