summaryrefslogtreecommitdiff
path: root/src/SMAPI/Framework/ModHelpers
diff options
context:
space:
mode:
Diffstat (limited to 'src/SMAPI/Framework/ModHelpers')
-rw-r--r--src/SMAPI/Framework/ModHelpers/ContentHelper.cs14
-rw-r--r--src/SMAPI/Framework/ModHelpers/ContentPackHelper.cs4
-rw-r--r--src/SMAPI/Framework/ModHelpers/DataHelper.cs12
-rw-r--r--src/SMAPI/Framework/ModHelpers/ModHelper.cs4
-rw-r--r--src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs4
-rw-r--r--src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs2
6 files changed, 20 insertions, 20 deletions
diff --git a/src/SMAPI/Framework/ModHelpers/ContentHelper.cs b/src/SMAPI/Framework/ModHelpers/ContentHelper.cs
index 15b164b1..043ae376 100644
--- a/src/SMAPI/Framework/ModHelpers/ContentHelper.cs
+++ b/src/SMAPI/Framework/ModHelpers/ContentHelper.cs
@@ -87,7 +87,7 @@ namespace StardewModdingAPI.Framework.ModHelpers
{
try
{
- this.AssertAndNormaliseAssetName(key);
+ this.AssertAndNormalizeAssetName(key);
switch (source)
{
case ContentSource.GameContent:
@@ -106,12 +106,12 @@ namespace StardewModdingAPI.Framework.ModHelpers
}
}
- /// <summary>Normalise an asset name so it's consistent with those generated by the game. This is mainly useful for string comparisons like <see cref="string.StartsWith(string)"/> on generated asset names, and isn't necessary when passing asset names into other content helper methods.</summary>
+ /// <summary>Normalize an asset name so it's consistent with those generated by the game. This is mainly useful for string comparisons like <see cref="string.StartsWith(string)"/> on generated asset names, and isn't necessary when passing asset names into other content helper methods.</summary>
/// <param name="assetName">The asset key.</param>
[Pure]
- public string NormaliseAssetName(string assetName)
+ public string NormalizeAssetName(string assetName)
{
- return this.ModContentManager.AssertAndNormaliseAssetName(assetName);
+ return this.ModContentManager.AssertAndNormalizeAssetName(assetName);
}
/// <summary>Get the underlying key in the game's content cache for an asset. This can be used to load custom map tilesheets, but should be avoided when you can use the content API instead. This does not validate whether the asset exists.</summary>
@@ -123,7 +123,7 @@ namespace StardewModdingAPI.Framework.ModHelpers
switch (source)
{
case ContentSource.GameContent:
- return this.GameContentManager.AssertAndNormaliseAssetName(key);
+ return this.GameContentManager.AssertAndNormalizeAssetName(key);
case ContentSource.ModFolder:
return this.ModContentManager.GetInternalAssetKey(key);
@@ -170,9 +170,9 @@ namespace StardewModdingAPI.Framework.ModHelpers
/// <param name="key">The asset key to check.</param>
/// <exception cref="ArgumentException">The asset key is empty or contains invalid characters.</exception>
[SuppressMessage("ReSharper", "ParameterOnlyUsedForPreconditionCheck.Local", Justification = "Parameter is only used for assertion checks by design.")]
- private void AssertAndNormaliseAssetName(string key)
+ private void AssertAndNormalizeAssetName(string key)
{
- this.ModContentManager.AssertAndNormaliseAssetName(key);
+ this.ModContentManager.AssertAndNormalizeAssetName(key);
if (Path.IsPathRooted(key))
throw new ArgumentException("The asset key must not be an absolute path.");
}
diff --git a/src/SMAPI/Framework/ModHelpers/ContentPackHelper.cs b/src/SMAPI/Framework/ModHelpers/ContentPackHelper.cs
index 34f24d65..acdd82a0 100644
--- a/src/SMAPI/Framework/ModHelpers/ContentPackHelper.cs
+++ b/src/SMAPI/Framework/ModHelpers/ContentPackHelper.cs
@@ -1,7 +1,7 @@
using System;
using System.Collections.Generic;
using System.IO;
-using StardewModdingAPI.Toolkit.Serialisation.Models;
+using StardewModdingAPI.Toolkit.Serialization.Models;
namespace StardewModdingAPI.Framework.ModHelpers
{
@@ -38,7 +38,7 @@ namespace StardewModdingAPI.Framework.ModHelpers
return this.ContentPacks.Value;
}
- /// <summary>Create a temporary content pack to read files from a directory, using randomised manifest fields. This will generate fake manifest data; any <c>manifest.json</c> in the directory will be ignored. Temporary content packs will not appear in the SMAPI log and update checks will not be performed.</summary>
+ /// <summary>Create a temporary content pack to read files from a directory, using randomized manifest fields. This will generate fake manifest data; any <c>manifest.json</c> in the directory will be ignored. Temporary content packs will not appear in the SMAPI log and update checks will not be performed.</summary>
/// <param name="directoryPath">The absolute directory path containing the content pack files.</param>
public IContentPack CreateFake(string directoryPath)
{
diff --git a/src/SMAPI/Framework/ModHelpers/DataHelper.cs b/src/SMAPI/Framework/ModHelpers/DataHelper.cs
index 3b5c1752..cc08c42b 100644
--- a/src/SMAPI/Framework/ModHelpers/DataHelper.cs
+++ b/src/SMAPI/Framework/ModHelpers/DataHelper.cs
@@ -1,7 +1,7 @@
using System;
using System.IO;
using Newtonsoft.Json;
-using StardewModdingAPI.Toolkit.Serialisation;
+using StardewModdingAPI.Toolkit.Serialization;
using StardewModdingAPI.Toolkit.Utilities;
using StardewValley;
@@ -40,14 +40,14 @@ namespace StardewModdingAPI.Framework.ModHelpers
/// <summary>Read data from a JSON file in the mod's folder.</summary>
/// <typeparam name="TModel">The model type. This should be a plain class that has public properties for the data you want. The properties can be complex types.</typeparam>
/// <param name="path">The file path relative to the mod folder.</param>
- /// <returns>Returns the deserialised model, or <c>null</c> if the file doesn't exist or is empty.</returns>
+ /// <returns>Returns the deserialized model, or <c>null</c> if the file doesn't exist or is empty.</returns>
/// <exception cref="InvalidOperationException">The <paramref name="path"/> is not relative or contains directory climbing (../).</exception>
public TModel ReadJsonFile<TModel>(string path) where TModel : class
{
if (!PathUtilities.IsSafeRelativePath(path))
throw new InvalidOperationException($"You must call {nameof(IModHelper.Data)}.{nameof(this.ReadJsonFile)} with a relative path.");
- path = Path.Combine(this.ModFolderPath, PathUtilities.NormalisePathSeparators(path));
+ path = Path.Combine(this.ModFolderPath, PathUtilities.NormalizePathSeparators(path));
return this.JsonHelper.ReadJsonFileIfExists(path, out TModel data)
? data
: null;
@@ -63,7 +63,7 @@ namespace StardewModdingAPI.Framework.ModHelpers
if (!PathUtilities.IsSafeRelativePath(path))
throw new InvalidOperationException($"You must call {nameof(IMod.Helper)}.{nameof(IModHelper.Data)}.{nameof(this.WriteJsonFile)} with a relative path (without directory climbing).");
- path = Path.Combine(this.ModFolderPath, PathUtilities.NormalisePathSeparators(path));
+ path = Path.Combine(this.ModFolderPath, PathUtilities.NormalizePathSeparators(path));
this.JsonHelper.WriteJsonFile(path, data);
}
@@ -83,7 +83,7 @@ namespace StardewModdingAPI.Framework.ModHelpers
throw new InvalidOperationException($"Can't use {nameof(IMod.Helper)}.{nameof(IModHelper.Data)}.{nameof(this.ReadSaveData)} because this isn't the main player. (Save files are stored on the main player's computer.)");
return Game1.CustomData.TryGetValue(this.GetSaveFileKey(key), out string value)
- ? this.JsonHelper.Deserialise<TModel>(value)
+ ? this.JsonHelper.Deserialize<TModel>(value)
: null;
}
@@ -101,7 +101,7 @@ namespace StardewModdingAPI.Framework.ModHelpers
string internalKey = this.GetSaveFileKey(key);
if (data != null)
- Game1.CustomData[internalKey] = this.JsonHelper.Serialise(data, Formatting.None);
+ Game1.CustomData[internalKey] = this.JsonHelper.Serialize(data, Formatting.None);
else
Game1.CustomData.Remove(internalKey);
}
diff --git a/src/SMAPI/Framework/ModHelpers/ModHelper.cs b/src/SMAPI/Framework/ModHelpers/ModHelper.cs
index 86e8eb28..25401e23 100644
--- a/src/SMAPI/Framework/ModHelpers/ModHelper.cs
+++ b/src/SMAPI/Framework/ModHelpers/ModHelper.cs
@@ -2,7 +2,7 @@ using System;
using System.IO;
using StardewModdingAPI.Events;
using StardewModdingAPI.Framework.Input;
-using StardewModdingAPI.Toolkit.Serialisation;
+using StardewModdingAPI.Toolkit.Serialization;
namespace StardewModdingAPI.Framework.ModHelpers
{
@@ -73,7 +73,7 @@ namespace StardewModdingAPI.Framework.ModHelpers
if (!Directory.Exists(modDirectory))
throw new InvalidOperationException("The specified mod directory does not exist.");
- // initialise
+ // initialize
this.DirectoryPath = modDirectory;
this.Content = contentHelper ?? throw new ArgumentNullException(nameof(contentHelper));
this.ContentPacks = contentPackHelper ?? throw new ArgumentNullException(nameof(contentPackHelper));
diff --git a/src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs b/src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs
index 8330e078..24bed3bb 100644
--- a/src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs
+++ b/src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs
@@ -75,9 +75,9 @@ namespace StardewModdingAPI.Framework.ModHelpers
public TInterface GetApi<TInterface>(string uniqueID) where TInterface : class
{
// validate
- if (!this.Registry.AreAllModsInitialised)
+ if (!this.Registry.AreAllModsInitialized)
{
- this.Monitor.Log("Tried to access a mod-provided API before all mods were initialised.", LogLevel.Error);
+ this.Monitor.Log("Tried to access a mod-provided API before all mods were initialized.", LogLevel.Error);
return null;
}
if (!typeof(TInterface).IsInterface)
diff --git a/src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs b/src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs
index 0ce72a9e..86c327ed 100644
--- a/src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs
+++ b/src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs
@@ -5,7 +5,7 @@ using StardewModdingAPI.Framework.Reflection;
namespace StardewModdingAPI.Framework.ModHelpers
{
/// <summary>Provides helper methods for accessing private game code.</summary>
- /// <remarks>This implementation searches up the type hierarchy, and caches the reflected fields and methods with a sliding expiry (to optimise performance without unnecessary memory usage).</remarks>
+ /// <remarks>This implementation searches up the type hierarchy, and caches the reflected fields and methods with a sliding expiry (to optimize performance without unnecessary memory usage).</remarks>
internal class ReflectionHelper : BaseHelper, IReflectionHelper
{
/*********