summaryrefslogtreecommitdiff
path: root/src/SMAPI/Events
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI/Events')
-rw-r--r--src/SMAPI/Events/AssetReadyEventArgs.cs8
-rw-r--r--src/SMAPI/Events/AssetRequestedEventArgs.cs8
-rw-r--r--src/SMAPI/Events/AssetsInvalidatedEventArgs.cs9
3 files changed, 21 insertions, 4 deletions
diff --git a/src/SMAPI/Events/AssetReadyEventArgs.cs b/src/SMAPI/Events/AssetReadyEventArgs.cs
index 946c9173..2c308f18 100644
--- a/src/SMAPI/Events/AssetReadyEventArgs.cs
+++ b/src/SMAPI/Events/AssetReadyEventArgs.cs
@@ -11,15 +11,21 @@ namespace StardewModdingAPI.Events
/// <summary>The name of the asset being requested.</summary>
public IAssetName Name { get; }
+ /// <summary>The <see cref="Name"/> with any locale codes stripped.</summary>
+ /// <remarks>For example, if <see cref="Name"/> contains a locale like <c>Data/Bundles.fr-FR</c>, this will be the name without locale like <c>Data/Bundles</c>. If the name has no locale, this field is equivalent.</remarks>
+ public IAssetName NameWithoutLocale { get; }
+
/*********
** Public methods
*********/
/// <summary>Construct an instance.</summary>
/// <param name="name">The name of the asset being requested.</param>
- internal AssetReadyEventArgs(IAssetName name)
+ /// <param name="nameWithoutLocale">The <paramref name="name"/> with any locale codes stripped.</param>
+ internal AssetReadyEventArgs(IAssetName name, IAssetName nameWithoutLocale)
{
this.Name = name;
+ this.NameWithoutLocale = nameWithoutLocale;
}
}
}
diff --git a/src/SMAPI/Events/AssetRequestedEventArgs.cs b/src/SMAPI/Events/AssetRequestedEventArgs.cs
index d022a4de..9e2cde7f 100644
--- a/src/SMAPI/Events/AssetRequestedEventArgs.cs
+++ b/src/SMAPI/Events/AssetRequestedEventArgs.cs
@@ -26,6 +26,10 @@ namespace StardewModdingAPI.Events
/// <summary>The name of the asset being requested.</summary>
public IAssetName Name { get; }
+ /// <summary>The <see cref="Name"/> with any locale codes stripped.</summary>
+ /// <remarks>For example, if <see cref="Name"/> contains a locale like <c>Data/Bundles.fr-FR</c>, this will be the name without locale like <c>Data/Bundles</c>. If the name has no locale, this field is equivalent.</remarks>
+ public IAssetName NameWithoutLocale { get; }
+
/// <summary>The load operations requested by the event handler.</summary>
internal IList<AssetLoadOperation> LoadOperations { get; } = new List<AssetLoadOperation>();
@@ -39,11 +43,13 @@ namespace StardewModdingAPI.Events
/// <summary>Construct an instance.</summary>
/// <param name="mod">The mod handling the event.</param>
/// <param name="name">The name of the asset being requested.</param>
+ /// <param name="nameWithoutLocale">The <paramref name="name"/> with any locale codes stripped.</param>
/// <param name="getOnBehalfOf">Get the mod metadata for a content pack, if it's a valid content pack for the mod.</param>
- internal AssetRequestedEventArgs(IModMetadata mod, IAssetName name, Func<IModMetadata, string, string, IModMetadata> getOnBehalfOf)
+ internal AssetRequestedEventArgs(IModMetadata mod, IAssetName name, IAssetName nameWithoutLocale, Func<IModMetadata, string, string, IModMetadata> getOnBehalfOf)
{
this.Mod = mod;
this.Name = name;
+ this.NameWithoutLocale = nameWithoutLocale;
this.GetOnBehalfOf = getOnBehalfOf;
}
diff --git a/src/SMAPI/Events/AssetsInvalidatedEventArgs.cs b/src/SMAPI/Events/AssetsInvalidatedEventArgs.cs
index f3d83dd6..614cdf49 100644
--- a/src/SMAPI/Events/AssetsInvalidatedEventArgs.cs
+++ b/src/SMAPI/Events/AssetsInvalidatedEventArgs.cs
@@ -1,7 +1,6 @@
using System;
using System.Collections.Generic;
using System.Collections.Immutable;
-using System.Linq;
namespace StardewModdingAPI.Events
{
@@ -14,15 +13,21 @@ namespace StardewModdingAPI.Events
/// <summary>The asset names that were invalidated.</summary>
public IReadOnlySet<IAssetName> Names { get; }
+ /// <summary>The <see cref="Names"/> with any locale codes stripped.</summary>
+ /// <remarks>For example, if <see cref="Names"/> contains a locale like <c>Data/Bundles.fr-FR</c>, this will have the name without locale like <c>Data/Bundles</c>. If the name has no locale, this field is equivalent.</remarks>
+ public IReadOnlySet<IAssetName> NamesWithoutLocale { get; }
+
/*********
** Public methods
*********/
/// <summary>Construct an instance.</summary>
/// <param name="names">The asset names that were invalidated.</param>
- internal AssetsInvalidatedEventArgs(IEnumerable<IAssetName> names)
+ /// <param name="namesWithoutLocale">The <paramref name="names"/> with any locale codes stripped.</param>
+ internal AssetsInvalidatedEventArgs(IEnumerable<IAssetName> names, IEnumerable<IAssetName> namesWithoutLocale)
{
this.Names = names.ToImmutableHashSet();
+ this.NamesWithoutLocale = namesWithoutLocale.ToImmutableHashSet();
}
}
}