Example #1
0
 public override void LoadConfiguration(string[] args)
 {
     Args         = args;
     GlobalLogger = CreateLoggers();
     Log(Shared.Resources.Strings.LOADING_CONFIGURATION, ESeverity.DEBUG);
     Protocol = GenericProtocol.GetInstance(_servercfg);
     SetCulture(_servercfg.ServiceCulture);
 }
Example #2
0
        private void ConfigureProxy(GenericProtocol protocol)
        {
            ServicePointManager.Expect100Continue = ClientConfig.Expect100Continue;

            if (!((protocol) is IProxyCompatible))
            {
                return;
            }

            var       proxyProtocol = ((IProxyCompatible)protocol);
            IWebProxy proxy;

            if (ClientConfig.ProxyEnabled)
            {
                // Configuration
#pragma warning disable 618
                proxy = ClientConfig.ProxyAutoConfiguration ? GlobalProxySelection.Select : new WebProxy(ClientConfig.ProxyAddress, ClientConfig.ProxyPort);
#pragma warning restore 618

                if (proxy != null)
                {
                    // Authentification
                    if (ClientConfig.ProxyAutoAuthentication)
                    {
                        proxy.Credentials = CredentialCache.DefaultCredentials;
                    }
                    else
                    {
                        var netCreds = new NetworkCredential
                        {
                            UserName = ClientConfig.ProxyUserName,
                            Password = ClientConfig.ProxyPassword,
                            Domain   = ClientConfig.ProxyDomain
                        };
                        proxy.Credentials = netCreds;
                    }
                }
            }
            else
            {
#pragma warning disable 618
                proxy = GlobalProxySelection.GetEmptyWebProxy();
#pragma warning restore 618
            }

            var webProxy = proxy as WebProxy;
            if (webProxy != null && webProxy.Address == null)
            {
#pragma warning disable 618
                proxy = GlobalProxySelection.GetEmptyWebProxy();
#pragma warning restore 618
            }

            proxyProtocol.Proxy = proxy;
            Log(webProxy != null ? string.Format(Strings.USING_PROXY, ((WebProxy)proxy).Address, proxy) : Strings.NOT_USING_PROXY, ESeverity.INFO);
        }
Example #3
0
        public virtual void LoadConfiguration(string[] args)
        {
            Args = args;

            GlobalLogger = CreateLoggers();
            Log(Strings.LOADING_CONFIGURATION, ESeverity.DEBUG);
            var cfg = new SharedConfig(Configuration);

            Protocol = GenericProtocol.GetInstance(cfg);
            SetCulture(cfg.ServiceCulture);
        }