mirror of
https://github.com/2dust/v2rayN.git
synced 2025-04-20 06:02:23 +00:00
Fixed the issue of update the Windows self contained version
This commit is contained in:
parent
45264005a4
commit
4a32b2c814
1 changed files with 13 additions and 11 deletions
|
@ -368,6 +368,7 @@ namespace ServiceLib.Services
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo(type);
|
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo(type);
|
||||||
|
var coreUrl = await GetUrlFromCore(coreInfo) ?? string.Empty;
|
||||||
SemanticVersion curVersion;
|
SemanticVersion curVersion;
|
||||||
string message;
|
string message;
|
||||||
string? url;
|
string? url;
|
||||||
|
@ -379,28 +380,28 @@ namespace ServiceLib.Services
|
||||||
{
|
{
|
||||||
curVersion = await GetCoreVersion(type);
|
curVersion = await GetCoreVersion(type);
|
||||||
message = string.Format(ResUI.IsLatestCore, type, curVersion.ToVersionString("v"));
|
message = string.Format(ResUI.IsLatestCore, type, curVersion.ToVersionString("v"));
|
||||||
url = string.Format(GetUrlFromCore(coreInfo), version.ToVersionString("v"));
|
url = string.Format(coreUrl, version.ToVersionString("v"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ECoreType.mihomo:
|
case ECoreType.mihomo:
|
||||||
{
|
{
|
||||||
curVersion = await GetCoreVersion(type);
|
curVersion = await GetCoreVersion(type);
|
||||||
message = string.Format(ResUI.IsLatestCore, type, curVersion);
|
message = string.Format(ResUI.IsLatestCore, type, curVersion);
|
||||||
url = string.Format(GetUrlFromCore(coreInfo), version.ToVersionString("v"));
|
url = string.Format(coreUrl, version.ToVersionString("v"));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ECoreType.sing_box:
|
case ECoreType.sing_box:
|
||||||
{
|
{
|
||||||
curVersion = await GetCoreVersion(type);
|
curVersion = await GetCoreVersion(type);
|
||||||
message = string.Format(ResUI.IsLatestCore, type, curVersion.ToVersionString("v"));
|
message = string.Format(ResUI.IsLatestCore, type, curVersion.ToVersionString("v"));
|
||||||
url = string.Format(GetUrlFromCore(coreInfo), version.ToVersionString("v"), version);
|
url = string.Format(coreUrl, version.ToVersionString("v"), version);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ECoreType.v2rayN:
|
case ECoreType.v2rayN:
|
||||||
{
|
{
|
||||||
curVersion = new SemanticVersion(Utils.GetVersionInfo());
|
curVersion = new SemanticVersion(Utils.GetVersionInfo());
|
||||||
message = string.Format(ResUI.IsLatestN, type, curVersion);
|
message = string.Format(ResUI.IsLatestN, type, curVersion);
|
||||||
url = string.Format(GetUrlFromCore(coreInfo), version);
|
url = string.Format(coreUrl, version);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
@ -422,18 +423,19 @@ namespace ServiceLib.Services
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private string? GetUrlFromCore(CoreInfo? coreInfo)
|
private async Task<string?> GetUrlFromCore(CoreInfo? coreInfo)
|
||||||
{
|
{
|
||||||
if (Utils.IsWindows())
|
if (Utils.IsWindows())
|
||||||
{
|
{
|
||||||
//Check for standalone windows .Net version
|
//Check for standalone windows .Net version
|
||||||
if (coreInfo?.CoreType == ECoreType.v2rayN
|
if (coreInfo?.CoreType == ECoreType.v2rayN && RuntimeInformation.ProcessArchitecture == Architecture.X64)
|
||||||
&& File.Exists(Path.Combine(Utils.StartupPath(), "wpfgfx_cor3.dll"))
|
{
|
||||||
&& File.Exists(Path.Combine(Utils.StartupPath(), "D3DCompiler_47_cor3.dll"))
|
var runtimes = await Utils.GetCliWrapOutput("dotnet", "--list-runtimes");
|
||||||
)
|
if (runtimes == null || runtimes.Contains("Microsoft.WindowsDesktop.App 8") == false)
|
||||||
{
|
{
|
||||||
return coreInfo?.DownloadUrlWin64?.Replace(".zip", "-SelfContained.zip");
|
return coreInfo?.DownloadUrlWin64?.Replace(".zip", "-SelfContained.zip");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return RuntimeInformation.ProcessArchitecture switch
|
return RuntimeInformation.ProcessArchitecture switch
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in a new issue