summaryrefslogtreecommitdiff
path: root/src/SMAPI/IAssetInfo.cs
blob: c3753b9703d31bb4a52468471b792afd729c2bd1 (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
using System;

namespace StardewModdingAPI
{
    /// <summary>Basic metadata for a content asset.</summary>
    public interface IAssetInfo
    {
        /*********
        ** Accessors
        *********/
        /// <summary>The content's locale code, if the content is localized.</summary>
        string Locale { get; }

        /// <summary>The asset name being read.</summary>
        /// <remarks>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>
        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 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.")]
        string AssetName { get; }

        /// <summary>The content data type.</summary>
        Type DataType { 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.")]
        bool AssetNameEquals(string path);
    }
}