Skip to content
This repository has been archived by the owner on Jul 10, 2024. It is now read-only.

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikMennen committed Mar 28, 2024
1 parent 9e150cd commit 982c8a4
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions src/OneWare.Essentials/Models/PackageModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -104,24 +104,27 @@ public async Task<bool> DownloadAsync(PackageVersion version)
if (target is {Url: not null})
{
var state = _applicationStateService.AddState($"Downloading {Package.Id}...", AppState.Loading);

var progress = new Progress<float>(x =>
{
Progress = x;
state.StatusMessage = $"Downloading {Package.Id} {(int)(x*100)}%";
});

//Download
if (!await _httpService.DownloadAndExtractArchiveAsync(target.Url, ExtractionFolder, progress))
var result = await _httpService.DownloadAndExtractArchiveAsync(target.Url, ExtractionFolder, progress);

_applicationStateService.RemoveState(state);

if (!result)
{
Status = PackageStatus.Available;
_applicationStateService.RemoveState(state);
return false;
}

PlatformHelper.ChmodFolder(ExtractionFolder);

_applicationStateService.RemoveState(state);

Install(target);

InstalledVersion = version;
Expand Down

0 comments on commit 982c8a4

Please sign in to comment.