summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI.Toolkit/Framework
diff options
context:
space:
mode:
Diffstat (limited to 'src/StardewModdingAPI.Toolkit/Framework')
-rw-r--r--src/StardewModdingAPI.Toolkit/Framework/Clients/WebApi/ModExtendedMetadataModel.cs4
-rw-r--r--src/StardewModdingAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs4
-rw-r--r--src/StardewModdingAPI.Toolkit/Framework/Clients/Wiki/WikiModEntry.cs3
-rw-r--r--src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs15
-rw-r--r--src/StardewModdingAPI.Toolkit/Framework/UpdateData/ModRepositoryKey.cs3
5 files changed, 29 insertions, 0 deletions
diff --git a/src/StardewModdingAPI.Toolkit/Framework/Clients/WebApi/ModExtendedMetadataModel.cs b/src/StardewModdingAPI.Toolkit/Framework/Clients/WebApi/ModExtendedMetadataModel.cs
index 247730d7..c9d9f916 100644
--- a/src/StardewModdingAPI.Toolkit/Framework/Clients/WebApi/ModExtendedMetadataModel.cs
+++ b/src/StardewModdingAPI.Toolkit/Framework/Clients/WebApi/ModExtendedMetadataModel.cs
@@ -28,6 +28,9 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi
/// <summary>The mod ID in the Chucklefish mod repo.</summary>
public int? ChucklefishID { get; set; }
+ /// <summary>The mod ID in the ModDrop mod repo.</summary>
+ public int? ModDropID { get; set; }
+
/// <summary>The GitHub repository in the form 'owner/repo'.</summary>
public string GitHubRepo { get; set; }
@@ -77,6 +80,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi
this.Name = wiki.Name.FirstOrDefault();
this.NexusID = wiki.NexusID;
this.ChucklefishID = wiki.ChucklefishID;
+ this.ModDropID = wiki.ModDropID;
this.GitHubRepo = wiki.GitHubRepo;
this.CustomSourceUrl = wiki.CustomSourceUrl;
this.CustomUrl = wiki.CustomUrl;
diff --git a/src/StardewModdingAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs b/src/StardewModdingAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs
index 7197bf2c..91078b08 100644
--- a/src/StardewModdingAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs
+++ b/src/StardewModdingAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs
@@ -52,6 +52,8 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki
// fetch game versions
string stableVersion = doc.DocumentNode.SelectSingleNode("div[@class='game-stable-version']")?.InnerText;
string betaVersion = doc.DocumentNode.SelectSingleNode("div[@class='game-beta-version']")?.InnerText;
+ if (betaVersion == stableVersion)
+ betaVersion = null;
// find mod entries
HtmlNodeCollection modNodes = doc.DocumentNode.SelectNodes("table[@id='mod-list']//tr[@class='mod']");
@@ -91,6 +93,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki
string[] warnings = this.GetAttributeAsCsv(node, "data-warnings");
int? nexusID = this.GetAttributeAsNullableInt(node, "data-nexus-id");
int? chucklefishID = this.GetAttributeAsNullableInt(node, "data-cf-id");
+ int? modDropID = this.GetAttributeAsNullableInt(node, "data-moddrop-id");
string githubRepo = this.GetAttribute(node, "data-github");
string customSourceUrl = this.GetAttribute(node, "data-custom-source");
string customUrl = this.GetAttribute(node, "data-url");
@@ -131,6 +134,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki
Author = authors,
NexusID = nexusID,
ChucklefishID = chucklefishID,
+ ModDropID = modDropID,
GitHubRepo = githubRepo,
CustomSourceUrl = customSourceUrl,
CustomUrl = customUrl,
diff --git a/src/StardewModdingAPI.Toolkit/Framework/Clients/Wiki/WikiModEntry.cs b/src/StardewModdingAPI.Toolkit/Framework/Clients/Wiki/WikiModEntry.cs
index ce8d6c5f..f7b7839b 100644
--- a/src/StardewModdingAPI.Toolkit/Framework/Clients/Wiki/WikiModEntry.cs
+++ b/src/StardewModdingAPI.Toolkit/Framework/Clients/Wiki/WikiModEntry.cs
@@ -21,6 +21,9 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki
/// <summary>The mod ID in the Chucklefish mod repo.</summary>
public int? ChucklefishID { get; set; }
+ /// <summary>The mod ID in the ModDrop mod repo.</summary>
+ public int? ModDropID { get; set; }
+
/// <summary>The GitHub repository in the form 'owner/repo'.</summary>
public string GitHubRepo { get; set; }
diff --git a/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs b/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs
index 106c294f..61d0d6f2 100644
--- a/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs
+++ b/src/StardewModdingAPI.Toolkit/Framework/ModScanning/ModScanner.cs
@@ -90,6 +90,14 @@ namespace StardewModdingAPI.Toolkit.Framework.ModScanning
}
}
+ // normalise display fields
+ if (manifest != null)
+ {
+ manifest.Name = this.StripNewlines(manifest.Name);
+ manifest.Description = this.StripNewlines(manifest.Description);
+ manifest.Author = this.StripNewlines(manifest.Author);
+ }
+
return new ModFolder(root, manifestFile.Directory, manifest, manifestError);
}
@@ -164,5 +172,12 @@ namespace StardewModdingAPI.Toolkit.Framework.ModScanning
{
return !this.IgnoreFilesystemEntries.Contains(entry.Name);
}
+
+ /// <summary>Strip newlines from a string.</summary>
+ /// <param name="input">The input to strip.</param>
+ private string StripNewlines(string input)
+ {
+ return input?.Replace("\r", "").Replace("\n", "");
+ }
}
}
diff --git a/src/StardewModdingAPI.Toolkit/Framework/UpdateData/ModRepositoryKey.cs b/src/StardewModdingAPI.Toolkit/Framework/UpdateData/ModRepositoryKey.cs
index 7ca32f04..f6c402d5 100644
--- a/src/StardewModdingAPI.Toolkit/Framework/UpdateData/ModRepositoryKey.cs
+++ b/src/StardewModdingAPI.Toolkit/Framework/UpdateData/ModRepositoryKey.cs
@@ -12,6 +12,9 @@ namespace StardewModdingAPI.Toolkit.Framework.UpdateData
/// <summary>A GitHub project containing releases.</summary>
GitHub,
+ /// <summary>The ModDrop mod repository.</summary>
+ ModDrop,
+
/// <summary>The Nexus Mods mod repository.</summary>
Nexus
}