summaryrefslogtreecommitdiff
path: root/src/SMAPI.Web
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI.Web')
-rw-r--r--src/SMAPI.Web/Framework/Clients/Nexus/NexusWebScrapeClient.cs10
1 files changed, 7 insertions, 3 deletions
diff --git a/src/SMAPI.Web/Framework/Clients/Nexus/NexusWebScrapeClient.cs b/src/SMAPI.Web/Framework/Clients/Nexus/NexusWebScrapeClient.cs
index df5a437d..1b3fa195 100644
--- a/src/SMAPI.Web/Framework/Clients/Nexus/NexusWebScrapeClient.cs
+++ b/src/SMAPI.Web/Framework/Clients/Nexus/NexusWebScrapeClient.cs
@@ -83,6 +83,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.Nexus
string url = this.GetModUrl(id);
string name = doc.DocumentNode.SelectSingleNode("//h1")?.InnerText.Trim();
string version = doc.DocumentNode.SelectSingleNode("//ul[contains(@class, 'stats')]//li[@class='stat-version']//div[@class='stat']")?.InnerText.Trim();
+ SemanticVersion.TryParse(version, out ISemanticVersion parsedVersion);
// extract file versions
List<string> rawVersions = new List<string>();
@@ -105,16 +106,19 @@ namespace StardewModdingAPI.Web.Framework.Clients.Nexus
{
if (!SemanticVersion.TryParse(rawVersion, out ISemanticVersion cur))
continue;
+ if (parsedVersion != null && !cur.IsNewerThan(parsedVersion))
+ continue;
+ if (latestFileVersion != null && !cur.IsNewerThan(latestFileVersion))
+ continue;
- if (latestFileVersion == null || cur.IsNewerThan(latestFileVersion))
- latestFileVersion = cur;
+ latestFileVersion = cur;
}
// yield info
return new NexusMod
{
Name = name,
- Version = version,
+ Version = parsedVersion?.ToString() ?? version,
LatestFileVersion = latestFileVersion,
Url = url
};