using StardewModdingAPI.Framework.Models; namespace StardewModdingAPI.Framework.ModLoading { /// Metadata for a mod. internal class ModMetadata : IModMetadata { /********* ** Accessors *********/ /// The mod's display name. public string DisplayName { get; } /// The mod's full directory path. public string DirectoryPath { get; } /// The mod manifest. public IManifest Manifest { get; } /// Metadata about the mod from SMAPI's internal data (if any). public ModDataRecord DataRecord { get; } /// The metadata resolution status. public ModMetadataStatus Status { get; private set; } /// The reason the metadata is invalid, if any. public string Error { get; private set; } /// The mod instance (if it was loaded). public IMod Mod { get; private set; } /********* ** Public methods *********/ /// Construct an instance. /// The mod's display name. /// The mod's full directory path. /// The mod manifest. /// Metadata about the mod from SMAPI's internal data (if any). public ModMetadata(string displayName, string directoryPath, IManifest manifest, ModDataRecord dataRecord) { this.DisplayName = displayName; this.DirectoryPath = directoryPath; this.Manifest = manifest; this.DataRecord = dataRecord; } /// Set the mod status. /// The metadata resolution status. /// The reason the metadata is invalid, if any. /// Return the instance for chaining. public IModMetadata SetStatus(ModMetadataStatus status, string error = null) { this.Status = status; this.Error = error; return this; } /// Set the mod instance. /// The mod instance to set. public IModMetadata SetMod(IMod mod) { this.Mod = mod; return this; } } }