public async Task <WikimediaDto> DownloadFileAsync(WikimediaDto doc) { if (doc == null) { throw new ArgumentNullException("The parameter is invalid", nameof(doc)); } string requestUrl = ConfigurationWikimedia.GetBaseUrl(); string directory = ConfigurationWikimedia.GetPath(); Console.WriteLine("directory"); Console.WriteLine(directory); doc.localPath = directory + doc.nameFile; Uri uri = new(requestUrl + doc.path); var wc = new WebClient(); wc.DownloadProgressChanged += (sender, args) => { if (args.ProgressPercentage == 100) { Console.WriteLine("termino la descarga!!" + doc.nameFile); } Console.WriteLine(" {0} - {1} % " + doc.nameFile + " complete", ProgressChanged(args.BytesReceived), args.ProgressPercentage); }; await wc.DownloadFileTaskAsync(uri, doc.localPath + doc.extension); return(doc); }
public WikimediaEntity MapFromDtoToEntity(WikimediaDto dto) { return(new WikimediaEntity { day = dto.day, extension = dto.extension, hour = dto.hour, month = dto.month, name = dto.name, year = dto.year, localPath = dto.localPath }); }