示例#1
0
        public static void ApplyProxySettings()
        {
            System.Net.WebProxy proxy = null;
            if (Properties.Settings.Default.UseProxy == true)
            {
                proxy = new System.Net.WebProxy(Properties.Settings.Default.ProxyAddress, Properties.Settings.Default.ProxyPort);
                switch (Settings.ProxyAuth)
                {
                case ProxyAuthEnum.DefaultAuthentification:
                    proxy.UseDefaultCredentials = true;
                    break;

                case ProxyAuthEnum.CustomAuthentification:
                    proxy.Credentials = new System.Net.NetworkCredential(
                        Settings.ProxyUsername,
                        MangosProvider.Decrypt(Settings.ProxyPassword));
                    break;

                case ProxyAuthEnum.NoAuthentification:
                default:
                    break;
                }
            }
            System.Net.WebRequest.DefaultWebProxy = proxy;
        }
示例#2
0
 private void LoadApplicationSettings()
 {
     DatabaseHost     = Settings.DatabaseHost;
     DatabasePort     = Settings.DatabasePort;
     DatabaseName     = Settings.DatabaseName;
     DatabaseUsername = Settings.DatabaseUsername;
     DatabasePassword = MangosProvider.Decrypt(Settings.DatabasePassword);
     UseProxy         = Settings.UseProxy;
     ProxyAddress     = Settings.ProxyAddress;
     ProxyPort        = Settings.ProxyPort;
     ProxyAuth        = Settings.ProxyAuth;
     ProxyUsername    = Settings.ProxyUsername;
     ProxyPassword    = MangosProvider.Decrypt(Settings.ProxyPassword);
 }