Browse Source

Add check box to toggle plugin argument input

tags/4.1.6
Student Main 6 years ago
parent
commit
4bce18a595
2 changed files with 52 additions and 20 deletions
  1. +35
    -20
      shadowsocks-csharp/View/ConfigForm.Designer.cs
  2. +17
    -0
      shadowsocks-csharp/View/ConfigForm.cs

+ 35
- 20
shadowsocks-csharp/View/ConfigForm.Designer.cs View File

@@ -68,6 +68,7 @@
this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
this.DuplicateButton = new System.Windows.Forms.Button(); this.DuplicateButton = new System.Windows.Forms.Button();
this.toolTip1 = new System.Windows.Forms.ToolTip(this.components); this.toolTip1 = new System.Windows.Forms.ToolTip(this.components);
this.UsePluginArgCheckBox = new System.Windows.Forms.CheckBox();
this.tableLayoutPanel1.SuspendLayout(); this.tableLayoutPanel1.SuspendLayout();
this.ServerGroupBox.SuspendLayout(); this.ServerGroupBox.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout();
@@ -86,7 +87,7 @@
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.Controls.Add(this.PluginOptionsLabel, 0, 6); this.tableLayoutPanel1.Controls.Add(this.PluginOptionsLabel, 0, 6);
this.tableLayoutPanel1.Controls.Add(this.PluginTextBox, 1, 5); this.tableLayoutPanel1.Controls.Add(this.PluginTextBox, 1, 5);
this.tableLayoutPanel1.Controls.Add(this.RemarksTextBox, 1, 9);
this.tableLayoutPanel1.Controls.Add(this.RemarksTextBox, 1, 10);
this.tableLayoutPanel1.Controls.Add(this.IPLabel, 0, 0); this.tableLayoutPanel1.Controls.Add(this.IPLabel, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.ServerPortLabel, 0, 1); this.tableLayoutPanel1.Controls.Add(this.ServerPortLabel, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.PasswordLabel, 0, 2); this.tableLayoutPanel1.Controls.Add(this.PasswordLabel, 0, 2);
@@ -95,19 +96,20 @@
this.tableLayoutPanel1.Controls.Add(this.PasswordTextBox, 1, 2); this.tableLayoutPanel1.Controls.Add(this.PasswordTextBox, 1, 2);
this.tableLayoutPanel1.Controls.Add(this.EncryptionLabel, 0, 4); this.tableLayoutPanel1.Controls.Add(this.EncryptionLabel, 0, 4);
this.tableLayoutPanel1.Controls.Add(this.EncryptionSelect, 1, 4); this.tableLayoutPanel1.Controls.Add(this.EncryptionSelect, 1, 4);
this.tableLayoutPanel1.Controls.Add(this.TimeoutLabel, 0, 10);
this.tableLayoutPanel1.Controls.Add(this.TimeoutTextBox, 1, 10);
this.tableLayoutPanel1.Controls.Add(this.TimeoutLabel, 0, 11);
this.tableLayoutPanel1.Controls.Add(this.TimeoutTextBox, 1, 11);
this.tableLayoutPanel1.Controls.Add(this.PluginLabel, 0, 5); this.tableLayoutPanel1.Controls.Add(this.PluginLabel, 0, 5);
this.tableLayoutPanel1.Controls.Add(this.PluginOptionsTextBox, 1, 6); this.tableLayoutPanel1.Controls.Add(this.PluginOptionsTextBox, 1, 6);
this.tableLayoutPanel1.Controls.Add(this.ShowPasswdCheckBox, 1, 3); this.tableLayoutPanel1.Controls.Add(this.ShowPasswdCheckBox, 1, 3);
this.tableLayoutPanel1.Controls.Add(this.PluginArgumentsTextBox, 1, 7);
this.tableLayoutPanel1.Controls.Add(this.PluginArgumentsLabel, 0, 7);
this.tableLayoutPanel1.Controls.Add(this.RemarksLabel, 0, 9);
this.tableLayoutPanel1.Controls.Add(this.PluginArgumentsTextBox, 1, 8);
this.tableLayoutPanel1.Controls.Add(this.PluginArgumentsLabel, 0, 8);
this.tableLayoutPanel1.Controls.Add(this.RemarksLabel, 0, 10);
this.tableLayoutPanel1.Controls.Add(this.UsePluginArgCheckBox, 1, 7);
this.tableLayoutPanel1.Location = new System.Drawing.Point(8, 21); this.tableLayoutPanel1.Location = new System.Drawing.Point(8, 21);
this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel1.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel1.Name = "tableLayoutPanel1"; this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(3); this.tableLayoutPanel1.Padding = new System.Windows.Forms.Padding(3);
this.tableLayoutPanel1.RowCount = 11;
this.tableLayoutPanel1.RowCount = 12;
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());
@@ -119,7 +121,8 @@
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(279, 270);
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle());
this.tableLayoutPanel1.Size = new System.Drawing.Size(279, 292);
this.tableLayoutPanel1.TabIndex = 0; this.tableLayoutPanel1.TabIndex = 0;
// //
// PluginOptionsLabel // PluginOptionsLabel
@@ -146,7 +149,7 @@
// RemarksTextBox // RemarksTextBox
// //
this.RemarksTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); 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, 216);
this.RemarksTextBox.Location = new System.Drawing.Point(113, 238);
this.RemarksTextBox.MaxLength = 32; this.RemarksTextBox.MaxLength = 32;
this.RemarksTextBox.Name = "RemarksTextBox"; this.RemarksTextBox.Name = "RemarksTextBox";
this.RemarksTextBox.Size = new System.Drawing.Size(160, 21); this.RemarksTextBox.Size = new System.Drawing.Size(160, 21);
@@ -262,7 +265,7 @@
// //
this.TimeoutLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.TimeoutLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.TimeoutLabel.AutoSize = true; this.TimeoutLabel.AutoSize = true;
this.TimeoutLabel.Location = new System.Drawing.Point(30, 247);
this.TimeoutLabel.Location = new System.Drawing.Point(30, 269);
this.TimeoutLabel.Name = "TimeoutLabel"; this.TimeoutLabel.Name = "TimeoutLabel";
this.TimeoutLabel.RightToLeft = System.Windows.Forms.RightToLeft.No; this.TimeoutLabel.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.TimeoutLabel.Size = new System.Drawing.Size(77, 12); this.TimeoutLabel.Size = new System.Drawing.Size(77, 12);
@@ -272,7 +275,7 @@
// TimeoutTextBox // TimeoutTextBox
// //
this.TimeoutTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); 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, 243);
this.TimeoutTextBox.Location = new System.Drawing.Point(113, 265);
this.TimeoutTextBox.MaxLength = 5; this.TimeoutTextBox.MaxLength = 5;
this.TimeoutTextBox.Name = "TimeoutTextBox"; this.TimeoutTextBox.Name = "TimeoutTextBox";
this.TimeoutTextBox.Size = new System.Drawing.Size(160, 21); this.TimeoutTextBox.Size = new System.Drawing.Size(160, 21);
@@ -315,7 +318,7 @@
// PluginArgumentsTextBox // PluginArgumentsTextBox
// //
this.PluginArgumentsTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); 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, 189);
this.PluginArgumentsTextBox.Location = new System.Drawing.Point(113, 211);
this.PluginArgumentsTextBox.MaxLength = 512; this.PluginArgumentsTextBox.MaxLength = 512;
this.PluginArgumentsTextBox.Name = "PluginArgumentsTextBox"; this.PluginArgumentsTextBox.Name = "PluginArgumentsTextBox";
this.PluginArgumentsTextBox.Size = new System.Drawing.Size(160, 21); this.PluginArgumentsTextBox.Size = new System.Drawing.Size(160, 21);
@@ -326,7 +329,7 @@
// //
this.PluginArgumentsLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.PluginArgumentsLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.PluginArgumentsLabel.AutoSize = true; this.PluginArgumentsLabel.AutoSize = true;
this.PluginArgumentsLabel.Location = new System.Drawing.Point(6, 193);
this.PluginArgumentsLabel.Location = new System.Drawing.Point(6, 215);
this.PluginArgumentsLabel.Name = "PluginArgumentsLabel"; this.PluginArgumentsLabel.Name = "PluginArgumentsLabel";
this.PluginArgumentsLabel.Size = new System.Drawing.Size(101, 12); this.PluginArgumentsLabel.Size = new System.Drawing.Size(101, 12);
this.PluginArgumentsLabel.TabIndex = 7; this.PluginArgumentsLabel.TabIndex = 7;
@@ -338,7 +341,7 @@
// //
this.RemarksLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.RemarksLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.RemarksLabel.AutoSize = true; this.RemarksLabel.AutoSize = true;
this.RemarksLabel.Location = new System.Drawing.Point(60, 220);
this.RemarksLabel.Location = new System.Drawing.Point(60, 242);
this.RemarksLabel.Name = "RemarksLabel"; this.RemarksLabel.Name = "RemarksLabel";
this.RemarksLabel.Size = new System.Drawing.Size(47, 12); this.RemarksLabel.Size = new System.Drawing.Size(47, 12);
this.RemarksLabel.TabIndex = 8; this.RemarksLabel.TabIndex = 8;
@@ -412,7 +415,7 @@
this.ServerGroupBox.Location = new System.Drawing.Point(178, 0); this.ServerGroupBox.Location = new System.Drawing.Point(178, 0);
this.ServerGroupBox.Margin = new System.Windows.Forms.Padding(12, 0, 0, 0); this.ServerGroupBox.Margin = new System.Windows.Forms.Padding(12, 0, 0, 0);
this.ServerGroupBox.Name = "ServerGroupBox"; this.ServerGroupBox.Name = "ServerGroupBox";
this.ServerGroupBox.Size = new System.Drawing.Size(290, 308);
this.ServerGroupBox.Size = new System.Drawing.Size(290, 330);
this.ServerGroupBox.TabIndex = 0; this.ServerGroupBox.TabIndex = 0;
this.ServerGroupBox.TabStop = false; this.ServerGroupBox.TabStop = false;
this.ServerGroupBox.Text = "Server"; this.ServerGroupBox.Text = "Server";
@@ -449,7 +452,7 @@
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.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, 404);
this.tableLayoutPanel2.Size = new System.Drawing.Size(468, 426);
this.tableLayoutPanel2.TabIndex = 7; this.tableLayoutPanel2.TabIndex = 7;
// //
// tableLayoutPanel6 // tableLayoutPanel6
@@ -462,7 +465,7 @@
this.tableLayoutPanel6.Controls.Add(this.MoveDownButton, 1, 0); this.tableLayoutPanel6.Controls.Add(this.MoveDownButton, 1, 0);
this.tableLayoutPanel6.Controls.Add(this.MoveUpButton, 0, 0); this.tableLayoutPanel6.Controls.Add(this.MoveUpButton, 0, 0);
this.tableLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Top; this.tableLayoutPanel6.Dock = System.Windows.Forms.DockStyle.Top;
this.tableLayoutPanel6.Location = new System.Drawing.Point(0, 372);
this.tableLayoutPanel6.Location = new System.Drawing.Point(0, 394);
this.tableLayoutPanel6.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel6.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel6.Name = "tableLayoutPanel6"; this.tableLayoutPanel6.Name = "tableLayoutPanel6";
this.tableLayoutPanel6.RowCount = 1; this.tableLayoutPanel6.RowCount = 1;
@@ -506,7 +509,7 @@
this.tableLayoutPanel5.Controls.Add(this.ProxyPortTextBox, 1, 0); this.tableLayoutPanel5.Controls.Add(this.ProxyPortTextBox, 1, 0);
this.tableLayoutPanel5.Controls.Add(this.ProxyPortLabel, 0, 0); this.tableLayoutPanel5.Controls.Add(this.ProxyPortLabel, 0, 0);
this.tableLayoutPanel5.Controls.Add(this.PortableModeCheckBox, 0, 1); this.tableLayoutPanel5.Controls.Add(this.PortableModeCheckBox, 0, 1);
this.tableLayoutPanel5.Location = new System.Drawing.Point(166, 308);
this.tableLayoutPanel5.Location = new System.Drawing.Point(166, 330);
this.tableLayoutPanel5.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel5.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel5.Name = "tableLayoutPanel5"; this.tableLayoutPanel5.Name = "tableLayoutPanel5";
this.tableLayoutPanel5.Padding = new System.Windows.Forms.Padding(3); this.tableLayoutPanel5.Padding = new System.Windows.Forms.Padding(3);
@@ -560,7 +563,7 @@
this.tableLayoutPanel3.Controls.Add(this.MyCancelButton, 1, 0); this.tableLayoutPanel3.Controls.Add(this.MyCancelButton, 1, 0);
this.tableLayoutPanel3.Controls.Add(this.OKButton, 0, 0); this.tableLayoutPanel3.Controls.Add(this.OKButton, 0, 0);
this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Right; this.tableLayoutPanel3.Dock = System.Windows.Forms.DockStyle.Right;
this.tableLayoutPanel3.Location = new System.Drawing.Point(309, 375);
this.tableLayoutPanel3.Location = new System.Drawing.Point(309, 397);
this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3);
this.tableLayoutPanel3.Name = "tableLayoutPanel3"; this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 1; this.tableLayoutPanel3.RowCount = 1;
@@ -579,7 +582,7 @@
this.tableLayoutPanel4.Controls.Add(this.DeleteButton, 1, 0); this.tableLayoutPanel4.Controls.Add(this.DeleteButton, 1, 0);
this.tableLayoutPanel4.Controls.Add(this.AddButton, 0, 0); this.tableLayoutPanel4.Controls.Add(this.AddButton, 0, 0);
this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Top; this.tableLayoutPanel4.Dock = System.Windows.Forms.DockStyle.Top;
this.tableLayoutPanel4.Location = new System.Drawing.Point(0, 308);
this.tableLayoutPanel4.Location = new System.Drawing.Point(0, 330);
this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel4.Name = "tableLayoutPanel4"; this.tableLayoutPanel4.Name = "tableLayoutPanel4";
this.tableLayoutPanel4.RowCount = 2; this.tableLayoutPanel4.RowCount = 2;
@@ -600,6 +603,17 @@
this.DuplicateButton.UseVisualStyleBackColor = true; this.DuplicateButton.UseVisualStyleBackColor = true;
this.DuplicateButton.Click += new System.EventHandler(this.DuplicateButton_Click); this.DuplicateButton.Click += new System.EventHandler(this.DuplicateButton_Click);
// //
// UsePluginArgCheckBox
//
this.UsePluginArgCheckBox.AutoSize = true;
this.UsePluginArgCheckBox.Location = new System.Drawing.Point(113, 189);
this.UsePluginArgCheckBox.Name = "UsePluginArgCheckBox";
this.UsePluginArgCheckBox.Size = new System.Drawing.Size(96, 16);
this.UsePluginArgCheckBox.TabIndex = 10;
this.UsePluginArgCheckBox.Text = "UsePluginArg";
this.UsePluginArgCheckBox.UseVisualStyleBackColor = true;
this.UsePluginArgCheckBox.CheckedChanged += new System.EventHandler(this.UsePluginArgCheckBox_CheckedChanged);
//
// ConfigForm // ConfigForm
// //
this.AcceptButton = this.OKButton; this.AcceptButton = this.OKButton;
@@ -678,6 +692,7 @@
private System.Windows.Forms.Label PluginArgumentsLabel; private System.Windows.Forms.Label PluginArgumentsLabel;
private System.Windows.Forms.ToolTip toolTip1; private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.CheckBox PortableModeCheckBox; private System.Windows.Forms.CheckBox PortableModeCheckBox;
private System.Windows.Forms.CheckBox UsePluginArgCheckBox;
} }
} }



