using System;
using System.Collections.Generic;
using Microsoft.Xna.Framework.Content;
using StardewModdingAPI.Framework.Exceptions;
using StardewValley;
namespace StardewModdingAPI.Framework.ContentManagers
{
/// A content manager which handles reading files.
internal interface IContentManager : IDisposable
{
/*********
** Accessors
*********/
/// A name for the mod manager. Not guaranteed to be unique.
string Name { get; }
/// The current language as a constant.
LocalizedContentManager.LanguageCode Language { get; }
/// The absolute path to the .
string FullRootDirectory { get; }
/// Whether this content manager can be targeted by managed asset keys (e.g. to load assets from a mod folder).
bool IsNamespaced { get; }
/*********
** Methods
*********/
/// Get whether an asset exists and can be loaded.
/// The expected asset type.
/// The normalized asset name.
bool DoesAssetExist(IAssetName assetName)
where T : notnull;
/// Load an asset through the content pipeline, using a localized variant of the if available.
/// The type of asset to load.
/// The asset name relative to the loader root directory.
/// The language for which to load the asset.
/// Whether to read/write the loaded asset to the asset cache.
T LoadLocalized(IAssetName assetName, LocalizedContentManager.LanguageCode language, bool useCache)
where T : notnull;
/// Load an asset through the content pipeline, using the exact asset name without checking for localized variants.
/// The type of asset to load.
/// The asset name relative to the loader root directory.
/// Whether to read/write the loaded asset to the asset cache.
T LoadExact(IAssetName assetName, bool useCache)
where T : notnull;
/// Assert that the given key has a valid format and return a normalized form consistent with the underlying cache.
/// The asset key to check.
/// The asset key is empty or contains invalid characters.
string AssertAndNormalizeAssetName(string? assetName);
/// Get the current content locale.
string GetLocale();
/// The locale for a language.
/// The language.
string GetLocale(LocalizedContentManager.LanguageCode language);
/// Get whether the content manager has already loaded and cached the given asset.
/// The asset path relative to the loader root directory, not including the .xnb extension.
bool IsLoaded(IAssetName assetName);
/// Get all assets in the cache.
IEnumerable> GetCachedAssets();
/// Purge matched assets from the cache.
/// The asset name to dispose.
/// Whether to dispose invalidated assets. This should only be true when they're being invalidated as part of a dispose, to avoid crashing the game.
/// Returns whether the asset was in the cache.
bool InvalidateCache(IAssetName assetName, bool dispose = false);
}
}