⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 ssnetworkcontrol.cs

📁 飞信的收发使用csharp进行开发
💻 CS
📖 第 1 页 / 共 4 页
字号:
        public string SocksProxyPassword
        {
            get
            {
                return this.txtSocksPassword.Text;
            }
        }

        public int SocksProxyPort
        {
            get
            {
                int num;
                if (int.TryParse(this.txtSocksPort.Text, out num))
                {
                    return num;
                }
                return 0;
            }
        }

        public string SocksProxyUserName
        {
            get
            {
                return this.txtSocksUserName.Text.Trim();
            }
        }

        public bool UseDirect
        {
            get
            {
                return this.chkUseDirect.Checked;
            }
        }

        public bool UseHttpProxy
        {
            get
            {
                return this.chkUseHttpProxy.Checked;
            }
        }

        public bool UseIeProxy
        {
            get
            {
                return (this.CurrentUseHttpProxyType == UseHttpProxyType.UseIeProxySetting);
            }
        }

        public bool UseSocksProxy
        {
            get
            {
                return false;
            }
        }

        private class ConnectionConfigation : IConnectionConfigation
        {
            private string _httpProxyHost = string.Empty;
            private string _httpProxyPassword = string.Empty;
            private int _httpProxyPort;
            private string _httpProxyUserName = string.Empty;
            private string _socksProxyHost = string.Empty;
            private string _socksProxyPassword = string.Empty;
            private int _socksProxyPort;
            private string _socksProxyUserName = string.Empty;
            private bool _useDirect;
            private bool _useHttpProxy;
            private bool _useIeProxy;
            private bool _useSocksProxy;

            private ConnectionConfigation()
            {
            }

            public static SsNetworkControl.ConnectionConfigation Clone(IConnectionConfigation configation)
            {
                SsNetworkControl.ConnectionConfigation configation2 = new SsNetworkControl.ConnectionConfigation();
                configation2.HttpProxyUserName = configation.HttpProxyUserName;
                configation2.HttpProxyPassword = configation.HttpProxyPassword;
                configation2.HttpProxyHost = configation.HttpProxyHost;
                configation2.HttpProxyPort = configation.HttpProxyPort;
                configation2.UseHttpProxy = configation.UseHttpProxy;
                configation2.UseIeProxy = configation.UseIeProxy;
                configation2.SocksProxyHost = configation.SocksProxyHost;
                configation2.SocksProxyPort = configation.SocksProxyPort;
                configation2.SocksProxyUserName = configation.SocksProxyUserName;
                configation2.SocksProxyPassword = configation.SocksProxyPassword;
                configation2.UseSocksProxy = configation.UseSocksProxy;
                configation2.UseDirect = configation.UseDirect;
                return configation2;
            }

            public string HttpProxyHost
            {
                get
                {
                    return this._httpProxyHost;
                }
                private set
                {
                    this._httpProxyHost = value;
                }
            }

            public string HttpProxyPassword
            {
                get
                {
                    return this._httpProxyPassword;
                }
                private set
                {
                    this._httpProxyPassword = value;
                }
            }

            public int HttpProxyPort
            {
                get
                {
                    return this._httpProxyPort;
                }
                private set
                {
                    this._httpProxyPort = value;
                }
            }

            public string HttpProxyUserName
            {
                get
                {
                    return this._httpProxyUserName;
                }
                private set
                {
                    this._httpProxyUserName = value;
                }
            }

            public string SocksProxyHost
            {
                get
                {
                    return this._socksProxyHost;
                }
                private set
                {
                    this._socksProxyHost = value;
                }
            }

            public string SocksProxyPassword
            {
                get
                {
                    return this._socksProxyPassword;
                }
                private set
                {
                    this._socksProxyPassword = value;
                }
            }

            public int SocksProxyPort
            {
                get
                {
                    return this._socksProxyPort;
                }
                private set
                {
                    this._socksProxyPort = value;
                }
            }

            public string SocksProxyUserName
            {
                get
                {
                    return this._socksProxyUserName;
                }
                private set
                {
                    this._socksProxyUserName = value;
                }
            }

            public bool UseDirect
            {
                get
                {
                    return this._useDirect;
                }
                private set
                {
                    this._useDirect = value;
                }
            }

            public bool UseHttpProxy
            {
                get
                {
                    return this._useHttpProxy;
                }
                private set
                {
                    this._useHttpProxy = value;
                }
            }

            public bool UseIeProxy
            {
                get
                {
                    return this._useIeProxy;
                }
                private set
                {
                    this._useIeProxy = value;
                }
            }

            public bool UseSocksProxy
            {
                get
                {
                    return false;
                }
                private set
                {
                    this._useSocksProxy = value;
                }
            }
        }

        private delegate void ReadIeHttpProxyProc();

        private enum UseHttpProxyType
        {
            UseIeProxySetting,
            UseManualProxySetting
        }

        private class UseHttpProxyTypeItem
        {
            private string _description = string.Empty;
            private SsNetworkControl.UseHttpProxyType _proxyType;

            public UseHttpProxyTypeItem(SsNetworkControl.UseHttpProxyType proxyType)
            {
                this.ProxyType = proxyType;
            }

            public override string ToString()
            {
                return SsNetworkControl.UseHttpProxyTypeText.GetString(this.ProxyType);
            }

            public string Description
            {
                get
                {
                    return SsNetworkControl.UseHttpProxyTypeText.GetDescription(this.ProxyType);
                }
            }

            public SsNetworkControl.UseHttpProxyType ProxyType
            {
                get
                {
                    return this._proxyType;
                }
                private set
                {
                    this._proxyType = value;
                }
            }
        }

        private static class UseHttpProxyTypeText
        {
            public static string GetDescription(SsNetworkControl.UseHttpProxyType type)
            {
                switch (type)
                {
                    case SsNetworkControl.UseHttpProxyType.UseIeProxySetting:
                        return StringTable.NetworkSettingOption.PromptUseIeProxySetting;

                    case SsNetworkControl.UseHttpProxyType.UseManualProxySetting:
                        return StringTable.NetworkSettingOption.PromptUseManualProxySetting;
                }
                return string.Empty;
            }

            public static string GetString(SsNetworkControl.UseHttpProxyType type)
            {
                switch (type)
                {
                    case SsNetworkControl.UseHttpProxyType.UseIeProxySetting:
                        return StringTable.NetworkSettingOption.UseIeProxySetting;

                    case SsNetworkControl.UseHttpProxyType.UseManualProxySetting:
                        return StringTable.NetworkSettingOption.UseManualProxySetting;
                }
                return string.Empty;
            }
        }
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -