protected override async Task Handle(Command request, CancellationToken cancellationToken) { var destinationPath = BuildDestinationPath(request); using var input = await _repo.GetAsStreamAsync(request.ListViewUrl.ViewUrl, cancellationToken); using var output = File.OpenWrite(destinationPath); await input.CopyToAsync(output, cancellationToken); }
protected override async Task Handle(Command request, CancellationToken cancellationToken) { var destinationDirectoryPath = Path.Combine(RepoDirectory, $"{request.ListViewUrl.Id}"); using var input = await _repo.GetAsStreamAsync(request.ListViewUrl.ViewUrl, cancellationToken); using var reader = ReaderFactory.Open(input); while (reader.MoveToNextEntry()) { if (!reader.Entry.IsDirectory) { reader.WriteEntryToDirectory(destinationDirectoryPath, new ExtractionOptions { ExtractFullPath = true, Overwrite = true }); } } }
protected override async Task Handle(Command request, CancellationToken cancellationToken) { var destinationDirectoryPath = Path.Combine(RepoDirectory, $"{request.ListViewUrl.Id}"); using var input = await _repo.GetAsStreamAsync(request.ListViewUrl.ViewUrl, cancellationToken); using var archive = SevenZipArchive.Open(input); foreach (var entry in archive.Entries) { if (!entry.IsDirectory) { entry.WriteToDirectory(destinationDirectoryPath, new ExtractionOptions { ExtractFullPath = true, Overwrite = true }); } } }