using System; namespace StardewModdingAPI { /// Generic metadata and methods for a content asset being loaded. /// The expected data type. public interface IAssetData : IAssetInfo where TValue : notnull { /********* ** Accessors *********/ /// The content data being read. TValue Data { get; } /********* ** Public methods *********/ /// Replace the entire content value with the given value. This is generally not recommended, since it may break compatibility with other mods or different versions of the game. /// The new content value. /// The is null. /// The 's type is not compatible with the loaded asset's type. void ReplaceWith(TValue value); } /// Generic metadata and methods for a content asset being loaded. public interface IAssetData : IAssetData { /********* ** Public methods *********/ /// Get a helper to manipulate the data as a dictionary. /// The expected dictionary key. /// The expected dictionary value. /// The content being read isn't a dictionary. IAssetDataForDictionary AsDictionary(); /// Get a helper to manipulate the data as an image. /// The content being read isn't an image. IAssetDataForImage AsImage(); /// Get a helper to manipulate the data as a map. /// The content being read isn't a map. IAssetDataForMap AsMap(); /// Get the data as a given type. /// The expected data type. /// The data can't be converted to . TData GetData(); } }