From 4e5843bb1fff6e9f39dfd5801ee69a37408633c6 Mon Sep 17 00:00:00 2001 From: David Smith Date: Wed, 11 Jan 2017 01:16:27 -0600 Subject: [PATCH] Change release page query to make sure it pulls the latest release, so that it can skip over prerelease builds. Use extension methods for examining the GitHub release page. --- TallyCore/Web/Utility/CheckForNewRelease.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/TallyCore/Web/Utility/CheckForNewRelease.cs b/TallyCore/Web/Utility/CheckForNewRelease.cs index df56a4ba..5f0f1b95 100644 --- a/TallyCore/Web/Utility/CheckForNewRelease.cs +++ b/TallyCore/Web/Utility/CheckForNewRelease.cs @@ -8,6 +8,7 @@ using System.Threading.Tasks; using HtmlAgilityPack; using NetTally.Web; +using NetTally.Adapters; namespace NetTally { @@ -143,11 +144,16 @@ private async Task 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); + } } } }