summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.github/ISSUE_TEMPLATE/bug_report.md30
-rw-r--r--.github/ISSUE_TEMPLATE/config.yml8
-rw-r--r--.github/ISSUE_TEMPLATE/custom.md37
-rw-r--r--.github/ISSUE_TEMPLATE/feature_request.md12
-rw-r--r--.github/ISSUE_TEMPLATE/general.md12
-rw-r--r--build/common.targets2
-rwxr-xr-xbuild/unix/prepare-install-package.sh2
-rwxr-xr-xbuild/unix/set-smapi-version.sh2
-rwxr-xr-xbuild/windows/finalize-install-package.sh2
-rw-r--r--docs/release-notes.md32
-rw-r--r--docs/technical/mod-package.md10
-rw-r--r--src/SMAPI.Installer/assets/install on Linux.sh2
-rw-r--r--src/SMAPI.Installer/assets/install on Windows.bat4
-rw-r--r--src/SMAPI.Installer/assets/install on macOS.command2
-rw-r--r--src/SMAPI.ModBuildConfig.Analyzer.Tests/SMAPI.ModBuildConfig.Analyzer.Tests.csproj4
-rw-r--r--src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj4
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/manifest.json4
-rw-r--r--src/SMAPI.Mods.ErrorHandler/manifest.json4
-rw-r--r--src/SMAPI.Mods.SaveBackup/manifest.json4
-rw-r--r--src/SMAPI.Tests/SMAPI.Tests.csproj10
-rw-r--r--src/SMAPI.Toolkit/Framework/UpdateData/ModSiteKey.cs5
-rw-r--r--src/SMAPI.Toolkit/Framework/UpdateData/UpdateKey.cs42
-rw-r--r--src/SMAPI.Toolkit/SMAPI.Toolkit.csproj6
-rw-r--r--src/SMAPI.Web/Controllers/ModsApiController.cs23
-rw-r--r--src/SMAPI.Web/Framework/Clients/GenericModDownload.cs18
-rw-r--r--src/SMAPI.Web/Framework/Clients/GenericModPage.cs17
-rw-r--r--src/SMAPI.Web/Framework/Clients/UpdateManifest/IUpdateManifestClient.cs7
-rw-r--r--src/SMAPI.Web/Framework/Clients/UpdateManifest/ResponseModels/UpdateManifestModModel.cs35
-rw-r--r--src/SMAPI.Web/Framework/Clients/UpdateManifest/ResponseModels/UpdateManifestModel.cs30
-rw-r--r--src/SMAPI.Web/Framework/Clients/UpdateManifest/ResponseModels/UpdateManifestVersionModel.cs28
-rw-r--r--src/SMAPI.Web/Framework/Clients/UpdateManifest/UpdateManifestClient.cs106
-rw-r--r--src/SMAPI.Web/Framework/Clients/UpdateManifest/UpdateManifestModDownload.cs34
-rw-r--r--src/SMAPI.Web/Framework/Clients/UpdateManifest/UpdateManifestModPage.cs71
-rw-r--r--src/SMAPI.Web/Framework/IModDownload.cs11
-rw-r--r--src/SMAPI.Web/Framework/IModPage.cs11
-rw-r--r--src/SMAPI.Web/Framework/ModInfoModel.cs30
-rw-r--r--src/SMAPI.Web/Framework/ModSiteManager.cs120
-rw-r--r--src/SMAPI.Web/Framework/RemoteModStatus.cs3
-rw-r--r--src/SMAPI.Web/SMAPI.Web.csproj16
-rw-r--r--src/SMAPI.Web/Startup.cs3
-rw-r--r--src/SMAPI.Web/wwwroot/schemas/content-patcher.json4
-rw-r--r--src/SMAPI.sln5
-rw-r--r--src/SMAPI/Constants.cs2
-rw-r--r--src/SMAPI/Context.cs2
-rw-r--r--src/SMAPI/Framework/ContentManagers/ModContentManager.cs10
-rw-r--r--src/SMAPI/Framework/ModLoading/ModResolver.cs13
-rw-r--r--src/SMAPI/Framework/SCore.cs12
-rw-r--r--src/SMAPI/Framework/SModHooks.cs18
-rw-r--r--src/SMAPI/SMAPI.csproj8
-rw-r--r--src/SMAPI/Utilities/DelegatingModHooks.cs137
-rw-r--r--src/SMAPI/Utilities/PerScreen.cs6
-rw-r--r--src/SMAPI/i18n/ko.json4
52 files changed, 821 insertions, 203 deletions
diff --git a/.github/ISSUE_TEMPLATE/bug_report.md b/.github/ISSUE_TEMPLATE/bug_report.md
deleted file mode 100644
index c51d164b..00000000
--- a/.github/ISSUE_TEMPLATE/bug_report.md
+++ /dev/null
@@ -1,30 +0,0 @@
----
-name: Bug report
-about: Report a problem with SMAPI.
-
----
-
-<!--
-
-Only report a bug here if you're sure it's a SMAPI bug!
-To request support instead, see https://smapi.io/community.
-
-Replace the instructions below with the bug details.
-
--->
-
-**Describe the bug**
-A clear and concise description of what the bug is. Provide any other details you think might be relevant here.
-
-**To Reproduce**
-Exact steps which reproduce the bug, if possible. For example:
-1. Load save '...'.
-2. Walk to '....'.
-3. Click '....'.
-4. Error occurs.
-
-**Log file**
-Upload your SMAPI log to https://smapi.io/log and post a link here.
-
-**Screenshots**
-If applicable, add screenshots to help explain your problem.
diff --git a/.github/ISSUE_TEMPLATE/config.yml b/.github/ISSUE_TEMPLATE/config.yml
new file mode 100644
index 00000000..63d7bb67
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/config.yml
@@ -0,0 +1,8 @@
+blank_issues_enabled: false
+contact_links:
+ - name: Troubleshooting guide for players
+ url: https://smapi.io/troubleshoot
+ about: See if your question is already answered first!
+ - name: Get help or discuss
+ url: https://smapi.io/help
+ about: Ask for help from the community, or join the Stardew Valley Discord to ask questions, report issues, or discuss with the SMAPI developer, players, and mod authors. The SMAPI developer is @Pathoschild#0001 on Discord.
diff --git a/.github/ISSUE_TEMPLATE/custom.md b/.github/ISSUE_TEMPLATE/custom.md
new file mode 100644
index 00000000..11306e7f
--- /dev/null
+++ b/.github/ISSUE_TEMPLATE/custom.md
@@ -0,0 +1,37 @@
+---
+name: Create a development task
+about: DON'T DO THIS BEFORE READING. This is for specific changes to the code or technical bug reports. See below if something isn't working, you have questions or ideas, or you want to discuss something.
+
+---
+
+<!--
+
+
+
+
+STOP!
+
+Is this a specific development task? Don't create an issue if not!
+See https://smapi.io/community if something isn't working, you have questions or ideas, or you want
+to discuss something.
+
+If you're absolutely sure it's a specific development task (e.g. a specific bug, not just
+'something went wrong on my computer'), edit the template below.
+
+-->
+
+**Describe the bug**
+A clear and concise description of what the bug is. Provide any other details you think might be relevant here.
+
+**To Reproduce**
+Exact steps which reproduce the bug, if possible. For example:
+1. Load save '...'.
+2. Walk to '....'.
+3. Click '....'.
+4. Error occurs.
+
+**Log file**
+Upload your SMAPI log to https://smapi.io/log and post a link here.
+
+**Screenshots**
+If applicable, add screenshots to help explain your problem.
diff --git a/.github/ISSUE_TEMPLATE/feature_request.md b/.github/ISSUE_TEMPLATE/feature_request.md
deleted file mode 100644
index 8d935dc8..00000000
--- a/.github/ISSUE_TEMPLATE/feature_request.md
+++ /dev/null
@@ -1,12 +0,0 @@
----
-name: Feature request
-about: Suggest an idea for SMAPI.
-
----
-
-<!--
-
-GitHub issues are only used for development tasks. Please don't submit feature requests here!
-Instead, see https://smapi.io/community to discuss SMAPI.
-
--->
diff --git a/.github/ISSUE_TEMPLATE/general.md b/.github/ISSUE_TEMPLATE/general.md
deleted file mode 100644
index f02d3c9a..00000000
--- a/.github/ISSUE_TEMPLATE/general.md
+++ /dev/null
@@ -1,12 +0,0 @@
----
-name: General
-about: Create a ticket about something else.
-
----
-
-<!--
-
-GitHub issues are only used for development tasks.
-For support and questions, see https://smapi.io/community instead.
-
--->
diff --git a/build/common.targets b/build/common.targets
index 512107a0..1ead1508 100644
--- a/build/common.targets
+++ b/build/common.targets
@@ -7,7 +7,7 @@ repo. It imports the other MSBuild files as needed.
<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<!--set general build properties -->
- <Version>3.18.1</Version>
+ <Version>3.18.3</Version>
<Product>SMAPI</Product>
<LangVersion>latest</LangVersion>
<AssemblySearchPaths>$(AssemblySearchPaths);{GAC}</AssemblySearchPaths>
diff --git a/build/unix/prepare-install-package.sh b/build/unix/prepare-install-package.sh
index 1d805e00..304579b9 100755
--- a/build/unix/prepare-install-package.sh
+++ b/build/unix/prepare-install-package.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
#
diff --git a/build/unix/set-smapi-version.sh b/build/unix/set-smapi-version.sh
index 0c0cbeb0..02b5e615 100755
--- a/build/unix/set-smapi-version.sh
+++ b/build/unix/set-smapi-version.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
#
#
diff --git a/build/windows/finalize-install-package.sh b/build/windows/finalize-install-package.sh
index 0996e3ed..117e33e5 100755
--- a/build/windows/finalize-install-package.sh
+++ b/build/windows/finalize-install-package.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
##########
## Read config
diff --git a/docs/release-notes.md b/docs/release-notes.md
index 54cbf96c..d6d3d1cd 100644
--- a/docs/release-notes.md
+++ b/docs/release-notes.md
@@ -8,8 +8,38 @@
-->
## Upcoming release
+* For mod authors:
+ * Added support for [custom update manifests](https://stardewvalleywiki.com/Modding:Modder_Guide/APIs/Update_checks#Custom_update_manifest) (thanks to Jamie Taylor!).
+
+## 3.18.3
+Released 09 April 2023 for Stardew Valley 1.5.6 or later.
+
+* For players:
+ * Fixed `findstr` installer error for some players.
+ * Fixed installer error for some Linux players due to a non-portable shebang (thanks to freyacoded!).
+ * Fixed error using load order overrides when there are broken mods installed (thanks to atravita!).
+ * Removed `LargeAddressAware` flag on SMAPI (no longer needed since it's 64-bit now).
+ * Improved translations. Thganks to stylemate (updated Korean)!
+
+* For mod authors:
+ * Added `IsActiveForScreen()` method to `PerScreen<T>`.
+ * Updated to [FluentHttpClient](https://github.com/Pathoschild/FluentHttpClient#readme) 4.3.0 (see [changes](https://github.com/Pathoschild/FluentHttpClient/blob/develop/RELEASE-NOTES.md#430)).
+ * Adjusted `ModContentManager.HandleUnknownFileType` to let mods patch it.
+ * Fixed `Context.IsWorldReady` being editable by mods.
+
+* For the web UI:
+ * Updated the JSON validator/schema for Content Patcher 1.29.0.
+
+## 3.18.2
+Released 09 January 2023 for Stardew Valley 1.5.6 or later.
+
* For players:
- * Fixed save backups being empty in rare cases on macOS.
+ * Fixed empty save backups for some macOS players.
+ * Fixed `player_add` console command not handling custom slingshots correctly (thanks too DaLion!).
+
+* For mod authors:
+ * Added `DelegatingModHooks` utility for mods which need to override SMAPI's mod hooks directly.
+ * Updated to Newtonsoft.Json 13.0.2 (see [changes](https://github.com/JamesNK/Newtonsoft.Json/releases/tag/13.0.2)) and Pintail 2.2.2 (see [changes](https://github.com/Nanoray-pl/Pintail/blob/master/docs/release-notes.md#222)).
## 3.18.1
Released 01 December 2022 for Stardew Valley 1.5.6 or later.
diff --git a/docs/technical/mod-package.md b/docs/technical/mod-package.md
index 0e710e50..ab8a2c95 100644
--- a/docs/technical/mod-package.md
+++ b/docs/technical/mod-package.md
@@ -99,6 +99,10 @@ There are two places you can put them:
2. Open the `.csproj` file in a text editor (Notepad is fine).
3. Add the properties between the first `<PropertyGroup>` and `</PropertyGroup>` tags you find.
+**Note:** you can't use a property before it's defined. That mainly means that when setting
+`GameModsPath`, you'll need to either specify `GamePath` manually or put the full path in
+`GameModsPath`.
+
### Available properties
These are the options you can set:
@@ -412,9 +416,11 @@ The NuGet package is generated automatically in `StardewModdingAPI.ModBuildConfi
when you compile it.
## Release notes
-## Upcoming release
+### 4.1.0
+Released 08 January 2023.
+
* Added `manifest.json` format validation on build (thanks to tylergibbs2!).
-* Fixed game assemblies no longer excluded from the release zip if referenced explicitly without setting `BundleExtraAssemblies`.
+* Fixed game DLLs not excluded from the release zip when they're referenced explicitly but `BundleExtraAssemblies` isn't set.
### 4.0.2
Released 09 October 2022.
diff --git a/src/SMAPI.Installer/assets/install on Linux.sh b/src/SMAPI.Installer/assets/install on Linux.sh
index 3b7eae9c..70b21521 100644
--- a/src/SMAPI.Installer/assets/install on Linux.sh
+++ b/src/SMAPI.Installer/assets/install on Linux.sh
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
cd "`dirname "$0"`"
internal/linux/SMAPI.Installer
diff --git a/src/SMAPI.Installer/assets/install on Windows.bat b/src/SMAPI.Installer/assets/install on Windows.bat
index b0d9ae81..c61a801e 100644
--- a/src/SMAPI.Installer/assets/install on Windows.bat
+++ b/src/SMAPI.Installer/assets/install on Windows.bat
@@ -4,7 +4,9 @@ setlocal enabledelayedexpansion
SET installerDir="%~dp0"
REM make sure we're not running within a zip folder
-echo %installerDir% | findstr /C:"%TEMP%" 1>nul
+REM The error level is usually 0 (install dir contains temp path), 1 (it doesn't), or 9009 (findstr doesn't exist due to a Windows issue).
+REM If the command doesn't exist, just skip this check.
+echo %installerDir% | findstr /C:"%TEMP%" 1>nul 2>null
if %ERRORLEVEL% EQU 0 (
echo Oops! It looks like you're running the installer from inside a zip file. Make sure you unzip the download first.
echo.
diff --git a/src/SMAPI.Installer/assets/install on macOS.command b/src/SMAPI.Installer/assets/install on macOS.command
index abd21dc8..e85230ed 100644
--- a/src/SMAPI.Installer/assets/install on macOS.command
+++ b/src/SMAPI.Installer/assets/install on macOS.command
@@ -1,4 +1,4 @@
-#!/bin/bash
+#!/usr/bin/env bash
cd "`dirname "$0"`"
diff --git a/src/SMAPI.ModBuildConfig.Analyzer.Tests/SMAPI.ModBuildConfig.Analyzer.Tests.csproj b/src/SMAPI.ModBuildConfig.Analyzer.Tests/SMAPI.ModBuildConfig.Analyzer.Tests.csproj
index 3be9c225..1719d39b 100644
--- a/src/SMAPI.ModBuildConfig.Analyzer.Tests/SMAPI.ModBuildConfig.Analyzer.Tests.csproj
+++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/SMAPI.ModBuildConfig.Analyzer.Tests.csproj
@@ -6,9 +6,9 @@
<ItemGroup>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="3.10.0" />
- <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
+ <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
<PackageReference Include="NUnit" Version="3.13.3" />
- <PackageReference Include="NUnit3TestAdapter" Version="4.2.1" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
+ <PackageReference Include="NUnit3TestAdapter" Version="4.3.1" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
</ItemGroup>
<ItemGroup>
diff --git a/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj b/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj
index cded6f65..badabfc7 100644
--- a/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj
+++ b/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj
@@ -10,7 +10,7 @@
<!--NuGet package-->
<PackageId>Pathoschild.Stardew.ModBuildConfig</PackageId>
<Title>Build package for SMAPI mods</Title>
- <Version>4.0.2</Version>
+ <Version>4.1.0</Version>
<Authors>Pathoschild</Authors>
<Description>Automates the build configuration for crossplatform Stardew Valley SMAPI mods. For SMAPI 3.13.0 or later.</Description>
<PackageLicenseExpression>MIT</PackageLicenseExpression>
@@ -24,7 +24,7 @@
<ItemGroup>
<PackageReference Include="Microsoft.Build.Utilities.Core" Version="16.10" />
- <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
+ <PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<!--
This is imported through Microsoft.Build.Utilities.Core. When installed by a mod, NuGet
diff --git a/src/SMAPI.Mods.ConsoleCommands/manifest.json b/src/SMAPI.Mods.ConsoleCommands/manifest.json
index 0afb5837..2447c5c3 100644
--- a/src/SMAPI.Mods.ConsoleCommands/manifest.json
+++ b/src/SMAPI.Mods.ConsoleCommands/manifest.json
@@ -1,9 +1,9 @@
{
"Name": "Console Commands",
"Author": "SMAPI",
- "Version": "3.18.1",
+ "Version": "3.18.3",
"Description": "Adds SMAPI console commands that let you manipulate the game.",
"UniqueID": "SMAPI.ConsoleCommands",
"EntryDll": "ConsoleCommands.dll",
- "MinimumApiVersion": "3.18.1"
+ "MinimumApiVersion": "3.18.3"
}
diff --git a/src/SMAPI.Mods.ErrorHandler/manifest.json b/src/SMAPI.Mods.ErrorHandler/manifest.json
index fe802d88..306c92fc 100644
--- a/src/SMAPI.Mods.ErrorHandler/manifest.json
+++ b/src/SMAPI.Mods.ErrorHandler/manifest.json
@@ -1,9 +1,9 @@
{
"Name": "Error Handler",
"Author": "SMAPI",
- "Version": "3.18.1",
+ "Version": "3.18.3",
"Description": "Handles some common vanilla errors to log more useful info or avoid breaking the game.",
"UniqueID": "SMAPI.ErrorHandler",
"EntryDll": "ErrorHandler.dll",
- "MinimumApiVersion": "3.18.1"
+ "MinimumApiVersion": "3.18.3"
}
diff --git a/src/SMAPI.Mods.SaveBackup/manifest.json b/src/SMAPI.Mods.SaveBackup/manifest.json
index 9a587a2b..c5075c57 100644
--- a/src/SMAPI.Mods.SaveBackup/manifest.json
+++ b/src/SMAPI.Mods.SaveBackup/manifest.json
@@ -1,9 +1,9 @@
{
"Name": "Save Backup",
"Author": "SMAPI",
- "Version": "3.18.1",
+ "Version": "3.18.3",
"Description": "Automatically backs up all your saves once per day into its folder.",
"UniqueID": "SMAPI.SaveBackup",
"EntryDll": "SaveBackup.dll",
- "MinimumApiVersion": "3.18.1"
+ "MinimumApiVersion": "3.18.3"
}
diff --git a/src/SMAPI.Tests/SMAPI.Tests.csproj b/src/SMAPI.Tests/SMAPI.Tests.csproj
index 597cd7dd..0b1fb638 100644
--- a/src/SMAPI.Tests/SMAPI.Tests.csproj
+++ b/src/SMAPI.Tests/SMAPI.Tests.csproj
@@ -14,12 +14,12 @@
</ItemGroup>
<ItemGroup>
- <PackageReference Include="FluentAssertions" Version="6.7.0" />
- <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.2.0" />
- <PackageReference Include="Moq" Version="4.18.1" />
- <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
+ <PackageReference Include="FluentAssertions" Version="6.8.0" />
+ <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
+ <PackageReference Include="Moq" Version="4.18.4" />
+ <PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
<PackageReference Include="NUnit" Version="3.13.3" />
- <PackageReference Include="NUnit3TestAdapter" Version="4.2.1" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
+ <PackageReference Include="NUnit3TestAdapter" Version="4.3.1" PrivateAssets="all" IncludeAssets="runtime; build; native; contentfiles; analyzers; buildtransitive" />
</ItemGroup>
<ItemGroup>
diff --git a/src/SMAPI.Toolkit/Framework/UpdateData/ModSiteKey.cs b/src/SMAPI.Toolkit/Framework/UpdateData/ModSiteKey.cs
index 47cd3f7e..195b0367 100644
--- a/src/SMAPI.Toolkit/Framework/UpdateData/ModSiteKey.cs
+++ b/src/SMAPI.Toolkit/Framework/UpdateData/ModSiteKey.cs
@@ -19,6 +19,9 @@ namespace StardewModdingAPI.Toolkit.Framework.UpdateData
ModDrop,
/// <summary>The Nexus Mods mod repository.</summary>
- Nexus
+ Nexus,
+
+ /// <summary>An arbitrary URL to a JSON file containing update data.</summary>
+ UpdateManifest
}
}
diff --git a/src/SMAPI.Toolkit/Framework/UpdateData/UpdateKey.cs b/src/SMAPI.Toolkit/Framework/UpdateData/UpdateKey.cs
index 960caf96..3e8064fd 100644
--- a/src/SMAPI.Toolkit/Framework/UpdateData/UpdateKey.cs
+++ b/src/SMAPI.Toolkit/Framework/UpdateData/UpdateKey.cs
@@ -58,31 +58,17 @@ namespace StardewModdingAPI.Toolkit.Framework.UpdateData
/// <param name="raw">The raw update key to parse.</param>
public static UpdateKey Parse(string? raw)
{
+ if (raw is null)
+ return new UpdateKey(raw, ModSiteKey.Unknown, null, null);
// extract site + ID
- string? rawSite;
- string? id;
- {
- string[]? parts = raw?.Trim().Split(':');
- if (parts?.Length != 2)
- return new UpdateKey(raw, ModSiteKey.Unknown, null, null);
-
- rawSite = parts[0].Trim();
- id = parts[1].Trim();
- }
- if (string.IsNullOrWhiteSpace(id))
+ (string rawSite, string? id) = UpdateKey.SplitTwoParts(raw, ':');
+ if (string.IsNullOrEmpty(id))
id = null;
// extract subkey
string? subkey = null;
if (id != null)
- {
- string[] parts = id.Split('@');
- if (parts.Length == 2)
- {
- id = parts[0].Trim();
- subkey = $"@{parts[1]}".Trim();
- }
- }
+ (id, subkey) = UpdateKey.SplitTwoParts(id, '@', true);
// parse
if (!Enum.TryParse(rawSite, true, out ModSiteKey site))
@@ -151,5 +137,23 @@ namespace StardewModdingAPI.Toolkit.Framework.UpdateData
{
return $"{site}:{id}{subkey}".Trim();
}
+
+
+ /*********
+ ** Private methods
+ *********/
+ /// <summary>Split a string into two parts at a delimiter and trim whitespace.</summary>
+ /// <param name="str">The string to split.</param>
+ /// <param name="delimiter">The character on which to split.</param>
+ /// <param name="keepDelimiter">Whether to include the delimiter in the second string.</param>
+ /// <returns>Returns a tuple containing the two strings, with the second value <c>null</c> if the delimiter wasn't found.</returns>
+ private static (string, string?) SplitTwoParts(string str, char delimiter, bool keepDelimiter = false)
+ {
+ int splitIndex = str.IndexOf(delimiter);
+
+ return splitIndex >= 0
+ ? (str.Substring(0, splitIndex).Trim(), str.Substring(splitIndex + (keepDelimiter ? 0 : 1)).Trim())
+ : (str.Trim(), null);
+ }
}
}
diff --git a/src/SMAPI.Toolkit/SMAPI.Toolkit.csproj b/src/SMAPI.Toolkit/SMAPI.Toolkit.csproj
index 10f1df70..2a9a8294 100644
--- a/src/SMAPI.Toolkit/SMAPI.Toolkit.csproj
+++ b/src/SMAPI.Toolkit/SMAPI.Toolkit.csproj
@@ -9,9 +9,9 @@
<Import Project="..\..\build\common.targets" />
<ItemGroup>
- <PackageReference Include="HtmlAgilityPack" Version="1.11.43" />
- <PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
- <PackageReference Include="Pathoschild.Http.FluentClient" Version="4.2.0" />
+ <PackageReference Include="HtmlAgilityPack" Version="1.11.46" />
+ <PackageReference Include="Newtonsoft.Json" Version="13.0.2" />
+ <PackageReference Include="Pathoschild.Http.FluentClient" Version="4.3.0" />
<PackageReference Include="System.Management" Version="5.0.0" Condition="'$(OS)' == 'Windows_NT'" />
<PackageReference Include="Microsoft.Win32.Registry" Version="5.0.0" Condition="'$(OS)' == 'Windows_NT'" />
<PackageReference Include="VdfConverter" Version="1.0.3" Condition="'$(OS)' == 'Windows_NT'" Private="False" />
diff --git a/src/SMAPI.