Esempio n. 1
0
 public PackageDownloader(
     HttpClient httpClient,
     ICommonTelemetryService telemetryService,
     ILogger <PackageDownloader> logger)
 {
     _httpClient       = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
     _telemetryService = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));
     _logger           = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Esempio n. 2
0
 public FileDownloader(
     HttpClient httpClient,
     ICommonTelemetryService telemetryService,
     IOptionsSnapshot <FileDownloaderConfiguration> downloaderConfigurationAccessor,
     ILogger <FileDownloader> logger)
 {
     _httpClient       = httpClient ?? throw new ArgumentNullException(nameof(httpClient));
     _telemetryService = telemetryService ?? throw new ArgumentNullException(nameof(telemetryService));
     if (downloaderConfigurationAccessor == null)
     {
         throw new ArgumentNullException(nameof(downloaderConfigurationAccessor));
     }
     if (downloaderConfigurationAccessor.Value.BufferSize <= 0)
     {
         throw new ArgumentException($"{nameof(downloaderConfigurationAccessor.Value.BufferSize)} cannot be less than 1", nameof(downloaderConfigurationAccessor));
     }
     _configuration = downloaderConfigurationAccessor.Value;
     _logger        = logger ?? throw new ArgumentNullException(nameof(logger));
 }