public Maybe <IWebProxy> CreateProxy() => SystemWebProxyRetriever.GetSystemWebProxy() .Select(proxy => { proxy.Credentials = string.IsNullOrWhiteSpace(Username) ? CredentialCache.DefaultNetworkCredentials : new NetworkCredential(Username, Password); return(proxy); });
public Maybe <IWebProxy> Visit(UseSystemProxySettings proxySettings) { return(SystemWebProxyRetriever.GetSystemWebProxy().Select(proxy => { proxy.Credentials = string.IsNullOrWhiteSpace(proxySettings.Username) ? CredentialCache.DefaultNetworkCredentials : new NetworkCredential(proxySettings.Username, proxySettings.Password); return proxy; })); }
public IEnumerable <EnvironmentVariable> GenerateEnvironmentVariables() => SystemWebProxyRetriever.GetSystemWebProxy().SelectValueOr( proxy => { var proxyUri = proxy.GetProxy(TestUri); return(ProxyEnvironmentVariablesGenerator.GetProxyEnvironmentVariables( proxyUri.Host, proxyUri.Port, Username, Password)); }, Enumerable.Empty <EnvironmentVariable>() );
public IEnumerable <EnvironmentVariable> Visit(UseSystemProxySettings proxySettings) { return(SystemWebProxyRetriever.GetSystemWebProxy().SelectValueOr( proxy => { var proxyUri = proxy.GetProxy(TestUri); return GetProxyEnvironmentVariables( proxyUri.Host, proxyUri.Port, proxySettings.Username, proxySettings.Password); }, Enumerable.Empty <EnvironmentVariable>())); }