diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-12-02 14:27:03 -0500 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2017-12-02 14:27:03 -0500 |
commit | 72a02c56d51f5e5b0e8e2fc7db59e1f0e6d93d5c (patch) | |
tree | 576ecf0daf31e4e9098a31ffb044766f0136d55e /src/SMAPI/Framework | |
parent | dce52adbc5f551fff71349e9c6190f947212c0b9 (diff) | |
download | SMAPI-72a02c56d51f5e5b0e8e2fc7db59e1f0e6d93d5c.tar.gz SMAPI-72a02c56d51f5e5b0e8e2fc7db59e1f0e6d93d5c.tar.bz2 SMAPI-72a02c56d51f5e5b0e8e2fc7db59e1f0e6d93d5c.zip |
add NormaliseAssetName content helper method (#404)
Diffstat (limited to 'src/SMAPI/Framework')
-rw-r--r-- | src/SMAPI/Framework/ModHelpers/ContentHelper.cs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/src/SMAPI/Framework/ModHelpers/ContentHelper.cs b/src/SMAPI/Framework/ModHelpers/ContentHelper.cs index 7665eb78..4a1d3853 100644 --- a/src/SMAPI/Framework/ModHelpers/ContentHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/ContentHelper.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics.CodeAnalysis; +using System.Diagnostics.Contracts; using System.IO; using System.Linq; using Microsoft.Xna.Framework.Content; @@ -134,6 +135,14 @@ namespace StardewModdingAPI.Framework.ModHelpers } } + /// <summary>Normalise an asset name so it's consistent with those generated by the game. This is mainly useful for string comparisons like <see cref="string.StartsWith(string)"/> on generated asset names, and isn't necessary when passing asset names into other content helper methods.</summary> + /// <param name="assetName">The asset key.</param> + [Pure] + public string NormaliseAssetName(string assetName) + { + return this.ContentManager.NormaliseAssetName(assetName); + } + /// <summary>Get the underlying key in the game's content cache for an asset. This can be used to load custom map tilesheets, but should be avoided when you can use the content API instead. This does not validate whether the asset exists.</summary> /// <param name="key">The asset key to fetch (if the <paramref name="source"/> is <see cref="ContentSource.GameContent"/>), or the local path to a content file relative to the mod folder.</param> /// <param name="source">Where to search for a matching content asset.</param> |