diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-11-01 01:31:41 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2016-11-01 01:31:41 -0400 |
commit | 9ab5831eac4ee221f9dcdc645f1b706298426638 (patch) | |
tree | cd87429b018e9404d84e7f9cb3ed40feaeb66552 | |
parent | 605c99ba7074c3dbfeb441f608d77a2bc50e4629 (diff) | |
download | SMAPI-9ab5831eac4ee221f9dcdc645f1b706298426638.tar.gz SMAPI-9ab5831eac4ee221f9dcdc645f1b706298426638.tar.bz2 SMAPI-9ab5831eac4ee221f9dcdc645f1b706298426638.zip |
format & document mod class
-rw-r--r-- | src/StardewModdingAPI/Mod.cs | 57 |
1 files 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 { + /// <summary>The base class for a mod.</summary> public class Mod { - /// <summary> - /// The mod's manifest - /// </summary> + /********* + ** Accessors + *********/ + /// <summary>The mod's manifest.</summary> public Manifest Manifest { get; internal set; } - /// <summary> - /// Where the mod is located on the disk. - /// </summary> + /// <summary>The full path to the mod's directory on the disk.</summary> public string PathOnDisk { get; internal set; } - /// <summary> - /// A basic path to store your mod's config at. - /// </summary> + /// <summary>The full path to the mod's <c>config.json</c> file on the disk.</summary> public string BaseConfigPath => Path.Combine(this.PathOnDisk, "config.json"); - /// <summary> - /// A basic path to where per-save configs are stored - /// </summary> - public string PerSaveConfigFolder => GetPerSaveConfigFolder(); - - /// <summary> - /// 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. - /// </summary> - public string PerSaveConfigPath => Constants.CurrentSavePathExists ? Path.Combine(PerSaveConfigFolder, Constants.SaveFolderName + ".json") : ""; - - /// <summary> - /// A basic method that is the entry-point of your mod. It will always be called once when the mod loads. - /// </summary> + /// <summary>The full path to the per-save configs folder (if <see cref="StardewModdingAPI.Manifest.PerSaveConfigs"/> is <c>true</c>).</summary> + public string PerSaveConfigFolder => this.GetPerSaveConfigFolder(); + + /// <summary>The full path to the per-save configuration file for the current save (if <see cref="StardewModdingAPI.Manifest.PerSaveConfigs"/> is <c>true</c>).</summary> + public string PerSaveConfigPath => Constants.CurrentSavePathExists ? Path.Combine(this.PerSaveConfigFolder, Constants.SaveFolderName + ".json") : ""; + + + /********* + ** Public methods + *********/ + /// <summary>The entry point for your mod. It will always be called once when the mod loads.</summary> public virtual void Entry(params object[] objects) { } + + /********* + ** Private methods + *********/ + /// <summary>Get the full path to the per-save configuration file for the current save (if <see cref="StardewModdingAPI.Manifest.PerSaveConfigs"/> is <c>true</c>).</summary> 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 +} |