using System; using System.Collections.Generic; using StardewModdingAPI.Framework.ModHelpers; using StardewModdingAPI.Framework.ModLoading; using StardewModdingAPI.Toolkit.Framework.Clients.WebApi; using StardewModdingAPI.Toolkit.Framework.ModData; using StardewModdingAPI.Toolkit.Framework.UpdateData; namespace StardewModdingAPI.Framework { /// Metadata for a mod. internal interface IModMetadata : IModInfo { /********* ** Accessors *********/ /// The mod's display name. string DisplayName { get; } /// The root path containing mods. string RootPath { get; } /// The mod's full directory path within the . string DirectoryPath { get; } /// The relative to the . string RelativeDirectoryPath { get; } /// Metadata about the mod from SMAPI's internal data (if any). ModDataRecordVersionedFields? DataRecord { get; } /// The metadata resolution status. ModMetadataStatus Status { get; } /// The reason the mod failed to load, if applicable. ModFailReason? FailReason { get; } /// The non-error issues with the mod, ignoring those suppressed via . ModWarning Warnings { get; } /// The reason the metadata is invalid, if any. string? Error { get; } /// A detailed technical message for , if any. string? ErrorDetails { get; } /// Whether the mod folder should be ignored. This is true if it was found within a folder whose name starts with a dot. bool IsIgnored { get; } /// The mod instance (if loaded and is false). IMod? Mod { get; } /// The content pack instance (if loaded and is true). IContentPack? ContentPack { get; } /// The translations for this mod (if loaded). TranslationHelper? Translations { get; } /// Writes messages to the console and log file as this mod. IMonitor? Monitor { get; } /// The mod-provided API (if any). object? Api { get; } /// The update-check metadata for this mod (if any). ModEntryModel? UpdateCheckData { get; } /// The fake content packs created by this mod, if any. ISet> FakeContentPacks { get; } /********* ** Public methods *********/ /// Set the mod status to . /// Return the instance for chaining. IModMetadata SetStatusFound(); /// Set the mod status. /// The metadata resolution status. /// The reason a mod could not be loaded. /// The reason the metadata is invalid, if any. /// A detailed technical message, if any. /// Return the instance for chaining. IModMetadata SetStatus(ModMetadataStatus status, ModFailReason reason, string? error, string? errorDetails = null); /// Set a warning flag for the mod. /// The warning to set. IModMetadata SetWarning(ModWarning warning); /// Remove a warning flag for the mod. /// The warning to remove. IModMetadata RemoveWarning(ModWarning warning); /// Set the mod instance. /// The mod instance to set. /// The translations for this mod (if loaded). IModMetadata SetMod(IMod mod, TranslationHelper translations); /// Set the mod instance. /// The contentPack instance to set. /// Writes messages to the console and log file. /// The translations for this mod (if loaded). IModMetadata SetMod(IContentPack contentPack, IMonitor monitor, TranslationHelper translations); /// Set the mod-provided API instance. /// The mod-provided API. IModMetadata SetApi(object? api); /// Set the update-check metadata for this mod. /// The update-check metadata. IModMetadata SetUpdateData(ModEntryModel data); /// Whether the mod manifest was loaded (regardless of whether the mod itself was loaded). bool HasManifest(); /// Whether the mod has an ID (regardless of whether the ID is valid or the mod itself was loaded). bool HasID(); /// Whether the mod has the given ID. /// The mod ID to check. bool HasID(string? id); /// Get the defined update keys. /// Only return valid update keys. IEnumerable GetUpdateKeys(bool validOnly = true); /// Get whether the given mod ID must be installed to load this mod. /// The mod ID to check. /// Whether to include optional dependencies. bool HasRequiredModId(string modId, bool includeOptional); /// Get the mod IDs that must be installed to load this mod. /// Whether to include optional dependencies. IEnumerable GetRequiredModIds(bool includeOptional = false); /// Whether the mod has at least one valid update key set. bool HasValidUpdateKeys(); /// Get whether the mod has any of the given warnings, ignoring those suppressed via . /// The warnings to check. bool HasWarnings(params ModWarning[] warnings); /// Get a relative path which includes the root folder name. string GetRelativePathWithRoot(); /// Get the currently live fake content packs created by this mod. IEnumerable GetFakeContentPacks(); } }