From 7013e1490d90e400658d74ff0fe79b184701e579 Mon Sep 17 00:00:00 2001
From: Qixiny <3185835784@qq.com>
Date: Fri, 22 Oct 2021 19:37:15 +0800
Subject: [PATCH] feature auto update subscribe
---
v2rayN/v2rayN/Forms/MainForm.cs | 14 +++++
.../Forms/OptionSettingForm.Designer.cs | 9 ++++
v2rayN/v2rayN/Forms/OptionSettingForm.cs | 2 +
v2rayN/v2rayN/Forms/OptionSettingForm.resx | 52 +++++++++++++++----
.../Forms/OptionSettingForm.zh-Hans.resx | 3 ++
v2rayN/v2rayN/Mode/Config.cs | 4 ++
v2rayN/v2rayN/Resx/ResUI.Designer.cs | 13 ++++-
v2rayN/v2rayN/Resx/ResUI.resx | 3 ++
v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx | 3 ++
9 files changed, 90 insertions(+), 13 deletions(-)
diff --git a/v2rayN/v2rayN/Forms/MainForm.cs b/v2rayN/v2rayN/Forms/MainForm.cs
index 7b75f1d3..2f2820f8 100644
--- a/v2rayN/v2rayN/Forms/MainForm.cs
+++ b/v2rayN/v2rayN/Forms/MainForm.cs
@@ -83,6 +83,8 @@ namespace v2rayN.Forms
HideForm();
+ AutoUpdateSubscription();
+
}
private void MainForm_FormClosing(object sender, FormClosingEventArgs e)
@@ -1354,6 +1356,18 @@ namespace v2rayN.Forms
(new UpdateHandle()).UpdateSubscriptionProcess(config, _updateUI);
}
+ ///
+ /// If enabled this setting,Then automatic update subscription on start
+ ///
+ private void AutoUpdateSubscription()
+ {
+ if (config.autoUpdateSubscribe)
+ {
+ ShowMsg(UIRes.I18N("StartAutoUpdateSubscribe"));
+ UpdateSubscriptionProcess();
+ }
+ }
+
private void tsbQRCodeSwitch_CheckedChanged(object sender, EventArgs e)
{
bool bShow = tsbQRCodeSwitch.Checked;
diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs b/v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs
index ada27d1b..3646e101 100644
--- a/v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs
+++ b/v2rayN/v2rayN/Forms/OptionSettingForm.Designer.cs
@@ -88,6 +88,7 @@
this.panel2 = new System.Windows.Forms.Panel();
this.btnOK = new System.Windows.Forms.Button();
this.panel1 = new System.Windows.Forms.Panel();
+ this.chkAutoUpdateSubscribe = new System.Windows.Forms.CheckBox();
this.tabControl1.SuspendLayout();
this.tabPage1.SuspendLayout();
this.groupBox1.SuspendLayout();
@@ -373,6 +374,7 @@
//
// tabPage7
//
+ this.tabPage7.Controls.Add(this.chkAutoUpdateSubscribe);
this.tabPage7.Controls.Add(this.txtautoUpdateInterval);
this.tabPage7.Controls.Add(this.label15);
this.tabPage7.Controls.Add(this.chkIgnoreGeoUpdateCore);
@@ -505,6 +507,12 @@
resources.ApplyResources(this.panel1, "panel1");
this.panel1.Name = "panel1";
//
+ // chkAutoUpdateSubscribe
+ //
+ resources.ApplyResources(this.chkAutoUpdateSubscribe, "chkAutoUpdateSubscribe");
+ this.chkAutoUpdateSubscribe.Name = "chkAutoUpdateSubscribe";
+ this.chkAutoUpdateSubscribe.UseVisualStyleBackColor = true;
+ //
// OptionSettingForm
//
resources.ApplyResources(this, "$this");
@@ -595,5 +603,6 @@
private System.Windows.Forms.Label label13;
private System.Windows.Forms.TextBox txtautoUpdateInterval;
private System.Windows.Forms.Label label15;
+ private System.Windows.Forms.CheckBox chkAutoUpdateSubscribe;
}
}
\ No newline at end of file
diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.cs b/v2rayN/v2rayN/Forms/OptionSettingForm.cs
index d104d927..ab247ede 100644
--- a/v2rayN/v2rayN/Forms/OptionSettingForm.cs
+++ b/v2rayN/v2rayN/Forms/OptionSettingForm.cs
@@ -96,6 +96,7 @@ namespace v2rayN.Forms
chkAllowLANConn.Checked = config.allowLANConn;
chkEnableStatistics.Checked = config.enableStatistics;
chkKeepOlderDedupl.Checked = config.keepOlderDedupl;
+ chkAutoUpdateSubscribe.Checked = config.autoUpdateSubscribe;
ComboItem[] cbSource = new ComboItem[]
{
@@ -292,6 +293,7 @@ namespace v2rayN.Forms
config.ignoreGeoUpdateCore = chkIgnoreGeoUpdateCore.Checked;
config.coreType = (ECoreType)cmbCoreType.SelectedIndex;
config.autoUpdateInterval = Utils.ToInt(txtautoUpdateInterval.Text);
+ config.autoUpdateSubscribe = chkAutoUpdateSubscribe.Checked;
return 0;
}
diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.resx b/v2rayN/v2rayN/Forms/OptionSettingForm.resx
index e4be1098..56407efa 100644
--- a/v2rayN/v2rayN/Forms/OptionSettingForm.resx
+++ b/v2rayN/v2rayN/Forms/OptionSettingForm.resx
@@ -1137,6 +1137,36 @@
2
+
+ True
+
+
+ NoControl
+
+
+ 15, 189
+
+
+ 174, 16
+
+
+ 39
+
+
+ Update subscribe on start
+
+
+ chkAutoUpdateSubscribe
+
+
+ System.Windows.Forms.CheckBox, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089
+
+
+ tabPage7
+
+
+ 0
+
325, 156
@@ -1156,7 +1186,7 @@
tabPage7
- 0
+ 1
True
@@ -1186,7 +1216,7 @@
tabPage7
- 1
+ 2
True
@@ -1216,7 +1246,7 @@
tabPage7
- 2
+ 3
v2fly_core
@@ -1243,7 +1273,7 @@
tabPage7
- 3
+ 4
True
@@ -1273,7 +1303,7 @@
tabPage7
- 4
+ 5
True
@@ -1303,7 +1333,7 @@
tabPage7
- 5
+ 6
161, 84
@@ -1324,7 +1354,7 @@
tabPage7
- 6
+ 7
True
@@ -1354,7 +1384,7 @@
tabPage7
- 7
+ 8
True
@@ -1384,7 +1414,7 @@
tabPage7
- 8
+ 9
True
@@ -1411,7 +1441,7 @@
tabPage7
- 9
+ 10
True
@@ -1438,7 +1468,7 @@
tabPage7
- 10
+ 11
4, 22
diff --git a/v2rayN/v2rayN/Forms/OptionSettingForm.zh-Hans.resx b/v2rayN/v2rayN/Forms/OptionSettingForm.zh-Hans.resx
index 7f62c293..47577c62 100644
--- a/v2rayN/v2rayN/Forms/OptionSettingForm.zh-Hans.resx
+++ b/v2rayN/v2rayN/Forms/OptionSettingForm.zh-Hans.resx
@@ -322,4 +322,7 @@
参数设置
+
+ 启动时自动更新订阅
+
\ No newline at end of file
diff --git a/v2rayN/v2rayN/Mode/Config.cs b/v2rayN/v2rayN/Mode/Config.cs
index a8a54cb2..b4f85572 100644
--- a/v2rayN/v2rayN/Mode/Config.cs
+++ b/v2rayN/v2rayN/Mode/Config.cs
@@ -200,6 +200,10 @@ namespace v2rayN.Mode
get; set;
} = 0;
+ public bool autoUpdateSubscribe
+ {
+ get;set;
+ }
#region 函数
public string address()
diff --git a/v2rayN/v2rayN/Resx/ResUI.Designer.cs b/v2rayN/v2rayN/Resx/ResUI.Designer.cs
index 1ad602d9..60bc9e09 100644
--- a/v2rayN/v2rayN/Resx/ResUI.Designer.cs
+++ b/v2rayN/v2rayN/Resx/ResUI.Designer.cs
@@ -47,8 +47,8 @@ namespace v2rayN.Resx {
}
///
- /// 重写当前线程的 CurrentUICulture 属性
- /// 重写当前线程的 CurrentUICulture 属性。
+ /// 重写当前线程的 CurrentUICulture 属性,对
+ /// 使用此强类型资源类的所有资源查找执行重写。
///
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
internal static global::System.Globalization.CultureInfo Culture {
@@ -825,6 +825,15 @@ namespace v2rayN.Resx {
}
}
+ ///
+ /// 查找类似 Start automatic update subscribe 的本地化字符串。
+ ///
+ internal static string StartAutoUpdateSubscribe {
+ get {
+ return ResourceManager.GetString("StartAutoUpdateSubscribe", resourceCulture);
+ }
+ }
+
///
/// 查找类似 PAC failed to start. Run it with Admin right. 的本地化字符串。
///
diff --git a/v2rayN/v2rayN/Resx/ResUI.resx b/v2rayN/v2rayN/Resx/ResUI.resx
index 2dc0c89b..978faaf8 100644
--- a/v2rayN/v2rayN/Resx/ResUI.resx
+++ b/v2rayN/v2rayN/Resx/ResUI.resx
@@ -394,4 +394,7 @@
Informations (Filter : {0})
+
+ Start automatic update subscribe
+
\ No newline at end of file
diff --git a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx b/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx
index ab3d7bb2..dfd9d6dd 100644
--- a/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx
+++ b/v2rayN/v2rayN/Resx/ResUI.zh-Hans.resx
@@ -394,4 +394,7 @@
信息 (过滤器 : {0})
+
+ 自动订阅更新开始
+
\ No newline at end of file