Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public async Task<DownloadResult> ExecuteAsync(
catch (Exception ex) when (ex is not OperationCanceledException)
{
sw.Stop();
return new DownloadResult(asset, null, existingBytes, sw.Elapsed, retries, false, ex.Message);
return new DownloadResult(asset, destPath, existingBytes, sw.Elapsed, retries, false, ex.Message);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public async Task<DownloadResult> ExecuteAsync(
catch (Exception ex) when (ex is not OperationCanceledException)
{
sw.Stop();
return new DownloadResult(asset, null, 0, sw.Elapsed, 0, false, ex.Message);
return new DownloadResult(asset, destPath, 0, sw.Elapsed, 0, false, ex.Message);
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ DownloadStatus Status

public record DownloadResult(
DownloadAsset Asset,
string? LocalPath,
string LocalPath,
long DownloadedBytes,
TimeSpan Duration,
int RetryCount,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ public async Task<DownloadReport> ExecuteAsync(

// Dispatch all-completed event ONCE after all assets finish (only failed results)
var failedDetails = results.Where(r => !r.Success)
.Select(r => ((object)r.Asset.Url, r.ErrorMessage ?? "failed")).ToList();
.Select(r => ((object)r.Asset, r.ErrorMessage ?? "failed")).ToList();
DownloadProgressReporter.DispatchAllCompleted(
this,
results.All(r => r.Success),
Expand Down
6 changes: 3 additions & 3 deletions src/c#/GeneralUpdate.Core/Strategy/OSSUpdateStrategy.cs
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ private async Task ExecuteClientAsync()

if (!string.IsNullOrEmpty(_configInfo.UpdateUrl))
{
DownloadVersionConfig(_configInfo.UpdateUrl, versionsFilePath);
await DownloadVersionConfig(_configInfo.UpdateUrl, versionsFilePath).ConfigureAwait(false);
}

if (!File.Exists(versionsFilePath))
Expand Down Expand Up @@ -210,15 +210,15 @@ public void StartApp()

#region Helpers

private static void DownloadVersionConfig(string url, string path)
private static async Task DownloadVersionConfig(string url, string path)
{
if (File.Exists(path))
{
File.SetAttributes(path, FileAttributes.Normal);
File.Delete(path);
}
using var httpClient = new HttpClient();
var bytes = httpClient.GetByteArrayAsync(url).GetAwaiter().GetResult();
var bytes = await httpClient.GetByteArrayAsync(url).ConfigureAwait(false);
File.WriteAllBytes(path, bytes);
}

Expand Down
Loading