blob: 20064946fe95c1d86b01bab5bbdfcb0ad3f2ab46 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
using System;
namespace StardewModdingAPI
{
/// <summary>Basic metadata for a content asset.</summary>
public interface IAssetInfo
{
/*********
** Accessors
*********/
#if SMAPI_DEPRECATED
/// <summary>The content's locale code, if the content is localized.</summary>
/// <remarks>LEGACY NOTE: when reading this field from an <see cref="IAssetLoader"/> or <see cref="IAssetEditor"/> implementation, for non-localized assets it will return the current game locale (or an empty string for English) instead of null.</remarks>
#else
/// <summary>The content's locale code, if the content is localized.</summary>
#endif
string? Locale { get; }
#if SMAPI_DEPRECATED
/// <summary>The asset name being read.</summary>
/// <remarks>LEGACY NOTE: when reading this field from an <see cref="IAssetLoader"/> or <see cref="IAssetEditor"/> implementation, it's always equivalent to <see cref="NameWithoutLocale"/> for backwards compatibility.</remarks>
#else
/// <summary>The asset name being read.</summary>
#endif
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 content data type.</summary>
Type DataType { get; }
#if SMAPI_DEPRECATED
/// <summary>The normalized asset name being read. The format may change between platforms; see <see cref="AssetNameEquals"/> to compare with a known path.</summary>
[Obsolete($"Use {nameof(Name)} or {nameof(NameWithoutLocale)} instead. This property will be removed in SMAPI 4.0.0.")]
string AssetName { get; }
/*********
** Public methods
*********/
/// <summary>Get whether the asset name being loaded matches a given name after normalization.</summary>
/// <param name="path">The expected asset path, relative to the game's content folder and without the .xnb extension or locale suffix (like 'Data\ObjectInformation').</param>
[Obsolete($"Use {nameof(Name)}.{nameof(IAssetName.IsEquivalentTo)} or {nameof(NameWithoutLocale)}.{nameof(IAssetName.IsEquivalentTo)} instead. This method will be removed in SMAPI 4.0.0.")]
bool AssetNameEquals(string path);
#endif
}
}
|