예제 #1
0
        public Maybe <IWebProxy> CreateProxy()
        {
            return(SystemWebProxyRetriever.GetSystemWebProxy()
                   .Select(proxy =>
            {
                proxy.Credentials = string.IsNullOrWhiteSpace(Username)
                        ? CredentialCache.DefaultNetworkCredentials
                        : new NetworkCredential(Username, Password);

                return proxy;
            }));
        }
예제 #2
0
        public IEnumerable <EnvironmentVariable> GenerateEnvironmentVariables()
        {
            return(SystemWebProxyRetriever.GetSystemWebProxy()
                   .SelectValueOr(
                       proxy =>
            {
                var proxyUri = proxy.GetProxy(TestUri);

                return ProxyEnvironmentVariablesGenerator.GetProxyEnvironmentVariables(
                    proxyUri.Host,
                    proxyUri.Port,
                    Username,
                    Password);
            },
                       Enumerable.Empty <EnvironmentVariable>()
                       ));
        }