Browse Source

Merge pull request #2212 from studentmain/master

Add check box to toggle plugin argument input
tags/4.1.6
Allen Zhu GitHub 5 years ago
parent
commit
9f243197e0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 55 additions and 21 deletions
  1. +1
    -0
      shadowsocks-csharp/Data/zh_CN.txt
  2. +1
    -1
      shadowsocks-csharp/Util/SystemProxy/Sysproxy.cs
  3. +35
    -20
      shadowsocks-csharp/View/ConfigForm.Designer.cs
  4. +18
    -0
      shadowsocks-csharp/View/ConfigForm.cs

+ 1
- 0
shadowsocks-csharp/Data/zh_CN.txt View File

@@ -53,6 +53,7 @@ Show Password=显示密码
Encryption=加密
Plugin Program=插件程序
Plugin Options=插件选项
Need Plugin Argument=需要命令行参数
Plugin Arguments=插件参数
Proxy Port=代理端口
Portable Mode=便携模式


+ 1
- 1
shadowsocks-csharp/Util/SystemProxy/Sysproxy.cs View File

@@ -195,7 +195,7 @@ namespace Shadowsocks.Util.SystemProxy
}
catch (System.ComponentModel.Win32Exception e)
{
// log the arguements
// log the arguments
throw new ProxyException(ProxyExceptionType.FailToRun, process.StartInfo.Arguments, e);
}
var stderr = error.ToString();


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

@@ -49,6 +49,7 @@
this.PluginArgumentsTextBox = new System.Windows.Forms.TextBox();
this.PluginArgumentsLabel = new System.Windows.Forms.Label();
this.RemarksLabel = new System.Windows.Forms.Label();
this.NeedPluginArgCheckBox = new System.Windows.Forms.CheckBox();
this.panel2 = new System.Windows.Forms.Panel();
this.OKButton = new System.Windows.Forms.Button();
this.MyCancelButton = new System.Windows.Forms.Button();
@@ -86,7 +87,7 @@
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle());
this.tableLayoutPanel1.Controls.Add(this.PluginOptionsLabel, 0, 6);
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.ServerPortLabel, 0, 1);
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.EncryptionLabel, 0, 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.PluginOptionsTextBox, 1, 6);
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.NeedPluginArgCheckBox, 1, 7);
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 = 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());
@@ -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.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;
//
// PluginOptionsLabel
@@ -146,7 +149,7 @@
// 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, 216);
this.RemarksTextBox.Location = new System.Drawing.Point(113, 238);
this.RemarksTextBox.MaxLength = 32;
this.RemarksTextBox.Name = "RemarksTextBox";
this.RemarksTextBox.Size = new System.Drawing.Size(160, 21);
@@ -262,7 +265,7 @@
//
this.TimeoutLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
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.RightToLeft = System.Windows.Forms.RightToLeft.No;
this.TimeoutLabel.Size = new System.Drawing.Size(77, 12);
@@ -272,7 +275,7 @@
// 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, 243);
this.TimeoutTextBox.Location = new System.Drawing.Point(113, 265);
this.TimeoutTextBox.MaxLength = 5;
this.TimeoutTextBox.Name = "TimeoutTextBox";
this.TimeoutTextBox.Size = new System.Drawing.Size(160, 21);
@@ -315,7 +318,7 @@
// 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, 189);
this.PluginArgumentsTextBox.Location = new System.Drawing.Point(113, 211);
this.PluginArgumentsTextBox.MaxLength = 512;
this.PluginArgumentsTextBox.Name = "PluginArgumentsTextBox";
this.PluginArgumentsTextBox.Size = new System.Drawing.Size(160, 21);
@@ -326,7 +329,7 @@
//
this.PluginArgumentsLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
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.Size = new System.Drawing.Size(101, 12);
this.PluginArgumentsLabel.TabIndex = 7;
@@ -338,12 +341,23 @@
//
this.RemarksLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
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.Size = new System.Drawing.Size(47, 12);
this.RemarksLabel.TabIndex = 8;
this.RemarksLabel.Text = "Remarks";
//
// NeedPluginArgCheckBox
//
this.NeedPluginArgCheckBox.AutoSize = true;
this.NeedPluginArgCheckBox.Location = new System.Drawing.Point(113, 189);
this.NeedPluginArgCheckBox.Name = "NeedPluginArgCheckBox";
this.NeedPluginArgCheckBox.Size = new System.Drawing.Size(150, 16);
this.NeedPluginArgCheckBox.TabIndex = 10;
this.NeedPluginArgCheckBox.Text = "Need Plugin Argument";
this.NeedPluginArgCheckBox.UseVisualStyleBackColor = true;
this.NeedPluginArgCheckBox.CheckedChanged += new System.EventHandler(this.UsePluginArgCheckBox_CheckedChanged);
//
// panel2
//
this.panel2.Anchor = System.Windows.Forms.AnchorStyles.Top;
@@ -412,7 +426,7 @@
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(290, 308);
this.ServerGroupBox.Size = new System.Drawing.Size(290, 330);
this.ServerGroupBox.TabIndex = 0;
this.ServerGroupBox.TabStop = false;
this.ServerGroupBox.Text = "Server";
@@ -449,7 +463,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.Size = new System.Drawing.Size(468, 404);
this.tableLayoutPanel2.Size = new System.Drawing.Size(468, 426);
this.tableLayoutPanel2.TabIndex = 7;
//
// tableLayoutPanel6
@@ -462,7 +476,7 @@
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, 372);
this.tableLayoutPanel6.Location = new System.Drawing.Point(0, 394);
this.tableLayoutPanel6.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel6.Name = "tableLayoutPanel6";
this.tableLayoutPanel6.RowCount = 1;
@@ -506,7 +520,7 @@
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, 308);
this.tableLayoutPanel5.Location = new System.Drawing.Point(166, 330);
this.tableLayoutPanel5.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel5.Name = "tableLayoutPanel5";
this.tableLayoutPanel5.Padding = new System.Windows.Forms.Padding(3);
@@ -560,7 +574,7 @@
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(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.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 1;
@@ -579,7 +593,7 @@
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, 308);
this.tableLayoutPanel4.Location = new System.Drawing.Point(0, 330);
this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(0);
this.tableLayoutPanel4.Name = "tableLayoutPanel4";
this.tableLayoutPanel4.RowCount = 2;
@@ -678,6 +692,7 @@
private System.Windows.Forms.Label PluginArgumentsLabel;
private System.Windows.Forms.ToolTip toolTip1;
private System.Windows.Forms.CheckBox PortableModeCheckBox;
private System.Windows.Forms.CheckBox NeedPluginArgCheckBox;
}
}


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

