diff options
| author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-03-05 15:31:06 -0500 |
|---|---|---|
| committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2022-03-05 15:31:06 -0500 |
| commit | b0d8b23c2c53ea3aafd60b0597a7562ac1708a42 (patch) | |
| tree | 46861f238b0e6df08c6b09f05c70ba826311a5e1 /src/SMAPI/Framework/ModHelpers | |
| parent | e82406a8458b6b7d1a032f5b2120f8d84a2abf66 (diff) | |
| download | SMAPI-b0d8b23c2c53ea3aafd60b0597a7562ac1708a42.tar.gz SMAPI-b0d8b23c2c53ea3aafd60b0597a7562ac1708a42.tar.bz2 SMAPI-b0d8b23c2c53ea3aafd60b0597a7562ac1708a42.zip | |
migrate more internal code to IAssetName (#766)
Diffstat (limited to 'src/SMAPI/Framework/ModHelpers')
| -rw-r--r-- | src/SMAPI/Framework/ModHelpers/ContentHelper.cs | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/SMAPI/Framework/ModHelpers/ContentHelper.cs b/src/SMAPI/Framework/ModHelpers/ContentHelper.cs index a01248a8..4e522c8d 100644 --- a/src/SMAPI/Framework/ModHelpers/ContentHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/ContentHelper.cs @@ -80,16 +80,18 @@ namespace StardewModdingAPI.Framework.ModHelpers /// <inheritdoc /> public T Load<T>(string key, ContentSource source = ContentSource.ModFolder) { + IAssetName assetName = this.ContentCore.ParseAssetName(key); + try { this.AssertAndNormalizeAssetName(key); switch (source) { case ContentSource.GameContent: - return this.GameContentManager.Load<T>(key, this.CurrentLocaleConstant, useCache: false); + return this.GameContentManager.Load<T>(assetName, this.CurrentLocaleConstant, useCache: false); case ContentSource.ModFolder: - return this.ModContentManager.Load<T>(key, Constants.DefaultLanguage, useCache: false); + return this.ModContentManager.Load<T>(assetName, Constants.DefaultLanguage, useCache: false); default: throw new SContentLoadException($"{this.ModName} failed loading content asset '{key}' from {source}: unknown content source '{source}'."); @@ -117,7 +119,7 @@ namespace StardewModdingAPI.Framework.ModHelpers return this.GameContentManager.AssertAndNormalizeAssetName(key); case ContentSource.ModFolder: - return this.ModContentManager.GetInternalAssetKey(key); + return this.ModContentManager.GetInternalAssetKey(key).Name; default: throw new NotSupportedException($"Unknown content source '{source}'."); |
