diff --git a/Netch/Forms/MainForm.Designer.cs b/Netch/Forms/MainForm.Designer.cs
index 1bc4c95d..f4de8dcd 100644
--- a/Netch/Forms/MainForm.Designer.cs
+++ b/Netch/Forms/MainForm.Designer.cs
@@ -39,6 +39,7 @@
this.SubscribeToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.ManageSubscribeLinksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.UpdateServersFromSubscribeLinksToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
+ this.UpdateServersFromSubscribeLinksWithProxyToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.OptionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.OpenDirectoryToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.CleanDNSCacheToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
@@ -170,7 +171,8 @@
//
this.SubscribeToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
this.ManageSubscribeLinksToolStripMenuItem,
- this.UpdateServersFromSubscribeLinksToolStripMenuItem});
+ this.UpdateServersFromSubscribeLinksToolStripMenuItem,
+ this.UpdateServersFromSubscribeLinksWithProxyToolStripMenuItem});
this.SubscribeToolStripMenuItem.Margin = new System.Windows.Forms.Padding(0, 0, 0, 1);
this.SubscribeToolStripMenuItem.Name = "SubscribeToolStripMenuItem";
this.SubscribeToolStripMenuItem.Size = new System.Drawing.Size(77, 21);
@@ -190,6 +192,13 @@
this.UpdateServersFromSubscribeLinksToolStripMenuItem.Text = "Update Servers From Subscribe Links";
this.UpdateServersFromSubscribeLinksToolStripMenuItem.Click += new System.EventHandler(this.UpdateServersFromSubscribeLinksToolStripMenuItem_Click);
//
+ // UpdateServersFromSubscribeLinksWithProxyToolStripMenuItem
+ //
+ this.UpdateServersFromSubscribeLinksWithProxyToolStripMenuItem.Name = "UpdateServersFromSubscribeLinksWithProxyToolStripMenuItem";
+ this.UpdateServersFromSubscribeLinksWithProxyToolStripMenuItem.Size = new System.Drawing.Size(294, 22);
+ this.UpdateServersFromSubscribeLinksWithProxyToolStripMenuItem.Text = "Update Servers From Subscribe Links With Proxy";
+ this.UpdateServersFromSubscribeLinksWithProxyToolStripMenuItem.Click += new System.EventHandler(this.UpdateServersFromSubscribeLinksWithProxyToolStripMenuItem_Click);
+ //
// OptionsToolStripMenuItem
//
this.OptionsToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
@@ -800,6 +809,7 @@
private System.Windows.Forms.ToolStripMenuItem UpdateACLToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem updateACLWithProxyToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem UpdateServersFromSubscribeLinksToolStripMenuItem;
+ private System.Windows.Forms.ToolStripMenuItem UpdateServersFromSubscribeLinksWithProxyToolStripMenuItem;
private System.Windows.Forms.ToolStripStatusLabel UploadSpeedLabel;
private System.Windows.Forms.ToolStripStatusLabel UsedBandwidthLabel;
private System.Windows.Forms.ToolStripLabel NewVersionLabel;
diff --git a/Netch/Forms/MainForm.MenuStrip.cs b/Netch/Forms/MainForm.MenuStrip.cs
index 5135dfa2..5bd0e235 100644
--- a/Netch/Forms/MainForm.MenuStrip.cs
+++ b/Netch/Forms/MainForm.MenuStrip.cs
@@ -94,21 +94,24 @@ namespace Netch.Forms
private async void UpdateServersFromSubscribeLinksToolStripMenuItem_Click(object sender, EventArgs e)
{
+ Global.Settings.UseProxyToUpdateSubscription = false;
await UpdateServersFromSubscribe();
}
+ private async void UpdateServersFromSubscribeLinksWithProxyToolStripMenuItem_Click(object sender, EventArgs e)
+ {
+ Global.Settings.UseProxyToUpdateSubscription = true;
+ await UpdateServersFromSubscribe(true);
+ }
- private async Task UpdateServersFromSubscribe()
+ private async Task UpdateServersFromSubscribe(bool useProxy = false)
{
void DisableItems(bool v)
{
MenuStrip.Enabled = ConfigurationGroupBox.Enabled = ProfileGroupBox.Enabled = ControlButton.Enabled = v;
}
- if (Global.Settings.UseProxyToUpdateSubscription && ServerComboBox.SelectedIndex == -1)
- Global.Settings.UseProxyToUpdateSubscription = false;
-
- if (Global.Settings.UseProxyToUpdateSubscription && ServerComboBox.SelectedIndex == -1)
+ if (useProxy && ServerComboBox.SelectedIndex == -1)
{
MessageBoxX.Show(i18N.Translate("Please select a server first"));
return;
@@ -122,11 +125,10 @@ namespace Netch.Forms
StatusText(i18N.Translate("Starting update subscription"));
DisableItems(false);
- var useProxyToUpdateSubscription = Global.Settings.UseProxyToUpdateSubscription;
try
{
string proxyServer = null;
- if (useProxyToUpdateSubscription)
+ if (useProxy)
{
var mode = new Models.Mode
{
@@ -149,8 +151,7 @@ namespace Netch.Forms
}
finally
{
- if (useProxyToUpdateSubscription)
- {
+ if (useProxy)
try
{
await MainController.Stop();
@@ -159,7 +160,6 @@ namespace Netch.Forms
{
// ignored
}
- }
DisableItems(true);
}
@@ -285,7 +285,7 @@ namespace Netch.Forms
{
var req = WebUtil.CreateRequest(Global.Settings.PAC);
- string pac = Path.Combine(Global.NetchDir, "bin\\pac.txt");
+ var pac = Path.Combine(Global.NetchDir, "bin\\pac.txt");
await WebUtil.DownloadFileAsync(req, pac);
@@ -312,9 +312,7 @@ namespace Netch.Forms
await Task.Run(() =>
{
if (NFController.UninstallDriver())
- {
NotifyTip(i18N.TranslateFormat("{0} has been uninstalled", "NF Service"));
- }
});
}
finally
@@ -369,7 +367,7 @@ namespace Netch.Forms
private void fAQToolStripMenuItem_Click(object sender, EventArgs e)
{
- Utils.Utils.Open($"https://netch.org/#/docs/zh-CN/faq");
+ Utils.Utils.Open("https://netch.org/#/docs/zh-CN/faq");
}
#endregion
diff --git a/Netch/Forms/MainForm.cs b/Netch/Forms/MainForm.cs
index cd0b6fad..1f39075e 100644
--- a/Netch/Forms/MainForm.cs
+++ b/Netch/Forms/MainForm.cs
@@ -108,7 +108,7 @@ namespace Netch.Forms
// 检查订阅更新
if (Global.Settings.UpdateSubscribeatWhenOpened)
{
- await UpdateServersFromSubscribe();
+ await UpdateServersFromSubscribe(Global.Settings.UseProxyToUpdateSubscription);
}
});
}
diff --git a/Netch/Forms/SubscribeForm.Designer.cs b/Netch/Forms/SubscribeForm.Designer.cs
index b8c8d3bb..c15c0789 100644
--- a/Netch/Forms/SubscribeForm.Designer.cs
+++ b/Netch/Forms/SubscribeForm.Designer.cs
@@ -48,13 +48,10 @@
this.DeleteToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.deleteServerToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.CopyLinkToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
- this.UseSelectedServerCheckBox = new System.Windows.Forms.CheckBox();
this.MainTableLayoutPanel = new System.Windows.Forms.TableLayoutPanel();
- this.ControlsPanel = new System.Windows.Forms.Panel();
this.AddSubscriptionBox.SuspendLayout();
this.pContextMenuStrip.SuspendLayout();
this.MainTableLayoutPanel.SuspendLayout();
- this.ControlsPanel.SuspendLayout();
this.SuspendLayout();
//
// AddSubscriptionBox
@@ -68,9 +65,9 @@
this.AddSubscriptionBox.Controls.Add(this.RemarkTextBox);
this.AddSubscriptionBox.Controls.Add(this.RemarkLabel);
this.AddSubscriptionBox.Dock = System.Windows.Forms.DockStyle.Fill;
- this.AddSubscriptionBox.Location = new System.Drawing.Point(8, 214);
+ this.AddSubscriptionBox.Location = new System.Drawing.Point(8, 248);
this.AddSubscriptionBox.Name = "AddSubscriptionBox";
- this.AddSubscriptionBox.Size = new System.Drawing.Size(668, 141);
+ this.AddSubscriptionBox.Size = new System.Drawing.Size(668, 135);
this.AddSubscriptionBox.TabIndex = 1;
this.AddSubscriptionBox.TabStop = false;
//
@@ -156,7 +153,7 @@
this.SubscribeLinkListView.Location = new System.Drawing.Point(8, 8);
this.SubscribeLinkListView.MultiSelect = false;
this.SubscribeLinkListView.Name = "SubscribeLinkListView";
- this.SubscribeLinkListView.Size = new System.Drawing.Size(668, 200);
+ this.SubscribeLinkListView.Size = new System.Drawing.Size(668, 234);
this.SubscribeLinkListView.TabIndex = 0;
this.SubscribeLinkListView.UseCompatibleStateImageBehavior = false;
this.SubscribeLinkListView.View = System.Windows.Forms.View.Details;
@@ -213,44 +210,23 @@
this.CopyLinkToolStripMenuItem.Text = "CopyLink";
this.CopyLinkToolStripMenuItem.Click += new System.EventHandler(this.CopyLinkToolStripMenuItem_Click);
//
- // UseSelectedServerCheckBox
- //
- this.UseSelectedServerCheckBox.AutoSize = true;
- this.UseSelectedServerCheckBox.Location = new System.Drawing.Point(3, 4);
- this.UseSelectedServerCheckBox.Name = "UseSelectedServerCheckBox";
- this.UseSelectedServerCheckBox.Size = new System.Drawing.Size(285, 21);
- this.UseSelectedServerCheckBox.TabIndex = 9;
- this.UseSelectedServerCheckBox.Text = "Use Selected Server To Update Subscription";
- this.UseSelectedServerCheckBox.UseVisualStyleBackColor = true;
- //
// MainTableLayoutPanel
//
this.MainTableLayoutPanel.ColumnCount = 1;
this.MainTableLayoutPanel.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.MainTableLayoutPanel.Controls.Add(this.SubscribeLinkListView, 0, 0);
this.MainTableLayoutPanel.Controls.Add(this.AddSubscriptionBox, 0, 1);
- this.MainTableLayoutPanel.Controls.Add(this.ControlsPanel, 0, 2);
this.MainTableLayoutPanel.Dock = System.Windows.Forms.DockStyle.Fill;
this.MainTableLayoutPanel.Location = new System.Drawing.Point(0, 0);
this.MainTableLayoutPanel.Name = "MainTableLayoutPanel";
this.MainTableLayoutPanel.Padding = new System.Windows.Forms.Padding(5);
- this.MainTableLayoutPanel.RowCount = 3;
- this.MainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 58.35777F));
- this.MainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 41.64223F));
+ this.MainTableLayoutPanel.RowCount = 2;
+ this.MainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 62.99213F));
+ this.MainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 37.00787F));
this.MainTableLayoutPanel.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 27F));
this.MainTableLayoutPanel.Size = new System.Drawing.Size(684, 391);
this.MainTableLayoutPanel.TabIndex = 11;
//
- // ControlsPanel
- //
- this.ControlsPanel.Controls.Add(this.UseSelectedServerCheckBox);
- this.ControlsPanel.Dock = System.Windows.Forms.DockStyle.Fill;
- this.ControlsPanel.Location = new System.Drawing.Point(5, 358);
- this.ControlsPanel.Margin = new System.Windows.Forms.Padding(0);
- this.ControlsPanel.Name = "ControlsPanel";
- this.ControlsPanel.Size = new System.Drawing.Size(674, 28);
- this.ControlsPanel.TabIndex = 2;
- //
// SubscribeForm
//
this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F);
@@ -270,13 +246,10 @@
this.AddSubscriptionBox.PerformLayout();
this.pContextMenuStrip.ResumeLayout(false);
this.MainTableLayoutPanel.ResumeLayout(false);
- this.ControlsPanel.ResumeLayout(false);
- this.ControlsPanel.PerformLayout();
this.ResumeLayout(false);
}
private System.Windows.Forms.ColumnHeader EnableColumnHeader;
- private System.Windows.Forms.Panel ControlsPanel;
private System.Windows.Forms.TableLayoutPanel MainTableLayoutPanel;
private System.Windows.Forms.Button UnselectButton;
private System.Windows.Forms.GroupBox AddSubscriptionBox;
@@ -294,7 +267,6 @@
private System.Windows.Forms.Label UserAgentLabel;
private System.Windows.Forms.TextBox UserAgentTextBox;
private System.Windows.Forms.ColumnHeader UserAgentHeader;
- private System.Windows.Forms.CheckBox UseSelectedServerCheckBox;
#endregion
diff --git a/Netch/Forms/SubscribeForm.cs b/Netch/Forms/SubscribeForm.cs
index 99434418..59c6cc47 100644
--- a/Netch/Forms/SubscribeForm.cs
+++ b/Netch/Forms/SubscribeForm.cs
@@ -8,6 +8,16 @@ namespace Netch.Forms
{
public partial class SubscribeForm : Form
{
+ public SubscribeForm()
+ {
+ InitializeComponent();
+
+ i18N.TranslateForm(this);
+ i18N.TranslateForm(pContextMenuStrip);
+
+ InitSubscribeLink();
+ }
+
private int SelectedIndex
{
get
@@ -19,33 +29,17 @@ namespace Netch.Forms
}
}
- public SubscribeForm()
- {
- InitializeComponent();
- i18N.TranslateForm(this);
- i18N.TranslateForm(pContextMenuStrip);
-
- UseSelectedServerCheckBox.Enabled = Global.Settings.Server.Any();
- UseSelectedServerCheckBox.Checked = Global.Settings.Server.Any() && Global.Settings.UseProxyToUpdateSubscription;
-
- InitSubscribeLink();
- }
-
#region EventHandler
private void SubscribeLinkListView_MouseUp(object sender, MouseEventArgs e)
{
if (e.Button == MouseButtons.Right)
- {
if (SelectedIndex != -1)
- {
pContextMenuStrip.Show(SubscribeLinkListView, e.Location);
- }
- }
}
///
- /// 选中/取消选中
+ /// 选中/取消选中
///
private void SubscribeLinkListView_SelectedIndexChanged(object sender, EventArgs e)
{
@@ -53,7 +47,7 @@ namespace Netch.Forms
}
///
- /// 订阅启/禁用
+ /// 订阅启/禁用
///
private void SubscribeLinkListView_ItemChecked(object sender, ItemCheckedEventArgs e)
{
@@ -63,7 +57,6 @@ namespace Netch.Forms
private void SubscribeForm_FormClosing(object sender, FormClosingEventArgs e)
{
- Global.Settings.UseProxyToUpdateSubscription = UseSelectedServerCheckBox.Checked;
Configuration.Save();
}
@@ -168,9 +161,7 @@ namespace Netch.Forms
private static void RenameServers(string oldGroup, string newGroup)
{
foreach (var server in Global.Settings.Server.Where(server => server.Group == oldGroup))
- {
server.Group = newGroup;
- }
}
private void InitSubscribeLink()
@@ -178,7 +169,6 @@ namespace Netch.Forms
SubscribeLinkListView.Items.Clear();
foreach (var item in Global.Settings.SubscribeLink)
- {
SubscribeLinkListView.Items.Add(new ListViewItem(new[]
{
"",
@@ -189,7 +179,6 @@ namespace Netch.Forms
{
Checked = item.Enable
});
- }
ResetEditingGroup();
}
diff --git a/Netch/Resources/zh-CN b/Netch/Resources/zh-CN
index 41510b6a..45c1a905 100644
--- a/Netch/Resources/zh-CN
+++ b/Netch/Resources/zh-CN
@@ -66,6 +66,7 @@
"Subscribe": "订阅",
"Manage Subscribe Links": "管理订阅链接",
"Update Servers From Subscribe Links": "从订阅链接更新服务器",
+ "Update Servers From Subscribe Links With Proxy": "使用代理从订阅链接更新服务器",
"No subscription link": "没有任何一条订阅链接",
"Updating {0}": "正在更新 {0}",
"Update {1} server(s) from {0}": "从 {0} 更新 {1} 个服务器",