small fixes

This commit is contained in:
Stanley Dimant
2022-09-28 17:03:21 +02:00
parent c2e92c094c
commit 1fee097481
5 changed files with 60 additions and 26 deletions

View File

@@ -74,6 +74,23 @@ namespace MareSynchronos.WebAPI
public int GetDownloadId() => _downloadId++;
public async Task DownloadFiles(int currentDownloadId, List<FileReplacementDto> fileReplacementDto, CancellationToken ct)
{
DownloadStarted?.Invoke();
try
{
await DownloadFilesInternal(currentDownloadId, fileReplacementDto, ct);
}
catch
{
CancelDownload(currentDownloadId);
}
finally
{
DownloadFinished?.Invoke();
}
}
private async Task DownloadFilesInternal(int currentDownloadId, List<FileReplacementDto> fileReplacementDto, CancellationToken ct)
{
DownloadStarted?.Invoke();
Logger.Debug("Downloading files (Download ID " + currentDownloadId + ")");