Example #1
0
        /// <summary>
        /// Downloads a raster file using downloader configured for the dataset
        /// </summary>
        /// <param name="report">Report item return by GenerateReport methods</param>
        /// <param name="dataset"></param>
        public void DownloadRasterFile(DemFileReport report, DEMDataSet dataset)
        {
            // Create directories if not existing
            new FileInfo(report.LocalName).Directory.Create();

            using (HttpClient client = new HttpClient())
            {
                var contentbytes = client.GetByteArrayAsync(report.URL).Result;
                using (FileStream fs = new FileStream(report.LocalName, FileMode.Create, FileAccess.Write))
                {
                    fs.Write(contentbytes, 0, contentbytes.Length);
                }
            }
        }
Example #2
0
        /// <summary>
        /// Downloads a raster file using downloader configured for the dataset
        /// </summary>
        /// <param name="report">Report item return by GenerateReport methods</param>
        /// <param name="dataset"></param>
        public void DownloadRasterFile(DemFileReport report, DEMDataSet dataset)
        {
            var downloader = _rasterIndexServiceResolver(dataset.DataSource.DataSourceType);

            lock (monitor[report.URL])
            {
                if (!File.Exists(report.LocalName))
                {
                    _logger?.LogInformation($"Downloading file {report.URL}...");

                    downloader.DownloadRasterFile(report, dataset);

                    this.GenerateFileMetadata(report.LocalName, dataset.FileFormat, false);
                }
            }
        }
 public void DownloadRasterFile(DemFileReport report, DEMDataSet dataset)
 {
     throw new NotImplementedException();
 }