/// <summary> /// Загружает и сохраняет в файловую систему обложку релиза /// </summary> /// <param name="release">Релиз</param> /// <param name="resourceLink">Адрес сайта</param> /// <param name="resourceId">ID ресурса</param> /// <returns>Task</returns> private async Task LoadAndSaveReleaseCover(AlbumInfoRelease release, string resourceLink, int resourceId) { var url = resourceLink + release.ImageUrl; var folderPath = $"{Helper.CoversPath}{resourceId}{@"\"}{DateTime.Now:yyyy_MM}{@"\"}"; var fileName = $"{release.ResourceInternalId}{Path.GetExtension(release.ImageUrl)}"; var fillPath = folderPath + fileName; var exists = Directory.Exists(folderPath); if (!exists) { Directory.CreateDirectory(folderPath); } if (File.Exists(fillPath)) { File.Delete(fillPath); } await _fileLoader.DownloadFile(url, fillPath).ConfigureAwait(false); release.CoverPath = fillPath; release.ImageFullUrl = url; }