Example #1
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="client"></param>
        private void UpdateClient(IProxyClientFactory client)
        {
            _inupdate = true;

            if ((client is DefaultProxyClientFactory) && (!HideDefault))
            {
                radioDefault.Checked = true;
            }
            else if ((client is IpProxyClientFactory) || (client is DefaultProxyClientFactory))
            {
                radioDirect.Checked = true;
            }
            else if (client is TcpProxyClientFactory)
            {
                TcpProxyClientFactory c = (TcpProxyClientFactory)client;
                radioProxy.Checked = true;

                textBoxHost.Text        = c.Hostname;
                numericUpDownPort.Value = c.Port;
                checkBoxIpv6.Checked    = c.IPv6;

                if (client is HttpProxyClientFactory)
                {
                    radioHttp.Checked = true;
                }
                else
                {
                    SocksProxyClientFactory socks = (SocksProxyClientFactory)client;
                    if (socks.Version4)
                    {
                        radioSocksv4.Checked = true;
                    }
                    else
                    {
                        radioSocksv5.Checked = true;
                    }
                }
            }
            else if (client is SystemProxyClientFactory)
            {
                radioSystem.Checked = true;
            }
            else if (client is ScriptProxyClientFactory)
            {
                _currentScript         = ((ScriptProxyClientFactory)client).Script ?? String.Empty;
                radioButtonPac.Checked = true;
            }

            _inupdate = false;
        }
Example #2
0
        private void RebuildClient()
        {
            if (radioDefault.Checked)
            {
                _client = new DefaultProxyClientFactory();
            }
            else if (radioDirect.Checked)
            {
                _client = new IpProxyClientFactory();
            }
            else if (radioProxy.Checked)
            {
                TcpProxyClientFactory factory;

                if (radioHttp.Checked)
                {
                    factory = new HttpProxyClientFactory();
                }
                else
                {
                    SocksProxyClientFactory f = new SocksProxyClientFactory();
                    f.Version4     = radioSocksv4.Checked;
                    f.SendHostname = checkBoxSendHostName.Checked;
                    factory        = f;
                }

                factory.Hostname = textBoxHost.Text;
                factory.Port     = (int)numericUpDownPort.Value;
                factory.IPv6     = checkBoxIpv6.Checked;

                _client = factory;
            }
            else if (radioSystem.Checked)
            {
                _client = new SystemProxyClientFactory();
            }
            else if (radioButtonPac.Checked)
            {
                _client = new ScriptProxyClientFactory()
                {
                    Script = _currentScript
                };
            }
        }