diff --git a/Netch/Forms/MainForm.MenuStrip.cs b/Netch/Forms/MainForm.MenuStrip.cs
index 12490818..c4cd9765 100644
--- a/Netch/Forms/MainForm.MenuStrip.cs
+++ b/Netch/Forms/MainForm.MenuStrip.cs
@@ -52,7 +52,7 @@ namespace Netch.Forms
private void AddServerToolStripMenuItem_Click(object sender, EventArgs e)
{
- Form form = ((ToolStripMenuItem) sender).Name switch
+ Form form = ((ToolStripMenuItem)sender).Name switch
{
"AddSocks5ServerToolStripMenuItem" => new Socks5(),
"AddShadowsocksServerToolStripMenuItem" => new Shadowsocks(),
@@ -113,6 +113,12 @@ namespace Netch.Forms
private async void UpdateServersFromSubscribeLinksToolStripMenuItem_Click(object sender, EventArgs e)
{
+ UpdateServersFromSubscribe();
+ }
+
+ public async void UpdateServersFromSubscribe()
+ {
+
void DisableItems(bool v)
{
MenuStrip.Enabled = ConfigurationGroupBox.Enabled = ProfileGroupBox.Enabled = ControlButton.Enabled = v;
diff --git a/Netch/Forms/MainForm.cs b/Netch/Forms/MainForm.cs
index b4b99427..f6a44cdc 100644
--- a/Netch/Forms/MainForm.cs
+++ b/Netch/Forms/MainForm.cs
@@ -83,6 +83,16 @@ namespace Netch.Forms
CheckUpdate();
}
});
+
+
+ Task.Run(() =>
+ {
+ // 检查订阅更新
+ if (Global.Settings.UpdateSubscribeatWhenOpened)
+ {
+ UpdateServersFromSubscribe();
+ }
+ });
}
private void OnCalled(object sender, OnlyInstance.Commands e)
diff --git a/Netch/Forms/SettingForm.Designer.cs b/Netch/Forms/SettingForm.Designer.cs
index c219086a..01e501c4 100644
--- a/Netch/Forms/SettingForm.Designer.cs
+++ b/Netch/Forms/SettingForm.Designer.cs
@@ -72,6 +72,7 @@
this.StartWhenOpenedCheckBox = new System.Windows.Forms.CheckBox();
this.StopWhenExitedCheckBox = new System.Windows.Forms.CheckBox();
this.ExitWhenClosedCheckBox = new System.Windows.Forms.CheckBox();
+ this.UpdateSubscribeatWhenOpenedCheckBox = new System.Windows.Forms.CheckBox();
this.PortGroupBox.SuspendLayout();
this.TUNTAPGroupBox.SuspendLayout();
this.BehaviorGroupBox.SuspendLayout();
@@ -276,7 +277,7 @@
//
// ControlButton
//
- this.ControlButton.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
+ this.ControlButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right)));
this.ControlButton.Location = new System.Drawing.Point(804, 356);
this.ControlButton.Name = "ControlButton";
this.ControlButton.Size = new System.Drawing.Size(75, 23);
@@ -287,7 +288,7 @@
//
// GlobalBypassIPsButton
//
- this.GlobalBypassIPsButton.Anchor = ((System.Windows.Forms.AnchorStyles) ((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
+ this.GlobalBypassIPsButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Left)));
this.GlobalBypassIPsButton.Location = new System.Drawing.Point(12, 356);
this.GlobalBypassIPsButton.Name = "GlobalBypassIPsButton";
this.GlobalBypassIPsButton.Size = new System.Drawing.Size(128, 23);
@@ -298,6 +299,7 @@
//
// BehaviorGroupBox
//
+ this.BehaviorGroupBox.Controls.Add(this.UpdateSubscribeatWhenOpenedCheckBox);
this.BehaviorGroupBox.Controls.Add(this.LanguageLabel);
this.BehaviorGroupBox.Controls.Add(this.LanguageComboBox);
this.BehaviorGroupBox.Controls.Add(this.ModifySystemDNSCheckBox);
@@ -517,6 +519,17 @@
this.ExitWhenClosedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
this.ExitWhenClosedCheckBox.UseVisualStyleBackColor = true;
//
+ // UpdateSubscribeatWhenOpenedCheckBox
+ //
+ this.UpdateSubscribeatWhenOpenedCheckBox.AutoSize = true;
+ this.UpdateSubscribeatWhenOpenedCheckBox.Location = new System.Drawing.Point(206, 129);
+ this.UpdateSubscribeatWhenOpenedCheckBox.Name = "UpdateSubscribeatWhenOpenedCheckBox";
+ this.UpdateSubscribeatWhenOpenedCheckBox.Size = new System.Drawing.Size(224, 21);
+ this.UpdateSubscribeatWhenOpenedCheckBox.TabIndex = 24;
+ this.UpdateSubscribeatWhenOpenedCheckBox.Text = "Update subscribeat when opened";
+ this.UpdateSubscribeatWhenOpenedCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleRight;
+ this.UpdateSubscribeatWhenOpenedCheckBox.UseVisualStyleBackColor = true;
+ //
// SettingForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@@ -527,9 +540,9 @@
this.Controls.Add(this.GlobalBypassIPsButton);
this.Controls.Add(this.ControlButton);
this.Controls.Add(this.TUNTAPGroupBox);
- this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte) (134)));
+ this.Font = new System.Drawing.Font("微软雅黑", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
- this.Icon = ((System.Drawing.Icon) (resources.GetObject("$this.Icon")));
+ this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
this.MaximizeBox = false;
this.Name = "SettingForm";
@@ -590,5 +603,6 @@
private System.Windows.Forms.ComboBox LanguageComboBox;
private System.Windows.Forms.CheckBox ModifySystemDNSCheckBox;
private System.Windows.Forms.CheckBox CheckBetaUpdateCheckBox;
+ private System.Windows.Forms.CheckBox UpdateSubscribeatWhenOpenedCheckBox;
}
}
\ No newline at end of file
diff --git a/Netch/Forms/SettingForm.cs b/Netch/Forms/SettingForm.cs
index 975cc918..71cbbb31 100644
--- a/Netch/Forms/SettingForm.cs
+++ b/Netch/Forms/SettingForm.cs
@@ -109,6 +109,7 @@ namespace Netch.Forms
BootShadowsocksFromDLLCheckBox.Checked = Global.Settings.BootShadowsocksFromDLL;
ModifySystemDNSCheckBox.Checked = Global.Settings.ModifySystemDNS;
CheckBetaUpdateCheckBox.Checked = Global.Settings.CheckBetaUpdate;
+ UpdateSubscribeatWhenOpenedCheckBox.Checked = Global.Settings.UpdateSubscribeatWhenOpened;
ProfileCountTextBox.Text = Global.Settings.ProfileCount.ToString();
TcpingAtStartedCheckBox.Checked = Global.Settings.StartedTcping;
@@ -142,6 +143,7 @@ namespace Netch.Forms
StartWhenOpenedCheckBox.Text = i18N.Translate(StartWhenOpenedCheckBox.Text);
MinimizeWhenStartedCheckBox.Text = i18N.Translate(MinimizeWhenStartedCheckBox.Text);
RunAtStartupCheckBox.Text = i18N.Translate(RunAtStartupCheckBox.Text);
+ UpdateSubscribeatWhenOpenedCheckBox.Text = i18N.Translate(UpdateSubscribeatWhenOpenedCheckBox.Text);
CheckUpdateWhenOpenedCheckBox.Text = i18N.Translate(CheckUpdateWhenOpenedCheckBox.Text);
ProfileCountLabel.Text = i18N.Translate(ProfileCountLabel.Text);
TcpingAtStartedCheckBox.Text = i18N.Translate(TcpingAtStartedCheckBox.Text);
@@ -186,6 +188,7 @@ namespace Netch.Forms
Global.Settings.StartWhenOpened = StartWhenOpenedCheckBox.Checked;
Global.Settings.CheckUpdateWhenOpened = CheckUpdateWhenOpenedCheckBox.Checked;
Global.Settings.CheckBetaUpdate = CheckBetaUpdateCheckBox.Checked;
+ Global.Settings.UpdateSubscribeatWhenOpened = UpdateSubscribeatWhenOpenedCheckBox.Checked;
Global.Settings.MinimizeWhenStarted = MinimizeWhenStartedCheckBox.Checked;
Global.Settings.RunAtStartup = RunAtStartupCheckBox.Checked;
Global.Settings.BootShadowsocksFromDLL = BootShadowsocksFromDLLCheckBox.Checked;
diff --git a/Netch/Models/Setting.cs b/Netch/Models/Setting.cs
index b5ba7225..eedc56db 100644
--- a/Netch/Models/Setting.cs
+++ b/Netch/Models/Setting.cs
@@ -94,6 +94,11 @@ namespace Netch.Models
///
public bool CheckBetaUpdate = false;
+ ///
+ /// 是否打开软件时更新订阅
+ ///
+ public bool UpdateSubscribeatWhenOpened = false;
+
///
/// 修改系统 DNS
///
diff --git a/Netch/Resources/zh-CN b/Netch/Resources/zh-CN
index ef28bd5d..5bf3349a 100644
--- a/Netch/Resources/zh-CN
+++ b/Netch/Resources/zh-CN
@@ -165,6 +165,7 @@
"Port value illegal. Try again.": "端口值非法。请重试。",
"Check update when opened": "打开软件时检查更新",
"Check Beta update": "检查 Beta 更新",
+ "Update subscribeat when opened": "自动更新订阅",
"SS DLL(No ACL support)": "SS DLL(不支持 ACL)",
"Modify System DNS": "修改系统 DNS",
"ProfileCount": "快捷配置数量",