diff --git a/v2rayN/v2rayN/Forms/MainForm.Designer.cs b/v2rayN/v2rayN/Forms/MainForm.Designer.cs index ac6c9e81..95f12d4a 100644 --- a/v2rayN/v2rayN/Forms/MainForm.Designer.cs +++ b/v2rayN/v2rayN/Forms/MainForm.Designer.cs @@ -67,9 +67,9 @@ this.menuExport2ServerConfig = new System.Windows.Forms.ToolStripMenuItem(); this.menuExport2ShareUrl = new System.Windows.Forms.ToolStripMenuItem(); this.menuExport2SubContent = new System.Windows.Forms.ToolStripMenuItem(); + this.tsbServer = new System.Windows.Forms.ToolStripDropDownButton(); this.tabGroup = new System.Windows.Forms.TabControl(); this.qrCodeControl = new v2rayN.Forms.QRCodeControl(); - this.tsbServer = new System.Windows.Forms.ToolStripDropDownButton(); this.scBig = new System.Windows.Forms.SplitContainer(); this.gbServers = new System.Windows.Forms.GroupBox(); this.mainMsgControl = new v2rayN.Forms.MainMsgControl(); @@ -111,6 +111,9 @@ this.tsbCheckUpdateN = new System.Windows.Forms.ToolStripMenuItem(); this.tsbCheckUpdateCore = new System.Windows.Forms.ToolStripMenuItem(); this.tsbCheckUpdateXrayCore = new System.Windows.Forms.ToolStripMenuItem(); + this.toolStripSeparator16 = new System.Windows.Forms.ToolStripSeparator(); + this.tsbCheckUpdateClashCore = new System.Windows.Forms.ToolStripMenuItem(); + this.tsbCheckUpdateClashMetaCore = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator15 = new System.Windows.Forms.ToolStripSeparator(); this.tsbCheckUpdateGeo = new System.Windows.Forms.ToolStripMenuItem(); this.toolStripSeparator10 = new System.Windows.Forms.ToolStripSeparator(); @@ -208,6 +211,7 @@ this.menuExport2ShareUrl, this.menuExport2SubContent}); this.cmsLv.Name = "cmsLv"; + this.cmsLv.OwnerItem = this.tsbServer; resources.ApplyResources(this.cmsLv, "cmsLv"); // // menuAddVmessServer @@ -414,6 +418,13 @@ resources.ApplyResources(this.menuExport2SubContent, "menuExport2SubContent"); this.menuExport2SubContent.Click += new System.EventHandler(this.menuExport2SubContent_Click); // + // tsbServer + // + this.tsbServer.DropDown = this.cmsLv; + this.tsbServer.Image = global::v2rayN.Properties.Resources.server; + resources.ApplyResources(this.tsbServer, "tsbServer"); + this.tsbServer.Name = "tsbServer"; + // // tabGroup // resources.ApplyResources(this.tabGroup, "tabGroup"); @@ -426,13 +437,6 @@ resources.ApplyResources(this.qrCodeControl, "qrCodeControl"); this.qrCodeControl.Name = "qrCodeControl"; // - // tsbServer - // - this.tsbServer.DropDown = this.cmsLv; - this.tsbServer.Image = global::v2rayN.Properties.Resources.server; - resources.ApplyResources(this.tsbServer, "tsbServer"); - this.tsbServer.Name = "tsbServer"; - // // scBig // resources.ApplyResources(this.scBig, "scBig"); @@ -707,6 +711,9 @@ this.tsbCheckUpdateN, this.tsbCheckUpdateCore, this.tsbCheckUpdateXrayCore, + this.toolStripSeparator16, + this.tsbCheckUpdateClashCore, + this.tsbCheckUpdateClashMetaCore, this.toolStripSeparator15, this.tsbCheckUpdateGeo}); this.tsbCheckUpdate.Image = global::v2rayN.Properties.Resources.checkupdate; @@ -731,6 +738,23 @@ resources.ApplyResources(this.tsbCheckUpdateXrayCore, "tsbCheckUpdateXrayCore"); this.tsbCheckUpdateXrayCore.Click += new System.EventHandler(this.tsbCheckUpdateXrayCore_Click); // + // toolStripSeparator16 + // + this.toolStripSeparator16.Name = "toolStripSeparator16"; + resources.ApplyResources(this.toolStripSeparator16, "toolStripSeparator16"); + // + // tsbCheckUpdateClashCore + // + this.tsbCheckUpdateClashCore.Name = "tsbCheckUpdateClashCore"; + resources.ApplyResources(this.tsbCheckUpdateClashCore, "tsbCheckUpdateClashCore"); + this.tsbCheckUpdateClashCore.Click += new System.EventHandler(this.tsbCheckUpdateClashCore_Click); + // + // tsbCheckUpdateClashMetaCore + // + this.tsbCheckUpdateClashMetaCore.Name = "tsbCheckUpdateClashMetaCore"; + resources.ApplyResources(this.tsbCheckUpdateClashMetaCore, "tsbCheckUpdateClashMetaCore"); + this.tsbCheckUpdateClashMetaCore.Click += new System.EventHandler(this.tsbCheckUpdateClashMetaCore_Click); + // // toolStripSeparator15 // this.toolStripSeparator15.Name = "toolStripSeparator15"; @@ -936,6 +960,9 @@ private System.Windows.Forms.ToolStripMenuItem menuMoveDown; private System.Windows.Forms.ToolStripMenuItem menuMoveBottom; private System.Windows.Forms.ToolStripMenuItem menuServerFilter; + private System.Windows.Forms.ToolStripMenuItem tsbCheckUpdateClashCore; + private System.Windows.Forms.ToolStripMenuItem tsbCheckUpdateClashMetaCore; + private System.Windows.Forms.ToolStripSeparator toolStripSeparator16; } } diff --git a/v2rayN/v2rayN/Forms/MainForm.cs b/v2rayN/v2rayN/Forms/MainForm.cs index f57d92cc..8c88b416 100644 --- a/v2rayN/v2rayN/Forms/MainForm.cs +++ b/v2rayN/v2rayN/Forms/MainForm.cs @@ -1327,6 +1327,16 @@ namespace v2rayN.Forms CheckUpdateCore(ECoreType.Xray); } + private void tsbCheckUpdateClashCore_Click(object sender, EventArgs e) + { + CheckUpdateCore(ECoreType.clash); + } + + private void tsbCheckUpdateClashMetaCore_Click(object sender, EventArgs e) + { + CheckUpdateCore(ECoreType.clash_meta); + } + private void CheckUpdateCore(ECoreType type) { void _updateUI(bool success, string msg) diff --git a/v2rayN/v2rayN/Forms/MainForm.resx b/v2rayN/v2rayN/Forms/MainForm.resx index 553fd572..565876f0 100644 --- a/v2rayN/v2rayN/Forms/MainForm.resx +++ b/v2rayN/v2rayN/Forms/MainForm.resx @@ -320,8 +320,20 @@ Export subscription (base64) share to clipboard + + Magenta + + + 64, 53 + + + Servers + + + ImageAboveText + - 356, 622 + 356, 600 cmsLv @@ -470,18 +482,6 @@ 0 - - Magenta - - - 64, 53 - - - Servers - - - ImageAboveText - Fill @@ -825,28 +825,43 @@ 6, 56 - 203, 22 + 219, 22 v2rayN (this software) - 203, 22 + 219, 22 - Update v2flyCore + Update v2fly Core - 203, 22 + 219, 22 - Update XrayCore + Update Xray Core + + + 216, 6 + + + 219, 22 + + + Update clash Core + + + 219, 22 + + + Update Clash.Meta Core - 200, 6 + 216, 6 - 203, 22 + 219, 22 Update Geo files @@ -1391,6 +1406,24 @@ System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + toolStripSeparator16 + + + System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tsbCheckUpdateClashCore + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + tsbCheckUpdateClashMetaCore + + + System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + toolStripSeparator15 diff --git a/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx b/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx index 740a1506..b4881f2c 100644 --- a/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx +++ b/v2rayN/v2rayN/Forms/MainForm.zh-Hans.resx @@ -561,4 +561,10 @@ 设置服务器过滤器 (Ctrl+F) + + Update clash Core + + + Update Clash.Meta Core + \ No newline at end of file diff --git a/v2rayN/v2rayN/Handler/LazyConfig.cs b/v2rayN/v2rayN/Handler/LazyConfig.cs index 71b53f3a..0f15823d 100644 --- a/v2rayN/v2rayN/Handler/LazyConfig.cs +++ b/v2rayN/v2rayN/Handler/LazyConfig.cs @@ -69,7 +69,8 @@ namespace v2rayN.Handler coreType = ECoreType.v2rayN, coreUrl = Global.NUrl, coreLatestUrl = Global.NUrl + "/latest", - coreDownloadUrl = Global.NUrl + "/download/{0}/v2rayN.zip", + coreDownloadUrl32 = Global.NUrl + "/download/{0}/v2rayN.zip", + coreDownloadUrl64 = Global.NUrl + "/download/{0}/v2rayN.zip", }); coreInfos.Add(new CoreInfo @@ -79,7 +80,8 @@ namespace v2rayN.Handler arguments = "", coreUrl = Global.v2flyCoreUrl, coreLatestUrl = Global.v2flyCoreUrl + "/latest", - coreDownloadUrl = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip", + coreDownloadUrl32 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip", + coreDownloadUrl64 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip", match = "V2Ray" }); @@ -90,7 +92,8 @@ namespace v2rayN.Handler arguments = "", coreUrl = Global.xrayCoreUrl, coreLatestUrl = Global.xrayCoreUrl + "/latest", - coreDownloadUrl = Global.xrayCoreUrl + "/download/{0}/Xray-windows-{1}.zip", + coreDownloadUrl32 = Global.xrayCoreUrl + "/download/{0}/Xray-windows-{1}.zip", + coreDownloadUrl64 = Global.xrayCoreUrl + "/download/{0}/Xray-windows-{1}.zip", match = "Xray" }); @@ -99,7 +102,11 @@ namespace v2rayN.Handler coreType = ECoreType.clash, coreExes = new List { "clash-windows-amd64-v3", "clash-windows-amd64", "clash-windows-386", "clash" }, arguments = "-f config.json", - coreUrl = Global.clashCoreUrl + coreUrl = Global.clashCoreUrl, + coreLatestUrl = Global.clashCoreUrl + "/latest", + coreDownloadUrl32 = Global.clashCoreUrl + "/download/{0}/clash-windows-386-{0}.zip", + coreDownloadUrl64 = Global.clashCoreUrl + "/download/{0}/clash-windows-amd64-{0}.zip", + match = "v" }); coreInfos.Add(new CoreInfo @@ -107,7 +114,10 @@ namespace v2rayN.Handler coreType = ECoreType.clash_meta, coreExes = new List { "Clash.Meta-windows-amd64v1", "Clash.Meta-windows-amd64", "Clash.Meta-windows-386", "Clash.Meta", "clash" }, arguments = "-f config.json", - coreUrl = Global.clashMetaCoreUrl + coreUrl = Global.clashMetaCoreUrl, + coreLatestUrl = Global.clashMetaCoreUrl + "/latest", + coreDownloadUrl32 = Global.clashMetaCoreUrl + "/download/{0}/Clash.Meta-windows-386-{0}.zip", + coreDownloadUrl64 = Global.clashMetaCoreUrl + "/download/{0}/Clash.Meta-windows-amd64-compatible-{0}.zip", }); coreInfos.Add(new CoreInfo @@ -115,7 +125,10 @@ namespace v2rayN.Handler coreType = ECoreType.hysteria, coreExes = new List { "hysteria-tun-windows-6.0-amd64", "hysteria-tun-windows-6.0-386", "hysteria" }, arguments = "", - coreUrl = Global.hysteriaCoreUrl + coreUrl = Global.hysteriaCoreUrl, + coreLatestUrl = Global.hysteriaCoreUrl + "/latest", + coreDownloadUrl32 = Global.hysteriaCoreUrl + "/download/{0}/hysteria-tun-windows-6.0-386.exe", + coreDownloadUrl64 = Global.hysteriaCoreUrl + "/download/{0}/hysteria-tun-windows-6.0-amd64.exe", }); coreInfos.Add(new CoreInfo diff --git a/v2rayN/v2rayN/Handler/UpdateHandle.cs b/v2rayN/v2rayN/Handler/UpdateHandle.cs index 9e30e38d..c200bbfe 100644 --- a/v2rayN/v2rayN/Handler/UpdateHandle.cs +++ b/v2rayN/v2rayN/Handler/UpdateHandle.cs @@ -295,7 +295,7 @@ namespace v2rayN.Handler try { var coreInfo = LazyConfig.Instance.GetCoreInfo(type); - string url = coreInfo.coreLatestUrl; + string url = coreInfo.coreLatestUrl; var result = await (new DownloadHandle()).UrlRedirectAsync(url, true); if (!Utils.IsNullOrEmpty(result)) @@ -374,29 +374,41 @@ namespace v2rayN.Handler string curVersion; string message; string url; - if (type == ECoreType.v2fly) + switch (type) { - curVersion = "v" + getCoreVersion(type); - message = string.Format(ResUI.IsLatestCore, curVersion); - string osBit = Environment.Is64BitProcess ? "64" : "32"; - url = string.Format(coreInfo.coreDownloadUrl, version, osBit); - } - else if (type == ECoreType.Xray) - { - curVersion = "v" + getCoreVersion(type); - message = string.Format(ResUI.IsLatestCore, curVersion); - string osBit = Environment.Is64BitProcess ? "64" : "32"; - url = string.Format(coreInfo.coreDownloadUrl, version, osBit); - } - else if (type == ECoreType.v2rayN) - { - curVersion = FileVersionInfo.GetVersionInfo(Utils.GetExePath()).FileVersion.ToString(); - message = string.Format(ResUI.IsLatestN, curVersion); - url = string.Format(coreInfo.coreDownloadUrl, version); - } - else - { - throw new ArgumentException("Type"); + case ECoreType.v2fly: + case ECoreType.Xray: + { + curVersion = "v" + getCoreVersion(type); + message = string.Format(ResUI.IsLatestCore, curVersion); + string osBit = Environment.Is64BitProcess ? "64" : "32"; + url = string.Format(coreInfo.coreDownloadUrl64, version, osBit); + break; + } + case ECoreType.clash: + case ECoreType.clash_meta: + { + curVersion = "";//getCoreVersion(type); + message = string.Format(ResUI.IsLatestCore, curVersion); + if (Environment.Is64BitProcess) + { + url = string.Format(coreInfo.coreDownloadUrl64, version); + } + else + { + url = string.Format(coreInfo.coreDownloadUrl32, version); + } + break; + } + case ECoreType.v2rayN: + { + curVersion = FileVersionInfo.GetVersionInfo(Utils.GetExePath()).FileVersion.ToString(); + message = string.Format(ResUI.IsLatestN, curVersion); + url = string.Format(coreInfo.coreDownloadUrl64, version); + break; + } + default: + throw new ArgumentException("Type"); } if (curVersion == version) diff --git a/v2rayN/v2rayN/Mode/CoreInfo.cs b/v2rayN/v2rayN/Mode/CoreInfo.cs index 86391c7d..4afc1c22 100644 --- a/v2rayN/v2rayN/Mode/CoreInfo.cs +++ b/v2rayN/v2rayN/Mode/CoreInfo.cs @@ -16,7 +16,9 @@ namespace v2rayN.Mode public string coreLatestUrl { get; set; } - public string coreDownloadUrl { get; set; } + public string coreDownloadUrl32 { get; set; } + + public string coreDownloadUrl64 { get; set; } public string match { get; set; } }