private async Task CompleteAndCompressFile(string FileName, DownloadItem item)
        {
            DownloadResult CompletedItem = null;

            using (var memoryStream = new MemoryStream())
            {
                using (var archive = new ZipArchive(memoryStream, ZipArchiveMode.Create, true))
                {
                    var CompletedQueue = item.Completed;
                    while (CompletedQueue.TryDequeue(out CompletedItem))
                    {
                        var image         = CompletedItem.Source as MetadataImage;
                        var fileInArchive = archive.CreateEntry(image.Name);
                        using (var entryStream = fileInArchive.Open())
                        {
                            using (CompletedItem.Data)
                            {
                                await CompletedItem.Data.CopyToAsync(entryStream);
                            }
                        }
                    }
                }
                using (var fs = new FileStream(FileName, FileMode.Create))
                {
                    var compressedBytes = memoryStream.ToArray();
                    await fs.WriteAsync(compressedBytes, 0, compressedBytes.Length);
                }
            }
        }
        public void Cancel()
        {
            foreach (var item in Requests)
            {
                item.Cancel();
            }
            DownloadResult result = null;

            while (Completed.TryDequeue(out result))
            {
                result.Data.Dispose();
            }
            IsCompleted = false;
            OnCompleted?.Invoke(this, null);
        }
 private async Task CompletedFolder(string Path, DownloadItem item)
 {
     if (!Directory.Exists(Path))
     {
         Directory.CreateDirectory(Path);
     }
     using (item)
     {
         var            CompletedQueue = item.Completed;
         DownloadResult CompletedItem  = null;
         while (CompletedQueue.TryDequeue(out CompletedItem))
         {
             var image = CompletedItem.Source as MetadataImage;
             using (var fs = new FileStream($"{Path}/{image.Name}", FileMode.Create))
             {
                 using (CompletedItem.Data)
                 {
                     await CompletedItem.Data.CopyToAsync(fs);
                 }
             }
         }
     }
 }