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

            return(proxy);
        });
示例#2
0
            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;
                }));
            }
示例#3
0
        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>()
            );
示例#4
0
            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>()));
            }