summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/StardewModdingAPI.Installer/InteractiveInstaller.cs32
-rw-r--r--src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs4
-rw-r--r--src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs2
-rw-r--r--src/StardewModdingAPI/Events/EventArgsCommand.cs2
-rw-r--r--src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs4
-rw-r--r--src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs4
-rw-r--r--src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs6
-rw-r--r--src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs6
-rw-r--r--src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs4
-rw-r--r--src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs2
-rw-r--r--src/StardewModdingAPI/Events/EventArgsInventoryChanged.cs8
-rw-r--r--src/StardewModdingAPI/Events/EventArgsKeyPressed.cs2
-rw-r--r--src/StardewModdingAPI/Events/EventArgsKeyboardStateChanged.cs4
-rw-r--r--src/StardewModdingAPI/Events/EventArgsLevelUp.cs4
-rw-r--r--src/StardewModdingAPI/Events/EventArgsLoadedGameChanged.cs2
-rw-r--r--src/StardewModdingAPI/Events/EventArgsLocationObjectsChanged.cs2
-rw-r--r--src/StardewModdingAPI/Events/EventArgsMineLevelChanged.cs4
-rw-r--r--src/StardewModdingAPI/Events/EventArgsMouseStateChanged.cs8
-rw-r--r--src/StardewModdingAPI/Events/EventArgsNewDay.cs6
-rw-r--r--src/StardewModdingAPI/Events/EventArgsStringChanged.cs4
-rw-r--r--src/StardewModdingAPI/Framework/AssemblyLoader.cs2
-rw-r--r--src/StardewModdingAPI/Framework/InternalExtensions.cs12
-rw-r--r--src/StardewModdingAPI/Framework/Monitor.cs2
23 files changed, 63 insertions, 63 deletions
diff --git a/src/StardewModdingAPI.Installer/InteractiveInstaller.cs b/src/StardewModdingAPI.Installer/InteractiveInstaller.cs
index b59e8305..e1e62d89 100644
--- a/src/StardewModdingAPI.Installer/InteractiveInstaller.cs
+++ b/src/StardewModdingAPI.Installer/InteractiveInstaller.cs
@@ -65,30 +65,30 @@ namespace StardewModdingApi.Installer
/// <param name="modsDir">The folder for SMAPI mods.</param>
private IEnumerable<string> GetUninstallPaths(DirectoryInfo installDir, DirectoryInfo modsDir)
{
- Func<string, string> installPath = path => Path.Combine(installDir.FullName, path);
+ string GetInstallPath(string path) => Path.Combine(installDir.FullName, path);
// common
- yield return installPath("Mono.Cecil.dll");
- yield return installPath("Newtonsoft.Json.dll");
- yield return installPath("StardewModdingAPI.exe");
- yield return installPath("StardewModdingAPI.config.json");
- yield return installPath("StardewModdingAPI.data.json");
- yield return installPath("StardewModdingAPI.AssemblyRewriters.dll");
- yield return installPath("steam_appid.txt");
+ yield return GetInstallPath("Mono.Cecil.dll");
+ yield return GetInstallPath("Newtonsoft.Json.dll");
+ yield return GetInstallPath("StardewModdingAPI.exe");
+ yield return GetInstallPath("StardewModdingAPI.config.json");
+ yield return GetInstallPath("StardewModdingAPI.data.json");
+ yield return GetInstallPath("StardewModdingAPI.AssemblyRewriters.dll");
+ yield return GetInstallPath("steam_appid.txt");
// Linux/Mac only
- yield return installPath("StardewModdingAPI");
- yield return installPath("StardewModdingAPI.exe.mdb");
- yield return installPath("System.Numerics.dll");
- yield return installPath("System.Runtime.Caching.dll");
+ yield return GetInstallPath("StardewModdingAPI");
+ yield return GetInstallPath("StardewModdingAPI.exe.mdb");
+ yield return GetInstallPath("System.Numerics.dll");
+ yield return GetInstallPath("System.Runtime.Caching.dll");
// Windows only
- yield return installPath("StardewModdingAPI.pdb");
+ yield return GetInstallPath("StardewModdingAPI.pdb");
// obsolete
- yield return installPath("Mods/.cache"); // 1.3-1.4
- yield return installPath("Mono.Cecil.Rocks.dll"); // 1.3–1.8
- yield return installPath("StardewModdingAPI-settings.json"); // 1.0-1.4
+ yield return GetInstallPath("Mods/.cache"); // 1.3-1.4
+ yield return GetInstallPath("Mono.Cecil.Rocks.dll"); // 1.3–1.8
+ yield return GetInstallPath("StardewModdingAPI-settings.json"); // 1.0-1.4
if (modsDir.Exists)
{
foreach (DirectoryInfo modDir in modsDir.EnumerateDirectories())
diff --git a/src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs b/src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs
index 708c02e0..2a2aa163 100644
--- a/src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsClickableMenuChanged.cs
@@ -10,10 +10,10 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The previous menu.</summary>
- public IClickableMenu NewMenu { get; private set; }
+ public IClickableMenu NewMenu { get; }
/// <summary>The current menu.</summary>
- public IClickableMenu PriorMenu { get; private set; }
+ public IClickableMenu PriorMenu { get; }
/*********
diff --git a/src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs b/src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs
index 1a62432f..5e6585f0 100644
--- a/src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs
+++ b/src/StardewModdingAPI/Events/EventArgsClickableMenuClosed.cs
@@ -10,7 +10,7 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The menu that was closed.</summary>
- public IClickableMenu PriorMenu { get; private set; }
+ public IClickableMenu PriorMenu { get; }
/*********
diff --git a/src/StardewModdingAPI/Events/EventArgsCommand.cs b/src/StardewModdingAPI/Events/EventArgsCommand.cs
index bae13694..88a9e5a3 100644
--- a/src/StardewModdingAPI/Events/EventArgsCommand.cs
+++ b/src/StardewModdingAPI/Events/EventArgsCommand.cs
@@ -10,7 +10,7 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The triggered command.</summary>
- public Command Command { get; private set; }
+ public Command Command { get; }
/*********
diff --git a/src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs b/src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs
index 87c96678..3243b80b 100644
--- a/src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs
+++ b/src/StardewModdingAPI/Events/EventArgsControllerButtonPressed.cs
@@ -11,10 +11,10 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The player who pressed the button.</summary>
- public PlayerIndex PlayerIndex { get; private set; }
+ public PlayerIndex PlayerIndex { get; }
/// <summary>The controller button that was pressed.</summary>
- public Buttons ButtonPressed { get; private set; }
+ public Buttons ButtonPressed { get; }
/*********
diff --git a/src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs b/src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs
index cb53b545..e05a080b 100644
--- a/src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs
+++ b/src/StardewModdingAPI/Events/EventArgsControllerButtonReleased.cs
@@ -11,10 +11,10 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The player who pressed the button.</summary>
- public PlayerIndex PlayerIndex { get; private set; }
+ public PlayerIndex PlayerIndex { get; }
/// <summary>The controller button that was pressed.</summary>
- public Buttons ButtonReleased { get; private set; }
+ public Buttons ButtonReleased { get; }
/*********
diff --git a/src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs b/src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs
index 72b73040..a2087733 100644
--- a/src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs
+++ b/src/StardewModdingAPI/Events/EventArgsControllerTriggerPressed.cs
@@ -11,13 +11,13 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The player who pressed the button.</summary>
- public PlayerIndex PlayerIndex { get; private set; }
+ public PlayerIndex PlayerIndex { get; }
/// <summary>The controller button that was pressed.</summary>
- public Buttons ButtonPressed { get; private set; }
+ public Buttons ButtonPressed { get; }
/// <summary>The current trigger value.</summary>
- public float Value { get; private set; }
+ public float Value { get; }
/*********
diff --git a/src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs b/src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs
index de28a159..d2eecbec 100644
--- a/src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs
+++ b/src/StardewModdingAPI/Events/EventArgsControllerTriggerReleased.cs
@@ -11,13 +11,13 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The player who pressed the button.</summary>
- public PlayerIndex PlayerIndex { get; private set; }
+ public PlayerIndex PlayerIndex { get; }
/// <summary>The controller button that was released.</summary>
- public Buttons ButtonReleased { get; private set; }
+ public Buttons ButtonReleased { get; }
/// <summary>The current trigger value.</summary>
- public float Value { get; private set; }
+ public float Value { get; }
/*********
diff --git a/src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs b/src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs
index aa0bb377..25d3ebf3 100644
--- a/src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsCurrentLocationChanged.cs
@@ -10,10 +10,10 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The player's current location.</summary>
- public GameLocation NewLocation { get; private set; }
+ public GameLocation NewLocation { get; }
/// <summary>The player's previous location.</summary>
- public GameLocation PriorLocation { get; private set; }
+ public GameLocation PriorLocation { get; }
/*********
diff --git a/src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs b/src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs
index c68951ce..fb8c821e 100644
--- a/src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsGameLocationsChanged.cs
@@ -11,7 +11,7 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The current list of game locations.</summary>
- public List<GameLocation> NewLocations { get; private set; }
+ public List<GameLocation> NewLocations { get; }
/*********
diff --git a/src/StardewModdingAPI/Events/EventArgsInventoryChanged.cs b/src/StardewModdingAPI/Events/EventArgsInventoryChanged.cs
index 11cbcedf..1ee02842 100644
--- a/src/StardewModdingAPI/Events/EventArgsInventoryChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsInventoryChanged.cs
@@ -12,16 +12,16 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The player's inventory.</summary>
- public List<Item> Inventory { get; private set; }
+ public List<Item> Inventory { get; }
/// <summary>The added items.</summary>
- public List<ItemStackChange> Added { get; private set; }
+ public List<ItemStackChange> Added { get; }
/// <summary>The removed items.</summary>
- public List<ItemStackChange> Removed { get; private set; }
+ public List<ItemStackChange> Removed { get; }
/// <summary>The items whose stack sizes changed.</summary>
- public List<ItemStackChange> QuantityChanged { get; private set; }
+ public List<ItemStackChange> QuantityChanged { get; }
/*********
diff --git a/src/StardewModdingAPI/Events/EventArgsKeyPressed.cs b/src/StardewModdingAPI/Events/EventArgsKeyPressed.cs
index 82a593be..d9d81e10 100644
--- a/src/StardewModdingAPI/Events/EventArgsKeyPressed.cs
+++ b/src/StardewModdingAPI/Events/EventArgsKeyPressed.cs
@@ -10,7 +10,7 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The keyboard button that was pressed.</summary>
- public Keys KeyPressed { get; private set; }
+ public Keys KeyPressed { get; }
/*********
diff --git a/src/StardewModdingAPI/Events/EventArgsKeyboardStateChanged.cs b/src/StardewModdingAPI/Events/EventArgsKeyboardStateChanged.cs
index 2e314731..14e397ce 100644
--- a/src/StardewModdingAPI/Events/EventArgsKeyboardStateChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsKeyboardStateChanged.cs
@@ -10,10 +10,10 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The previous keyboard state.</summary>
- public KeyboardState NewState { get; private set; }
+ public KeyboardState NewState { get; }
/// <summary>The current keyboard state.</summary>
- public KeyboardState PriorState { get; private set; }
+ public KeyboardState PriorState { get; }
/*********
diff --git a/src/StardewModdingAPI/Events/EventArgsLevelUp.cs b/src/StardewModdingAPI/Events/EventArgsLevelUp.cs
index 826914da..fe6696d4 100644
--- a/src/StardewModdingAPI/Events/EventArgsLevelUp.cs
+++ b/src/StardewModdingAPI/Events/EventArgsLevelUp.cs
@@ -9,10 +9,10 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The player skill that leveled up.</summary>
- public LevelType Type { get; private set; }
+ public LevelType Type { get; }
/// <summary>The new skill level.</summary>
- public int NewLevel { get; private set; }
+ public int NewLevel { get; }
/// <summary>The player skill types.</summary>
public enum LevelType
diff --git a/src/StardewModdingAPI/Events/EventArgsLoadedGameChanged.cs b/src/StardewModdingAPI/Events/EventArgsLoadedGameChanged.cs
index cd7a366f..51d64016 100644
--- a/src/StardewModdingAPI/Events/EventArgsLoadedGameChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsLoadedGameChanged.cs
@@ -9,7 +9,7 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>Whether the save has been loaded. This is always true.</summary>
- public bool LoadedGame { get; private set; }
+ public bool LoadedGame { get; }
/*********
diff --git a/src/StardewModdingAPI/Events/EventArgsLocationObjectsChanged.cs b/src/StardewModdingAPI/Events/EventArgsLocationObjectsChanged.cs
index f708ab6b..058999e9 100644
--- a/src/StardewModdingAPI/Events/EventArgsLocationObjectsChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsLocationObjectsChanged.cs
@@ -12,7 +12,7 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The current list of objects in the current location.</summary>
- public SerializableDictionary<Vector2, Object> NewObjects { get; private set; }
+ public SerializableDictionary<Vector2, Object> NewObjects { get; }
/*********
diff --git a/src/StardewModdingAPI/Events/EventArgsMineLevelChanged.cs b/src/StardewModdingAPI/Events/EventArgsMineLevelChanged.cs
index a02921d2..c82fed35 100644
--- a/src/StardewModdingAPI/Events/EventArgsMineLevelChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsMineLevelChanged.cs
@@ -9,10 +9,10 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The previous mine level.</summary>
- public int PreviousMineLevel { get; private set; }
+ public int PreviousMineLevel { get; }
/// <summary>The current mine level.</summary>
- public int CurrentMineLevel { get; private set; }
+ public int CurrentMineLevel { get; }
/*********
diff --git a/src/StardewModdingAPI/Events/EventArgsMouseStateChanged.cs b/src/StardewModdingAPI/Events/EventArgsMouseStateChanged.cs
index a589e29d..57298164 100644
--- a/src/StardewModdingAPI/Events/EventArgsMouseStateChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsMouseStateChanged.cs
@@ -11,16 +11,16 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The previous mouse state.</summary>
- public MouseState PriorState { get; private set; }
+ public MouseState PriorState { get; }
/// <summary>The current mouse state.</summary>
- public MouseState NewState { get; private set; }
+ public MouseState NewState { get; }
/// <summary>The previous mouse position on the screen adjusted for the zoom level.</summary>
- public Point PriorPosition { get; private set; }
+ public Point PriorPosition { get; }
/// <summary>The current mouse position on the screen adjusted for the zoom level.</summary>
- public Point NewPosition { get; private set; }
+ public Point NewPosition { get; }
/*********
diff --git a/src/StardewModdingAPI/Events/EventArgsNewDay.cs b/src/StardewModdingAPI/Events/EventArgsNewDay.cs
index 5088cb5c..aba837e4 100644
--- a/src/StardewModdingAPI/Events/EventArgsNewDay.cs
+++ b/src/StardewModdingAPI/Events/EventArgsNewDay.cs
@@ -9,13 +9,13 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The previous day value.</summary>
- public int PreviousDay { get; private set; }
+ public int PreviousDay { get; }
/// <summary>The current day value.</summary>
- public int CurrentDay { get; private set; }
+ public int CurrentDay { get; }
/// <summary>Whether the game just started the transition (<c>true</c>) or finished it (<c>false</c>).</summary>
- public bool IsNewDay { get; private set; }
+ public bool IsNewDay { get; }
/*********
diff --git a/src/StardewModdingAPI/Events/EventArgsStringChanged.cs b/src/StardewModdingAPI/Events/EventArgsStringChanged.cs
index f91951ae..85b6fab5 100644
--- a/src/StardewModdingAPI/Events/EventArgsStringChanged.cs
+++ b/src/StardewModdingAPI/Events/EventArgsStringChanged.cs
@@ -9,10 +9,10 @@ namespace StardewModdingAPI.Events
** Accessors
*********/
/// <summary>The previous value.</summary>
- public string NewString { get; private set; }
+ public string NewString { get; }
/// <summary>The current value.</summary>
- public string PriorString { get; private set; }
+ public string PriorString { get; }
/*********
** Public methods
diff --git a/src/StardewModdingAPI/Framework/AssemblyLoader.cs b/src/StardewModdingAPI/Framework/AssemblyLoader.cs
index f6fe89f5..2c9973c1 100644
--- a/src/StardewModdingAPI/Framework/AssemblyLoader.cs
+++ b/src/StardewModdingAPI/Framework/AssemblyLoader.cs
@@ -284,7 +284,7 @@ namespace StardewModdingAPI.Framework
{
if (!hash.Contains(message))
{
- this.Monitor.Log(message, level);
+ monitor.Log(message, level);
hash.Add(message);
}
}
diff --git a/src/StardewModdingAPI/Framework/InternalExtensions.cs b/src/StardewModdingAPI/Framework/InternalExtensions.cs
index 4ca79518..a2d589ff 100644
--- a/src/StardewModdingAPI/Framework/InternalExtensions.cs
+++ b/src/StardewModdingAPI/Framework/InternalExtensions.cs
@@ -39,7 +39,7 @@ namespace StardewModdingAPI.Framework
if (handlers == null)
return;
- foreach (EventHandler handler in Enumerable.Cast<EventHandler>(handlers))
+ foreach (EventHandler handler in handlers.Cast<EventHandler>())
{
try
{
@@ -64,7 +64,7 @@ namespace StardewModdingAPI.Framework
if (handlers == null)
return;
- foreach (EventHandler<TEventArgs> handler in Enumerable.Cast<EventHandler<TEventArgs>>(handlers))
+ foreach (EventHandler<TEventArgs> handler in handlers.Cast<EventHandler<TEventArgs>>())
{
try
{
@@ -85,14 +85,14 @@ namespace StardewModdingAPI.Framework
public static string GetLogSummary(this Exception exception)
{
// type load exception
- if (exception is TypeLoadException)
- return $"Failed loading type: {((TypeLoadException)exception).TypeName}: {exception}";
+ if (exception is TypeLoadException typeLoadEx)
+ return $"Failed loading type: {typeLoadEx.TypeName}: {exception}";
// reflection type load exception
- if (exception is ReflectionTypeLoadException)
+ if (exception is ReflectionTypeLoadException reflectionTypeLoadEx)
{
string summary = exception.ToString();
- foreach (Exception childEx in ((ReflectionTypeLoadException)exception).LoaderExceptions)
+ foreach (Exception childEx in reflectionTypeLoadEx.LoaderExceptions)
summary += $"\n\n{childEx.GetLogSummary()}";
return summary;
}
diff --git a/src/StardewModdingAPI/Framework/Monitor.cs b/src/StardewModdingAPI/Framework/Monitor.cs
index 64075f2f..70dd94c0 100644
--- a/src/StardewModdingAPI/Framework/Monitor.cs
+++ b/src/StardewModdingAPI/Framework/Monitor.cs
@@ -21,7 +21,7 @@ namespace StardewModdingAPI.Framework
private readonly LogFileManager LogFile;
/// <summary>The maximum length of the <see cref="LogLevel"/> values.</summary>
- private static readonly int MaxLevelLength = (from level in Enumerable.Cast<LogLevel>(Enum.GetValues(typeof(LogLevel))) select level.ToString().Length).Max();
+ private static readonly int MaxLevelLength = (from level in Enum.GetValues(typeof(LogLevel)).Cast<LogLevel>() select level.ToString().Length).Max();
/// <summary>The console text color for each log level.</summary>
private static readonly Dictionary<LogLevel, ConsoleColor> Colors = new Dictionary<LogLevel, ConsoleColor>