mirror of
https://github.com/2dust/v2rayN.git
synced 2025-04-20 06:02:23 +00:00
Improved CoreInfo
This commit is contained in:
parent
7a839063d0
commit
f60575b77c
11 changed files with 186 additions and 201 deletions
|
@ -108,17 +108,17 @@ namespace ServiceLib.Handler
|
||||||
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo();
|
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo();
|
||||||
foreach (var it in coreInfo)
|
foreach (var it in coreInfo)
|
||||||
{
|
{
|
||||||
if (it.coreType == ECoreType.v2rayN)
|
if (it.CoreType == ECoreType.v2rayN)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
foreach (string vName in it.coreExes)
|
foreach (string vName in it.CoreExes)
|
||||||
{
|
{
|
||||||
var existing = Process.GetProcessesByName(vName);
|
var existing = Process.GetProcessesByName(vName);
|
||||||
foreach (Process p in existing)
|
foreach (Process p in existing)
|
||||||
{
|
{
|
||||||
string? path = p.MainModule?.FileName;
|
string? path = p.MainModule?.FileName;
|
||||||
if (path == Utils.GetExeName(Utils.GetBinPath(vName, it.coreType.ToString())))
|
if (path == Utils.GetExeName(Utils.GetBinPath(vName, it.CoreType.ToString())))
|
||||||
{
|
{
|
||||||
KillProcess(p);
|
KillProcess(p);
|
||||||
}
|
}
|
||||||
|
@ -151,10 +151,10 @@ 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 (string name in coreInfo.CoreExes)
|
||||||
{
|
{
|
||||||
string vName = Utils.GetExeName(name);
|
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))
|
||||||
{
|
{
|
||||||
fileName = vName;
|
fileName = vName;
|
||||||
|
@ -163,7 +163,7 @@ namespace ServiceLib.Handler
|
||||||
}
|
}
|
||||||
if (Utils.IsNullOrEmpty(fileName))
|
if (Utils.IsNullOrEmpty(fileName))
|
||||||
{
|
{
|
||||||
string msg = string.Format(ResUI.NotFoundCore, Utils.GetBinPath("", coreInfo.coreType.ToString()), string.Join(", ", coreInfo.coreExes.ToArray()), coreInfo.coreUrl);
|
string msg = string.Format(ResUI.NotFoundCore, Utils.GetBinPath("", coreInfo.CoreType.ToString()), string.Join(", ", coreInfo.CoreExes.ToArray()), coreInfo.Url);
|
||||||
Logging.SaveLog(msg);
|
Logging.SaveLog(msg);
|
||||||
ShowMsg(false, msg);
|
ShowMsg(false, msg);
|
||||||
}
|
}
|
||||||
|
@ -288,7 +288,7 @@ namespace ServiceLib.Handler
|
||||||
StartInfo = new()
|
StartInfo = new()
|
||||||
{
|
{
|
||||||
FileName = fileName,
|
FileName = fileName,
|
||||||
Arguments = string.Format(coreInfo.arguments, configPath),
|
Arguments = string.Format(coreInfo.Arguments, configPath),
|
||||||
WorkingDirectory = Utils.GetConfigPath(),
|
WorkingDirectory = Utils.GetConfigPath(),
|
||||||
UseShellExecute = false,
|
UseShellExecute = false,
|
||||||
RedirectStandardOutput = displayLog,
|
RedirectStandardOutput = displayLog,
|
||||||
|
|
|
@ -19,7 +19,7 @@ namespace ServiceLib.Handler
|
||||||
{
|
{
|
||||||
InitCoreInfo();
|
InitCoreInfo();
|
||||||
}
|
}
|
||||||
return _coreInfo?.FirstOrDefault(t => t.coreType == coreType);
|
return _coreInfo?.FirstOrDefault(t => t.CoreType == coreType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<CoreInfo> GetCoreInfo()
|
public List<CoreInfo> GetCoreInfo()
|
||||||
|
@ -37,139 +37,135 @@ namespace ServiceLib.Handler
|
||||||
|
|
||||||
_coreInfo.Add(new CoreInfo
|
_coreInfo.Add(new CoreInfo
|
||||||
{
|
{
|
||||||
coreType = ECoreType.v2rayN,
|
CoreType = ECoreType.v2rayN,
|
||||||
coreUrl = Global.NUrl,
|
Url = Global.NUrl,
|
||||||
coreReleaseApiUrl = Global.NUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
ReleaseApiUrl = Global.NUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||||
coreDownloadUrl32 = Global.NUrl + "/download/{0}/v2rayN-32.zip",
|
DownloadUrlWin32 = Global.NUrl + "/download/{0}/v2rayN-windows-32.zip",
|
||||||
coreDownloadUrl64 = Global.NUrl + "/download/{0}/v2rayN.zip",
|
DownloadUrlWin64 = Global.NUrl + "/download/{0}/v2rayN-windows-64.zip",
|
||||||
coreDownloadUrlArm64 = Global.NUrl + "/download/{0}/v2rayN-arm64.zip",
|
DownloadUrlWinArm64 = Global.NUrl + "/download/{0}/v2rayN-windows-arm64.zip",
|
||||||
coreDownloadUrlLinux32 = Global.NUrl + "/download/{0}/v2rayN-linux-32.zip",
|
DownloadUrlLinux64 = Global.NUrl + "/download/{0}/v2rayN-linux-64.zip",
|
||||||
coreDownloadUrlLinux64 = Global.NUrl + "/download/{0}/v2rayN-linux-64.zip",
|
DownloadUrlLinuxArm64 = Global.NUrl + "/download/{0}/v2rayN-linux-arm64.zip",
|
||||||
coreDownloadUrlLinuxArm64 = Global.NUrl + "/download/{0}/v2rayN-linux-arm64.zip",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
_coreInfo.Add(new CoreInfo
|
_coreInfo.Add(new CoreInfo
|
||||||
{
|
{
|
||||||
coreType = ECoreType.v2fly,
|
CoreType = ECoreType.v2fly,
|
||||||
coreExes = new List<string> { "wv2ray", "v2ray" },
|
CoreExes = new List<string> { "wv2ray", "v2ray" },
|
||||||
arguments = "",
|
Arguments = "",
|
||||||
coreUrl = Global.V2flyCoreUrl,
|
Url = Global.V2flyCoreUrl,
|
||||||
coreReleaseApiUrl = Global.V2flyCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
ReleaseApiUrl = Global.V2flyCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||||
match = "V2Ray",
|
Match = "V2Ray",
|
||||||
versionArg = "-version",
|
VersionArg = "-version",
|
||||||
redirectInfo = true,
|
RedirectInfo = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
_coreInfo.Add(new CoreInfo
|
_coreInfo.Add(new CoreInfo
|
||||||
{
|
{
|
||||||
coreType = ECoreType.v2fly_v5,
|
CoreType = ECoreType.v2fly_v5,
|
||||||
coreExes = new List<string> { "v2ray" },
|
CoreExes = new List<string> { "v2ray" },
|
||||||
arguments = "run -c config.json -format jsonv5",
|
Arguments = "run -c config.json -format jsonv5",
|
||||||
coreUrl = Global.V2flyCoreUrl,
|
Url = Global.V2flyCoreUrl,
|
||||||
coreReleaseApiUrl = Global.V2flyCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
ReleaseApiUrl = Global.V2flyCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||||
match = "V2Ray",
|
Match = "V2Ray",
|
||||||
versionArg = "version",
|
VersionArg = "version",
|
||||||
redirectInfo = true,
|
RedirectInfo = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
_coreInfo.Add(new CoreInfo
|
_coreInfo.Add(new CoreInfo
|
||||||
{
|
{
|
||||||
coreType = ECoreType.Xray,
|
CoreType = ECoreType.Xray,
|
||||||
coreExes = new List<string> { "xray", "wxray" },
|
CoreExes = new List<string> { "xray", "wxray" },
|
||||||
arguments = "run {0}",
|
Arguments = "run {0}",
|
||||||
coreUrl = Global.XrayCoreUrl,
|
Url = Global.XrayCoreUrl,
|
||||||
coreReleaseApiUrl = Global.XrayCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
ReleaseApiUrl = Global.XrayCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||||
coreDownloadUrl32 = Global.XrayCoreUrl + "/download/{0}/Xray-windows-32.zip",
|
DownloadUrlWin32 = Global.XrayCoreUrl + "/download/{0}/Xray-windows-32.zip",
|
||||||
coreDownloadUrl64 = Global.XrayCoreUrl + "/download/{0}/Xray-windows-64.zip",
|
DownloadUrlWin64 = Global.XrayCoreUrl + "/download/{0}/Xray-windows-64.zip",
|
||||||
coreDownloadUrlArm64 = Global.XrayCoreUrl + "/download/{0}/Xray-windows-arm64-v8a.zip",
|
DownloadUrlWinArm64 = Global.XrayCoreUrl + "/download/{0}/Xray-windows-arm64-v8a.zip",
|
||||||
coreDownloadUrlLinux32 = Global.XrayCoreUrl + "/download/{0}/Xray-linux-32.zip",
|
DownloadUrlLinux64 = Global.XrayCoreUrl + "/download/{0}/Xray-linux-64.zip",
|
||||||
coreDownloadUrlLinux64 = Global.XrayCoreUrl + "/download/{0}/Xray-linux-64.zip",
|
DownloadUrlLinuxArm64 = Global.XrayCoreUrl + "/download/{0}/Xray-linux-arm64-v8a.zip",
|
||||||
coreDownloadUrlLinuxArm64 = Global.XrayCoreUrl + "/download/{0}/Xray-linux-arm64-v8a.zip",
|
Match = "Xray",
|
||||||
match = "Xray",
|
VersionArg = "-version",
|
||||||
versionArg = "-version",
|
RedirectInfo = true,
|
||||||
redirectInfo = true,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
_coreInfo.Add(new CoreInfo
|
_coreInfo.Add(new CoreInfo
|
||||||
{
|
{
|
||||||
coreType = ECoreType.mihomo,
|
CoreType = ECoreType.mihomo,
|
||||||
coreExes = new List<string> { $"mihomo-windows-amd64{(Avx2.X64.IsSupported ? "" : "-compatible")}", "mihomo-windows-amd64-compatible", "mihomo-windows-amd64", "mihomo-windows-386", "mihomo", "clash" },
|
CoreExes = new List<string> { $"mihomo-windows-amd64{(Avx2.X64.IsSupported ? "" : "-compatible")}", "mihomo-windows-amd64-compatible", "mihomo-windows-amd64", "mihomo-windows-386", "mihomo", "clash" },
|
||||||
arguments = "-f config.json" + PortableMode(),
|
Arguments = "-f config.json" + PortableMode(),
|
||||||
coreUrl = Global.MihomoCoreUrl,
|
Url = Global.MihomoCoreUrl,
|
||||||
coreReleaseApiUrl = Global.MihomoCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
ReleaseApiUrl = Global.MihomoCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||||
coreDownloadUrl32 = Global.MihomoCoreUrl + "/download/{0}/mihomo-windows-386-{0}.zip",
|
DownloadUrlWin32 = Global.MihomoCoreUrl + "/download/{0}/mihomo-windows-386-{0}.zip",
|
||||||
coreDownloadUrl64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-windows-amd64-compatible-{0}.zip",
|
DownloadUrlWin64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-windows-amd64-compatible-{0}.zip",
|
||||||
coreDownloadUrlArm64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-windows-arm64-{0}.zip",
|
DownloadUrlWinArm64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-windows-arm64-{0}.zip",
|
||||||
coreDownloadUrlLinux32 = Global.MihomoCoreUrl + "/download/{0}/mihomo-linux-386-{0}.gz",
|
DownloadUrlLinux64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-linux-amd64-compatible-{0}.gz",
|
||||||
coreDownloadUrlLinux64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-linux-amd64-compatible-{0}.gz",
|
DownloadUrlLinuxArm64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-linux-arm64-{0}.gz",
|
||||||
coreDownloadUrlLinuxArm64 = Global.MihomoCoreUrl + "/download/{0}/mihomo-linux-arm64-{0}.gz",
|
Match = "Mihomo",
|
||||||
match = "Mihomo",
|
VersionArg = "-v",
|
||||||
versionArg = "-v",
|
RedirectInfo = true,
|
||||||
redirectInfo = true,
|
|
||||||
});
|
});
|
||||||
|
|
||||||
_coreInfo.Add(new CoreInfo
|
_coreInfo.Add(new CoreInfo
|
||||||
{
|
{
|
||||||
coreType = ECoreType.hysteria,
|
CoreType = ECoreType.hysteria,
|
||||||
coreExes = new List<string> { "hysteria-windows-amd64", "hysteria-windows-386", "hysteria" },
|
CoreExes = new List<string> { "hysteria-windows-amd64", "hysteria-windows-386", "hysteria" },
|
||||||
arguments = "",
|
Arguments = "",
|
||||||
coreUrl = Global.HysteriaCoreUrl,
|
Url = Global.HysteriaCoreUrl,
|
||||||
coreReleaseApiUrl = Global.HysteriaCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
ReleaseApiUrl = Global.HysteriaCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||||
redirectInfo = true,
|
RedirectInfo = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
_coreInfo.Add(new CoreInfo
|
_coreInfo.Add(new CoreInfo
|
||||||
{
|
{
|
||||||
coreType = ECoreType.naiveproxy,
|
CoreType = ECoreType.naiveproxy,
|
||||||
coreExes = new List<string> { "naiveproxy", "naive" },
|
CoreExes = new List<string> { "naiveproxy", "naive" },
|
||||||
arguments = "config.json",
|
Arguments = "config.json",
|
||||||
coreUrl = Global.NaiveproxyCoreUrl,
|
Url = Global.NaiveproxyCoreUrl,
|
||||||
redirectInfo = false,
|
RedirectInfo = false,
|
||||||
});
|
});
|
||||||
|
|
||||||
_coreInfo.Add(new CoreInfo
|
_coreInfo.Add(new CoreInfo
|
||||||
{
|
{
|
||||||
coreType = ECoreType.tuic,
|
CoreType = ECoreType.tuic,
|
||||||
coreExes = new List<string> { "tuic-client", "tuic" },
|
CoreExes = new List<string> { "tuic-client", "tuic" },
|
||||||
arguments = "-c config.json",
|
Arguments = "-c config.json",
|
||||||
coreUrl = Global.TuicCoreUrl,
|
Url = Global.TuicCoreUrl,
|
||||||
redirectInfo = true,
|
RedirectInfo = true,
|
||||||
});
|
});
|
||||||
|
|
||||||
_coreInfo.Add(new CoreInfo
|
_coreInfo.Add(new CoreInfo
|
||||||
{
|
{
|
||||||
coreType = ECoreType.sing_box,
|
CoreType = ECoreType.sing_box,
|
||||||
coreExes = new List<string> { "sing-box-client", "sing-box" },
|
CoreExes = new List<string> { "sing-box-client", "sing-box" },
|
||||||
arguments = "run {0} --disable-color",
|
Arguments = "run {0} --disable-color",
|
||||||
coreUrl = Global.SingboxCoreUrl,
|
Url = Global.SingboxCoreUrl,
|
||||||
redirectInfo = true,
|
RedirectInfo = true,
|
||||||
coreReleaseApiUrl = Global.SingboxCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
ReleaseApiUrl = Global.SingboxCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||||
coreDownloadUrl32 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-windows-386.zip",
|
DownloadUrlWin32 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-windows-386.zip",
|
||||||
coreDownloadUrl64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-windows-amd64.zip",
|
DownloadUrlWin64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-windows-amd64.zip",
|
||||||
coreDownloadUrlArm64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-windows-arm64.zip",
|
DownloadUrlWinArm64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-windows-arm64.zip",
|
||||||
coreDownloadUrlLinux32 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-linux-386.tar.gz",
|
DownloadUrlLinux64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-linux-amd64.tar.gz",
|
||||||
coreDownloadUrlLinux64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-linux-amd64.tar.gz",
|
DownloadUrlLinuxArm64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-linux-arm64.tar.gz",
|
||||||
coreDownloadUrlLinuxArm64 = Global.SingboxCoreUrl + "/download/{0}/sing-box-{1}-linux-arm64.tar.gz",
|
Match = "sing-box",
|
||||||
match = "sing-box",
|
VersionArg = "version",
|
||||||
versionArg = "version",
|
|
||||||
});
|
});
|
||||||
|
|
||||||
_coreInfo.Add(new CoreInfo
|
_coreInfo.Add(new CoreInfo
|
||||||
{
|
{
|
||||||
coreType = ECoreType.juicity,
|
CoreType = ECoreType.juicity,
|
||||||
coreExes = new List<string> { "juicity-client", "juicity" },
|
CoreExes = new List<string> { "juicity-client", "juicity" },
|
||||||
arguments = "run -c config.json",
|
Arguments = "run -c config.json",
|
||||||
coreUrl = Global.JuicityCoreUrl
|
Url = Global.JuicityCoreUrl
|
||||||
});
|
});
|
||||||
|
|
||||||
_coreInfo.Add(new CoreInfo
|
_coreInfo.Add(new CoreInfo
|
||||||
{
|
{
|
||||||
coreType = ECoreType.hysteria2,
|
CoreType = ECoreType.hysteria2,
|
||||||
coreExes = new List<string> { "hysteria-windows-amd64", "hysteria-windows-386", "hysteria" },
|
CoreExes = new List<string> { "hysteria-windows-amd64", "hysteria-windows-386", "hysteria" },
|
||||||
arguments = "",
|
Arguments = "",
|
||||||
coreUrl = Global.HysteriaCoreUrl,
|
Url = Global.HysteriaCoreUrl,
|
||||||
coreReleaseApiUrl = Global.HysteriaCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
ReleaseApiUrl = Global.HysteriaCoreUrl.Replace(Global.GithubUrl, Global.GithubApiUrl),
|
||||||
redirectInfo = true,
|
RedirectInfo = true,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
{
|
{
|
||||||
public class CheckUpdateItem
|
public class CheckUpdateItem
|
||||||
{
|
{
|
||||||
public bool? isSelected { get; set; }
|
public bool? IsSelected { get; set; }
|
||||||
public string coreType { get; set; }
|
public string? CoreType { get; set; }
|
||||||
public string? remarks { get; set; }
|
public string? Remarks { get; set; }
|
||||||
public string? fileName { get; set; }
|
public string? FileName { get; set; }
|
||||||
public bool? isFinished { get; set; }
|
public bool? IsFinished { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,28 +3,18 @@
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class CoreInfo
|
public class CoreInfo
|
||||||
{
|
{
|
||||||
public ECoreType coreType { get; set; }
|
public ECoreType CoreType { get; set; }
|
||||||
|
public List<string>? CoreExes { get; set; }
|
||||||
public List<string> coreExes { get; set; }
|
public string? Arguments { get; set; }
|
||||||
|
public string? Url { get; set; }
|
||||||
public string arguments { get; set; }
|
public string? ReleaseApiUrl { get; set; }
|
||||||
|
public string? DownloadUrlWin32 { get; set; }
|
||||||
public string coreUrl { get; set; }
|
public string? DownloadUrlWin64 { get; set; }
|
||||||
|
public string? DownloadUrlWinArm64 { get; set; }
|
||||||
public string coreReleaseApiUrl { get; set; }
|
public string? DownloadUrlLinux64 { get; set; }
|
||||||
|
public string? DownloadUrlLinuxArm64 { get; set; }
|
||||||
public string coreDownloadUrl32 { get; set; }
|
public string? Match { get; set; }
|
||||||
|
public string? VersionArg { get; set; }
|
||||||
public string coreDownloadUrl64 { get; set; }
|
public bool RedirectInfo { get; set; }
|
||||||
|
|
||||||
public string coreDownloadUrlArm64 { get; set; }
|
|
||||||
public string? coreDownloadUrlLinux32 { get; set; }
|
|
||||||
public string? coreDownloadUrlLinux64 { get; set; }
|
|
||||||
public string? coreDownloadUrlLinuxArm64 { get; set; }
|
|
||||||
|
|
||||||
public string match { get; set; }
|
|
||||||
public string versionArg { get; set; }
|
|
||||||
|
|
||||||
public bool redirectInfo { get; set; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -992,13 +992,13 @@ namespace ServiceLib.Services.CoreConfig
|
||||||
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo();
|
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo();
|
||||||
foreach (var it in coreInfo)
|
foreach (var it in coreInfo)
|
||||||
{
|
{
|
||||||
if (it.coreType == ECoreType.v2rayN)
|
if (it.CoreType == ECoreType.v2rayN)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
foreach (var it2 in it.coreExes)
|
foreach (var it2 in it.CoreExes)
|
||||||
{
|
{
|
||||||
if (!lstDnsExe.Contains(it2) && it.coreType != ECoreType.sing_box)
|
if (!lstDnsExe.Contains(it2) && it.CoreType != ECoreType.sing_box)
|
||||||
{
|
{
|
||||||
lstDnsExe.Add($"{it2}.exe");
|
lstDnsExe.Add($"{it2}.exe");
|
||||||
}
|
}
|
||||||
|
|
|
@ -275,7 +275,7 @@ namespace ServiceLib.Services
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo(type);
|
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo(type);
|
||||||
var url = coreInfo?.coreReleaseApiUrl;
|
var url = coreInfo?.ReleaseApiUrl;
|
||||||
|
|
||||||
var result = await downloadHandle.TryDownloadString(url, true, Global.AppName);
|
var result = await downloadHandle.TryDownloadString(url, true, Global.AppName);
|
||||||
if (Utils.IsNotEmpty(result))
|
if (Utils.IsNotEmpty(result))
|
||||||
|
@ -304,10 +304,10 @@ 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 (string name in coreInfo.CoreExes)
|
||||||
{
|
{
|
||||||
string vName = Utils.GetExeName(name);
|
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))
|
||||||
{
|
{
|
||||||
filePath = vName;
|
filePath = vName;
|
||||||
|
@ -324,7 +324,7 @@ namespace ServiceLib.Services
|
||||||
|
|
||||||
using Process p = new();
|
using Process p = new();
|
||||||
p.StartInfo.FileName = filePath;
|
p.StartInfo.FileName = filePath;
|
||||||
p.StartInfo.Arguments = coreInfo.versionArg;
|
p.StartInfo.Arguments = coreInfo.VersionArg;
|
||||||
p.StartInfo.WorkingDirectory = Utils.GetConfigPath();
|
p.StartInfo.WorkingDirectory = Utils.GetConfigPath();
|
||||||
p.StartInfo.UseShellExecute = false;
|
p.StartInfo.UseShellExecute = false;
|
||||||
p.StartInfo.RedirectStandardOutput = true;
|
p.StartInfo.RedirectStandardOutput = true;
|
||||||
|
@ -339,7 +339,7 @@ namespace ServiceLib.Services
|
||||||
case ECoreType.v2fly:
|
case ECoreType.v2fly:
|
||||||
case ECoreType.Xray:
|
case ECoreType.Xray:
|
||||||
case ECoreType.v2fly_v5:
|
case ECoreType.v2fly_v5:
|
||||||
version = Regex.Match(echo, $"{coreInfo.match} ([0-9.]+) \\(").Groups[1].Value;
|
version = Regex.Match(echo, $"{coreInfo.Match} ([0-9.]+) \\(").Groups[1].Value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ECoreType.mihomo:
|
case ECoreType.mihomo:
|
||||||
|
@ -429,19 +429,19 @@ namespace ServiceLib.Services
|
||||||
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
|
||||||
&& File.Exists(Path.Combine(Utils.StartupPath(), "wpfgfx_cor3.dll"))
|
&& File.Exists(Path.Combine(Utils.StartupPath(), "wpfgfx_cor3.dll"))
|
||||||
&& File.Exists(Path.Combine(Utils.StartupPath(), "D3DCompiler_47_cor3.dll"))
|
&& File.Exists(Path.Combine(Utils.StartupPath(), "D3DCompiler_47_cor3.dll"))
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
return coreInfo?.coreDownloadUrl64.Replace("v2rayN.zip", "zz_v2rayN-SelfContained.zip");
|
return coreInfo?.DownloadUrlWin64?.Replace("v2rayN.zip", "zz_v2rayN-SelfContained.zip");
|
||||||
}
|
}
|
||||||
|
|
||||||
return RuntimeInformation.ProcessArchitecture switch
|
return RuntimeInformation.ProcessArchitecture switch
|
||||||
{
|
{
|
||||||
Architecture.Arm64 => coreInfo?.coreDownloadUrlArm64,
|
Architecture.Arm64 => coreInfo?.DownloadUrlWinArm64,
|
||||||
Architecture.X86 => coreInfo?.coreDownloadUrl32,
|
Architecture.X86 => coreInfo?.DownloadUrlWin32,
|
||||||
Architecture.X64 => coreInfo?.coreDownloadUrl64,
|
Architecture.X64 => coreInfo?.DownloadUrlWin64,
|
||||||
_ => null,
|
_ => null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
@ -449,9 +449,8 @@ namespace ServiceLib.Services
|
||||||
{
|
{
|
||||||
return RuntimeInformation.ProcessArchitecture switch
|
return RuntimeInformation.ProcessArchitecture switch
|
||||||
{
|
{
|
||||||
Architecture.Arm64 => coreInfo?.coreDownloadUrlLinuxArm64,
|
Architecture.Arm64 => coreInfo?.DownloadUrlLinuxArm64,
|
||||||
Architecture.X86 => coreInfo?.coreDownloadUrlLinux32,
|
Architecture.X64 => coreInfo?.DownloadUrlLinux64,
|
||||||
Architecture.X64 => coreInfo?.coreDownloadUrlLinux64,
|
|
||||||
_ => null,
|
_ => null,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,61 +50,61 @@ namespace ServiceLib.ViewModels
|
||||||
|
|
||||||
_checkUpdateItem.Add(new CheckUpdateItem()
|
_checkUpdateItem.Add(new CheckUpdateItem()
|
||||||
{
|
{
|
||||||
isSelected = false,
|
IsSelected = false,
|
||||||
coreType = _v2rayN,
|
CoreType = _v2rayN,
|
||||||
remarks = ResUI.menuCheckUpdate,
|
Remarks = ResUI.menuCheckUpdate,
|
||||||
});
|
});
|
||||||
_checkUpdateItem.Add(new CheckUpdateItem()
|
_checkUpdateItem.Add(new CheckUpdateItem()
|
||||||
{
|
{
|
||||||
isSelected = true,
|
IsSelected = true,
|
||||||
coreType = ECoreType.Xray.ToString(),
|
CoreType = ECoreType.Xray.ToString(),
|
||||||
remarks = ResUI.menuCheckUpdate,
|
Remarks = ResUI.menuCheckUpdate,
|
||||||
});
|
});
|
||||||
_checkUpdateItem.Add(new CheckUpdateItem()
|
_checkUpdateItem.Add(new CheckUpdateItem()
|
||||||
{
|
{
|
||||||
isSelected = true,
|
IsSelected = true,
|
||||||
coreType = ECoreType.mihomo.ToString(),
|
CoreType = ECoreType.mihomo.ToString(),
|
||||||
remarks = ResUI.menuCheckUpdate,
|
Remarks = ResUI.menuCheckUpdate,
|
||||||
});
|
});
|
||||||
if (Utils.IsWindows())
|
if (Utils.IsWindows())
|
||||||
{
|
{
|
||||||
_checkUpdateItem.Add(new CheckUpdateItem()
|
_checkUpdateItem.Add(new CheckUpdateItem()
|
||||||
{
|
{
|
||||||
isSelected = true,
|
IsSelected = true,
|
||||||
coreType = ECoreType.sing_box.ToString(),
|
CoreType = ECoreType.sing_box.ToString(),
|
||||||
remarks = ResUI.menuCheckUpdate,
|
Remarks = ResUI.menuCheckUpdate,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
_checkUpdateItem.Add(new CheckUpdateItem()
|
_checkUpdateItem.Add(new CheckUpdateItem()
|
||||||
{
|
{
|
||||||
isSelected = true,
|
IsSelected = true,
|
||||||
coreType = _geo,
|
CoreType = _geo,
|
||||||
remarks = ResUI.menuCheckUpdate,
|
Remarks = ResUI.menuCheckUpdate,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task CheckUpdate()
|
private async Task CheckUpdate()
|
||||||
{
|
{
|
||||||
_lstUpdated.Clear();
|
_lstUpdated.Clear();
|
||||||
_lstUpdated = _checkUpdateItem.Where(x => x.isSelected == true)
|
_lstUpdated = _checkUpdateItem.Where(x => x.IsSelected == true)
|
||||||
.Select(x => new CheckUpdateItem() { coreType = x.coreType }).ToList();
|
.Select(x => new CheckUpdateItem() { CoreType = x.CoreType }).ToList();
|
||||||
|
|
||||||
for (int k = _checkUpdateItem.Count - 1; k >= 0; k--)
|
for (int k = _checkUpdateItem.Count - 1; k >= 0; k--)
|
||||||
{
|
{
|
||||||
var item = _checkUpdateItem[k];
|
var item = _checkUpdateItem[k];
|
||||||
if (item.isSelected == true)
|
if (item.IsSelected == true)
|
||||||
{
|
{
|
||||||
IsCheckUpdate = false;
|
IsCheckUpdate = false;
|
||||||
UpdateView(item.coreType, "...");
|
UpdateView(item.CoreType, "...");
|
||||||
if (item.coreType == _geo)
|
if (item.CoreType == _geo)
|
||||||
{
|
{
|
||||||
await CheckUpdateGeo();
|
await CheckUpdateGeo();
|
||||||
}
|
}
|
||||||
else if (item.coreType == _v2rayN)
|
else if (item.CoreType == _v2rayN)
|
||||||
{
|
{
|
||||||
await CheckUpdateN(EnableCheckPreReleaseUpdate);
|
await CheckUpdateN(EnableCheckPreReleaseUpdate);
|
||||||
}
|
}
|
||||||
else if (item.coreType == ECoreType.mihomo.ToString())
|
else if (item.CoreType == ECoreType.mihomo.ToString())
|
||||||
{
|
{
|
||||||
await CheckUpdateCore(item, false);
|
await CheckUpdateCore(item, false);
|
||||||
}
|
}
|
||||||
|
@ -118,15 +118,15 @@ namespace ServiceLib.ViewModels
|
||||||
|
|
||||||
private void UpdatedPlusPlus(string coreType, string fileName)
|
private void UpdatedPlusPlus(string coreType, string fileName)
|
||||||
{
|
{
|
||||||
var item = _lstUpdated.FirstOrDefault(x => x.coreType == coreType);
|
var item = _lstUpdated.FirstOrDefault(x => x.CoreType == coreType);
|
||||||
if (item == null)
|
if (item == null)
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
item.isFinished = true;
|
item.IsFinished = true;
|
||||||
if (!fileName.IsNullOrEmpty())
|
if (!fileName.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
item.fileName = fileName;
|
item.FileName = fileName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -179,31 +179,31 @@ namespace ServiceLib.ViewModels
|
||||||
{
|
{
|
||||||
void _updateUI(bool success, string msg)
|
void _updateUI(bool success, string msg)
|
||||||
{
|
{
|
||||||
UpdateView(item.coreType, msg);
|
UpdateView(item.CoreType, msg);
|
||||||
if (success)
|
if (success)
|
||||||
{
|
{
|
||||||
UpdateView(item.coreType, ResUI.MsgUpdateV2rayCoreSuccessfullyMore);
|
UpdateView(item.CoreType, ResUI.MsgUpdateV2rayCoreSuccessfullyMore);
|
||||||
|
|
||||||
UpdatedPlusPlus(item.coreType, msg);
|
UpdatedPlusPlus(item.CoreType, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
var type = (ECoreType)Enum.Parse(typeof(ECoreType), item.coreType);
|
var type = (ECoreType)Enum.Parse(typeof(ECoreType), item.CoreType);
|
||||||
await (new UpdateService()).CheckUpdateCore(type, _config, _updateUI, preRelease)
|
await (new UpdateService()).CheckUpdateCore(type, _config, _updateUI, preRelease)
|
||||||
.ContinueWith(t =>
|
.ContinueWith(t =>
|
||||||
{
|
{
|
||||||
UpdatedPlusPlus(item.coreType, "");
|
UpdatedPlusPlus(item.CoreType, "");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task UpdateFinished()
|
private async Task UpdateFinished()
|
||||||
{
|
{
|
||||||
if (_lstUpdated.Count > 0 && _lstUpdated.Count(x => x.isFinished == true) == _lstUpdated.Count)
|
if (_lstUpdated.Count > 0 && _lstUpdated.Count(x => x.IsFinished == true) == _lstUpdated.Count)
|
||||||
{
|
{
|
||||||
_updateView?.Invoke(EViewAction.DispatcherCheckUpdateFinished, false);
|
_updateView?.Invoke(EViewAction.DispatcherCheckUpdateFinished, false);
|
||||||
await Task.Delay(2000);
|
await Task.Delay(2000);
|
||||||
UpgradeCore();
|
UpgradeCore();
|
||||||
|
|
||||||
if (_lstUpdated.Any(x => x.coreType == _v2rayN && x.isFinished == true))
|
if (_lstUpdated.Any(x => x.CoreType == _v2rayN && x.IsFinished == true))
|
||||||
{
|
{
|
||||||
await Task.Delay(1000);
|
await Task.Delay(1000);
|
||||||
UpgradeN();
|
UpgradeN();
|
||||||
|
@ -230,7 +230,7 @@ namespace ServiceLib.ViewModels
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var fileName = _lstUpdated.FirstOrDefault(x => x.coreType == _v2rayN)?.fileName;
|
var fileName = _lstUpdated.FirstOrDefault(x => x.CoreType == _v2rayN)?.FileName;
|
||||||
if (fileName.IsNullOrEmpty())
|
if (fileName.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -247,17 +247,17 @@ namespace ServiceLib.ViewModels
|
||||||
{
|
{
|
||||||
foreach (var item in _lstUpdated)
|
foreach (var item in _lstUpdated)
|
||||||
{
|
{
|
||||||
if (item.fileName.IsNullOrEmpty())
|
if (item.FileName.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
var fileName = item.fileName;
|
var fileName = item.FileName;
|
||||||
if (!File.Exists(fileName))
|
if (!File.Exists(fileName))
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
string toPath = Utils.GetBinPath("", item.coreType);
|
string toPath = Utils.GetBinPath("", item.CoreType);
|
||||||
|
|
||||||
if (fileName.Contains(".tar.gz"))
|
if (fileName.Contains(".tar.gz"))
|
||||||
{
|
{
|
||||||
|
@ -265,14 +265,14 @@ namespace ServiceLib.ViewModels
|
||||||
}
|
}
|
||||||
else if (fileName.Contains(".gz"))
|
else if (fileName.Contains(".gz"))
|
||||||
{
|
{
|
||||||
FileManager.UncompressedFile(fileName, toPath, item.coreType);
|
FileManager.UncompressedFile(fileName, toPath, item.CoreType);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
FileManager.ZipExtractToFile(fileName, toPath, _config.guiItem.ignoreGeoUpdateCore ? "geo" : "");
|
FileManager.ZipExtractToFile(fileName, toPath, _config.guiItem.ignoreGeoUpdateCore ? "geo" : "");
|
||||||
}
|
}
|
||||||
|
|
||||||
UpdateView(item.coreType, ResUI.MsgUpdateV2rayCoreSuccessfully);
|
UpdateView(item.CoreType, ResUI.MsgUpdateV2rayCoreSuccessfully);
|
||||||
|
|
||||||
if (File.Exists(fileName))
|
if (File.Exists(fileName))
|
||||||
{
|
{
|
||||||
|
@ -285,19 +285,19 @@ namespace ServiceLib.ViewModels
|
||||||
{
|
{
|
||||||
var item = new CheckUpdateItem()
|
var item = new CheckUpdateItem()
|
||||||
{
|
{
|
||||||
coreType = coreType,
|
CoreType = coreType,
|
||||||
remarks = msg,
|
Remarks = msg,
|
||||||
};
|
};
|
||||||
_updateView?.Invoke(EViewAction.DispatcherCheckUpdate, item);
|
_updateView?.Invoke(EViewAction.DispatcherCheckUpdate, item);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UpdateViewResult(CheckUpdateItem item)
|
public void UpdateViewResult(CheckUpdateItem item)
|
||||||
{
|
{
|
||||||
var found = _checkUpdateItem.FirstOrDefault(t => t.coreType == item.coreType);
|
var found = _checkUpdateItem.FirstOrDefault(t => t.CoreType == item.CoreType);
|
||||||
if (found != null)
|
if (found != null)
|
||||||
{
|
{
|
||||||
var itemCopy = JsonUtils.DeepCopy(found);
|
var itemCopy = JsonUtils.DeepCopy(found);
|
||||||
itemCopy.remarks = item.remarks;
|
itemCopy.Remarks = item.Remarks;
|
||||||
_checkUpdateItem.Replace(found, itemCopy);
|
_checkUpdateItem.Replace(found, itemCopy);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -68,15 +68,15 @@
|
||||||
Margin="8"
|
Margin="8"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
IsChecked="{Binding isSelected}" />
|
IsChecked="{Binding IsSelected}" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Text="{Binding coreType}" />
|
Text="{Binding CoreType}" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Text="{Binding remarks}"
|
Text="{Binding Remarks}"
|
||||||
TextWrapping="WrapWithOverflow" />
|
TextWrapping="WrapWithOverflow" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
|
@ -448,13 +448,13 @@ namespace v2rayN.Desktop.Views
|
||||||
{
|
{
|
||||||
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo();
|
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo();
|
||||||
foreach (var it in coreInfo
|
foreach (var it in coreInfo
|
||||||
.Where(t => t.coreType != ECoreType.v2fly
|
.Where(t => t.CoreType != ECoreType.v2fly
|
||||||
&& t.coreType != ECoreType.hysteria))
|
&& t.CoreType != ECoreType.hysteria))
|
||||||
{
|
{
|
||||||
var item = new MenuItem()
|
var item = new MenuItem()
|
||||||
{
|
{
|
||||||
Tag = it.coreUrl.Replace(@"/releases", ""),
|
Tag = it.Url.Replace(@"/releases", ""),
|
||||||
Header = string.Format(ResUI.menuWebsiteItem, it.coreType.ToString().Replace("_", " ")).UpperFirstChar()
|
Header = string.Format(ResUI.menuWebsiteItem, it.CoreType.ToString().Replace("_", " ")).UpperFirstChar()
|
||||||
};
|
};
|
||||||
item.Click += MenuItem_Click;
|
item.Click += MenuItem_Click;
|
||||||
menuHelp.Items.Add(item);
|
menuHelp.Items.Add(item);
|
||||||
|
|
|
@ -84,15 +84,15 @@
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Margin="8"
|
Margin="8"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
IsChecked="{Binding isSelected}" />
|
IsChecked="{Binding IsSelected}" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Style="{StaticResource ListItemTitle}"
|
Style="{StaticResource ListItemTitle}"
|
||||||
Text="{Binding coreType}" />
|
Text="{Binding CoreType}" />
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
Style="{StaticResource ListItemSubTitle}"
|
Style="{StaticResource ListItemSubTitle}"
|
||||||
Text="{Binding remarks}"
|
Text="{Binding Remarks}"
|
||||||
TextWrapping="WrapWithOverflow" />
|
TextWrapping="WrapWithOverflow" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|
|
@ -492,13 +492,13 @@ namespace v2rayN.Views
|
||||||
{
|
{
|
||||||
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo();
|
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo();
|
||||||
foreach (var it in coreInfo
|
foreach (var it in coreInfo
|
||||||
.Where(t => t.coreType != ECoreType.v2fly
|
.Where(t => t.CoreType != ECoreType.v2fly
|
||||||
&& t.coreType != ECoreType.hysteria))
|
&& t.CoreType != ECoreType.hysteria))
|
||||||
{
|
{
|
||||||
var item = new MenuItem()
|
var item = new MenuItem()
|
||||||
{
|
{
|
||||||
Tag = it.coreUrl.Replace(@"/releases", ""),
|
Tag = it.Url.Replace(@"/releases", ""),
|
||||||
Header = string.Format(ResUI.menuWebsiteItem, it.coreType.ToString().Replace("_", " ")).UpperFirstChar()
|
Header = string.Format(ResUI.menuWebsiteItem, it.CoreType.ToString().Replace("_", " ")).UpperFirstChar()
|
||||||
};
|
};
|
||||||
item.Click += MenuItem_Click;
|
item.Click += MenuItem_Click;
|
||||||
menuHelp.Items.Add(item);
|
menuHelp.Items.Add(item);
|
||||||
|
|
Loading…
Reference in a new issue