Skip to content

Commit

Permalink
Change release page query to make sure it pulls the latest release, s…
Browse files Browse the repository at this point in the history
…o that it

can skip over prerelease builds.
Use extension methods for examining the GitHub release page.
  • Loading branch information
Kinematics committed Jan 11, 2017
1 parent 7a140c7 commit 4e5843b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions TallyCore/Web/Utility/CheckForNewRelease.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using System.Threading.Tasks;
using HtmlAgilityPack;
using NetTally.Web;
using NetTally.Adapters;

namespace NetTally
{
Expand Down Expand Up @@ -143,11 +144,16 @@ private async Task<string> GetLatestVersionString()

if (htmldoc != null)
{
var h1ReleaseTitle = htmldoc.DocumentNode.Descendants("h1")?.FirstOrDefault(n => n.GetAttributeValue("class", "").Contains("release-title"));
var latest = htmldoc.DocumentNode.GetDescendantWithClass("div", "label-latest");

if (h1ReleaseTitle != null)
if (latest != null)
{
return GetVersionString(h1ReleaseTitle.InnerText);
var releaseTitle = latest.GetDescendantWithClass("h1", "release-title");

if (releaseTitle != null)
{
return GetVersionString(releaseTitle.InnerText);
}
}
}
}
Expand Down

0 comments on commit 4e5843b

Please sign in to comment.