diff --git a/shadowsocks-csharp/Controller/Service/TCPRelay.cs b/shadowsocks-csharp/Controller/Service/TCPRelay.cs index 49197251..d427b8bf 100644 --- a/shadowsocks-csharp/Controller/Service/TCPRelay.cs +++ b/shadowsocks-csharp/Controller/Service/TCPRelay.cs @@ -95,7 +95,6 @@ namespace Shadowsocks.Controller class TCPHandler { - class AsyncSession { public IProxy Remote { get; } @@ -121,6 +120,8 @@ namespace Shadowsocks.Controller } } + private readonly int _serverTimeout; + private readonly int _proxyTimeout; // Size of receive buffer. public static readonly int RecvSize = 8192; @@ -169,10 +170,12 @@ namespace Shadowsocks.Controller public TCPHandler(ShadowsocksController controller, Configuration config, TCPRelay tcprelay, Socket socket) { - this._controller = controller; - this._config = config; - this._tcprelay = tcprelay; - this._connection = socket; + _controller = controller; + _config = config; + _tcprelay = tcprelay; + _connection = socket; + _proxyTimeout = config.proxy.proxyTimeout * 1000; + _serverTimeout = config.GetCurrentServer().timeout * 1000; lastActivity = DateTime.Now; } @@ -442,7 +445,7 @@ namespace Shadowsocks.Controller var session = new AsyncSession(remote); _currentRemoteSession = session; - ProxyTimer proxyTimer = new ProxyTimer(3000); + ProxyTimer proxyTimer = new ProxyTimer(_proxyTimeout); proxyTimer.AutoReset = false; proxyTimer.Elapsed += proxyConnectTimer_Elapsed; proxyTimer.Enabled = true; @@ -515,7 +518,7 @@ namespace Shadowsocks.Controller } _startConnectTime = DateTime.Now; - ServerTimer connectTimer = new ServerTimer(3000); + ServerTimer connectTimer = new ServerTimer(_serverTimeout); connectTimer.AutoReset = false; connectTimer.Elapsed += destConnectTimer_Elapsed; connectTimer.Enabled = true; diff --git a/shadowsocks-csharp/Data/cn.txt b/shadowsocks-csharp/Data/cn.txt index 7030ff40..afeed4d7 100644 --- a/shadowsocks-csharp/Data/cn.txt +++ b/shadowsocks-csharp/Data/cn.txt @@ -47,6 +47,7 @@ Password=密码 Encryption=加密 Proxy Port=代理端口 Remarks=备注 +Timeout(Sec)=超时(秒) Onetime Authentication=一次性认证 OK=确定 Cancel=取消 @@ -132,3 +133,4 @@ Proxy request failed=代理请求失败 Proxy handshake failed=代理握手失败 Register hotkey failed=注册热键失败 Cannot parse hotkey: {0}=解析热键失败: {0} +Timeout is invalid, it should not exceed {0}=超时无效,不应超过 {0} diff --git a/shadowsocks-csharp/Data/zh_tw.txt b/shadowsocks-csharp/Data/zh_tw.txt index ea3f24ad..4c32e7b3 100644 --- a/shadowsocks-csharp/Data/zh_tw.txt +++ b/shadowsocks-csharp/Data/zh_tw.txt @@ -47,6 +47,7 @@ Password=密碼 Encryption=加密 Proxy Port=代理連接埠 Remarks=備註 +Timeout(Sec)=超時(秒) Onetime Authentication=單次驗證 OK=確定 Cancel=取消 @@ -132,3 +133,4 @@ Proxy request failed=代理請求失敗 Proxy handshake failed=代理握手失敗 Register hotkey failed=註冊捷徑鍵失敗 Cannot parse hotkey: {0}=解析捷徑鍵失敗: {0} +Timeout is invalid, it should not exceed {0}=超時無效,不應超過 {0} diff --git a/shadowsocks-csharp/Model/Configuration.cs b/shadowsocks-csharp/Model/Configuration.cs index beaf3574..5b3ab57e 100755 --- a/shadowsocks-csharp/Model/Configuration.cs +++ b/shadowsocks-csharp/Model/Configuration.cs @@ -44,6 +44,7 @@ namespace Shadowsocks.Model CheckPort(server.server_port); CheckPassword(server.password); CheckServer(server.server); + CheckTimeout(server.timeout, Server.MaxServerTimeoutSec); } public static Configuration Load() @@ -147,5 +148,12 @@ namespace Shadowsocks.Model if (server.IsNullOrEmpty()) throw new ArgumentException(I18N.GetString("Server IP can not be blank")); } + + public static void CheckTimeout(int timeout, int maxTimeout) + { + if (timeout <= 0 || timeout > maxTimeout) + throw new ArgumentException(string.Format( + I18N.GetString("Timeout is invalid, it should not exceed {0}"), maxTimeout)); + } } } diff --git a/shadowsocks-csharp/Model/ProxyConfig.cs b/shadowsocks-csharp/Model/ProxyConfig.cs index 1aa83ed6..462df824 100644 --- a/shadowsocks-csharp/Model/ProxyConfig.cs +++ b/shadowsocks-csharp/Model/ProxyConfig.cs @@ -8,10 +8,14 @@ namespace Shadowsocks.Model public const int PROXY_SOCKS5 = 0; public const int PROXY_HTTP = 1; + public const int MaxProxyTimeoutSec = 10; + private const int DefaultProxyTimeoutSec = 3; + public bool useProxy; public int proxyType; public string proxyServer; public int proxyPort; + public int proxyTimeout; public ProxyConfig() { @@ -19,6 +23,7 @@ namespace Shadowsocks.Model proxyType = PROXY_SOCKS5; proxyServer = ""; proxyPort = 0; + proxyTimeout = DefaultProxyTimeoutSec; } } } diff --git a/shadowsocks-csharp/Model/Server.cs b/shadowsocks-csharp/Model/Server.cs index 85032f08..462a7add 100755 --- a/shadowsocks-csharp/Model/Server.cs +++ b/shadowsocks-csharp/Model/Server.cs @@ -15,12 +15,16 @@ namespace Shadowsocks.Model DetailsParser = new Regex("^((?.+?)(?-auth)??:(?.*)@(?.+?)" + ":(?\\d+?))$", RegexOptions.Compiled | RegexOptions.IgnoreCase); + private const int DefaultServerTimeoutSec = 5; + public const int MaxServerTimeoutSec = 20; + public string server; public int server_port; public string password; public string method; public string remarks; public bool auth; + public int timeout; public override int GetHashCode() { @@ -67,6 +71,7 @@ namespace Shadowsocks.Model password = ""; remarks = ""; auth = false; + timeout = DefaultServerTimeoutSec; } public Server(string ssURL) : this() diff --git a/shadowsocks-csharp/View/ConfigForm.Designer.cs b/shadowsocks-csharp/View/ConfigForm.Designer.cs index b2829704..6f546053 100755 --- a/shadowsocks-csharp/View/ConfigForm.Designer.cs +++ b/shadowsocks-csharp/View/ConfigForm.Designer.cs @@ -57,6 +57,8 @@ this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); this.DuplicateButton = new System.Windows.Forms.Button(); + this.TimeoutLabel = new System.Windows.Forms.Label(); + this.TimeoutTextBox = new System.Windows.Forms.TextBox(); this.tableLayoutPanel1.SuspendLayout(); this.ServerGroupBox.SuspendLayout(); this.tableLayoutPanel2.SuspendLayout(); @@ -83,12 +85,14 @@ 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.Controls.Add(this.OneTimeAuth, 1, 6); + this.tableLayoutPanel1.Controls.Add(this.OneTimeAuth, 1, 7); + this.tableLayoutPanel1.Controls.Add(this.TimeoutLabel, 0, 6); + this.tableLayoutPanel1.Controls.Add(this.TimeoutTextBox, 1, 6); 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 = 7; + this.tableLayoutPanel1.RowCount = 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()); @@ -96,13 +100,14 @@ 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(249, 162); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.Size = new System.Drawing.Size(255, 189); 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(83, 113); + this.RemarksTextBox.Location = new System.Drawing.Point(89, 113); this.RemarksTextBox.MaxLength = 32; this.RemarksTextBox.Name = "RemarksTextBox"; this.RemarksTextBox.Size = new System.Drawing.Size(160, 21); @@ -113,7 +118,7 @@ // this.RemarksLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.RemarksLabel.AutoSize = true; - this.RemarksLabel.Location = new System.Drawing.Point(30, 117); + this.RemarksLabel.Location = new System.Drawing.Point(36, 117); this.RemarksLabel.Name = "RemarksLabel"; this.RemarksLabel.Size = new System.Drawing.Size(47, 12); this.RemarksLabel.TabIndex = 9; @@ -123,7 +128,7 @@ // this.IPLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.IPLabel.AutoSize = true; - this.IPLabel.Location = new System.Drawing.Point(18, 10); + this.IPLabel.Location = new System.Drawing.Point(24, 10); this.IPLabel.Name = "IPLabel"; this.IPLabel.Size = new System.Drawing.Size(59, 12); this.IPLabel.TabIndex = 0; @@ -133,7 +138,7 @@ // this.ServerPortLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.ServerPortLabel.AutoSize = true; - this.ServerPortLabel.Location = new System.Drawing.Point(6, 37); + this.ServerPortLabel.Location = new System.Drawing.Point(12, 37); this.ServerPortLabel.Name = "ServerPortLabel"; this.ServerPortLabel.Size = new System.Drawing.Size(71, 12); this.ServerPortLabel.TabIndex = 1; @@ -143,7 +148,7 @@ // this.PasswordLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.PasswordLabel.AutoSize = true; - this.PasswordLabel.Location = new System.Drawing.Point(24, 64); + this.PasswordLabel.Location = new System.Drawing.Point(30, 64); this.PasswordLabel.Name = "PasswordLabel"; this.PasswordLabel.Size = new System.Drawing.Size(53, 12); this.PasswordLabel.TabIndex = 2; @@ -152,7 +157,7 @@ // 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(83, 6); + this.IPTextBox.Location = new System.Drawing.Point(89, 6); this.IPTextBox.MaxLength = 512; this.IPTextBox.Name = "IPTextBox"; this.IPTextBox.Size = new System.Drawing.Size(160, 21); @@ -162,7 +167,7 @@ // 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(83, 33); + this.ServerPortTextBox.Location = new System.Drawing.Point(89, 33); this.ServerPortTextBox.MaxLength = 10; this.ServerPortTextBox.Name = "ServerPortTextBox"; this.ServerPortTextBox.Size = new System.Drawing.Size(160, 21); @@ -172,7 +177,7 @@ // 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(83, 60); + this.PasswordTextBox.Location = new System.Drawing.Point(89, 60); this.PasswordTextBox.MaxLength = 256; this.PasswordTextBox.Name = "PasswordTextBox"; this.PasswordTextBox.Size = new System.Drawing.Size(160, 21); @@ -184,7 +189,7 @@ // this.EncryptionLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; this.EncryptionLabel.AutoSize = true; - this.EncryptionLabel.Location = new System.Drawing.Point(12, 91); + this.EncryptionLabel.Location = new System.Drawing.Point(18, 91); this.EncryptionLabel.Name = "EncryptionLabel"; this.EncryptionLabel.Size = new System.Drawing.Size(65, 12); this.EncryptionLabel.TabIndex = 8; @@ -213,7 +218,7 @@ "camellia-128-cfb", "camellia-192-cfb", "camellia-256-cfb"}); - this.EncryptionSelect.Location = new System.Drawing.Point(83, 87); + this.EncryptionSelect.Location = new System.Drawing.Point(89, 87); this.EncryptionSelect.Name = "EncryptionSelect"; this.EncryptionSelect.Size = new System.Drawing.Size(160, 20); this.EncryptionSelect.TabIndex = 3; @@ -221,7 +226,7 @@ // OneTimeAuth // this.OneTimeAuth.AutoSize = true; - this.OneTimeAuth.Location = new System.Drawing.Point(83, 140); + this.OneTimeAuth.Location = new System.Drawing.Point(89, 167); this.OneTimeAuth.Name = "OneTimeAuth"; this.OneTimeAuth.Size = new System.Drawing.Size(156, 16); this.OneTimeAuth.TabIndex = 5; @@ -296,7 +301,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(260, 200); + this.ServerGroupBox.Size = new System.Drawing.Size(266, 227); this.ServerGroupBox.TabIndex = 0; this.ServerGroupBox.TabStop = false; this.ServerGroupBox.Text = "Server"; @@ -333,7 +338,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(438, 296); + this.tableLayoutPanel2.Size = new System.Drawing.Size(444, 323); this.tableLayoutPanel2.TabIndex = 7; // // tableLayoutPanel6 @@ -346,7 +351,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, 264); + this.tableLayoutPanel6.Location = new System.Drawing.Point(0, 291); this.tableLayoutPanel6.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel6.Name = "tableLayoutPanel6"; this.tableLayoutPanel6.RowCount = 1; @@ -389,16 +394,16 @@ 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(242, 200); + this.tableLayoutPanel5.Location = new System.Drawing.Point(248, 227); 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, 27F)); - this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 27F)); - this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 27F)); - this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 27F)); + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 58F)); + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 58F)); + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 58F)); + this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 58F)); this.tableLayoutPanel5.Size = new System.Drawing.Size(196, 64); this.tableLayoutPanel5.TabIndex = 9; // @@ -433,7 +438,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(279, 267); + this.tableLayoutPanel3.Location = new System.Drawing.Point(285, 294); this.tableLayoutPanel3.Margin = new System.Windows.Forms.Padding(3, 3, 0, 3); this.tableLayoutPanel3.Name = "tableLayoutPanel3"; this.tableLayoutPanel3.RowCount = 1; @@ -452,7 +457,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, 200); + this.tableLayoutPanel4.Location = new System.Drawing.Point(0, 227); this.tableLayoutPanel4.Margin = new System.Windows.Forms.Padding(0); this.tableLayoutPanel4.Name = "tableLayoutPanel4"; this.tableLayoutPanel4.RowCount = 2; @@ -473,6 +478,26 @@ this.DuplicateButton.UseVisualStyleBackColor = true; this.DuplicateButton.Click += new System.EventHandler(this.DuplicateButton_Click); // + // TimeoutLabel + // + this.TimeoutLabel.Anchor = System.Windows.Forms.AnchorStyles.Right; + this.TimeoutLabel.AutoSize = true; + this.TimeoutLabel.Location = new System.Drawing.Point(6, 144); + this.TimeoutLabel.Name = "TimeoutLabel"; + this.TimeoutLabel.RightToLeft = System.Windows.Forms.RightToLeft.No; + this.TimeoutLabel.Size = new System.Drawing.Size(77, 12); + this.TimeoutLabel.TabIndex = 10; + 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(89, 140); + this.TimeoutTextBox.MaxLength = 5; + this.TimeoutTextBox.Name = "TimeoutTextBox"; + this.TimeoutTextBox.Size = new System.Drawing.Size(160, 21); + this.TimeoutTextBox.TabIndex = 11; + // // ConfigForm // this.AcceptButton = this.OKButton; @@ -542,6 +567,8 @@ private System.Windows.Forms.Button MoveUpButton; private System.Windows.Forms.CheckBox OneTimeAuth; private System.Windows.Forms.Button DuplicateButton; + private System.Windows.Forms.Label TimeoutLabel; + private System.Windows.Forms.TextBox TimeoutTextBox; } } diff --git a/shadowsocks-csharp/View/ConfigForm.cs b/shadowsocks-csharp/View/ConfigForm.cs index b0228795..3e32cb4a 100755 --- a/shadowsocks-csharp/View/ConfigForm.cs +++ b/shadowsocks-csharp/View/ConfigForm.cs @@ -49,6 +49,7 @@ namespace Shadowsocks.View EncryptionLabel.Text = I18N.GetString("Encryption"); ProxyPortLabel.Text = I18N.GetString("Proxy Port"); RemarksLabel.Text = I18N.GetString("Remarks"); + TimeoutLabel.Text = I18N.GetString("Timeout(Sec)"); OneTimeAuth.Text = I18N.GetString("Onetime Authentication"); ServerGroupBox.Text = I18N.GetString("Server"); OKButton.Text = I18N.GetString("OK"); @@ -85,6 +86,7 @@ namespace Shadowsocks.View password = PasswordTextBox.Text, method = EncryptionSelect.Text, remarks = RemarksTextBox.Text, + timeout = int.Parse(TimeoutTextBox.Text), auth = OneTimeAuth.Checked }; int localPort = int.Parse(ProxyPortTextBox.Text); @@ -118,6 +120,7 @@ namespace Shadowsocks.View ProxyPortTextBox.Text = _modifiedConfiguration.localPort.ToString(); EncryptionSelect.Text = server.method ?? "aes-256-cfb"; RemarksTextBox.Text = server.remarks; + TimeoutTextBox.Text = server.timeout.ToString(); OneTimeAuth.Checked = server.auth; } } diff --git a/shadowsocks-csharp/View/ProxyForm.Designer.cs b/shadowsocks-csharp/View/ProxyForm.Designer.cs index cb564d4e..74e780ef 100644 --- a/shadowsocks-csharp/View/ProxyForm.Designer.cs +++ b/shadowsocks-csharp/View/ProxyForm.Designer.cs @@ -28,226 +28,252 @@ /// private void InitializeComponent() { - this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); - this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); - this.MyCancelButton = new System.Windows.Forms.Button(); - this.OKButton = new System.Windows.Forms.Button(); - this.UseProxyCheckBox = new System.Windows.Forms.CheckBox(); - this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); - this.ProxyAddrLabel = new System.Windows.Forms.Label(); - this.ProxyServerTextBox = new System.Windows.Forms.TextBox(); - this.ProxyPortLable = new System.Windows.Forms.Label(); - this.ProxyPortTextBox = new System.Windows.Forms.TextBox(); - this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); - this.ProxyTypeLabel = new System.Windows.Forms.Label(); - this.ProxyTypeComboBox = new System.Windows.Forms.ComboBox(); - this.tableLayoutPanel1.SuspendLayout(); - this.tableLayoutPanel3.SuspendLayout(); - this.tableLayoutPanel2.SuspendLayout(); - this.tableLayoutPanel4.SuspendLayout(); - this.SuspendLayout(); - // - // tableLayoutPanel1 - // - this.tableLayoutPanel1.AutoSize = true; - this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; - this.tableLayoutPanel1.ColumnCount = 1; - this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel3, 0, 3); - this.tableLayoutPanel1.Controls.Add(this.UseProxyCheckBox, 0, 0); - this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 2); - this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel4, 0, 1); - this.tableLayoutPanel1.Location = new System.Drawing.Point(15, 15); - this.tableLayoutPanel1.Name = "tableLayoutPanel1"; - this.tableLayoutPanel1.RowCount = 4; - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel1.Size = new System.Drawing.Size(395, 123); - this.tableLayoutPanel1.TabIndex = 0; - // - // 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(236, 94); - 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 = 9; - // - // 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 = 13; - this.MyCancelButton.Text = "Cancel"; - this.MyCancelButton.UseVisualStyleBackColor = true; - this.MyCancelButton.Click += new System.EventHandler(this.CancelButton_Click); - // - // 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 = 12; - this.OKButton.Text = "OK"; - this.OKButton.UseVisualStyleBackColor = true; - this.OKButton.Click += new System.EventHandler(this.OKButton_Click); - // - // UseProxyCheckBox - // - this.UseProxyCheckBox.AutoSize = true; - this.UseProxyCheckBox.Location = new System.Drawing.Point(3, 3); - this.UseProxyCheckBox.Name = "UseProxyCheckBox"; - this.UseProxyCheckBox.Size = new System.Drawing.Size(78, 16); - this.UseProxyCheckBox.TabIndex = 0; - this.UseProxyCheckBox.Text = "Use Proxy"; - this.UseProxyCheckBox.UseVisualStyleBackColor = true; - this.UseProxyCheckBox.CheckedChanged += new System.EventHandler(this.UseProxyCheckBox_CheckedChanged); - // - // tableLayoutPanel2 - // - this.tableLayoutPanel2.AutoSize = true; - this.tableLayoutPanel2.ColumnCount = 4; - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); - this.tableLayoutPanel2.Controls.Add(this.ProxyAddrLabel, 0, 0); - this.tableLayoutPanel2.Controls.Add(this.ProxyServerTextBox, 1, 0); - this.tableLayoutPanel2.Controls.Add(this.ProxyPortLable, 2, 0); - this.tableLayoutPanel2.Controls.Add(this.ProxyPortTextBox, 3, 0); - this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 61); - this.tableLayoutPanel2.Name = "tableLayoutPanel2"; - this.tableLayoutPanel2.RowCount = 1; - this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); - this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F)); - this.tableLayoutPanel2.Size = new System.Drawing.Size(389, 27); - this.tableLayoutPanel2.TabIndex = 1; - // - // ProxyAddrLabel - // - this.ProxyAddrLabel.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.ProxyAddrLabel.AutoSize = true; - this.ProxyAddrLabel.Location = new System.Drawing.Point(3, 7); - this.ProxyAddrLabel.Name = "ProxyAddrLabel"; - this.ProxyAddrLabel.Size = new System.Drawing.Size(65, 12); - this.ProxyAddrLabel.TabIndex = 0; - this.ProxyAddrLabel.Text = "Proxy Addr"; - // - // ProxyServerTextBox - // - this.ProxyServerTextBox.Location = new System.Drawing.Point(74, 3); - this.ProxyServerTextBox.MaxLength = 512; - this.ProxyServerTextBox.Name = "ProxyServerTextBox"; - this.ProxyServerTextBox.Size = new System.Drawing.Size(135, 21); - this.ProxyServerTextBox.TabIndex = 1; - this.ProxyServerTextBox.WordWrap = false; - // - // ProxyPortLable - // - this.ProxyPortLable.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.ProxyPortLable.AutoSize = true; - this.ProxyPortLable.Location = new System.Drawing.Point(215, 7); - this.ProxyPortLable.Name = "ProxyPortLable"; - this.ProxyPortLable.Size = new System.Drawing.Size(65, 12); - this.ProxyPortLable.TabIndex = 2; - this.ProxyPortLable.Text = "Proxy Port"; - // - // ProxyPortTextBox - // - this.ProxyPortTextBox.Location = new System.Drawing.Point(286, 3); - this.ProxyPortTextBox.MaxLength = 10; - this.ProxyPortTextBox.Name = "ProxyPortTextBox"; - this.ProxyPortTextBox.Size = new System.Drawing.Size(100, 21); - this.ProxyPortTextBox.TabIndex = 3; - this.ProxyPortTextBox.WordWrap = false; - // - // tableLayoutPanel4 - // - this.tableLayoutPanel4.AutoSize = true; - 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.ProxyTypeLabel, 0, 0); - this.tableLayoutPanel4.Controls.Add(this.ProxyTypeComboBox, 1, 0); - this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 25); - this.tableLayoutPanel4.Name = "tableLayoutPanel4"; - this.tableLayoutPanel4.RowCount = 1; - this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); - this.tableLayoutPanel4.Size = new System.Drawing.Size(198, 30); - this.tableLayoutPanel4.TabIndex = 10; - // - // ProxyTypeLabel - // - this.ProxyTypeLabel.Anchor = System.Windows.Forms.AnchorStyles.Left; - this.ProxyTypeLabel.AutoSize = true; - this.ProxyTypeLabel.Location = new System.Drawing.Point(3, 9); - this.ProxyTypeLabel.Name = "ProxyTypeLabel"; - this.ProxyTypeLabel.Size = new System.Drawing.Size(65, 12); - this.ProxyTypeLabel.TabIndex = 1; - this.ProxyTypeLabel.Text = "Proxy Type"; - // - // ProxyTypeComboBox - // - this.ProxyTypeComboBox.Dock = System.Windows.Forms.DockStyle.Fill; - this.ProxyTypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.ProxyTypeComboBox.FormattingEnabled = true; - this.ProxyTypeComboBox.Items.AddRange(new object[] { - "SOCKS5", - "HTTP"}); - this.ProxyTypeComboBox.Location = new System.Drawing.Point(74, 5); - this.ProxyTypeComboBox.Margin = new System.Windows.Forms.Padding(3, 5, 3, 5); - this.ProxyTypeComboBox.Name = "ProxyTypeComboBox"; - this.ProxyTypeComboBox.Size = new System.Drawing.Size(121, 20); - this.ProxyTypeComboBox.TabIndex = 2; - // - // ProxyForm - // - 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(441, 165); - this.Controls.Add(this.tableLayoutPanel1); - this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; - this.MaximizeBox = false; - this.MinimizeBox = false; - this.Name = "ProxyForm"; - this.Padding = new System.Windows.Forms.Padding(12, 12, 12, 9); - this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; - this.Text = "Edit Proxy"; - this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ProxyForm_FormClosed); - this.tableLayoutPanel1.ResumeLayout(false); - this.tableLayoutPanel1.PerformLayout(); - this.tableLayoutPanel3.ResumeLayout(false); - this.tableLayoutPanel2.ResumeLayout(false); - this.tableLayoutPanel2.PerformLayout(); - this.tableLayoutPanel4.ResumeLayout(false); - this.tableLayoutPanel4.PerformLayout(); - this.ResumeLayout(false); - this.PerformLayout(); - + this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel(); + this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel(); + this.MyCancelButton = new System.Windows.Forms.Button(); + this.OKButton = new System.Windows.Forms.Button(); + this.UseProxyCheckBox = new System.Windows.Forms.CheckBox(); + this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel(); + this.ProxyAddrLabel = new System.Windows.Forms.Label(); + this.ProxyServerTextBox = new System.Windows.Forms.TextBox(); + this.ProxyPortLabel = new System.Windows.Forms.Label(); + this.ProxyPortTextBox = new System.Windows.Forms.TextBox(); + this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel(); + this.ProxyTypeLabel = new System.Windows.Forms.Label(); + this.ProxyTypeComboBox = new System.Windows.Forms.ComboBox(); + this.ProxyTimeoutTextBox = new System.Windows.Forms.TextBox(); + this.ProxyTimeoutLabel = new System.Windows.Forms.Label(); + this.tableLayoutPanel1.SuspendLayout(); + this.tableLayoutPanel3.SuspendLayout(); + this.tableLayoutPanel2.SuspendLayout(); + this.tableLayoutPanel4.SuspendLayout(); + this.SuspendLayout(); + // + // tableLayoutPanel1 + // + this.tableLayoutPanel1.AutoSize = true; + this.tableLayoutPanel1.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink; + this.tableLayoutPanel1.ColumnCount = 1; + this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel3, 0, 3); + this.tableLayoutPanel1.Controls.Add(this.UseProxyCheckBox, 0, 0); + this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 2); + this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel4, 0, 1); + this.tableLayoutPanel1.Location = new System.Drawing.Point(15, 15); + this.tableLayoutPanel1.Name = "tableLayoutPanel1"; + this.tableLayoutPanel1.RowCount = 4; + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel1.Size = new System.Drawing.Size(395, 123); + this.tableLayoutPanel1.TabIndex = 0; + // + // 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(236, 94); + 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 = 9; + // + // 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 = 13; + this.MyCancelButton.Text = "Cancel"; + this.MyCancelButton.UseVisualStyleBackColor = true; + this.MyCancelButton.Click += new System.EventHandler(this.CancelButton_Click); + // + // 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 = 12; + this.OKButton.Text = "OK"; + this.OKButton.UseVisualStyleBackColor = true; + this.OKButton.Click += new System.EventHandler(this.OKButton_Click); + // + // UseProxyCheckBox + // + this.UseProxyCheckBox.AutoSize = true; + this.UseProxyCheckBox.Location = new System.Drawing.Point(3, 3); + this.UseProxyCheckBox.Name = "UseProxyCheckBox"; + this.UseProxyCheckBox.Size = new System.Drawing.Size(78, 16); + this.UseProxyCheckBox.TabIndex = 0; + this.UseProxyCheckBox.Text = "Use Proxy"; + this.UseProxyCheckBox.UseVisualStyleBackColor = true; + this.UseProxyCheckBox.CheckedChanged += new System.EventHandler(this.UseProxyCheckBox_CheckedChanged); + // + // tableLayoutPanel2 + // + this.tableLayoutPanel2.AutoSize = true; + this.tableLayoutPanel2.ColumnCount = 4; + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel2.Controls.Add(this.ProxyAddrLabel, 0, 0); + this.tableLayoutPanel2.Controls.Add(this.ProxyServerTextBox, 1, 0); + this.tableLayoutPanel2.Controls.Add(this.ProxyPortLabel, 2, 0); + this.tableLayoutPanel2.Controls.Add(this.ProxyPortTextBox, 3, 0); + this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 61); + this.tableLayoutPanel2.Name = "tableLayoutPanel2"; + this.tableLayoutPanel2.RowCount = 1; + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F)); + this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 27F)); + this.tableLayoutPanel2.Size = new System.Drawing.Size(389, 27); + this.tableLayoutPanel2.TabIndex = 1; + // + // ProxyAddrLabel + // + this.ProxyAddrLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.ProxyAddrLabel.AutoSize = true; + this.ProxyAddrLabel.Location = new System.Drawing.Point(3, 7); + this.ProxyAddrLabel.Name = "ProxyAddrLabel"; + this.ProxyAddrLabel.Size = new System.Drawing.Size(65, 12); + this.ProxyAddrLabel.TabIndex = 0; + this.ProxyAddrLabel.Text = "Proxy Addr"; + // + // ProxyServerTextBox + // + this.ProxyServerTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.ProxyServerTextBox.Location = new System.Drawing.Point(74, 3); + this.ProxyServerTextBox.MaxLength = 512; + this.ProxyServerTextBox.Name = "ProxyServerTextBox"; + this.ProxyServerTextBox.Size = new System.Drawing.Size(135, 21); + this.ProxyServerTextBox.TabIndex = 1; + this.ProxyServerTextBox.WordWrap = false; + // + // ProxyPortLabel + // + this.ProxyPortLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.ProxyPortLabel.AutoSize = true; + this.ProxyPortLabel.Location = new System.Drawing.Point(215, 7); + this.ProxyPortLabel.Name = "ProxyPortLabel"; + this.ProxyPortLabel.Size = new System.Drawing.Size(65, 12); + this.ProxyPortLabel.TabIndex = 2; + this.ProxyPortLabel.Text = "Proxy Port"; + // + // ProxyPortTextBox + // + this.ProxyPortTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.ProxyPortTextBox.Location = new System.Drawing.Point(286, 3); + this.ProxyPortTextBox.MaxLength = 10; + this.ProxyPortTextBox.Name = "ProxyPortTextBox"; + this.ProxyPortTextBox.Size = new System.Drawing.Size(100, 21); + this.ProxyPortTextBox.TabIndex = 3; + this.ProxyPortTextBox.WordWrap = false; + // + // tableLayoutPanel4 + // + this.tableLayoutPanel4.AutoSize = true; + this.tableLayoutPanel4.ColumnCount = 4; + this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle()); + this.tableLayoutPanel4.Controls.Add(this.ProxyTypeLabel, 0, 0); + this.tableLayoutPanel4.Controls.Add(this.ProxyTypeComboBox, 1, 0); + this.tableLayoutPanel4.Controls.Add(this.ProxyTimeoutTextBox, 3, 0); + this.tableLayoutPanel4.Controls.Add(this.ProxyTimeoutLabel, 2, 0); + this.tableLayoutPanel4.Location = new System.Drawing.Point(3, 25); + this.tableLayoutPanel4.Name = "tableLayoutPanel4"; + this.tableLayoutPanel4.RowCount = 1; + this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle()); + this.tableLayoutPanel4.Size = new System.Drawing.Size(387, 30); + this.tableLayoutPanel4.TabIndex = 10; + // + // ProxyTypeLabel + // + this.ProxyTypeLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.ProxyTypeLabel.AutoSize = true; + this.ProxyTypeLabel.Location = new System.Drawing.Point(3, 9); + this.ProxyTypeLabel.Name = "ProxyTypeLabel"; + this.ProxyTypeLabel.Size = new System.Drawing.Size(65, 12); + this.ProxyTypeLabel.TabIndex = 1; + this.ProxyTypeLabel.Text = "Proxy Type"; + // + // ProxyTypeComboBox + // + this.ProxyTypeComboBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.ProxyTypeComboBox.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.ProxyTypeComboBox.FormattingEnabled = true; + this.ProxyTypeComboBox.Items.AddRange(new object[] { + "SOCKS5", + "HTTP"}); + this.ProxyTypeComboBox.Location = new System.Drawing.Point(74, 5); + this.ProxyTypeComboBox.Margin = new System.Windows.Forms.Padding(3, 5, 3, 5); + this.ProxyTypeComboBox.Name = "ProxyTypeComboBox"; + this.ProxyTypeComboBox.Size = new System.Drawing.Size(121, 20); + this.ProxyTypeComboBox.TabIndex = 2; + // + // ProxyTimeoutTextBox + // + this.ProxyTimeoutTextBox.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.ProxyTimeoutTextBox.Location = new System.Drawing.Point(284, 4); + this.ProxyTimeoutTextBox.Name = "ProxyTimeoutTextBox"; + this.ProxyTimeoutTextBox.Size = new System.Drawing.Size(100, 21); + this.ProxyTimeoutTextBox.TabIndex = 3; + // + // ProxyTimeoutLabel + // + this.ProxyTimeoutLabel.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right))); + this.ProxyTimeoutLabel.AutoSize = true; + this.ProxyTimeoutLabel.Location = new System.Drawing.Point(201, 9); + this.ProxyTimeoutLabel.Name = "ProxyTimeoutLabel"; + this.ProxyTimeoutLabel.Size = new System.Drawing.Size(77, 12); + this.ProxyTimeoutLabel.TabIndex = 4; + this.ProxyTimeoutLabel.Text = "Timeout(Sec)"; + // + // ProxyForm + // + 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(441, 165); + this.Controls.Add(this.tableLayoutPanel1); + this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle; + this.MaximizeBox = false; + this.MinimizeBox = false; + this.Name = "ProxyForm"; + this.Padding = new System.Windows.Forms.Padding(12, 12, 12, 9); + this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; + this.Text = "Edit Proxy"; + this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.ProxyForm_FormClosed); + this.tableLayoutPanel1.ResumeLayout(false); + this.tableLayoutPanel1.PerformLayout(); + this.tableLayoutPanel3.ResumeLayout(false); + this.tableLayoutPanel2.ResumeLayout(false); + this.tableLayoutPanel2.PerformLayout(); + this.tableLayoutPanel4.ResumeLayout(false); + this.tableLayoutPanel4.PerformLayout(); + this.ResumeLayout(false); + this.PerformLayout(); + } #endregion @@ -257,13 +283,15 @@ private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2; private System.Windows.Forms.Label ProxyAddrLabel; private System.Windows.Forms.TextBox ProxyServerTextBox; - private System.Windows.Forms.Label ProxyPortLable; + private System.Windows.Forms.Label ProxyPortLabel; private System.Windows.Forms.TextBox ProxyPortTextBox; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3; private System.Windows.Forms.Button MyCancelButton; private System.Windows.Forms.Button OKButton; private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4; private System.Windows.Forms.Label ProxyTypeLabel; - private System.Windows.Forms.ComboBox ProxyTypeComboBox; + private System.Windows.Forms.ComboBox ProxyTypeComboBox; + private System.Windows.Forms.TextBox ProxyTimeoutTextBox; + private System.Windows.Forms.Label ProxyTimeoutLabel; } } \ No newline at end of file diff --git a/shadowsocks-csharp/View/ProxyForm.cs b/shadowsocks-csharp/View/ProxyForm.cs index 1a18f9c8..3b351f4b 100644 --- a/shadowsocks-csharp/View/ProxyForm.cs +++ b/shadowsocks-csharp/View/ProxyForm.cs @@ -34,7 +34,8 @@ namespace Shadowsocks.View UseProxyCheckBox.Text = I18N.GetString("Use Proxy"); ProxyTypeLabel.Text = I18N.GetString("Proxy Type"); ProxyAddrLabel.Text = I18N.GetString("Proxy Addr"); - ProxyPortLable.Text = I18N.GetString("Proxy Port"); + ProxyPortLabel.Text = I18N.GetString("Proxy Port"); + ProxyTimeoutLabel.Text = I18N.GetString("Timeout(Sec)"); OKButton.Text = I18N.GetString("OK"); MyCancelButton.Text = I18N.GetString("Cancel"); this.Text = I18N.GetString("Edit Proxy"); @@ -51,6 +52,7 @@ namespace Shadowsocks.View UseProxyCheckBox.Checked = _modifiedConfiguration.useProxy; ProxyServerTextBox.Text = _modifiedConfiguration.proxyServer; ProxyPortTextBox.Text = _modifiedConfiguration.proxyPort.ToString(); + ProxyTimeoutTextBox.Text = _modifiedConfiguration.proxyTimeout.ToString(); ProxyTypeComboBox.SelectedIndex = _modifiedConfiguration.proxyType; } @@ -63,8 +65,10 @@ namespace Shadowsocks.View var type = ProxyTypeComboBox.SelectedIndex; var proxy = ProxyServerTextBox.Text; var port = int.Parse(ProxyPortTextBox.Text); + var timeout = int.Parse(ProxyTimeoutTextBox.Text); Configuration.CheckServer(proxy); Configuration.CheckPort(port); + Configuration.CheckTimeout(timeout, ProxyConfig.MaxProxyTimeoutSec); controller.EnableProxy(type, proxy, port); } @@ -90,6 +94,9 @@ namespace Shadowsocks.View var tmpProxyPort = 0; int.TryParse(ProxyPortTextBox.Text, out tmpProxyPort); _modifiedConfiguration.proxyPort = tmpProxyPort; + var tmpProxyTimeout = 0; + int.TryParse(ProxyTimeoutTextBox.Text, out tmpProxyTimeout); + _modifiedConfiguration.proxyTimeout = tmpProxyTimeout; controller.SaveProxyConfig(_modifiedConfiguration); this.Close(); @@ -116,14 +123,17 @@ namespace Shadowsocks.View { ProxyServerTextBox.Enabled = true; ProxyPortTextBox.Enabled = true; + ProxyTimeoutTextBox.Enabled = true; ProxyTypeComboBox.Enabled = true; } else { ProxyServerTextBox.Clear(); ProxyPortTextBox.Clear(); + ProxyTimeoutTextBox.Clear(); ProxyServerTextBox.Enabled = false; ProxyPortTextBox.Enabled = false; + ProxyTimeoutTextBox.Enabled = false; ProxyTypeComboBox.Enabled = false; } } diff --git a/shadowsocks-csharp/View/ProxyForm.resx b/shadowsocks-csharp/View/ProxyForm.resx index 1af7de15..29dcb1b3 100644 --- a/shadowsocks-csharp/View/ProxyForm.resx +++ b/shadowsocks-csharp/View/ProxyForm.resx @@ -1,120 +1,120 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + \ No newline at end of file