private static List <SslCertBundle> DownloadCertBundles(UrlDownloaderConfig dlConfig)
        {
            List <SslCertBundle> sslCertBundles = new List <SslCertBundle>();
            List <string>        strs           = new List <string>();

            if (BattleNet.Client().GetMobileEnvironment() != constants.MobileEnv.PRODUCTION)
            {
                strs.Add("http://nydus-qa.web.blizzard.net/Bnet/zxx/client/bgs-key-fingerprint");
            }
            strs.Add("http://nydus.battle.net/Bnet/zxx/client/bgs-key-fingerprint");
            IUrlDownloader urlDownloader = BattleNet.Client().GetUrlDownloader();
            int            count         = strs.Count;

            foreach (string str in strs)
            {
                urlDownloader.Download(str, (bool success, byte[] bytes) => {
                    if (success)
                    {
                        SslCertBundle sslCertBundle = new SslCertBundle(bytes);
                        sslCertBundles.Add(sslCertBundle);
                    }
                    count--;
                }, dlConfig);
            }
            while (count > 0)
            {
                Thread.Sleep(15);
            }
            return(sslCertBundles);
        }
Beispiel #2
0
        private static List <SslCertBundle> DownloadCertBundles(UrlDownloaderConfig dlConfig)
        {
            List <SslCertBundle> dlBundles = new List <SslCertBundle>();
            List <string>        list      = new List <string>();

            if (BattleNet.Client().GetMobileEnvironment() != constants.MobileEnv.PRODUCTION)
            {
                list.Add("http://nydus-qa.web.blizzard.net/Bnet/zxx/client/bgs-key-fingerprint");
            }
            list.Add("http://nydus.battle.net/Bnet/zxx/client/bgs-key-fingerprint");
            IUrlDownloader urlDownloader         = BattleNet.Client().GetUrlDownloader();
            int            numDownloadsRemaining = list.Count;

            foreach (string url in list)
            {
                urlDownloader.Download(url, delegate(bool success, byte[] bytes)
                {
                    if (success)
                    {
                        SslCertBundle item = new SslCertBundle(bytes);
                        dlBundles.Add(item);
                    }
                    numDownloadsRemaining--;
                }, dlConfig);
            }
            while (numDownloadsRemaining > 0)
            {
                Thread.Sleep(15);
            }
            return(dlBundles);
        }
Beispiel #3
0
 public ProxyRoundRobinUrlDownloader(IProxyRepository proxyRepository,
                                     IProxiedUrlDownloader proxiedDownloader,
                                     IConfigurationReader configurationReader,
                                     IUrlDownloader urlDownloader)
 {
     _proxyRepository     = proxyRepository;
     _proxiedDownloader   = proxiedDownloader;
     _configurationReader = configurationReader;
     _urlDownloader       = urlDownloader;
 }
Beispiel #4
0
        /// <summary>
        /// Creates a Fred object with the given application key and URL downloader.
        /// </summary>
        /// <param name="key">The FRED developer key.</param>
        /// <param name="downloader">The downloader to use.</param>
        /// <remarks>User's shouldn't use this version of the constructor. It main purpose is for unit testing where
        /// we can mock the downloader.</remarks>
        public Fred(string key, IUrlDownloader downloader)
        {
            var trimmed = key.Trim();
            if (string.IsNullOrWhiteSpace(trimmed))
            {
                throw new ArgumentNullException("key", "The FRED key cannot be null or an empty string.");
            }

            if (downloader == null)
            {
                throw new ArgumentNullException("downloader", "The downloader cannot be null.");
            }

            _key = trimmed;
            _downloader = downloader;
        }
Beispiel #5
0
        public UpdateManager(string urlOrPath,
                             string applicationName,
                             FrameworkVersion appFrameworkVersion,
                             string rootDirectory          = null,
                             IFileSystemFactory fileSystem = null,
                             IUrlDownloader urlDownloader  = null)
        {
            Contract.Requires(!String.IsNullOrEmpty(urlOrPath));
            Contract.Requires(!String.IsNullOrEmpty(applicationName));

            updateUrlOrPath          = urlOrPath;
            this.applicationName     = applicationName;
            this.appFrameworkVersion = appFrameworkVersion;

            this.rootAppDirectory = Path.Combine(rootDirectory ?? getLocalAppDataDirectory(), applicationName);
            this.fileSystem       = fileSystem ?? AnonFileSystem.Default;

            this.urlDownloader = urlDownloader ?? new DirectUrlDownloader(fileSystem);
        }
Beispiel #6
0
        public UpdateManager(string urlOrPath, 
            string applicationName,
            FrameworkVersion appFrameworkVersion,
            string rootDirectory = null,
            IFileSystemFactory fileSystem = null,
            IUrlDownloader urlDownloader = null)
        {
            Contract.Requires(!String.IsNullOrEmpty(urlOrPath));
            Contract.Requires(!String.IsNullOrEmpty(applicationName));

            log = LogManager.GetLogger<UpdateManager>();

            updateUrlOrPath = urlOrPath;
            this.applicationName = applicationName;
            this.appFrameworkVersion = appFrameworkVersion;

            this.rootAppDirectory = Path.Combine(rootDirectory ?? getLocalAppDataDirectory(), applicationName);
            this.fileSystem = fileSystem ?? AnonFileSystem.Default;

            this.urlDownloader = urlDownloader ?? new DirectUrlDownloader(fileSystem);
        }
Beispiel #7
0
        public UpdateManager(string urlOrPath, 
            string applicationName,
            FrameworkVersion appFrameworkVersion,
            string rootDirectory = null,
            IFileSystemFactory fileSystem = null,
            IUrlDownloader urlDownloader = null)
        {
            Contract.Requires(!String.IsNullOrEmpty(urlOrPath));
            Contract.Requires(!String.IsNullOrEmpty(applicationName));

            // XXX: ALWAYS BE LOGGING
            log = new WrappingFullLogger(new FileLogger(applicationName), typeof(UpdateManager));

            updateUrlOrPath = urlOrPath;
            this.applicationName = applicationName;
            this.appFrameworkVersion = appFrameworkVersion;

            this.rootAppDirectory = Path.Combine(rootDirectory ?? getLocalAppDataDirectory(), applicationName);
            this.fileSystem = fileSystem ?? AnonFileSystem.Default;

            this.urlDownloader = urlDownloader ?? new DirectUrlDownloader(fileSystem);
        }
Beispiel #8
0
 public StoreInfoDownloader(IUrlDownloader urlDownloader, IZipCodeUrlSerializer zipCodeUrlSerializer)
 {
     _urlDownloader        = urlDownloader;
     _zipCodeUrlSerializer = zipCodeUrlSerializer;
 }
 public ProxyListReader(IUrlDownloader urlDownloader)
 {
     _urlDownloader = urlDownloader;
 }