예제 #1
0
        /// <summary>
        /// Initializes a new instance of the RemoteImageCatalog class.
        /// </summary>
        /// <param name="resourceDownloader">A resource downloader used to download resources.</param>
        /// <param name="imageCache">Handles caching downloaded images.</param>
        /// <param name="maxConcurrentDownloads">The maximum number of allowed concurrent downloads.</param>
        /// <param name="maxRetryAttempts">The number of retries for a failed request.</param>
        public RemoteImageCatalog(
            IResourceDownloader resourceDownloader,
            ICache <byte[]> imageCache,
            int maxConcurrentDownloads = Constants.MaximumConcurrentDownloads,
            int maxRetryAttempts       = Constants.RetryAttempts)
        {
            Throw.IfArgumentNull(resourceDownloader, nameof(resourceDownloader));
            Throw.IfArgumentNull(imageCache, nameof(imageCache));

            if (maxConcurrentDownloads <= 0)
            {
                throw new ArgumentOutOfRangeException(nameof(maxConcurrentDownloads), "The maximum number of concurrent downloads must be greater than 0.");
            }

            if (maxRetryAttempts < 0)
            {
                throw new ArgumentOutOfRangeException(nameof(maxRetryAttempts), "The maximum number of retries must be greater than or equal to 0.");
            }

            this.resourceDownloader     = resourceDownloader;
            this.imageCache             = imageCache;
            this.maxConcurrentDownloads = maxConcurrentDownloads;
            this.maxRetryAttempts       = maxRetryAttempts;

            this.startDownloadSync = new object();
            this.imageRequests     = new ConcurrentDictionary <string, RemoteImageRequest>();
        }
 public GitHubAssetDownloader(IJsonSerializer jsonSerializer,
                              IPowerShell powerShell,
                              IResourceDownloader resourceDownloader)
 {
     this.jsonSerializer     = jsonSerializer;
     this.powerShell         = powerShell;
     this.resourceDownloader = resourceDownloader;
 }
예제 #3
0
 public ManifestRepository(IArguments arguments,
                           IFileSystem fileSystem,
                           IJsonSerializer jsonSerializer,
                           IResourceDownloader resourceDownloader)
 {
     this.arguments          = arguments;
     this.fileSystem         = fileSystem;
     this.jsonSerializer     = jsonSerializer;
     this.resourceDownloader = resourceDownloader;
 }
예제 #4
0
 public ResourceLocator(IResourceDownloader <TIdentifier, TResult> resourceDownloader, ICacheKeyGenerator <TIdentifier> cacheKeyGenerator)
 {
     _resourceDownloader = resourceDownloader;
     _cacheKeyGenerator  = cacheKeyGenerator;
 }
예제 #5
0
 public Tretton37(IResourceDownloader resourceDownloader)
 {
     _resourceDownloader = resourceDownloader;
 }