using System; using StardewValley; namespace StardewModdingAPI { /// The name for an asset loaded through the content pipeline. public interface IAssetName : IEquatable { /********* ** Accessors *********/ /// The full normalized asset name, including the locale if applicable (like Data/Achievements.fr-FR). string Name { get; } /// The base asset name without the locale code. string BaseName { get; } /// The locale code specified in the , if it's a valid code recognized by the game content. string LocaleCode { get; } /// The language code matching the , if applicable. LocalizedContentManager.LanguageCode? LanguageCode { get; } /********* ** Public methods *********/ /// Get whether the given asset name is equivalent, ignoring capitalization and formatting. /// The asset name to compare this instance to. /// Whether to compare the given name with the (if true) or (if false). This has no effect on any locale included in the given . bool IsEquivalentTo(string assetName, bool useBaseName = false); /// Get whether the given asset name is equivalent, ignoring capitalization and formatting. /// The asset name to compare this instance to. /// Whether to compare the given name with the (if true) or (if false). bool IsEquivalentTo(IAssetName assetName, bool useBaseName = false); /// Get whether the asset name starts with the given value, ignoring capitalization and formatting. This can be used with a trailing slash to test for an asset folder, like Data/. /// The prefix to match. /// Whether to match if the prefix occurs mid-word, so Data/AchievementsToIgnore matches prefix Data/Achievements. If this is false, the prefix only matches if the asset name starts with the prefix followed by a non-alphanumeric character (including ., /, or \\) or the end of string. /// Whether to match the prefix if there's a subfolder path after it, so Data/Achievements/Example matches prefix Data/Achievements. If this is false, the prefix only matches if the asset name has no / or \\ characters after the prefix. bool StartsWith(string prefix, bool allowPartialWord = true, bool allowSubfolder = true); /// Get whether the asset is directly within the given asset path. /// For example, Characters/Dialogue/Abigail is directly under Characters/Dialogue but not Characters or Characters/Dialogue/Ab. To allow sub-paths, use instead. /// The asset path to check. This doesn't need a trailing slash. bool IsDirectlyUnderPath(string assetFolder); /// Get an asset name representing the without locale. internal IAssetName GetBaseAssetName(); } }