Skip to content

Commit

Permalink
Properly order releases in AutoUpdater when pulled from github.
Browse files Browse the repository at this point in the history
  • Loading branch information
Soapwood committed Jul 24, 2024
1 parent 401ca15 commit 327b2d7
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
16 changes: 14 additions & 2 deletions VXAutoUpdater/Core/VXMusicAutoUpdater.cs
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,15 @@ public async Task<List<Release>> GetLatestVersionsForBranch(string branch)
releasesToDisplay = allReleases.Where(release => !release.Prerelease && !release.Draft);
else if(string.Equals("Nightly", branch))
releasesToDisplay = allReleases.Where(release => release.Prerelease && !release.Draft );

var orderedReleases = releasesToDisplay
.Select(release => new { Release = release, Version = ParseVersion(release.TagName) })
.Where(x => x.Version != null)
.OrderByDescending(x => x.Version)
.Select(x => x.Release)
.ToList();


return releasesToDisplay.ToList();
return orderedReleases;
}
catch (Exception ex)
{
Expand All @@ -120,6 +126,12 @@ public async Task<List<Release>> GetLatestVersionsForBranch(string branch)
// No new update available or error occurred
return null;
}

private static Version ParseVersion(string versionString)
{
Version version;
return Version.TryParse(versionString, out version) ? version : null;
}

public async Task<bool> DownloadUpdate(Release release)
{
Expand Down
2 changes: 1 addition & 1 deletion VXMusicDesktop/VXMusicDesktop.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<PackageIcon>VXLogo.png</PackageIcon>
<ApplicationIcon>Images\VXLogoIcon.ico</ApplicationIcon>
<RunPostBuildEvent>Always</RunPostBuildEvent>
<Version>0.6.4.11</Version>
<Version>0.6.4.12</Version>
<SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<Title>VXMusicDesktop</Title>
<Authors>VirtualXtensions</Authors>
Expand Down

0 comments on commit 327b2d7

Please sign in to comment.