From a74c5358bcc7df836d1bf883bc956f775341e41f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=95=C3=85=C3=80=C3=9A?= Date: Mon, 17 Aug 2015 08:50:58 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E6=9B=B4=E6=96=B0=E6=9C=8D?= =?UTF-8?q?=E5=8A=A1=E5=99=A8=E5=8A=9F=E8=83=BD=EF=BC=8C=E8=87=AA=E5=8A=A8?= =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=9C=8D=E5=8A=A1=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../Controller/Service/UpdateServer.cs | 62 +++ shadowsocks-csharp/Data/cn.txt | 4 +- shadowsocks-csharp/View/ConfigForm.Designer.cs | 13 + shadowsocks-csharp/View/ConfigForm.Designer.cs.bak | 459 +++++++++++++++++++++ shadowsocks-csharp/View/ConfigForm.cs | 11 +- shadowsocks-csharp/shadowsocks-csharp.csproj | 1 + shadowsocks-csharp/shadowsocks-csharp.csproj.bak | 262 ++++++++++++ 7 files changed, 810 insertions(+), 2 deletions(-) create mode 100644 shadowsocks-csharp/Controller/Service/UpdateServer.cs create mode 100644 shadowsocks-csharp/View/ConfigForm.Designer.cs.bak create mode 100644 shadowsocks-csharp/shadowsocks-csharp.csproj.bak diff --git a/shadowsocks-csharp/Controller/Service/UpdateServer.cs b/shadowsocks-csharp/Controller/Service/UpdateServer.cs new file mode 100644 index 00000000..ab35f92d --- /dev/null +++ b/shadowsocks-csharp/Controller/Service/UpdateServer.cs @@ -0,0 +1,62 @@ +using Shadowsocks.Model; +using System; +using System.Collections.Generic; +using System.Net; +using System.Text.RegularExpressions; + +namespace Shadowsocks.Controller +{ + public class UpdateServer + { + private WebClient http; + private List servers; + public UpdateServer(Configuration config) + { + http = new WebClient(); + http.Headers.Add("User-Agent", "Mozilla/5.0 (Windows NT 5.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/35.0.3319.102 Safari/537.36"); + //http.Proxy = new WebProxy(IPAddress.Loopback.ToString(), config.localPort); + servers = new List(); + } + + public List updateServerData() + { + byte[] bytes = http.DownloadData("http://www.ishadowsocks.com/"); + string str = System.Text.Encoding.GetEncoding("utf-8").GetString(bytes); + MatchCollection mc = Regex.Matches(str, @"
\s*(

.*?

\s*)+
"); + + foreach (Match match in mc) + { + string serverStr = match.ToString(); + MatchCollection serverMc = Regex.Matches(serverStr, @"

(.*?)

"); + Server server = Configuration.GetDefaultServer(); + foreach (Match m in serverMc) + { + string value = m.Groups[1].Value; + string[] values = value.Split(':'); + if (values.Length == 2) + { + if (values[0].Contains("服务器地址")) + { + server.remarks = values[0]; + server.server = values[1]; + } + if (values[0].Contains("端口")) + { + server.server_port = Convert.ToInt32(values[1]); + } + if (values[0].Contains("密码") && !values[0].Contains("注意")) + { + server.password = values[1]; + } + if (values[0].Contains("加密方式")) + { + server.method = values[1]; + servers.Add(server); + } + } + } + } + return servers; + } + } +} diff --git a/shadowsocks-csharp/Data/cn.txt b/shadowsocks-csharp/Data/cn.txt index b4c7a6ee..19255df0 100644 --- a/shadowsocks-csharp/Data/cn.txt +++ b/shadowsocks-csharp/Data/cn.txt @@ -75,4 +75,6 @@ No QRCode found. Try to zoom in or move it to the center of the screen.=未发 Failed to decode QRCode=无法解析二维码 Failed to update registry=无法修改注册表 System Proxy On: =系统代理已启用: -Running: Port {0}=正在运行:端口 {0} \ No newline at end of file +Running: Port {0}=正在运行:端口 {0} +Update Server=更新服务器 +update server sucess=更新服务器信息成功 \ No newline at end of file diff --git a/shadowsocks-csharp/View/ConfigForm.Designer.cs b/shadowsocks-csharp/View/ConfigForm.Designer.cs index 83dae64a..536bf11f 100755 --- a/shadowsocks-csharp/View/ConfigForm.Designer.cs +++ b/shadowsocks-csharp/View/ConfigForm.Designer.cs @@ -52,6 +52,7 @@ this.ProxyPortLabel = new System.Windows.Forms.Label(); this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); + this.updateServerButton = new System.Windows.Forms.Button(); this.tableLayoutPanel1.SuspendLayout(); this.ServerGroupBox.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); @@ -300,6 +301,7 @@ this.tableLayoutPanel2.Controls.Add(this.ServersListBox, 0, 0); this.tableLayoutPanel2.Controls.Add(this.ServerGroupBox, 1, 0); this.tableLayoutPanel2.Controls.Add(this.tableLayoutPanel4, 0, 1); + this.tableLayoutPanel2.Controls.Add(this.updateServerButton, 0, 2); this.tableLayoutPanel2.Location = new System.Drawing.Point(12, 12); this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel2.Name = "tableLayoutPanel2"; @@ -391,6 +393,16 @@ this.tableLayoutPanel4.Size = new System.Drawing.Size(166, 32); this.tableLayoutPanel4.TabIndex = 8; // + // updateServer + // + this.updateServerButton.Location = new System.Drawing.Point(3, 214); + this.updateServerButton.Name = "updateServer"; + this.updateServerButton.Size = new System.Drawing.Size(108, 23); + this.updateServerButton.TabIndex = 10; + this.updateServerButton.Text = "Update Server"; + this.updateServerButton.UseVisualStyleBackColor = true; + this.updateServerButton.Click += new System.EventHandler(this.updateServer_Click); + // // ConfigForm // this.AcceptButton = this.OKButton; @@ -453,6 +465,7 @@ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel5; private System.Windows.Forms.TextBox ProxyPortTextBox; private System.Windows.Forms.Label ProxyPortLabel; + private System.Windows.Forms.Button updateServerButton; } } diff --git a/shadowsocks-csharp/View/ConfigForm.Designer.cs.bak b/shadowsocks-csharp/View/ConfigForm.Designer.cs.bak new file mode 100644 index 00000000..6a899419 --- /dev/null +++ b/shadowsocks-csharp/View/ConfigForm.Designer.cs.bak @@ -0,0 +1,459 @@ +namespace Shadowsocks.View +{ + partial class ConfigForm + { + /// + /// 必需的设计器变量。 + /// + private System.ComponentModel.IContainer components = null; + + /// + /// 清理所有正在使用的资源。 + /// + /// 如果应释放托管资源,为 true;否则为 false。 + protected override void Dispose(bool disposing) + { + if (disposing && (components != null)) + { + components.Dispose(); + } + base.Dispose(disposing); + } + + #region Windows 窗体设计器生成的代码 + + /// + /// 设计器支持所需的方法 - 不要 + /// 使用代码编辑器修改此方法的内容。 + /// + private void InitializeComponent() + { + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.RemarksTextBox = new System.Windows.Forms.TextBox(); + this.RemarksLabel = new System.Windows.Forms.Label(); + this.IPLabel = new System.Windows.Forms.Label(); + this.ServerPortLabel = new System.Windows.Forms.Label(); + this.PasswordLabel = new System.Windows.Forms.Label(); + this.IPTextBox = new System.Windows.Forms.TextBox(); + this.ServerPortTextBox = new System.Windows.Forms.TextBox(); + this.PasswordTextBox = new System.Windows.Forms.TextBox(); + this.EncryptionLabel = new System.Windows.Forms.Label(); + this.EncryptionSelect = new System.Windows.Forms.ComboBox(); + this.panel2 = new System.Windows.Forms.Panel(); + this.OKButton = new System.Windows.Forms.Button(); + this.MyCancelButton = new System.Windows.Forms.Button(); + this.DeleteButton = new System.Windows.Forms.Button(); + this.AddButton = new System.Windows.Forms.Button(); + this.ServerGroupBox = new System.Windows.Forms.GroupBox(); + this.ServersListBox = new System.Windows.Forms.ListBox(); + this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); + this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel(); + this.ProxyPortTextBox = new System.Windows.Forms.TextBox(); + this.ProxyPortLabel = new System.Windows.Forms.Label(); + this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); + this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); + this.updateServerButton = new System.Windows.Forms.Button(); + this.tableLayoutPanel1.SuspendLayout(); + this.ServerGroupBox.SuspendLayout(); + this.tableLayoutPanel2.SuspendLayout(); + this.tableLayoutPanel5.SuspendLayout(); + this.tableLayoutPanel3.SuspendLayout(); + this.tableLayoutPanel4.SuspendLayout(); + this.SuspendLayout(); + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.AutoSize = true; + this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + 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.RemarksTextBox, 1, 5); + this.tableLayoutPanel1.Controls.Add(this.RemarksLabel, 0, 5); + this.tableLayoutPanel1.Controls.Add(this.IPLabel, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.ServerPortLabel, 0, 1); + this.tableLayoutPanel1.Controls.Add(this.PasswordLabel, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.IPTextBox, 1, 0); + this.tableLayoutPanel1.Controls.Add(this.ServerPortTextBox, 1, 1); + this.tableLayoutPanel1.Controls.Add(this.PasswordTextBox, 1, 2); + this.tableLayoutPanel1.Controls.Add(this.EncryptionLabel, 0, 3); + this.tableLayoutPanel1.Controls.Add(this.EncryptionSelect, 1, 3); + this.tableLayoutPanel1.Location = new System.Drawing.Point(8, 21); + this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(3); + this.tableLayoutPanel1.RowCount = 6; + 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.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(238, 137); + this.tableLayoutPanel1.TabIndex = 0; + // + // RemarksTextBox + // + this.RemarksTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.RemarksTextBox.Location = new System.Drawing.Point(72, 111); + this.RemarksTextBox.MaxLength = 32; + this.RemarksTextBox.Name = "RemarksTextBox"; + this.RemarksTextBox.Size = new System.Drawing.Size(160, 20); + this.RemarksTextBox.TabIndex = 10; + this.RemarksTextBox.WordWrap = false; + // + // RemarksLabel + // + this.RemarksLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.RemarksLabel.AutoSize = true; + this.RemarksLabel.Location = new System.Drawing.Point(17, 114); + this.RemarksLabel.Name = "RemarksLabel"; + this.RemarksLabel.Size = new System.Drawing.Size(49, 13); + this.RemarksLabel.TabIndex = 9; + this.RemarksLabel.Text = "Remarks"; + // + // IPLabel + // + this.IPLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.IPLabel.AutoSize = true; + this.IPLabel.Location = new System.Drawing.Point(15, 9); + this.IPLabel.Name = "IPLabel"; + this.IPLabel.Size = new System.Drawing.Size(51, 13); + this.IPLabel.TabIndex = 0; + this.IPLabel.Text = "Server IP"; + // + // ServerPortLabel + // + this.ServerPortLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.ServerPortLabel.AutoSize = true; + this.ServerPortLabel.Location = new System.Drawing.Point(6, 35); + this.ServerPortLabel.Name = "ServerPortLabel"; + this.ServerPortLabel.Size = new System.Drawing.Size(60, 13); + this.ServerPortLabel.TabIndex = 1; + this.ServerPortLabel.Text = "Server Port"; + // + // PasswordLabel + // + this.PasswordLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.PasswordLabel.AutoSize = true; + this.PasswordLabel.Location = new System.Drawing.Point(13, 61); + this.PasswordLabel.Name = "PasswordLabel"; + this.PasswordLabel.Size = new System.Drawing.Size(53, 13); + this.PasswordLabel.TabIndex = 2; + this.PasswordLabel.Text = "Password"; + // + // IPTextBox + // + this.IPTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.IPTextBox.Location = new System.Drawing.Point(72, 6); + this.IPTextBox.MaxLength = 512; + this.IPTextBox.Name = "IPTextBox"; + this.IPTextBox.Size = new System.Drawing.Size(160, 20); + this.IPTextBox.TabIndex = 0; + this.IPTextBox.WordWrap = false; + // + // ServerPortTextBox + // + this.ServerPortTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.ServerPortTextBox.Location = new System.Drawing.Point(72, 32); + this.ServerPortTextBox.MaxLength = 10; + this.ServerPortTextBox.Name = "ServerPortTextBox"; + this.ServerPortTextBox.Size = new System.Drawing.Size(160, 20); + this.ServerPortTextBox.TabIndex = 1; + this.ServerPortTextBox.WordWrap = false; + // + // PasswordTextBox + // + this.PasswordTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.PasswordTextBox.Location = new System.Drawing.Point(72, 58); + this.PasswordTextBox.MaxLength = 256; + this.PasswordTextBox.Name = "PasswordTextBox"; + this.PasswordTextBox.PasswordChar = '*'; + this.PasswordTextBox.Size = new System.Drawing.Size(160, 20); + this.PasswordTextBox.TabIndex = 2; + this.PasswordTextBox.WordWrap = false; + // + // EncryptionLabel + // + this.EncryptionLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.EncryptionLabel.AutoSize = true; + this.EncryptionLabel.Location = new System.Drawing.Point(9, 88); + this.EncryptionLabel.Name = "EncryptionLabel"; + this.EncryptionLabel.Size = new System.Drawing.Size(57, 13); + this.EncryptionLabel.TabIndex = 8; + this.EncryptionLabel.Text = "Encryption"; + // + // EncryptionSelect + // + this.EncryptionSelect.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) + | System.Windows.Forms.AnchorStyles.Right))); + this.EncryptionSelect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.EncryptionSelect.FormattingEnabled = true; + this.EncryptionSelect.ImeMode = System.Windows.Forms.ImeMode.NoControl; + this.EncryptionSelect.ItemHeight = 13; + this.EncryptionSelect.Items.AddRange(new object[] { + "table", + "rc4-md5", + "salsa20", + "chacha20", + "aes-256-cfb", + "aes-192-cfb", + "aes-128-cfb", + "rc4"}); + this.EncryptionSelect.Location = new System.Drawing.Point(72, 84); + this.EncryptionSelect.Name = "EncryptionSelect"; + this.EncryptionSelect.Size = new System.Drawing.Size(160, 21); + this.EncryptionSelect.TabIndex = 3; + // + // panel2 + // + this.panel2.Anchor = System.Windows.Forms.AnchorStyles.Top; + this.panel2.AutoSize = true; + this.panel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.panel2.Location = new System.Drawing.Point(207, 187); + this.panel2.Name = "panel2"; + this.panel2.Size = new System.Drawing.Size(0, 0); + this.panel2.TabIndex = 1; + // + // OKButton + // + this.OKButton.DialogResult = System.Windows.Forms.DialogResult.OK; + this.OKButton.Dock = System.Windows.Forms.DockStyle.Right; + this.OKButton.Location = new System.Drawing.Point(3, 3); + this.OKButton.Margin = new System.Windows.Forms.Padding(3, 3, 3, 0); + this.OKButton.Name = "OKButton"; + this.OKButton.Size = new System.Drawing.Size(75, 23); + this.OKButton.TabIndex = 8; + this.OKButton.Text = "OK"; + this.OKButton.UseVisualStyleBackColor = true; + this.OKButton.Click += new System.EventHandler(this.OKButton_Click); + // + // MyCancelButton + // + this.MyCancelButton.DialogResult = System.Windows.Forms.DialogResult.Cancel; + this.MyCancelButton.Dock = System.Windows.Forms.DockStyle.Right; + this.MyCancelButton.Location = new System.Drawing.Point(84, 3); + this.MyCancelButton.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0); + this.MyCancelButton.Name = "MyCancelButton"; + this.MyCancelButton.Size = new System.Drawing.Size(75, 23); + this.MyCancelButton.TabIndex = 9; + this.MyCancelButton.Text = "Cancel"; + this.MyCancelButton.UseVisualStyleBackColor = true; + this.MyCancelButton.Click += new System.EventHandler(this.CancelButton_Click); + // + // DeleteButton + // + this.DeleteButton.Dock = System.Windows.Forms.DockStyle.Right; + this.DeleteButton.Location = new System.Drawing.Point(86, 6); + this.DeleteButton.Margin = new System.Windows.Forms.Padding(3, 6, 0, 3); + this.DeleteButton.Name = "DeleteButton"; + this.DeleteButton.Size = new System.Drawing.Size(80, 23); + this.DeleteButton.TabIndex = 7; + this.DeleteButton.Text = "&Delete"; + this.DeleteButton.UseVisualStyleBackColor = true; + this.DeleteButton.Click += new System.EventHandler(this.DeleteButton_Click); + // + // AddButton + // + this.AddButton.Dock = System.Windows.Forms.DockStyle.Left; + this.AddButton.Location = new System.Drawing.Point(0, 6); + this.AddButton.Margin = new System.Windows.Forms.Padding(0, 6, 3, 3); + this.AddButton.Name = "AddButton"; + this.AddButton.Size = new System.Drawing.Size(80, 23); + this.AddButton.TabIndex = 6; + this.AddButton.Text = "&Add"; + this.AddButton.UseVisualStyleBackColor = true; + this.AddButton.Click += new System.EventHandler(this.AddButton_Click); + // + // ServerGroupBox + // + this.ServerGroupBox.AutoSize = true; + this.ServerGroupBox.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.ServerGroupBox.Controls.Add(this.tableLayoutPanel1); + this.ServerGroupBox.Location = new System.Drawing.Point(178, 0); + this.ServerGroupBox.Margin = new System.Windows.Forms.Padding(12, 0, 0, 0); + this.ServerGroupBox.Name = "ServerGroupBox"; + this.ServerGroupBox.Size = new System.Drawing.Size(249, 174); + this.ServerGroupBox.TabIndex = 6; + this.ServerGroupBox.TabStop = false; + this.ServerGroupBox.Text = "Server"; + // + // ServersListBox + // + this.ServersListBox.FormattingEnabled = true; + this.ServersListBox.IntegralHeight = false; + this.ServersListBox.Location = new System.Drawing.Point(0, 0); + this.ServersListBox.Margin = new System.Windows.Forms.Padding(0); + this.ServersListBox.Name = "ServersListBox"; + this.ServersListBox.Size = new System.Drawing.Size(166, 148); + this.ServersListBox.TabIndex = 5; + this.ServersListBox.SelectedIndexChanged += new System.EventHandler(this.ServersListBox_SelectedIndexChanged); + // + // tableLayoutPanel2 + // + this.tableLayoutPanel2.AutoSize = true; + this.tableLayoutPanel2.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.tableLayoutPanel2.ColumnCount = 2; + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel2.Controls.Add(this.tableLayoutPanel5, 1, 1); + this.tableLayoutPanel2.Controls.Add(this.tableLayoutPanel3, 1, 2); + this.tableLayoutPanel2.Controls.Add(this.ServersListBox, 0, 0); + this.tableLayoutPanel2.Controls.Add(this.ServerGroupBox, 1, 0); + this.tableLayoutPanel2.Controls.Add(this.tableLayoutPanel4, 0, 1); + this.tableLayoutPanel2.Location = new System.Drawing.Point(12, 12); + this.tableLayoutPanel2.Margin = new System.Windows.Forms.Padding(0); + this.tableLayoutPanel2.Name = "tableLayoutPanel2"; + this.tableLayoutPanel2.RowCount = 3; + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel2.Size = new System.Drawing.Size(427, 238); + this.tableLayoutPanel2.TabIndex = 7; + // + // tableLayoutPanel5 + // + this.tableLayoutPanel5.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) + | System.Windows.Forms.AnchorStyles.Right))); + this.tableLayoutPanel5.AutoSize = true; + this.tableLayoutPanel5.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.tableLayoutPanel5.ColumnCount = 2; + this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel5.Controls.Add(this.ProxyPortTextBox, 1, 0); + this.tableLayoutPanel5.Controls.Add(this.ProxyPortLabel, 0, 0); + this.tableLayoutPanel5.Location = new System.Drawing.Point(241, 174); + this.tableLayoutPanel5.Margin = new System.Windows.Forms.Padding(0); + this.tableLayoutPanel5.Name = "tableLayoutPanel5"; + this.tableLayoutPanel5.Padding = new System.Windows.Forms.Padding(3); + this.tableLayoutPanel5.RowCount = 1; + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 26F)); + this.tableLayoutPanel5.Size = new System.Drawing.Size(186, 32); + this.tableLayoutPanel5.TabIndex = 9; + // + // ProxyPortTextBox + // + this.ProxyPortTextBox.Anchor = System.Windows.Forms.AnchorStyles.Left; + this.ProxyPortTextBox.Location = new System.Drawing.Point(67, 6); + this.ProxyPortTextBox.MaxLength = 10; + this.ProxyPortTextBox.Name = "ProxyPortTextBox"; + this.ProxyPortTextBox.Size = new System.Drawing.Size(113, 20); + this.ProxyPortTextBox.TabIndex = 4; + this.ProxyPortTextBox.WordWrap = false; + // + // ProxyPortLabel + // + this.ProxyPortLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.ProxyPortLabel.AutoSize = true; + this.ProxyPortLabel.Location = new System.Drawing.Point(6, 9); + this.ProxyPortLabel.Name = "ProxyPortLabel"; + this.ProxyPortLabel.Size = new System.Drawing.Size(55, 13); + this.ProxyPortLabel.TabIndex = 3; + this.ProxyPortLabel.Text = "Proxy Port"; + // + // tableLayoutPanel3 + // + this.tableLayoutPanel3.AutoSize = true; + this.tableLayoutPanel3.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.tableLayoutPanel3.ColumnCount = 2; + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel3.Controls.Add(this.MyCancelButton, 1, 0); + this.tableLayoutPanel3.Controls.Add(this.OKButton, 0, 0); + this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Right; + this.tableLayoutPanel3.Location = new System.Drawing.Point(268, 209); + this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); + this.tableLayoutPanel3.Name = "tableLayoutPanel3"; + this.tableLayoutPanel3.RowCount = 1; + this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel3.Size = new System.Drawing.Size(159, 26); + this.tableLayoutPanel3.TabIndex = 8; + // + // tableLayoutPanel4 + // + this.tableLayoutPanel4.AutoSize = true; + this.tableLayoutPanel4.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.tableLayoutPanel4.ColumnCount = 2; + this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel4.Controls.Add(this.DeleteButton, 1, 0); + this.tableLayoutPanel4.Controls.Add(this.AddButton, 0, 0); + this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Top; + this.tableLayoutPanel4.Location = new System.Drawing.Point(0, 174); + this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(0); + this.tableLayoutPanel4.Name = "tableLayoutPanel4"; + this.tableLayoutPanel4.RowCount = 1; + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel4.Size = new System.Drawing.Size(166, 32); + this.tableLayoutPanel4.TabIndex = 8; + // + // ConfigForm + // + this.AcceptButton = this.OKButton; + this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi; + this.AutoSize = true; + this.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.CancelButton = this.MyCancelButton; + this.ClientSize = new System.Drawing.Size(574, 367); + this.Controls.Add(this.tableLayoutPanel2); + this.Controls.Add(this.panel2); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "ConfigForm"; + this.Padding = new System.Windows.Forms.Padding(12, 12, 12, 9); + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Edit Servers"; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ConfigForm_FormClosed); + this.Load += new System.EventHandler(this.ConfigForm_Load); + this.Shown += new System.EventHandler(this.ConfigForm_Shown); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.ServerGroupBox.ResumeLayout(false); + this.ServerGroupBox.PerformLayout(); + this.tableLayoutPanel2.ResumeLayout(false); + this.tableLayoutPanel2.PerformLayout(); + this.tableLayoutPanel5.ResumeLayout(false); + this.tableLayoutPanel5.PerformLayout(); + this.tableLayoutPanel3.ResumeLayout(false); + this.tableLayoutPanel4.ResumeLayout(false); + this.ResumeLayout(false); + this.PerformLayout(); + + } + + #endregion + + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1; + private System.Windows.Forms.Label IPLabel; + private System.Windows.Forms.Label ServerPortLabel; + private System.Windows.Forms.Label PasswordLabel; + private System.Windows.Forms.TextBox IPTextBox; + private System.Windows.Forms.TextBox ServerPortTextBox; + private System.Windows.Forms.TextBox PasswordTextBox; + private System.Windows.Forms.Label EncryptionLabel; + private System.Windows.Forms.ComboBox EncryptionSelect; + private System.Windows.Forms.Panel panel2; + private System.Windows.Forms.Button OKButton; + private System.Windows.Forms.Button MyCancelButton; + private System.Windows.Forms.Button DeleteButton; + private System.Windows.Forms.Button AddButton; + private System.Windows.Forms.GroupBox ServerGroupBox; + private System.Windows.Forms.ListBox ServersListBox; + private System.Windows.Forms.TextBox RemarksTextBox; + private System.Windows.Forms.Label RemarksLabel; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4; + private System.Windows.Forms.TableLayoutPanel tableLayoutPanel5; + private System.Windows.Forms.TextBox ProxyPortTextBox; + private System.Windows.Forms.Label ProxyPortLabel; + } +} + diff --git a/shadowsocks-csharp/View/ConfigForm.cs b/shadowsocks-csharp/View/ConfigForm.cs index 675aa23e..dc897899 100755 --- a/shadowsocks-csharp/View/ConfigForm.cs +++ b/shadowsocks-csharp/View/ConfigForm.cs @@ -52,6 +52,7 @@ namespace Shadowsocks.View OKButton.Text = I18N.GetString("OK"); MyCancelButton.Text = I18N.GetString("Cancel"); this.Text = I18N.GetString("Edit Servers"); + updateServerButton.Text = I18N.GetString("Update Server"); } private void controller_ConfigChanged(object sender, EventArgs e) @@ -226,6 +227,14 @@ namespace Shadowsocks.View { controller.ConfigChanged -= controller_ConfigChanged; } - + + private void updateServer_Click(object sender, EventArgs e) + { + UpdateServer updateServer = new UpdateServer(controller.GetConfigurationCopy()); + _modifiedConfiguration.configs = updateServer.updateServerData(); + controller.SaveServers(_modifiedConfiguration.configs, _modifiedConfiguration.localPort); + MessageBox.Show(I18N.GetString("update server sucess")); + Close(); + } } } diff --git a/shadowsocks-csharp/shadowsocks-csharp.csproj b/shadowsocks-csharp/shadowsocks-csharp.csproj index 8200aa07..8874ff19 100644 --- a/shadowsocks-csharp/shadowsocks-csharp.csproj +++ b/shadowsocks-csharp/shadowsocks-csharp.csproj @@ -145,6 +145,7 @@ + diff --git a/shadowsocks-csharp/shadowsocks-csharp.csproj.bak b/shadowsocks-csharp/shadowsocks-csharp.csproj.bak new file mode 100644 index 00000000..b221be3e --- /dev/null +++ b/shadowsocks-csharp/shadowsocks-csharp.csproj.bak @@ -0,0 +1,262 @@ + + + + Debug + AnyCPU + 9.0.21022 + 2.0 + {8C02D2F7-7CDB-4D55-9F25-CD03EF4AA062} + WinExe + Properties + Shadowsocks + Shadowsocks + v4.0 + 512 + + + shadowsocks.ico + false + + + + + 3.5 + Client + publish\ + true + Disk + false + Foreground + 7 + Days + false + false + true + 1 + 1.0.0.%2a + false + true + + + true + bin\x86\Debug\ + TRACE;DEBUG + full + x86 + prompt + ManagedMinimumRules.ruleset + false + + + bin\x86\Release\ + TRACE + true + pdbonly + x86 + prompt + ManagedMinimumRules.ruleset + false + true + + + app.manifest + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + True + True + Resources.resx + + + + + + + Form + + + ConfigForm.cs + + + + + + + + + Form + + + LogForm.cs + + + + Form + + + QRCodeForm.cs + + + Form + + + ConfigForm.cs + Designer + + + ResXFileCodeGenerator + Designer + Resources.Designer.cs + + + LogForm.cs + + + QRCodeForm.cs + + + + Designer + + + + + + + + + + + + + + + + + + + + False + .NET Framework 3.5 SP1 Client Profile + false + + + False + .NET Framework 2.0 %28x86%29 + false + + + False + .NET Framework 3.0 %28x86%29 + false + + + False + .NET Framework 3.5 + true + + + False + .NET Framework 3.5 SP1 + false + + + False + Windows Installer 3.1 + true + + + + + \ No newline at end of file