+ 17
- 0
shadowsocks-csharp/View/ConfigForm.cs View File

@@ -144,10 +144,22 @@ namespace Shadowsocks.View
PluginTextBox.Text = server.plugin; PluginTextBox.Text = server.plugin;
PluginOptionsTextBox.Text = server.plugin_opts; PluginOptionsTextBox.Text = server.plugin_opts;
PluginArgumentsTextBox.Text = server.plugin_args; PluginArgumentsTextBox.Text = server.plugin_args;
bool showPluginArgInput = !string.IsNullOrEmpty(server.plugin_args);
UsePluginArgCheckBox.Checked = showPluginArgInput;
ShowHidePluginArgInput(showPluginArgInput);
RemarksTextBox.Text = server.remarks; RemarksTextBox.Text = server.remarks;
TimeoutTextBox.Text = server.timeout.ToString(); TimeoutTextBox.Text = server.timeout.ToString();
} }
private void ShowHidePluginArgInput(bool show)
{
PluginArgumentsTextBox.Visible = show;
PluginArgumentsLabel.Visible = show;
}
private void LoadServerNameListToUI(Configuration configuration) private void LoadServerNameListToUI(Configuration configuration)
{ {
ServersListBox.Items.Clear(); ServersListBox.Items.Clear();
@@ -362,5 +374,10 @@ namespace Shadowsocks.View
{ {
this.PasswordTextBox.UseSystemPasswordChar = !this.ShowPasswdCheckBox.Checked; this.PasswordTextBox.UseSystemPasswordChar = !this.ShowPasswdCheckBox.Checked;
} }
private void UsePluginArgCheckBox_CheckedChanged(object sender, EventArgs e)
{
ShowHidePluginArgInput(this.UsePluginArgCheckBox.Checked);
}
} }
} }

Loading…
Cancel
Save