예제 #1
0
        /// <summary>
        ///     Downloads the image from the configured image url and the image path found in the api
        /// </summary>
        /// <param name="sourceImage"></param>
        /// <param name="destinationImage"></param>
        /// <returns></returns>
        public void DownloadImage(string sourceImage, string destinationImage)
        {
            try
            {
                using (var webClient = new WebClientManager())
                {
                    var downloadUrl = $"{ADIWF_Config.MediaCloud}/{sourceImage}";

                    webClient.DownloadWebBasedFile(
                        downloadUrl,
                        false,
                        destinationImage);

                    _log.Info($"Successfully Downloaded Image: {sourceImage} as {destinationImage}");
                }
            }
            catch (Exception diEx)
            {
                _log.Error($"[DownloadImage] Error Downloading Image: {diEx.Message}");
                if (diEx.InnerException != null)
                {
                    _log.Error($"[DownloadImage] Inner Exception: {diEx.InnerException.Message}");
                }
            }
        }