From 9ab5831eac4ee221f9dcdc645f1b706298426638 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 1 Nov 2016 01:31:41 -0400 Subject: format & document mod class --- src/StardewModdingAPI/Mod.cs | 57 ++++++++++++++++++++++---------------------- 1 file changed, 28 insertions(+), 29 deletions(-) diff --git a/src/StardewModdingAPI/Mod.cs b/src/StardewModdingAPI/Mod.cs index e83049de..e8824fc6 100644 --- a/src/StardewModdingAPI/Mod.cs +++ b/src/StardewModdingAPI/Mod.cs @@ -2,50 +2,49 @@ namespace StardewModdingAPI { + /// The base class for a mod. public class Mod { - /// - /// The mod's manifest - /// + /********* + ** Accessors + *********/ + /// The mod's manifest. public Manifest Manifest { get; internal set; } - /// - /// Where the mod is located on the disk. - /// + /// The full path to the mod's directory on the disk. public string PathOnDisk { get; internal set; } - /// - /// A basic path to store your mod's config at. - /// + /// The full path to the mod's config.json file on the disk. public string BaseConfigPath => Path.Combine(this.PathOnDisk, "config.json"); - /// - /// A basic path to where per-save configs are stored - /// - public string PerSaveConfigFolder => GetPerSaveConfigFolder(); - - /// - /// A basic path to store your mod's config at, dependent on the current save. - /// The Manifest must allow for per-save configs. This is to keep from having an - /// empty directory in every mod folder. - /// - public string PerSaveConfigPath => Constants.CurrentSavePathExists ? Path.Combine(PerSaveConfigFolder, Constants.SaveFolderName + ".json") : ""; - - /// - /// A basic method that is the entry-point of your mod. It will always be called once when the mod loads. - /// + /// The full path to the per-save configs folder (if is true). + public string PerSaveConfigFolder => this.GetPerSaveConfigFolder(); + + /// The full path to the per-save configuration file for the current save (if is true). + public string PerSaveConfigPath => Constants.CurrentSavePathExists ? Path.Combine(this.PerSaveConfigFolder, Constants.SaveFolderName + ".json") : ""; + + + /********* + ** Public methods + *********/ + /// The entry point for your mod. It will always be called once when the mod loads. public virtual void Entry(params object[] objects) { } + + /********* + ** Private methods + *********/ + /// Get the full path to the per-save configuration file for the current save (if is true). private string GetPerSaveConfigFolder() { - if (Manifest.PerSaveConfigs) + if (!this.Manifest.PerSaveConfigs) { - return Path.Combine(PathOnDisk, "psconfigs"); + Log.AsyncR($"The mod [{this.Manifest.Name}] is not configured to use per-save configs."); + return ""; } - Log.AsyncR($"The mod [{Manifest.Name}] is not configured to use per-save configs."); - return ""; + return Path.Combine(this.PathOnDisk, "psconfigs"); } } -} \ No newline at end of file +} -- cgit