summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/Content
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI/Framework/Content')
-rw-r--r--src/SMAPI/Framework/Content/AssetInfo.cs12
-rw-r--r--src/SMAPI/Framework/Content/AssetName.cs9
2 files changed, 17 insertions, 4 deletions
diff --git a/src/SMAPI/Framework/Content/AssetInfo.cs b/src/SMAPI/Framework/Content/AssetInfo.cs
index 6a5b4f31..556f1c2a 100644
--- a/src/SMAPI/Framework/Content/AssetInfo.cs
+++ b/src/SMAPI/Framework/Content/AssetInfo.cs
@@ -23,8 +23,11 @@ namespace StardewModdingAPI.Framework.Content
public IAssetName Name { get; }
/// <inheritdoc />
- [Obsolete($"Use {nameof(Name)} instead.")]
- public string AssetName => this.Name.Name;
+ public IAssetName NameWithoutLocale { get; }
+
+ /// <inheritdoc />
+ [Obsolete($"Use {nameof(Name)} or {nameof(NameWithoutLocale)} instead.")]
+ public string AssetName => this.NameWithoutLocale.Name;
/// <inheritdoc />
public Type DataType { get; }
@@ -42,15 +45,16 @@ namespace StardewModdingAPI.Framework.Content
{
this.Locale = locale;
this.Name = assetName;
+ this.NameWithoutLocale = assetName.GetBaseAssetName();
this.DataType = type;
this.GetNormalizedPath = getNormalizedPath;
}
/// <inheritdoc />
- [Obsolete($"Use {nameof(Name)}.{nameof(IAssetName.IsEquivalentTo)} instead.")]
+ [Obsolete($"Use {nameof(Name)}.{nameof(IAssetName.IsEquivalentTo)} or {nameof(NameWithoutLocale)}.{nameof(IAssetName.IsEquivalentTo)} instead.")]
public bool AssetNameEquals(string path)
{
- return this.Name.IsEquivalentTo(path);
+ return this.NameWithoutLocale.IsEquivalentTo(path);
}
diff --git a/src/SMAPI/Framework/Content/AssetName.cs b/src/SMAPI/Framework/Content/AssetName.cs
index 992647f8..7ce0f8ee 100644
--- a/src/SMAPI/Framework/Content/AssetName.cs
+++ b/src/SMAPI/Framework/Content/AssetName.cs
@@ -142,12 +142,21 @@ namespace StardewModdingAPI.Framework.Content
}
+ /// <inheritdoc />
public bool IsDirectlyUnderPath(string assetFolder)
{
return this.StartsWith(assetFolder + "/", allowPartialWord: false, allowSubfolder: false);
}
/// <inheritdoc />
+ IAssetName IAssetName.GetBaseAssetName()
+ {
+ return this.LocaleCode == null
+ ? this
+ : new AssetName(this.BaseName, null, null);
+ }
+
+ /// <inheritdoc />
public bool Equals(IAssetName other)
{
return other switch