@@ -53,6 +53,7 @@ namespace Shadowsocks.View
PluginLabel.Text = I18N.GetString("Plugin Program");
PluginOptionsLabel.Text = I18N.GetString("Plugin Options");
PluginArgumentsLabel.Text = I18N.GetString("Plugin Arguments");
NeedPluginArgCheckBox.Text = I18N.GetString("Need Plugin Argument");
ProxyPortLabel.Text = I18N.GetString("Proxy Port");
PortableModeCheckBox.Text = I18N.GetString("Portable Mode");
toolTip1.SetToolTip(this.PortableModeCheckBox, I18N.GetString("Restart required"));
@@ -144,10 +145,22 @@ namespace Shadowsocks.View
PluginTextBox.Text = server.plugin;
PluginOptionsTextBox.Text = server.plugin_opts;
PluginArgumentsTextBox.Text = server.plugin_args;
bool showPluginArgInput = !string.IsNullOrEmpty(server.plugin_args);
NeedPluginArgCheckBox.Checked = showPluginArgInput;
ShowHidePluginArgInput(showPluginArgInput);
RemarksTextBox.Text = server.remarks;
TimeoutTextBox.Text = server.timeout.ToString();
}
private void ShowHidePluginArgInput(bool show)
{
PluginArgumentsTextBox.Visible = show;
PluginArgumentsLabel.Visible = show;
}
private void LoadServerNameListToUI(Configuration configuration)
{
ServersListBox.Items.Clear();
@@ -362,5 +375,10 @@ namespace Shadowsocks.View
{
this.PasswordTextBox.UseSystemPasswordChar = !this.ShowPasswdCheckBox.Checked;
}
private void UsePluginArgCheckBox_CheckedChanged(object sender, EventArgs e)
{
ShowHidePluginArgInput(this.NeedPluginArgCheckBox.Checked);
}
}
}

Loading…
Cancel
Save