From 01e3b10f5e9b632cf711aaa3a6f80c8ade3698a3 Mon Sep 17 00:00:00 2001 From: Student Main Date: Mon, 6 Jan 2020 00:30:47 +0800 Subject: [PATCH] deprecate unsafe encryption method --- shadowsocks-csharp/Data/i18n.csv | 3 +- .../View/ConfigForm.Designer.cs | 238 +++++++++--------- shadowsocks-csharp/View/ConfigForm.cs | 82 +++++- 3 files changed, 204 insertions(+), 119 deletions(-) diff --git a/shadowsocks-csharp/Data/i18n.csv b/shadowsocks-csharp/Data/i18n.csv index 3db1ef8f..f6be9f33 100644 --- a/shadowsocks-csharp/Data/i18n.csv +++ b/shadowsocks-csharp/Data/i18n.csv @@ -1,4 +1,4 @@ -en,ru-RU,zh-CN,zh-TW,ja +en,ru-RU,zh-CN,zh-TW,ja #Restart program to apply translation,,,, #This is comment line,,,, #Always keep language name at head of file,,,, @@ -75,6 +75,7 @@ Apply,Применить,应用,應用,適用 New server,Новый сервер,未配置的服务器,新伺服器,新規サーバー Move &Up,Выше,上移(&U),上移 (&U),上に移動 (&U) Move D&own,Ниже,下移(&O),下移 (&O),下に移動 (&O) +deprecated,不推荐,, ,,,, #Statistics Config,,,, ,,,, diff --git a/shadowsocks-csharp/View/ConfigForm.Designer.cs b/shadowsocks-csharp/View/ConfigForm.Designer.cs index fafbca48..0642fa77 100755 --- a/shadowsocks-csharp/View/ConfigForm.Designer.cs +++ b/shadowsocks-csharp/View/ConfigForm.Designer.cs @@ -106,10 +106,10 @@ this.tableLayoutPanel1.Controls.Add(this.PluginArgumentsLabel, 0, 8); this.tableLayoutPanel1.Controls.Add(this.RemarksLabel, 0, 10); this.tableLayoutPanel1.Controls.Add(this.NeedPluginArgCheckBox, 1, 7); - this.tableLayoutPanel1.Location = new System.Drawing.Point(8, 21); + this.tableLayoutPanel1.Location = new System.Drawing.Point(10, 26); this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(3); + this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); this.tableLayoutPanel1.RowCount = 12; this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); @@ -123,16 +123,17 @@ 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(279, 292); + this.tableLayoutPanel1.Size = new System.Drawing.Size(394, 357); this.tableLayoutPanel1.TabIndex = 0; // // PluginOptionsLabel // this.PluginOptionsLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.PluginOptionsLabel.AutoSize = true; - this.PluginOptionsLabel.Location = new System.Drawing.Point(18, 166); + this.PluginOptionsLabel.Location = new System.Drawing.Point(24, 203); + this.PluginOptionsLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.PluginOptionsLabel.Name = "PluginOptionsLabel"; - this.PluginOptionsLabel.Size = new System.Drawing.Size(89, 12); + this.PluginOptionsLabel.Size = new System.Drawing.Size(119, 15); this.PluginOptionsLabel.TabIndex = 6; this.PluginOptionsLabel.Text = "Plugin Options"; this.toolTip1.SetToolTip(this.PluginOptionsLabel, "Environment variables for plugin program"); @@ -140,20 +141,22 @@ // PluginTextBox // this.PluginTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.PluginTextBox.Location = new System.Drawing.Point(113, 135); + this.PluginTextBox.Location = new System.Drawing.Point(151, 165); + this.PluginTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.PluginTextBox.MaxLength = 256; this.PluginTextBox.Name = "PluginTextBox"; - this.PluginTextBox.Size = new System.Drawing.Size(160, 21); + this.PluginTextBox.Size = new System.Drawing.Size(235, 25); this.PluginTextBox.TabIndex = 5; this.PluginTextBox.WordWrap = false; // // 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(113, 238); + this.RemarksTextBox.Location = new System.Drawing.Point(151, 291); + this.RemarksTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.RemarksTextBox.MaxLength = 32; this.RemarksTextBox.Name = "RemarksTextBox"; - this.RemarksTextBox.Size = new System.Drawing.Size(160, 21); + this.RemarksTextBox.Size = new System.Drawing.Size(235, 25); this.RemarksTextBox.TabIndex = 8; this.RemarksTextBox.WordWrap = false; // @@ -161,9 +164,10 @@ // this.IPLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.IPLabel.AutoSize = true; - this.IPLabel.Location = new System.Drawing.Point(48, 10); + this.IPLabel.Location = new System.Drawing.Point(64, 13); + this.IPLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.IPLabel.Name = "IPLabel"; - this.IPLabel.Size = new System.Drawing.Size(59, 12); + this.IPLabel.Size = new System.Drawing.Size(79, 15); this.IPLabel.TabIndex = 0; this.IPLabel.Text = "Server IP"; // @@ -171,9 +175,10 @@ // this.ServerPortLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.ServerPortLabel.AutoSize = true; - this.ServerPortLabel.Location = new System.Drawing.Point(36, 37); + this.ServerPortLabel.Location = new System.Drawing.Point(48, 46); + this.ServerPortLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.ServerPortLabel.Name = "ServerPortLabel"; - this.ServerPortLabel.Size = new System.Drawing.Size(71, 12); + this.ServerPortLabel.Size = new System.Drawing.Size(95, 15); this.ServerPortLabel.TabIndex = 1; this.ServerPortLabel.Text = "Server Port"; // @@ -181,9 +186,10 @@ // this.PasswordLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.PasswordLabel.AutoSize = true; - this.PasswordLabel.Location = new System.Drawing.Point(54, 64); + this.PasswordLabel.Location = new System.Drawing.Point(72, 79); + this.PasswordLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.PasswordLabel.Name = "PasswordLabel"; - this.PasswordLabel.Size = new System.Drawing.Size(53, 12); + this.PasswordLabel.Size = new System.Drawing.Size(71, 15); this.PasswordLabel.TabIndex = 2; this.PasswordLabel.Text = "Password"; this.PasswordLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -191,30 +197,33 @@ // 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(113, 6); + this.IPTextBox.Location = new System.Drawing.Point(151, 8); + this.IPTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.IPTextBox.MaxLength = 512; this.IPTextBox.Name = "IPTextBox"; - this.IPTextBox.Size = new System.Drawing.Size(160, 21); + this.IPTextBox.Size = new System.Drawing.Size(235, 25); 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(113, 33); + this.ServerPortTextBox.Location = new System.Drawing.Point(151, 41); + this.ServerPortTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.ServerPortTextBox.MaxLength = 10; this.ServerPortTextBox.Name = "ServerPortTextBox"; - this.ServerPortTextBox.Size = new System.Drawing.Size(160, 21); + this.ServerPortTextBox.Size = new System.Drawing.Size(235, 25); 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(113, 60); + this.PasswordTextBox.Location = new System.Drawing.Point(151, 74); + this.PasswordTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.PasswordTextBox.MaxLength = 256; this.PasswordTextBox.Name = "PasswordTextBox"; - this.PasswordTextBox.Size = new System.Drawing.Size(160, 21); + this.PasswordTextBox.Size = new System.Drawing.Size(235, 25); this.PasswordTextBox.TabIndex = 2; this.PasswordTextBox.UseSystemPasswordChar = true; this.PasswordTextBox.WordWrap = false; @@ -223,9 +232,10 @@ // this.EncryptionLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.EncryptionLabel.AutoSize = true; - this.EncryptionLabel.Location = new System.Drawing.Point(42, 113); + this.EncryptionLabel.Location = new System.Drawing.Point(56, 138); + this.EncryptionLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.EncryptionLabel.Name = "EncryptionLabel"; - this.EncryptionLabel.Size = new System.Drawing.Size(65, 12); + this.EncryptionLabel.Size = new System.Drawing.Size(87, 15); this.EncryptionLabel.TabIndex = 4; this.EncryptionLabel.Text = "Encryption"; // @@ -236,69 +246,54 @@ this.EncryptionSelect.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.EncryptionSelect.FormattingEnabled = true; this.EncryptionSelect.ImeMode = System.Windows.Forms.ImeMode.NoControl; - this.EncryptionSelect.ItemHeight = 12; - this.EncryptionSelect.Items.AddRange(new object[] { - "rc4-md5", - "salsa20", - "chacha20", - "chacha20-ietf", - "aes-256-cfb", - "aes-192-cfb", - "aes-128-cfb", - "aes-256-ctr", - "aes-192-ctr", - "aes-128-ctr", - "bf-cfb", - "camellia-128-cfb", - "camellia-192-cfb", - "camellia-256-cfb", - "aes-128-gcm", - "aes-192-gcm", - "aes-256-gcm", - "chacha20-ietf-poly1305", - "xchacha20-ietf-poly1305"}); - this.EncryptionSelect.Location = new System.Drawing.Point(113, 109); + this.EncryptionSelect.ItemHeight = 15; + this.EncryptionSelect.Location = new System.Drawing.Point(151, 134); + this.EncryptionSelect.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.EncryptionSelect.Name = "EncryptionSelect"; - this.EncryptionSelect.Size = new System.Drawing.Size(160, 20); + this.EncryptionSelect.Size = new System.Drawing.Size(235, 23); this.EncryptionSelect.TabIndex = 4; // // TimeoutLabel // this.TimeoutLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.TimeoutLabel.AutoSize = true; - this.TimeoutLabel.Location = new System.Drawing.Point(30, 269); + this.TimeoutLabel.Location = new System.Drawing.Point(40, 329); + this.TimeoutLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.TimeoutLabel.Name = "TimeoutLabel"; this.TimeoutLabel.RightToLeft = System.Windows.Forms.RightToLeft.No; - this.TimeoutLabel.Size = new System.Drawing.Size(77, 12); + this.TimeoutLabel.Size = new System.Drawing.Size(103, 15); this.TimeoutLabel.TabIndex = 9; this.TimeoutLabel.Text = "Timeout(Sec)"; // // TimeoutTextBox // this.TimeoutTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.TimeoutTextBox.Location = new System.Drawing.Point(113, 265); + this.TimeoutTextBox.Location = new System.Drawing.Point(151, 324); + this.TimeoutTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.TimeoutTextBox.MaxLength = 5; this.TimeoutTextBox.Name = "TimeoutTextBox"; - this.TimeoutTextBox.Size = new System.Drawing.Size(160, 21); + this.TimeoutTextBox.Size = new System.Drawing.Size(235, 25); this.TimeoutTextBox.TabIndex = 9; // // PluginLabel // this.PluginLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.PluginLabel.AutoSize = true; - this.PluginLabel.Location = new System.Drawing.Point(18, 139); + this.PluginLabel.Location = new System.Drawing.Point(24, 170); + this.PluginLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.PluginLabel.Name = "PluginLabel"; - this.PluginLabel.Size = new System.Drawing.Size(89, 12); + this.PluginLabel.Size = new System.Drawing.Size(119, 15); this.PluginLabel.TabIndex = 5; this.PluginLabel.Text = "Plugin Program"; // // PluginOptionsTextBox // this.PluginOptionsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.PluginOptionsTextBox.Location = new System.Drawing.Point(113, 162); + this.PluginOptionsTextBox.Location = new System.Drawing.Point(151, 198); + this.PluginOptionsTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.PluginOptionsTextBox.MaxLength = 256; this.PluginOptionsTextBox.Name = "PluginOptionsTextBox"; - this.PluginOptionsTextBox.Size = new System.Drawing.Size(160, 21); + this.PluginOptionsTextBox.Size = new System.Drawing.Size(235, 25); this.PluginOptionsTextBox.TabIndex = 6; this.PluginOptionsTextBox.WordWrap = false; // @@ -307,9 +302,10 @@ this.ShowPasswdCheckBox.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left))); this.ShowPasswdCheckBox.AutoSize = true; - this.ShowPasswdCheckBox.Location = new System.Drawing.Point(113, 87); + this.ShowPasswdCheckBox.Location = new System.Drawing.Point(151, 107); + this.ShowPasswdCheckBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.ShowPasswdCheckBox.Name = "ShowPasswdCheckBox"; - this.ShowPasswdCheckBox.Size = new System.Drawing.Size(102, 16); + this.ShowPasswdCheckBox.Size = new System.Drawing.Size(133, 19); this.ShowPasswdCheckBox.TabIndex = 3; this.ShowPasswdCheckBox.Text = "Show Password"; this.ShowPasswdCheckBox.TextAlign = System.Drawing.ContentAlignment.MiddleCenter; @@ -319,10 +315,11 @@ // PluginArgumentsTextBox // this.PluginArgumentsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); - this.PluginArgumentsTextBox.Location = new System.Drawing.Point(113, 211); + this.PluginArgumentsTextBox.Location = new System.Drawing.Point(151, 258); + this.PluginArgumentsTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.PluginArgumentsTextBox.MaxLength = 512; this.PluginArgumentsTextBox.Name = "PluginArgumentsTextBox"; - this.PluginArgumentsTextBox.Size = new System.Drawing.Size(160, 21); + this.PluginArgumentsTextBox.Size = new System.Drawing.Size(235, 25); this.PluginArgumentsTextBox.TabIndex = 7; this.PluginArgumentsTextBox.WordWrap = false; // @@ -330,9 +327,10 @@ // this.PluginArgumentsLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.PluginArgumentsLabel.AutoSize = true; - this.PluginArgumentsLabel.Location = new System.Drawing.Point(6, 215); + this.PluginArgumentsLabel.Location = new System.Drawing.Point(8, 263); + this.PluginArgumentsLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.PluginArgumentsLabel.Name = "PluginArgumentsLabel"; - this.PluginArgumentsLabel.Size = new System.Drawing.Size(101, 12); + this.PluginArgumentsLabel.Size = new System.Drawing.Size(135, 15); this.PluginArgumentsLabel.TabIndex = 7; this.PluginArgumentsLabel.Text = "Plugin Arguments"; this.toolTip1.SetToolTip(this.PluginArgumentsLabel, "Not a SIP003 standard. Used as CLI arguments.\r\nMandatory:\r\n%SS_LOCAL_HOST%, %SS_L" + @@ -342,18 +340,20 @@ // this.RemarksLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.RemarksLabel.AutoSize = true; - this.RemarksLabel.Location = new System.Drawing.Point(60, 242); + this.RemarksLabel.Location = new System.Drawing.Point(80, 296); + this.RemarksLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.RemarksLabel.Name = "RemarksLabel"; - this.RemarksLabel.Size = new System.Drawing.Size(47, 12); + this.RemarksLabel.Size = new System.Drawing.Size(63, 15); this.RemarksLabel.TabIndex = 8; this.RemarksLabel.Text = "Remarks"; // // NeedPluginArgCheckBox // this.NeedPluginArgCheckBox.AutoSize = true; - this.NeedPluginArgCheckBox.Location = new System.Drawing.Point(113, 189); + this.NeedPluginArgCheckBox.Location = new System.Drawing.Point(151, 231); + this.NeedPluginArgCheckBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.NeedPluginArgCheckBox.Name = "NeedPluginArgCheckBox"; - this.NeedPluginArgCheckBox.Size = new System.Drawing.Size(144, 16); + this.NeedPluginArgCheckBox.Size = new System.Drawing.Size(189, 19); this.NeedPluginArgCheckBox.TabIndex = 10; this.NeedPluginArgCheckBox.Text = "Need Plugin Argument"; this.NeedPluginArgCheckBox.UseVisualStyleBackColor = true; @@ -364,7 +364,8 @@ 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(165, 187); + this.panel2.Location = new System.Drawing.Point(206, 234); + this.panel2.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(0, 0); this.panel2.TabIndex = 1; @@ -373,10 +374,10 @@ // 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.Location = new System.Drawing.Point(4, 4); + this.OKButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 0); this.OKButton.Name = "OKButton"; - this.OKButton.Size = new System.Drawing.Size(75, 23); + this.OKButton.Size = new System.Drawing.Size(94, 29); this.OKButton.TabIndex = 17; this.OKButton.Text = "OK"; this.OKButton.UseVisualStyleBackColor = true; @@ -386,10 +387,10 @@ // 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, 3, 0); + this.MyCancelButton.Location = new System.Drawing.Point(106, 4); + this.MyCancelButton.Margin = new System.Windows.Forms.Padding(4, 4, 4, 0); this.MyCancelButton.Name = "MyCancelButton"; - this.MyCancelButton.Size = new System.Drawing.Size(75, 23); + this.MyCancelButton.Size = new System.Drawing.Size(94, 29); this.MyCancelButton.TabIndex = 18; this.MyCancelButton.Text = "Cancel"; this.MyCancelButton.UseVisualStyleBackColor = true; @@ -399,10 +400,10 @@ // this.ApplyButton.Dock = System.Windows.Forms.DockStyle.Right; this.ApplyButton.Enabled = false; - this.ApplyButton.Location = new System.Drawing.Point(165, 3); - this.ApplyButton.Margin = new System.Windows.Forms.Padding(3, 3, 0, 0); + this.ApplyButton.Location = new System.Drawing.Point(208, 4); + this.ApplyButton.Margin = new System.Windows.Forms.Padding(4, 4, 0, 0); this.ApplyButton.Name = "ApplyButton"; - this.ApplyButton.Size = new System.Drawing.Size(75, 23); + this.ApplyButton.Size = new System.Drawing.Size(94, 29); this.ApplyButton.TabIndex = 19; this.ApplyButton.Text = "Apply"; this.ApplyButton.UseVisualStyleBackColor = true; @@ -411,10 +412,10 @@ // 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.Location = new System.Drawing.Point(108, 8); + this.DeleteButton.Margin = new System.Windows.Forms.Padding(4, 8, 0, 4); this.DeleteButton.Name = "DeleteButton"; - this.DeleteButton.Size = new System.Drawing.Size(80, 23); + this.DeleteButton.Size = new System.Drawing.Size(100, 29); this.DeleteButton.TabIndex = 13; this.DeleteButton.Text = "&Delete"; this.DeleteButton.UseVisualStyleBackColor = true; @@ -423,10 +424,10 @@ // 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.Location = new System.Drawing.Point(0, 8); + this.AddButton.Margin = new System.Windows.Forms.Padding(0, 8, 4, 4); this.AddButton.Name = "AddButton"; - this.AddButton.Size = new System.Drawing.Size(80, 23); + this.AddButton.Size = new System.Drawing.Size(100, 29); this.AddButton.TabIndex = 12; this.AddButton.Text = "&Add"; this.AddButton.UseVisualStyleBackColor = true; @@ -437,10 +438,11 @@ 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.Location = new System.Drawing.Point(223, 0); + this.ServerGroupBox.Margin = new System.Windows.Forms.Padding(15, 0, 0, 0); this.ServerGroupBox.Name = "ServerGroupBox"; - this.ServerGroupBox.Size = new System.Drawing.Size(290, 330); + this.ServerGroupBox.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); + this.ServerGroupBox.Size = new System.Drawing.Size(408, 405); this.ServerGroupBox.TabIndex = 0; this.ServerGroupBox.TabStop = false; this.ServerGroupBox.Text = "Server"; @@ -449,11 +451,11 @@ // this.ServersListBox.FormattingEnabled = true; this.ServersListBox.IntegralHeight = false; - this.ServersListBox.ItemHeight = 12; + this.ServersListBox.ItemHeight = 15; 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.Size = new System.Drawing.Size(206, 184); this.ServersListBox.TabIndex = 11; this.ServersListBox.SelectedIndexChanged += new System.EventHandler(this.ServersListBox_SelectedIndexChanged); // @@ -470,14 +472,14 @@ 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.Location = new System.Drawing.Point(15, 15); 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(468, 426); + this.tableLayoutPanel2.Size = new System.Drawing.Size(631, 528); this.tableLayoutPanel2.TabIndex = 7; // // tableLayoutPanel6 @@ -490,21 +492,21 @@ this.tableLayoutPanel6.Controls.Add(this.MoveDownButton, 1, 0); this.tableLayoutPanel6.Controls.Add(this.MoveUpButton, 0, 0); this.tableLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Top; - this.tableLayoutPanel6.Location = new System.Drawing.Point(0, 394); + this.tableLayoutPanel6.Location = new System.Drawing.Point(0, 487); this.tableLayoutPanel6.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel6.Name = "tableLayoutPanel6"; this.tableLayoutPanel6.RowCount = 1; this.tableLayoutPanel6.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel6.Size = new System.Drawing.Size(166, 32); + this.tableLayoutPanel6.Size = new System.Drawing.Size(208, 41); this.tableLayoutPanel6.TabIndex = 10; // // MoveDownButton // this.MoveDownButton.Dock = System.Windows.Forms.DockStyle.Right; - this.MoveDownButton.Location = new System.Drawing.Point(86, 6); - this.MoveDownButton.Margin = new System.Windows.Forms.Padding(3, 6, 0, 3); + this.MoveDownButton.Location = new System.Drawing.Point(108, 8); + this.MoveDownButton.Margin = new System.Windows.Forms.Padding(4, 8, 0, 4); this.MoveDownButton.Name = "MoveDownButton"; - this.MoveDownButton.Size = new System.Drawing.Size(80, 23); + this.MoveDownButton.Size = new System.Drawing.Size(100, 29); this.MoveDownButton.TabIndex = 16; this.MoveDownButton.Text = "Move D&own"; this.MoveDownButton.UseVisualStyleBackColor = true; @@ -513,10 +515,10 @@ // MoveUpButton // this.MoveUpButton.Dock = System.Windows.Forms.DockStyle.Left; - this.MoveUpButton.Location = new System.Drawing.Point(0, 6); - this.MoveUpButton.Margin = new System.Windows.Forms.Padding(0, 6, 3, 3); + this.MoveUpButton.Location = new System.Drawing.Point(0, 8); + this.MoveUpButton.Margin = new System.Windows.Forms.Padding(0, 8, 4, 4); this.MoveUpButton.Name = "MoveUpButton"; - this.MoveUpButton.Size = new System.Drawing.Size(80, 23); + this.MoveUpButton.Size = new System.Drawing.Size(100, 29); this.MoveUpButton.TabIndex = 15; this.MoveUpButton.Text = "Move &Up"; this.MoveUpButton.UseVisualStyleBackColor = true; @@ -534,23 +536,24 @@ this.tableLayoutPanel5.Controls.Add(this.ProxyPortTextBox, 1, 0); this.tableLayoutPanel5.Controls.Add(this.ProxyPortLabel, 0, 0); this.tableLayoutPanel5.Controls.Add(this.PortableModeCheckBox, 0, 1); - this.tableLayoutPanel5.Location = new System.Drawing.Point(166, 330); + this.tableLayoutPanel5.Location = new System.Drawing.Point(208, 405); this.tableLayoutPanel5.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel5.Name = "tableLayoutPanel5"; - this.tableLayoutPanel5.Padding = new System.Windows.Forms.Padding(3); + this.tableLayoutPanel5.Padding = new System.Windows.Forms.Padding(4, 4, 4, 4); this.tableLayoutPanel5.RowCount = 2; this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel5.Size = new System.Drawing.Size(196, 64); + this.tableLayoutPanel5.Size = new System.Drawing.Size(251, 82); this.tableLayoutPanel5.TabIndex = 9; // // ProxyPortTextBox // this.ProxyPortTextBox.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.ProxyPortTextBox.Location = new System.Drawing.Point(77, 6); + this.ProxyPortTextBox.Location = new System.Drawing.Point(103, 8); + this.ProxyPortTextBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.ProxyPortTextBox.MaxLength = 10; this.ProxyPortTextBox.Name = "ProxyPortTextBox"; - this.ProxyPortTextBox.Size = new System.Drawing.Size(113, 21); + this.ProxyPortTextBox.Size = new System.Drawing.Size(140, 25); this.ProxyPortTextBox.TabIndex = 10; this.ProxyPortTextBox.WordWrap = false; // @@ -558,9 +561,10 @@ // this.ProxyPortLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.ProxyPortLabel.AutoSize = true; - this.ProxyPortLabel.Location = new System.Drawing.Point(6, 10); + this.ProxyPortLabel.Location = new System.Drawing.Point(8, 13); + this.ProxyPortLabel.Margin = new System.Windows.Forms.Padding(4, 0, 4, 0); this.ProxyPortLabel.Name = "ProxyPortLabel"; - this.ProxyPortLabel.Size = new System.Drawing.Size(65, 12); + this.ProxyPortLabel.Size = new System.Drawing.Size(87, 15); this.ProxyPortLabel.TabIndex = 10; this.ProxyPortLabel.Text = "Proxy Port"; // @@ -569,9 +573,10 @@ this.PortableModeCheckBox.Anchor = System.Windows.Forms.AnchorStyles.Left; this.PortableModeCheckBox.AutoSize = true; this.tableLayoutPanel5.SetColumnSpan(this.PortableModeCheckBox, 2); - this.PortableModeCheckBox.Location = new System.Drawing.Point(6, 37); + this.PortableModeCheckBox.Location = new System.Drawing.Point(8, 48); + this.PortableModeCheckBox.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.PortableModeCheckBox.Name = "PortableModeCheckBox"; - this.PortableModeCheckBox.Size = new System.Drawing.Size(102, 16); + this.PortableModeCheckBox.Size = new System.Drawing.Size(133, 19); this.PortableModeCheckBox.TabIndex = 11; this.PortableModeCheckBox.Text = "Portable Mode"; this.toolTip1.SetToolTip(this.PortableModeCheckBox, "restart required"); @@ -585,17 +590,17 @@ 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()); - this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 20F)); + this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 25F)); this.tableLayoutPanel3.Controls.Add(this.MyCancelButton, 1, 0); this.tableLayoutPanel3.Controls.Add(this.OKButton, 0, 0); this.tableLayoutPanel3.Controls.Add(this.ApplyButton, 2, 0); this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Right; - this.tableLayoutPanel3.Location = new System.Drawing.Point(228, 397); - this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); + this.tableLayoutPanel3.Location = new System.Drawing.Point(329, 491); + this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(4, 4, 0, 4); this.tableLayoutPanel3.Name = "tableLayoutPanel3"; this.tableLayoutPanel3.RowCount = 1; this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel3.Size = new System.Drawing.Size(240, 26); + this.tableLayoutPanel3.Size = new System.Drawing.Size(302, 33); this.tableLayoutPanel3.TabIndex = 8; // // tableLayoutPanel4 @@ -609,22 +614,22 @@ 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, 330); + this.tableLayoutPanel4.Location = new System.Drawing.Point(0, 405); this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel4.Name = "tableLayoutPanel4"; this.tableLayoutPanel4.RowCount = 2; this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel4.Size = new System.Drawing.Size(166, 64); + this.tableLayoutPanel4.Size = new System.Drawing.Size(208, 82); this.tableLayoutPanel4.TabIndex = 8; // // DuplicateButton // this.DuplicateButton.Dock = System.Windows.Forms.DockStyle.Left; - this.DuplicateButton.Location = new System.Drawing.Point(0, 38); - this.DuplicateButton.Margin = new System.Windows.Forms.Padding(0, 6, 3, 3); + this.DuplicateButton.Location = new System.Drawing.Point(0, 49); + this.DuplicateButton.Margin = new System.Windows.Forms.Padding(0, 8, 4, 4); this.DuplicateButton.Name = "DuplicateButton"; - this.DuplicateButton.Size = new System.Drawing.Size(80, 23); + this.DuplicateButton.Size = new System.Drawing.Size(100, 29); this.DuplicateButton.TabIndex = 14; this.DuplicateButton.Text = "Dupli&cate"; this.DuplicateButton.UseVisualStyleBackColor = true; @@ -633,19 +638,20 @@ // ConfigForm // this.AcceptButton = this.OKButton; - this.AutoScaleDimensions = new System.Drawing.SizeF(96F, 96F); + 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.CancelButton = this.MyCancelButton; - this.ClientSize = new System.Drawing.Size(491, 438); + this.ClientSize = new System.Drawing.Size(614, 548); this.Controls.Add(this.tableLayoutPanel2); this.Controls.Add(this.panel2); this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.Margin = new System.Windows.Forms.Padding(4, 4, 4, 4); this.MaximizeBox = false; this.MinimizeBox = false; this.Name = "ConfigForm"; - this.Padding = new System.Windows.Forms.Padding(12, 12, 12, 9); + this.Padding = new System.Windows.Forms.Padding(15, 15, 15, 11); this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; this.Text = "Edit Servers"; this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ConfigForm_FormClosed); diff --git a/shadowsocks-csharp/View/ConfigForm.cs b/shadowsocks-csharp/View/ConfigForm.cs index 379edc29..1d94ec79 100755 --- a/shadowsocks-csharp/View/ConfigForm.cs +++ b/shadowsocks-csharp/View/ConfigForm.cs @@ -2,7 +2,9 @@ using Shadowsocks.Controller; using Shadowsocks.Model; using Shadowsocks.Properties; using System; +using System.Collections.Generic; using System.Drawing; +using System.Linq; using System.Windows.Forms; namespace Shadowsocks.View @@ -17,10 +19,86 @@ namespace Shadowsocks.View private bool isChange = false; + private class EncryptionMethod + { + public readonly string name; + public readonly bool deprecated; + + // Edit here to add/delete encryption method displayed in UI + private static string[] deprecatedMethod = new string[] + { + "rc4-md5", + "salsa20", + "chacha20", + "bf-cfb", + }; + private static string[] inuseMethod = new string[] + { + "aes-256-gcm", + "aes-192-gcm", + "aes-128-gcm", + "chacha20-ietf-poly1305", + "xchacha20-ietf-poly1305", + "chacha20-ietf", + "aes-256-cfb", + "aes-192-cfb", + "aes-128-cfb", + "aes-256-ctr", + "aes-192-ctr", + "aes-128-ctr", + "camellia-256-cfb", + "camellia-192-cfb", + "camellia-128-cfb", + }; + public static EncryptionMethod[] AllMethods + { + get + { + if (!init) Init(); + return allMethods; + } + } + private static bool init = false; + private static EncryptionMethod[] allMethods; + private static Dictionary methodByName = new Dictionary(); + private static void Init() + { + var all = new List(); + + all.AddRange(inuseMethod.Select(i => new EncryptionMethod(i, false))); + all.AddRange(deprecatedMethod.Select(d => new EncryptionMethod(d, true))); + + allMethods = all.ToArray(); + foreach (var item in all) + { + methodByName[item.name] = item; + } + init = true; + } + + public static EncryptionMethod GetMethod(string name) + { + if (!init) Init(); + return methodByName[name]; + } + + private EncryptionMethod(string name, bool deprecated) + { + this.name = name; + this.deprecated = deprecated; + } + + public override string ToString() + { + return deprecated ? $"{name} ({I18N.GetString("deprecated")})" : name; + } + } + public ConfigForm(ShadowsocksController controller) { Font = SystemFonts.MessageBoxFont; InitializeComponent(); + EncryptionSelect.Items.AddRange(EncryptionMethod.AllMethods); // a dirty hack ServersListBox.Dock = DockStyle.Fill; @@ -115,7 +193,7 @@ namespace Shadowsocks.View server = address, server_port = addressPort.Value, password = serverPassword, - method = EncryptionSelect.Text, + method = ((EncryptionMethod)EncryptionSelect.SelectedItem).name, plugin = PluginTextBox.Text, plugin_opts = PluginOptionsTextBox.Text, plugin_args = PluginArgumentsTextBox.Text, @@ -316,7 +394,7 @@ namespace Shadowsocks.View IPTextBox.Text = server.server; ServerPortTextBox.Text = server.server_port.ToString(); PasswordTextBox.Text = server.password; - EncryptionSelect.Text = server.method ?? Server.DefaultMethod; + EncryptionSelect.SelectedItem = EncryptionMethod.GetMethod(server.method ?? Server.DefaultMethod); PluginTextBox.Text = server.plugin; PluginOptionsTextBox.Text = server.plugin_opts; PluginArgumentsTextBox.Text = server.plugin_args;