diff --git a/shadowsocks-csharp/Data/cn.txt b/shadowsocks-csharp/Data/cn.txt index ef095c1c..024336d2 100644 --- a/shadowsocks-csharp/Data/cn.txt +++ b/shadowsocks-csharp/Data/cn.txt @@ -213,6 +213,7 @@ URL=网址 Group name=组名 Last Update=最近更新 Auto update=自动更新 +Filter Text=排除关键词 # Messages diff --git a/shadowsocks-csharp/Model/Configuration.cs b/shadowsocks-csharp/Model/Configuration.cs index 843f0f02..00d89ad3 100755 --- a/shadowsocks-csharp/Model/Configuration.cs +++ b/shadowsocks-csharp/Model/Configuration.cs @@ -71,6 +71,7 @@ public class ServerSubscribe public string URL = DEFAULT_FEED_URL; public string Group; + public string FilterText; public UInt64 LastUpdateTime; } diff --git a/shadowsocks-csharp/View/MenuViewController.cs b/shadowsocks-csharp/View/MenuViewController.cs index 0107c32b..58b18c1c 100755 --- a/shadowsocks-csharp/View/MenuViewController.cs +++ b/shadowsocks-csharp/View/MenuViewController.cs @@ -452,6 +452,12 @@ void updateFreeNodeChecker_NewFreeNodeFound(object sender, EventArgs e) { urls.Add(selected_server.GetSSRLinkForServer()); } } + //排除关键词 + string filterText = updateFreeNodeChecker.subscribeTask.FilterText; + string[] filter_texts = { }; + if (!String.IsNullOrEmpty(filterText)) { + filter_texts = filterText.Split(','); + } // import all, find difference { @@ -477,6 +483,20 @@ void updateFreeNodeChecker_NewFreeNodeFound(object sender, EventArgs e) { } } old_insert_servers[server.id] = server; + //排除关键词 + if (filter_texts.Length > 0) + { + foreach (string filter_text in filter_texts) + { + if (server.remarks.Contains(filter_text)) + { + match = true; + Logging.Log(LogLevel.Debug, "server will be remove:" + server.remarks); + break; + } + } + } + // if (!match) { foreach (KeyValuePair pair in old_servers) { if (server.isMatchServer(pair.Value)) { diff --git a/shadowsocks-csharp/View/SubscribeForm.Designer.cs b/shadowsocks-csharp/View/SubscribeForm.Designer.cs index 2b2fc026..a680cea9 100644 --- a/shadowsocks-csharp/View/SubscribeForm.Designer.cs +++ b/shadowsocks-csharp/View/SubscribeForm.Designer.cs @@ -44,6 +44,8 @@ private void InitializeComponent() this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); this.buttonAdd = new System.Windows.Forms.Button(); this.buttonDel = new System.Windows.Forms.Button(); + this.label4 = new System.Windows.Forms.Label(); + this.textBoxFilter = new System.Windows.Forms.TextBox(); this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); this.tableLayoutPanel3.SuspendLayout(); @@ -56,30 +58,31 @@ private void InitializeComponent() this.tableLayoutPanel1.ColumnCount = 2; this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.Controls.Add(this.label4, 0, 3); this.tableLayoutPanel1.Controls.Add(this.label1, 0, 0); this.tableLayoutPanel1.Controls.Add(this.label2, 0, 1); this.tableLayoutPanel1.Controls.Add(this.textBoxURL, 1, 0); this.tableLayoutPanel1.Controls.Add(this.textBoxGroup, 1, 1); this.tableLayoutPanel1.Controls.Add(this.label3, 0, 2); this.tableLayoutPanel1.Controls.Add(this.textUpdate, 1, 2); - this.tableLayoutPanel1.Location = new System.Drawing.Point(529, 4); - this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tableLayoutPanel1.Controls.Add(this.textBoxFilter, 1, 3); + this.tableLayoutPanel1.Location = new System.Drawing.Point(440, 3); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 3; + this.tableLayoutPanel1.RowCount = 4; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.Size = new System.Drawing.Size(391, 102); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.Size = new System.Drawing.Size(338, 124); this.tableLayoutPanel1.TabIndex = 0; // // label1 // this.label1.Anchor = System.Windows.Forms.AnchorStyles.Right; this.label1.AutoSize = true; - this.label1.Location = new System.Drawing.Point(60, 7); - this.label1.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label1.Location = new System.Drawing.Point(67, 8); this.label1.Name = "label1"; - this.label1.Size = new System.Drawing.Size(42, 20); + this.label1.Size = new System.Drawing.Size(31, 15); this.label1.TabIndex = 0; this.label1.Text = "URL"; // @@ -87,57 +90,51 @@ private void InitializeComponent() // this.label2.Anchor = System.Windows.Forms.AnchorStyles.Right; this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(4, 41); - this.label2.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label2.Location = new System.Drawing.Point(11, 39); this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(98, 20); + this.label2.Size = new System.Drawing.Size(87, 15); this.label2.TabIndex = 0; this.label2.Text = "Group name"; // // textBoxURL // - this.textBoxURL.Location = new System.Drawing.Point(110, 4); - this.textBoxURL.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.textBoxURL.Location = new System.Drawing.Point(104, 3); this.textBoxURL.Name = "textBoxURL"; - this.textBoxURL.Size = new System.Drawing.Size(277, 26); + this.textBoxURL.Size = new System.Drawing.Size(231, 25); this.textBoxURL.TabIndex = 1; // // textBoxGroup // - this.textBoxGroup.Location = new System.Drawing.Point(110, 38); - this.textBoxGroup.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.textBoxGroup.Location = new System.Drawing.Point(104, 34); this.textBoxGroup.Name = "textBoxGroup"; this.textBoxGroup.ReadOnly = true; - this.textBoxGroup.Size = new System.Drawing.Size(277, 26); + this.textBoxGroup.Size = new System.Drawing.Size(231, 25); this.textBoxGroup.TabIndex = 1; // // label3 // this.label3.Anchor = System.Windows.Forms.AnchorStyles.Right; this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(5, 75); - this.label3.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); + this.label3.Location = new System.Drawing.Point(3, 70); this.label3.Name = "label3"; - this.label3.Size = new System.Drawing.Size(97, 20); + this.label3.Size = new System.Drawing.Size(95, 15); this.label3.TabIndex = 0; this.label3.Text = "Last Update"; // // textUpdate // - this.textUpdate.Location = new System.Drawing.Point(110, 72); - this.textUpdate.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.textUpdate.Location = new System.Drawing.Point(104, 65); this.textUpdate.Name = "textUpdate"; this.textUpdate.ReadOnly = true; - this.textUpdate.Size = new System.Drawing.Size(277, 26); + this.textUpdate.Size = new System.Drawing.Size(231, 25); this.textUpdate.TabIndex = 1; // // checkBoxAutoUpdate // this.checkBoxAutoUpdate.AutoSize = true; - this.checkBoxAutoUpdate.Location = new System.Drawing.Point(4, 52); - this.checkBoxAutoUpdate.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.checkBoxAutoUpdate.Location = new System.Drawing.Point(3, 43); this.checkBoxAutoUpdate.Name = "checkBoxAutoUpdate"; - this.checkBoxAutoUpdate.Size = new System.Drawing.Size(123, 24); + this.checkBoxAutoUpdate.Size = new System.Drawing.Size(117, 19); this.checkBoxAutoUpdate.TabIndex = 3; this.checkBoxAutoUpdate.Text = "Auto update"; this.checkBoxAutoUpdate.UseVisualStyleBackColor = true; @@ -150,21 +147,19 @@ private void InitializeComponent() this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel2.Controls.Add(this.buttonOK, 0, 0); this.tableLayoutPanel2.Controls.Add(this.buttonCancel, 1, 0); - this.tableLayoutPanel2.Location = new System.Drawing.Point(529, 396); - this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tableLayoutPanel2.Location = new System.Drawing.Point(441, 330); this.tableLayoutPanel2.Name = "tableLayoutPanel2"; this.tableLayoutPanel2.RowCount = 1; this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel2.Size = new System.Drawing.Size(435, 90); + this.tableLayoutPanel2.Size = new System.Drawing.Size(362, 75); this.tableLayoutPanel2.TabIndex = 2; // // buttonOK // this.buttonOK.Anchor = System.Windows.Forms.AnchorStyles.None; - this.buttonOK.Location = new System.Drawing.Point(32, 16); - this.buttonOK.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.buttonOK.Location = new System.Drawing.Point(27, 13); this.buttonOK.Name = "buttonOK"; - this.buttonOK.Size = new System.Drawing.Size(153, 58); + this.buttonOK.Size = new System.Drawing.Size(127, 48); this.buttonOK.TabIndex = 0; this.buttonOK.Text = "OK"; this.buttonOK.UseVisualStyleBackColor = true; @@ -173,10 +168,9 @@ private void InitializeComponent() // buttonCancel // this.buttonCancel.Anchor = System.Windows.Forms.AnchorStyles.None; - this.buttonCancel.Location = new System.Drawing.Point(249, 16); - this.buttonCancel.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.buttonCancel.Location = new System.Drawing.Point(208, 13); this.buttonCancel.Name = "buttonCancel"; - this.buttonCancel.Size = new System.Drawing.Size(153, 58); + this.buttonCancel.Size = new System.Drawing.Size(127, 48); this.buttonCancel.TabIndex = 0; this.buttonCancel.Text = "Cancel"; this.buttonCancel.UseVisualStyleBackColor = true; @@ -191,23 +185,21 @@ private void InitializeComponent() this.tableLayoutPanel3.Controls.Add(this.tableLayoutPanel2, 1, 1); this.tableLayoutPanel3.Controls.Add(this.listServerSubscribe, 0, 0); this.tableLayoutPanel3.Controls.Add(this.tableLayoutPanel4, 0, 1); - this.tableLayoutPanel3.Location = new System.Drawing.Point(18, 18); - this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tableLayoutPanel3.Location = new System.Drawing.Point(15, 15); this.tableLayoutPanel3.Name = "tableLayoutPanel3"; this.tableLayoutPanel3.RowCount = 2; this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 78.59327F)); this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 21.40673F)); - this.tableLayoutPanel3.Size = new System.Drawing.Size(969, 490); + this.tableLayoutPanel3.Size = new System.Drawing.Size(807, 408); this.tableLayoutPanel3.TabIndex = 1; // // listServerSubscribe // this.listServerSubscribe.FormattingEnabled = true; - this.listServerSubscribe.ItemHeight = 20; - this.listServerSubscribe.Location = new System.Drawing.Point(4, 4); - this.listServerSubscribe.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.listServerSubscribe.ItemHeight = 15; + this.listServerSubscribe.Location = new System.Drawing.Point(3, 3); this.listServerSubscribe.Name = "listServerSubscribe"; - this.listServerSubscribe.Size = new System.Drawing.Size(512, 364); + this.listServerSubscribe.Size = new System.Drawing.Size(427, 304); this.listServerSubscribe.TabIndex = 4; this.listServerSubscribe.SelectedIndexChanged += new System.EventHandler(this.listServerSubscribe_SelectedIndexChanged); // @@ -219,22 +211,20 @@ private void InitializeComponent() this.tableLayoutPanel4.Controls.Add(this.checkBoxAutoUpdate, 0, 1); this.tableLayoutPanel4.Controls.Add(this.buttonAdd, 0, 0); this.tableLayoutPanel4.Controls.Add(this.buttonDel, 1, 0); - this.tableLayoutPanel4.Location = new System.Drawing.Point(4, 389); - this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 323); this.tableLayoutPanel4.Name = "tableLayoutPanel4"; this.tableLayoutPanel4.RowCount = 2; this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F)); - this.tableLayoutPanel4.Size = new System.Drawing.Size(514, 97); + this.tableLayoutPanel4.Size = new System.Drawing.Size(428, 81); this.tableLayoutPanel4.TabIndex = 5; // // buttonAdd // this.buttonAdd.Anchor = System.Windows.Forms.AnchorStyles.Right; - this.buttonAdd.Location = new System.Drawing.Point(141, 7); - this.buttonAdd.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.buttonAdd.Location = new System.Drawing.Point(118, 6); this.buttonAdd.Name = "buttonAdd"; - this.buttonAdd.Size = new System.Drawing.Size(112, 34); + this.buttonAdd.Size = new System.Drawing.Size(93, 28); this.buttonAdd.TabIndex = 0; this.buttonAdd.Text = "&Add"; this.buttonAdd.UseVisualStyleBackColor = true; @@ -243,24 +233,39 @@ private void InitializeComponent() // buttonDel // this.buttonDel.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.buttonDel.Location = new System.Drawing.Point(261, 7); - this.buttonDel.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.buttonDel.Location = new System.Drawing.Point(217, 6); this.buttonDel.Name = "buttonDel"; - this.buttonDel.Size = new System.Drawing.Size(112, 34); + this.buttonDel.Size = new System.Drawing.Size(93, 28); this.buttonDel.TabIndex = 1; this.buttonDel.Text = "&Delete"; this.buttonDel.UseVisualStyleBackColor = true; this.buttonDel.Click += new System.EventHandler(this.buttonDel_Click); // + // label4 + // + this.label4.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.label4.AutoSize = true; + this.label4.Location = new System.Drawing.Point(3, 101); + this.label4.Name = "label4"; + this.label4.Size = new System.Drawing.Size(95, 15); + this.label4.TabIndex = 2; + this.label4.Text = "Filter Text"; + // + // textBoxFilter + // + this.textBoxFilter.Location = new System.Drawing.Point(104, 96); + this.textBoxFilter.Name = "textBoxFilter"; + this.textBoxFilter.Size = new System.Drawing.Size(231, 25); + this.textBoxFilter.TabIndex = 1; + // // SubscribeForm // - this.AutoScaleDimensions = new System.Drawing.SizeF(144F, 144F); + this.AutoScaleDimensions = new System.Drawing.SizeF(120F, 120F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; this.AutoSize = true; this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.ClientSize = new System.Drawing.Size(1022, 546); + this.ClientSize = new System.Drawing.Size(852, 455); this.Controls.Add(this.tableLayoutPanel3); - this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.Name = "SubscribeForm"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Subscribe Settings"; @@ -294,5 +299,7 @@ private void InitializeComponent() private System.Windows.Forms.Button buttonDel; private System.Windows.Forms.Label label3; private System.Windows.Forms.TextBox textUpdate; + private System.Windows.Forms.Label label4; + private System.Windows.Forms.TextBox textBoxFilter; } } \ No newline at end of file diff --git a/shadowsocks-csharp/View/SubscribeForm.cs b/shadowsocks-csharp/View/SubscribeForm.cs index 5d82a0a4..60d6aa2e 100644 --- a/shadowsocks-csharp/View/SubscribeForm.cs +++ b/shadowsocks-csharp/View/SubscribeForm.cs @@ -41,6 +41,7 @@ private void UpdateTexts() buttonOK.Text = I18N.GetString("OK"); buttonCancel.Text = I18N.GetString("Cancel"); label3.Text = I18N.GetString("Last Update"); + label4.Text = I18N.GetString("Filter Text"); } private void SubscribeForm_FormClosed(object sender, FormClosedEventArgs e) @@ -124,6 +125,7 @@ private void UpdateSelected(int index) ServerSubscribe ss = _modifiedConfiguration.serverSubscribes[index]; textBoxURL.Text = ss.URL; textBoxGroup.Text = ss.Group; + textBoxFilter.Text = ss.FilterText; _old_select_index = index; if (ss.LastUpdateTime != 0) { @@ -149,6 +151,7 @@ private void SaveSelected(int index) ss.Group = ""; ss.LastUpdateTime = 0; } + ss.FilterText = textBoxFilter.Text; } }