summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Constants.cs
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2016-11-04 16:12:09 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2016-11-04 16:12:09 -0400
commit532235ef10525a8d2997a512b0b0acb408db2fb8 (patch)
tree4a3d5de6182e6ec421115d85867a0bc2b65eedfd /src/StardewModdingAPI/Constants.cs
parentda4269124c75b1cb5878c2115450797056ebb267 (diff)
downloadSMAPI-532235ef10525a8d2997a512b0b0acb408db2fb8.tar.gz
SMAPI-532235ef10525a8d2997a512b0b0acb408db2fb8.tar.bz2
SMAPI-532235ef10525a8d2997a512b0b0acb408db2fb8.zip
format & document constants
Diffstat (limited to 'src/StardewModdingAPI/Constants.cs')
-rw-r--r--src/StardewModdingAPI/Constants.cs57
1 files changed, 30 insertions, 27 deletions
diff --git a/src/StardewModdingAPI/Constants.cs b/src/StardewModdingAPI/Constants.cs
index c6aa40f5..b9501ad8 100644
--- a/src/StardewModdingAPI/Constants.cs
+++ b/src/StardewModdingAPI/Constants.cs
@@ -5,56 +5,59 @@ using StardewValley;
namespace StardewModdingAPI
{
- /// <summary>
- /// Static class containing readonly values.
- /// </summary>
+ /// <summary>Contains SMAPI's constants and assumptions.</summary>
public static class Constants
{
+ /*********
+ ** Properties
+ *********/
+ /// <summary>The directory name containing the current save's data (if a save is loaded).</summary>
+ private static string RawSaveFolderName => Constants.PlayerNull ? string.Empty : $"{Game1.player.name.RemoveNumerics()}_{Game1.uniqueIDForThisGame}";
+
+ /// <summary>The directory path containing the current save's data (if a save is loaded).</summary>
+ private static string RawSavePath => Constants.PlayerNull ? string.Empty : Path.Combine(Constants.SavesPath, Constants.RawSaveFolderName);
+
+
+ /*********
+ ** Accessors
+ *********/
/// <summary>SMAPI's current semantic version.</summary>
public static readonly Version Version = new Version(1, 0, 0, $"alpha-{DateTime.UtcNow.ToString("yyyyMMddHHmm")}");
/// <summary>The GitHub repository to check for updates.</summary>
public const string GitHubRepository = "cjsu/SMAPI";
- /// <summary>
- /// Not quite "constant", but it makes more sense for it to be here, at least for now
- /// </summary>
+ /// <summary>The number of mods currently loaded by SMAPI.</summary>
public static int ModsLoaded = 0;
- /// <summary>
- /// Stardew Valley's roaming app data location.
- /// %AppData%//StardewValley
- /// </summary>
+ /// <summary>The directory path containing Stardew Valley's app data.</summary>
public static string DataPath => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley");
- public static string SavesPath => Path.Combine(DataPath, "Saves");
+ /// <summary>The directory path where all saves are stored.</summary>
+ public static string SavesPath => Path.Combine(Constants.DataPath, "Saves");
- private static string saveFolderName => PlayerNull ? string.Empty : Game1.player.name.RemoveNumerics() + "_" + Game1.uniqueIDForThisGame;
- public static string SaveFolderName => CurrentSavePathExists ? saveFolderName : "";
+ /// <summary>Whether the directory containing the current save's data exists on disk.</summary>
+ public static bool CurrentSavePathExists => Directory.Exists(Constants.RawSavePath);
- private static string currentSavePath => PlayerNull ? string.Empty : Path.Combine(SavesPath, saveFolderName);
- public static string CurrentSavePath => CurrentSavePathExists ? currentSavePath : "";
+ /// <summary>The directory name containing the current save's data (if a save is loaded and the directory exists).</summary>
+ public static string SaveFolderName => Constants.CurrentSavePathExists ? Constants.RawSaveFolderName : "";
- public static bool CurrentSavePathExists => Directory.Exists(currentSavePath);
+ /// <summary>The directory path containing the current save's data (if a save is loaded and the directory exists).</summary>
+ public static string CurrentSavePath => Constants.CurrentSavePathExists ? Constants.RawSavePath : "";
+ /// <summary>Whether a player save has been loaded.</summary>
public static bool PlayerNull => !Game1.hasLoadedGame || Game1.player == null || string.IsNullOrEmpty(Game1.player.name);
- /// <summary>
- /// Execution path to execute the code.
- /// </summary>
+ /// <summary>The path to the current assembly being executing.</summary>
public static string ExecutionPath => Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
- /// <summary>
- /// Title for the API console
- /// </summary>
+ /// <summary>The title of the SMAPI console window.</summary>
public static string ConsoleTitle => $"Stardew Modding API Console - Version {Constants.Version} - Mods Loaded: {Constants.ModsLoaded}";
- /// <summary>
- /// Path for log files to be output to.
- /// %LocalAppData%//StardewValley//ErrorLogs
- /// </summary>
+ /// <summary>The directory path in which error logs should be stored.</summary>
public static string LogDir => Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley", "ErrorLogs");
- public static string LogPath => Path.Combine(LogDir, "MODDED_ProgramLog.Log_LATEST.txt");
+ /// <summary>The file path to the error log where the latest output should be saved.</summary>
+ public static string LogPath => Path.Combine(Constants.LogDir, "MODDED_ProgramLog.Log_LATEST.txt");
}
} \ No newline at end of file