Support update clash core

pull/2447/head
2dust 2022-06-24 09:32:55 +08:00
parent aec8459761
commit cf45e89b16
7 changed files with 161 additions and 58 deletions

View File

@ -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;
}
}

View File

@ -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)

View File

@ -320,8 +320,20 @@
<data name="menuExport2SubContent.Text" xml:space="preserve">
<value>Export subscription (base64) share to clipboard</value>
</data>
<data name="tsbServer.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="tsbServer.Size" type="System.Drawing.Size, System.Drawing">
<value>64, 53</value>
</data>
<data name="tsbServer.Text" xml:space="preserve">
<value>Servers</value>
</data>
<data name="tsbServer.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageAboveText</value>
</data>
<data name="cmsLv.Size" type="System.Drawing.Size, System.Drawing">
<value>356, 622</value>
<value>356, 600</value>
</data>
<data name="&gt;&gt;cmsLv.Name" xml:space="preserve">
<value>cmsLv</value>
@ -470,18 +482,6 @@
<data name="&gt;&gt;scServers.ZOrder" xml:space="preserve">
<value>0</value>
</data>
<data name="tsbServer.ImageTransparentColor" type="System.Drawing.Color, System.Drawing">
<value>Magenta</value>
</data>
<data name="tsbServer.Size" type="System.Drawing.Size, System.Drawing">
<value>64, 53</value>
</data>
<data name="tsbServer.Text" xml:space="preserve">
<value>Servers</value>
</data>
<data name="tsbServer.TextImageRelation" type="System.Windows.Forms.TextImageRelation, System.Windows.Forms">
<value>ImageAboveText</value>
</data>
<data name="scBig.Dock" type="System.Windows.Forms.DockStyle, System.Windows.Forms">
<value>Fill</value>
</data>
@ -825,28 +825,43 @@
<value>6, 56</value>
</data>
<data name="tsbCheckUpdateN.Size" type="System.Drawing.Size, System.Drawing">
<value>203, 22</value>
<value>219, 22</value>
</data>
<data name="tsbCheckUpdateN.Text" xml:space="preserve">
<value>v2rayN (this software)</value>
</data>
<data name="tsbCheckUpdateCore.Size" type="System.Drawing.Size, System.Drawing">
<value>203, 22</value>
<value>219, 22</value>
</data>
<data name="tsbCheckUpdateCore.Text" xml:space="preserve">
<value>Update v2fly Core</value>
</data>
<data name="tsbCheckUpdateXrayCore.Size" type="System.Drawing.Size, System.Drawing">
<value>203, 22</value>
<value>219, 22</value>
</data>
<data name="tsbCheckUpdateXrayCore.Text" xml:space="preserve">
<value>Update Xray Core</value>
</data>
<data name="toolStripSeparator16.Size" type="System.Drawing.Size, System.Drawing">
<value>216, 6</value>
</data>
<data name="tsbCheckUpdateClashCore.Size" type="System.Drawing.Size, System.Drawing">
<value>219, 22</value>
</data>
<data name="tsbCheckUpdateClashCore.Text" xml:space="preserve">
<value>Update clash Core</value>
</data>
<data name="tsbCheckUpdateClashMetaCore.Size" type="System.Drawing.Size, System.Drawing">
<value>219, 22</value>
</data>
<data name="tsbCheckUpdateClashMetaCore.Text" xml:space="preserve">
<value>Update Clash.Meta Core</value>
</data>
<data name="toolStripSeparator15.Size" type="System.Drawing.Size, System.Drawing">
<value>200, 6</value>
<value>216, 6</value>
</data>
<data name="tsbCheckUpdateGeo.Size" type="System.Drawing.Size, System.Drawing">
<value>203, 22</value>
<value>219, 22</value>
</data>
<data name="tsbCheckUpdateGeo.Text" xml:space="preserve">
<value>Update Geo files</value>
@ -1391,6 +1406,24 @@
<data name="&gt;&gt;tsbCheckUpdateXrayCore.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripSeparator16.Name" xml:space="preserve">
<value>toolStripSeparator16</value>
</data>
<data name="&gt;&gt;toolStripSeparator16.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripSeparator, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;tsbCheckUpdateClashCore.Name" xml:space="preserve">
<value>tsbCheckUpdateClashCore</value>
</data>
<data name="&gt;&gt;tsbCheckUpdateClashCore.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;tsbCheckUpdateClashMetaCore.Name" xml:space="preserve">
<value>tsbCheckUpdateClashMetaCore</value>
</data>
<data name="&gt;&gt;tsbCheckUpdateClashMetaCore.Type" xml:space="preserve">
<value>System.Windows.Forms.ToolStripMenuItem, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</data>
<data name="&gt;&gt;toolStripSeparator15.Name" xml:space="preserve">
<value>toolStripSeparator15</value>
</data>

View File

@ -561,4 +561,10 @@
<data name="menuServerFilter.Text" xml:space="preserve">
<value>设置服务器过滤器 (Ctrl+F)</value>
</data>
<data name="tsbCheckUpdateClashCore.Text" xml:space="preserve">
<value>Update clash Core</value>
</data>
<data name="tsbCheckUpdateClashMetaCore.Text" xml:space="preserve">
<value>Update Clash.Meta Core</value>
</data>
</root>

View File

@ -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<string> { "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<string> { "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<string> { "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

View File

@ -374,28 +374,40 @@ namespace v2rayN.Handler
string curVersion;
string message;
string url;
if (type == ECoreType.v2fly)
switch (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.coreDownloadUrl, version, osBit);
url = string.Format(coreInfo.coreDownloadUrl64, version, osBit);
break;
}
else if (type == ECoreType.Xray)
case ECoreType.clash:
case ECoreType.clash_meta:
{
curVersion = "v" + getCoreVersion(type);
curVersion = "";//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)
if (Environment.Is64BitProcess)
{
curVersion = FileVersionInfo.GetVersionInfo(Utils.GetExePath()).FileVersion.ToString();
message = string.Format(ResUI.IsLatestN, curVersion);
url = string.Format(coreInfo.coreDownloadUrl, version);
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");
}

View File

@ -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; }
}