From 929dccb75a1405737975d76648e015a3e7c00177 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Sat, 7 Oct 2017 23:07:10 -0400 Subject: reorganise repo structure --- src/SMAPI/Framework/ModLoading/ModMetadata.cs | 68 +++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) create mode 100644 src/SMAPI/Framework/ModLoading/ModMetadata.cs (limited to 'src/SMAPI/Framework/ModLoading/ModMetadata.cs') diff --git a/src/SMAPI/Framework/ModLoading/ModMetadata.cs b/src/SMAPI/Framework/ModLoading/ModMetadata.cs new file mode 100644 index 00000000..5055da75 --- /dev/null +++ b/src/SMAPI/Framework/ModLoading/ModMetadata.cs @@ -0,0 +1,68 @@ +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; + } + } +} -- cgit