summaryrefslogtreecommitdiff
path: root/src/StardewModdingAPI/Framework
diff options
context:
space:
mode:
authorJesse Plamondon-Willard <github@jplamondonw.com>2017-09-23 20:53:12 -0400
committerJesse Plamondon-Willard <github@jplamondonw.com>2017-09-23 20:53:12 -0400
commit2d36105c33ffba77eb979ef6ef0d2e7d906b09bc (patch)
treefe74c3eb7dea4e6e7d59c00cab2e2308c43da3d0 /src/StardewModdingAPI/Framework
parenta149f82b7a00d1ebf5ab33e529be93ce70873947 (diff)
downloadSMAPI-2d36105c33ffba77eb979ef6ef0d2e7d906b09bc.tar.gz
SMAPI-2d36105c33ffba77eb979ef6ef0d2e7d906b09bc.tar.bz2
SMAPI-2d36105c33ffba77eb979ef6ef0d2e7d906b09bc.zip
drop support for SMAPI 1.x (#360)
Diffstat (limited to 'src/StardewModdingAPI/Framework')
-rw-r--r--src/StardewModdingAPI/Framework/CursorPosition.cs2
-rw-r--r--src/StardewModdingAPI/Framework/ModHelpers/ReflectionHelper.cs4
-rw-r--r--src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs25
-rw-r--r--src/StardewModdingAPI/Framework/ModRegistry.cs8
-rw-r--r--src/StardewModdingAPI/Framework/Models/Manifest.cs9
-rw-r--r--src/StardewModdingAPI/Framework/Models/ManifestDependency.cs12
-rw-r--r--src/StardewModdingAPI/Framework/Monitor.cs27
-rw-r--r--src/StardewModdingAPI/Framework/SGame.cs81
-rw-r--r--src/StardewModdingAPI/Framework/Serialisation/SFieldConverter.cs6
-rw-r--r--src/StardewModdingAPI/Framework/Utilities/ContextHash.cs3
10 files changed, 15 insertions, 162 deletions
diff --git a/src/StardewModdingAPI/Framework/CursorPosition.cs b/src/StardewModdingAPI/Framework/CursorPosition.cs
index 0fb2309b..db02b3d1 100644
--- a/src/StardewModdingAPI/Framework/CursorPosition.cs
+++ b/src/StardewModdingAPI/Framework/CursorPosition.cs
@@ -1,4 +1,3 @@
-#if !SMAPI_1_x
using Microsoft.Xna.Framework;
namespace StardewModdingAPI.Framework
@@ -34,4 +33,3 @@ namespace StardewModdingAPI.Framework
}
}
}
-#endif
diff --git a/src/StardewModdingAPI/Framework/ModHelpers/ReflectionHelper.cs b/src/StardewModdingAPI/Framework/ModHelpers/ReflectionHelper.cs
index 14a339da..8d435416 100644
--- a/src/StardewModdingAPI/Framework/ModHelpers/ReflectionHelper.cs
+++ b/src/StardewModdingAPI/Framework/ModHelpers/ReflectionHelper.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using StardewModdingAPI.Framework.Reflection;
namespace StardewModdingAPI.Framework.ModHelpers
@@ -180,7 +180,6 @@ namespace StardewModdingAPI.Framework.ModHelpers
/// <param name="type">The type being accessed.</param>
private void AssertAccessAllowed(Type type)
{
-#if !SMAPI_1_x
// validate type namespace
if (type.Namespace != null)
{
@@ -188,7 +187,6 @@ namespace StardewModdingAPI.Framework.ModHelpers
if (type.Namespace == rootSmapiNamespace || type.Namespace.StartsWith(rootSmapiNamespace + "."))
throw new InvalidOperationException($"SMAPI blocked access by {this.ModName} to its internals through the reflection API. Accessing the SMAPI internals is strongly discouraged since they're subject to change, which means the mod can break without warning.");
}
-#endif
}
/// <summary>Assert that mods can use the reflection helper to access the given type.</summary>
diff --git a/src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs b/src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs
index 6b19db5c..87b6a99c 100644
--- a/src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs
+++ b/src/StardewModdingAPI/Framework/ModLoading/ModResolver.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
@@ -109,17 +109,6 @@ namespace StardewModdingAPI.Framework.ModLoading
ModCompatibility compatibility = mod.Compatibility;
if (compatibility?.Compatibility == ModCompatibilityType.AssumeBroken)
{
-#if SMAPI_1_x
- bool hasOfficialUrl = mod.Compatibility.UpdateUrls.Length > 0;
- bool hasUnofficialUrl = mod.Compatibility.UpdateUrls.Length > 1;
-
- string reasonPhrase = compatibility.ReasonPhrase ?? "it's not compatible with the latest version of the game or SMAPI";
- string error = $"{reasonPhrase}. Please check for a version newer than {compatibility.UpperVersionLabel ?? compatibility.UpperVersion.ToString()} here:";
- if (hasOfficialUrl)
- error += !hasUnofficialUrl ? $" {compatibility.UpdateUrls[0]}" : $"{Environment.NewLine}- official mod: {compatibility.UpdateUrls[0]}";
- if (hasUnofficialUrl)
- error += $"{Environment.NewLine}- unofficial update: {compatibility.UpdateUrls[1]}";
-#else
string reasonPhrase = compatibility.ReasonPhrase ?? "it's no longer compatible";
string error = $"{reasonPhrase}. Please check for a ";
if (mod.Manifest.Version.Equals(compatibility.UpperVersion) && compatibility.UpperVersionLabel == null)
@@ -127,7 +116,6 @@ namespace StardewModdingAPI.Framework.ModLoading
else
error += $"version newer than {compatibility.UpperVersionLabel ?? compatibility.UpperVersion.ToString()}";
error += " at " + string.Join(" or ", compatibility.UpdateUrls);
-#endif
mod.SetStatus(ModMetadataStatus.Failed, error);
continue;
@@ -150,7 +138,6 @@ namespace StardewModdingAPI.Framework.ModLoading
}
// validate required fields
-#if !SMAPI_1_x
{
List<string> missingFields = new List<string>(3);
@@ -164,11 +151,9 @@ namespace StardewModdingAPI.Framework.ModLoading
if (missingFields.Any())
mod.SetStatus(ModMetadataStatus.Failed, $"its manifest is missing required fields ({string.Join(", ", missingFields)}).");
}
-#endif
}
// validate IDs are unique
-#if !SMAPI_1_x
{
var duplicatesByID = mods
.GroupBy(mod => mod.Manifest?.UniqueID?.Trim(), mod => mod, StringComparer.InvariantCultureIgnoreCase)
@@ -183,7 +168,6 @@ namespace StardewModdingAPI.Framework.ModLoading
}
}
}
-#endif
}
/// <summary>Sort the given mods by the order they should be loaded.</summary>
@@ -264,12 +248,7 @@ namespace StardewModdingAPI.Framework.ModLoading
ID = entry.UniqueID,
MinVersion = entry.MinimumVersion,
Mod = dependencyMod,
- IsRequired =
-#if SMAPI_1_x
- true
-#else
- entry.IsRequired
-#endif
+ IsRequired = entry.IsRequired
}
)
.ToArray();
diff --git a/src/StardewModdingAPI/Framework/ModRegistry.cs b/src/StardewModdingAPI/Framework/ModRegistry.cs
index 8f30d813..9dde7a20 100644
--- a/src/StardewModdingAPI/Framework/ModRegistry.cs
+++ b/src/StardewModdingAPI/Framework/ModRegistry.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
@@ -42,11 +42,7 @@ namespace StardewModdingAPI.Framework
uniqueID = uniqueID.Trim();
// find match
- return this.GetAll().FirstOrDefault(p =>
-#if SMAPI_1_x
- p.UniqueID != null &&
-#endif
- p.UniqueID.Trim().Equals(uniqueID, StringComparison.InvariantCultureIgnoreCase));
+ return this.GetAll().FirstOrDefault(p => p.UniqueID.Trim().Equals(uniqueID, StringComparison.InvariantCultureIgnoreCase));
}
/// <summary>Get whether a mod has been loaded.</summary>
diff --git a/src/StardewModdingAPI/Framework/Models/Manifest.cs b/src/StardewModdingAPI/Framework/Models/Manifest.cs
index f97cb8ff..2e9566bf 100644
--- a/src/StardewModdingAPI/Framework/Models/Manifest.cs
+++ b/src/StardewModdingAPI/Framework/Models/Manifest.cs
@@ -1,4 +1,3 @@
-using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using StardewModdingAPI.Framework.Serialisation;
@@ -35,23 +34,15 @@ namespace StardewModdingAPI.Framework.Models
[JsonConverter(typeof(SFieldConverter))]
public IManifestDependency[] Dependencies { get; set; }
-#if !SMAPI_1_x
/// <summary>The mod's unique ID in Nexus Mods (if any), used for update checks.</summary>
public string NexusID { get; set; }
/// <summary>The mod's organisation and project name on GitHub (if any), used for update checks.</summary>
public string GitHubProject { get; set; }
-#endif
/// <summary>The unique mod ID.</summary>
public string UniqueID { get; set; }
-#if SMAPI_1_x
- /// <summary>Whether the mod uses per-save config files.</summary>
- [Obsolete("Use " + nameof(Mod) + "." + nameof(Mod.Helper) + "." + nameof(IModHelper.ReadConfig) + " instead")]
- public bool PerSaveConfigs { get; set; }
-#endif
-
/// <summary>Any manifest fields which didn't match a valid field.</summary>
[JsonExtensionData]
public IDictionary<string, object> ExtraFields { get; set; }
diff --git a/src/StardewModdingAPI/Framework/Models/ManifestDependency.cs b/src/StardewModdingAPI/Framework/Models/ManifestDependency.cs
index 67f906e3..5646b335 100644
--- a/src/StardewModdingAPI/Framework/Models/ManifestDependency.cs
+++ b/src/StardewModdingAPI/Framework/Models/ManifestDependency.cs
@@ -1,4 +1,4 @@
-namespace StardewModdingAPI.Framework.Models
+namespace StardewModdingAPI.Framework.Models
{
/// <summary>A mod dependency listed in a mod manifest.</summary>
internal class ManifestDependency : IManifestDependency
@@ -12,10 +12,8 @@
/// <summary>The minimum required version (if any).</summary>
public ISemanticVersion MinimumVersion { get; set; }
-#if !SMAPI_1_x
/// <summary>Whether the dependency must be installed to use the mod.</summary>
public bool IsRequired { get; set; }
-#endif
/*********
** Public methods
@@ -24,19 +22,13 @@
/// <param name="uniqueID">The unique mod ID to require.</param>
/// <param name="minimumVersion">The minimum required version (if any).</param>
/// <param name="required">Whether the dependency must be installed to use the mod.</param>
- public ManifestDependency(string uniqueID, string minimumVersion
-#if !SMAPI_1_x
- , bool required = true
-#endif
- )
+ public ManifestDependency(string uniqueID, string minimumVersion, bool required = true)
{
this.UniqueID = uniqueID;
this.MinimumVersion = !string.IsNullOrWhiteSpace(minimumVersion)
? new SemanticVersion(minimumVersion)
: null;
-#if !SMAPI_1_x
this.IsRequired = required;
-#endif
}
}
}
diff --git a/src/StardewModdingAPI/Framework/Monitor.cs b/src/StardewModdingAPI/Framework/Monitor.cs
index c2c3a689..bf338386 100644
--- a/src/StardewModdingAPI/Framework/Monitor.cs
+++ b/src/StardewModdingAPI/Framework/Monitor.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
@@ -37,10 +37,8 @@ namespace StardewModdingAPI.Framework
/// <summary>Whether SMAPI is aborting. Mods don't need to worry about this unless they have background tasks.</summary>
public bool IsExiting => this.ExitTokenSource.IsCancellationRequested;
-#if !SMAPI_1_x
/// <summary>Whether to show the full log stamps (with time/level/logger) in the console. If false, shows a simplified stamp with only the logger.</summary>
internal bool ShowFullStampInConsole { get; set; }
-#endif
/// <summary>Whether to show trace messages in the console.</summary>
internal bool ShowTraceInConsole { get; set; }
@@ -89,7 +87,6 @@ namespace StardewModdingAPI.Framework
this.ExitTokenSource.Cancel();
}
-#if !SMAPI_1_x
/// <summary>Write a newline to the console and log file.</summary>
internal void Newline()
{
@@ -98,20 +95,6 @@ namespace StardewModdingAPI.Framework
if (this.WriteToFile)
this.LogFile.WriteLine("");
}
-#endif
-
-#if SMAPI_1_x
- /// <summary>Log a message for the player or developer, using the specified console color.</summary>
- /// <param name="source">The name of the mod logging the message.</param>
- /// <param name="message">The message to log.</param>
- /// <param name="color">The console color.</param>
- /// <param name="level">The log level.</param>
- [Obsolete("This method is provided for backwards compatibility and otherwise should not be used. Use " + nameof(Monitor) + "." + nameof(Monitor.Log) + " instead.")]
- internal void LegacyLog(string source, string message, ConsoleColor color, LogLevel level = LogLevel.Debug)
- {
- this.LogImpl(source, message, level, color);
- }
-#endif
/*********
@@ -136,11 +119,7 @@ namespace StardewModdingAPI.Framework
string levelStr = level.ToString().ToUpper().PadRight(Monitor.MaxLevelLength);
string fullMessage = $"[{DateTime.Now:HH:mm:ss} {levelStr} {source}] {message}";
-#if !SMAPI_1_x
string consoleMessage = this.ShowFullStampInConsole ? fullMessage : $"[{source}] {message}";
-#else
- string consoleMessage = fullMessage;
-#endif
// write to console
if (this.WriteToConsole && (this.ShowTraceInConsole || level != LogLevel.Trace))
@@ -168,11 +147,9 @@ namespace StardewModdingAPI.Framework
/// <summary>Get the color scheme to use for the current console.</summary>
private static IDictionary<LogLevel, ConsoleColor> GetConsoleColorScheme()
{
-#if !SMAPI_1_x
// scheme for dark console background
if (Monitor.IsDark(Console.BackgroundColor))
{
-#endif
return new Dictionary<LogLevel, ConsoleColor>
{
[LogLevel.Trace] = ConsoleColor.DarkGray,
@@ -182,7 +159,6 @@ namespace StardewModdingAPI.Framework
[LogLevel.Error] = ConsoleColor.Red,
[LogLevel.Alert] = ConsoleColor.Magenta
};
-#if !SMAPI_1_x
}
// scheme for light console background
@@ -195,7 +171,6 @@ namespace StardewModdingAPI.Framework
[LogLevel.Error] = ConsoleColor.Red,
[LogLevel.Alert] = ConsoleColor.DarkMagenta
};
-#endif
}
/// <summary>Get whether a console color should be considered dark, which is subjectively defined as 'white looks better than black on this text'.</summary>
diff --git a/src/StardewModdingAPI/Framework/SGame.cs b/src/StardewModdingAPI/Framework/SGame.cs
index 387aeacc..7287cab7 100644
--- a/src/StardewModdingAPI/Framework/SGame.cs
+++ b/src/StardewModdingAPI/Framework/SGame.cs
@@ -20,9 +20,6 @@ using StardewValley.Menus;
using StardewValley.Tools;
using xTile.Dimensions;
using xTile.Layers;
-#if SMAPI_1_x
-using SFarmer = StardewValley.Farmer;
-#endif
namespace StardewModdingAPI.Framework
{
@@ -117,23 +114,6 @@ namespace StardewModdingAPI.Framework
/// <summary>The time of day (in 24-hour military format) at last check.</summary>
private int PreviousTime;
-#if SMAPI_1_x
- /// <summary>The day of month (1–28) at last check.</summary>
- private int PreviousDay;
-
- /// <summary>The season name (winter, spring, summer, or fall) at last check.</summary>
- private string PreviousSeason;
-
- /// <summary>The year number at last check.</summary>
- private int PreviousYear;
-
- /// <summary>Whether the game was transitioning to a new day at last check.</summary>
- private bool PreviousIsNewDay;
-
- /// <summary>The player character at last check.</summary>
- private SFarmer PreviousFarmer;
-#endif
-
/// <summary>The previous content locale.</summary>
private LocalizedContentManager.LanguageCode? PreviousLocale;
@@ -164,10 +144,10 @@ namespace StardewModdingAPI.Framework
private Color bgColor => SGame.Reflection.GetPrivateField<Color>(this, nameof(bgColor)).GetValue();
public RenderTarget2D screenWrapper => SGame.Reflection.GetPrivateProperty<RenderTarget2D>(this, "screen").GetValue(); // deliberately renamed to avoid an infinite loop
public BlendState lightingBlend => SGame.Reflection.GetPrivateField<BlendState>(this, nameof(lightingBlend)).GetValue();
- private readonly Action drawFarmBuildings = () => SGame.Reflection.GetPrivateMethod(SGame.Instance, nameof(drawFarmBuildings)).Invoke(new object[0]);
- private readonly Action drawHUD = () => SGame.Reflection.GetPrivateMethod(SGame.Instance, nameof(drawHUD)).Invoke(new object[0]);
- private readonly Action drawDialogueBox = () => SGame.Reflection.GetPrivateMethod(SGame.Instance, nameof(drawDialogueBox)).Invoke(new object[0]);
- private readonly Action renderScreenBuffer = () => SGame.Reflection.GetPrivateMethod(SGame.Instance, nameof(renderScreenBuffer)).Invoke(new object[0]);
+ private readonly Action drawFarmBuildings = () => SGame.Reflection.GetPrivateMethod(SGame.Instance, nameof(drawFarmBuildings)).Invoke();
+ private readonly Action drawHUD = () => SGame.Reflection.GetPrivateMethod(SGame.Instance, nameof(drawHUD)).Invoke();
+ private readonly Action drawDialogueBox = () => SGame.Reflection.GetPrivateMethod(SGame.Instance, nameof(drawDialogueBox)).Invoke();
+ private readonly Action renderScreenBuffer = () => SGame.Reflection.GetPrivateMethod(SGame.Instance, nameof(renderScreenBuffer)).Invoke();
// ReSharper restore ArrangeStaticMemberQualifier, ArrangeThisQualifier, InconsistentNaming
@@ -295,10 +275,6 @@ namespace StardewModdingAPI.Framework
if (this.FirstUpdate)
{
GameEvents.InvokeInitialize(this.Monitor);
-#if SMAPI_1_x
- GameEvents.InvokeLoadContent(this.Monitor);
- GameEvents.InvokeGameLoaded(this.Monitor);
-#endif
}
/*********
@@ -321,10 +297,8 @@ namespace StardewModdingAPI.Framework
*********/
if (Context.IsSaveLoaded && !SaveGame.IsProcessing /*still loading save*/ && this.AfterLoadTimer >= 0)
{
-#if !SMAPI_1_x
if (Game1.dayOfMonth != 0) // wait until new-game intro finishes (world not fully initialised yet)
-#endif
- this.AfterLoadTimer--;
+ this.AfterLoadTimer--;
if (this.AfterLoadTimer == 0)
{
@@ -332,9 +306,6 @@ namespace StardewModdingAPI.Framework
Context.IsWorldReady = true;
SaveEvents.InvokeAfterLoad(this.Monitor);
-#if SMAPI_1_x
- PlayerEvents.InvokeLoadedGame(this.Monitor, new EventArgsLoadedGameChanged(Game1.hasLoadedGame));
-#endif
TimeEvents.InvokeAfterDayStarted(this.Monitor);
}
}
@@ -403,7 +374,6 @@ namespace StardewModdingAPI.Framework
bool isClick = framePressedKeys.Contains(SButton.MouseLeft) || (framePressedKeys.Contains(SButton.ControllerA) && !currentlyPressedKeys.Contains(SButton.ControllerX));
// get cursor position
-#if !SMAPI_1_x
ICursorPosition cursor;
{
// cursor position
@@ -414,14 +384,11 @@ namespace StardewModdingAPI.Framework
: Game1.player.GetGrabTile();
cursor = new CursorPosition(screenPixels, tile, grabTile);
}
-#endif
// raise button pressed
foreach (SButton button in framePressedKeys)
{
-#if !SMAPI_1_x
InputEvents.InvokeButtonPressed(this.Monitor, button, cursor, isClick);
-#endif
// legacy events
if (button.TryGetKeyboard(out Keys key))
@@ -441,12 +408,10 @@ namespace StardewModdingAPI.Framework
// raise button released
foreach (SButton button in frameReleasedKeys)
{
-#if !SMAPI_1_x
bool wasClick =
(button == SButton.MouseLeft && previousPressedKeys.Contains(SButton.MouseLeft)) // released left click
|| (button == SButton.ControllerA && previousPressedKeys.Contains(SButton.ControllerA) && !previousPressedKeys.Contains(SButton.ControllerX));
InputEvents.InvokeButtonReleased(this.Monitor, button, cursor, wasClick);
-#endif
// legacy events
if (button.TryGetKeyboard(out Keys key))
@@ -524,12 +489,6 @@ namespace StardewModdingAPI.Framework
if (this.GetHash(Game1.locations) != this.PreviousGameLocations)
LocationEvents.InvokeLocationsChanged(this.Monitor, Game1.locations);
-#if SMAPI_1_x
- // raise player changed
- if (Game1.player != this.PreviousFarmer)
- PlayerEvents.InvokeFarmerChanged(this.Monitor, this.PreviousFarmer, Game1.player);
-#endif
-
// raise events that shouldn't be triggered on initial load
if (Game1.uniqueIDForThisGame == this.PreviousSaveID)
{
@@ -559,14 +518,6 @@ namespace StardewModdingAPI.Framework
// raise time changed
if (Game1.timeOfDay != this.PreviousTime)
TimeEvents.InvokeTimeOfDayChanged(this.Monitor, this.PreviousTime, Game1.timeOfDay);
-#if SMAPI_1_x
- if (Game1.dayOfMonth != this.PreviousDay)
- TimeEvents.InvokeDayOfMonthChanged(this.Monitor, this.PreviousDay, Game1.dayOfMonth);
- if (Game1.currentSeason != this.PreviousSeason)
- TimeEvents.InvokeSeasonOfYearChanged(this.Monitor, this.PreviousSeason, Game1.currentSeason);
- if (Game1.year != this.PreviousYear)
- TimeEvents.InvokeYearOfGameChanged(this.Monitor, this.PreviousYear, Game1.year);
-#endif
// raise mine level changed
if (Game1.mine != null && Game1.mine.mineLevel != this.PreviousMineLevel)
@@ -587,26 +538,9 @@ namespace StardewModdingAPI.Framework
this.PreviousTime = Game1.timeOfDay;
this.PreviousMineLevel = Game1.mine?.mineLevel ?? 0;
this.PreviousSaveID = Game1.uniqueIDForThisGame;
-#if SMAPI_1_x
- this.PreviousFarmer = Game1.player;
- this.PreviousDay = Game1.dayOfMonth;
- this.PreviousSeason = Game1.currentSeason;
- this.PreviousYear = Game1.year;
-#endif
}
/*********
- ** Game day transition event (obsolete)
- *********/
-#if SMAPI_1_x
- if (Game1.newDay != this.PreviousIsNewDay)
- {
- TimeEvents.InvokeOnNewDay(this.Monitor, this.PreviousDay, Game1.dayOfMonth, Game1.newDay);
- this.PreviousIsNewDay = Game1.newDay;
- }
-#endif
-
- /*********
** Game update
*********/
try
@@ -623,12 +557,7 @@ namespace StardewModdingAPI.Framework
*********/
GameEvents.InvokeUpdateTick(this.Monitor);
if (this.FirstUpdate)
- {
-#if SMAPI_1_x
- GameEvents.InvokeFirstUpdateTick(this.Monitor);
-#endif
this.FirstUpdate = false;
- }
if (this.CurrentUpdateTick % 2 == 0)
GameEvents.InvokeSecondUpdateTick(this.Monitor);
if (this.CurrentUpdateTick % 4 == 0)
diff --git a/src/StardewModdingAPI/Framework/Serialisation/SFieldConverter.cs b/src/StardewModdingAPI/Framework/Serialisation/SFieldConverter.cs
index 11ffdccb..5419896f 100644
--- a/src/StardewModdingAPI/Framework/Serialisation/SFieldConverter.cs
+++ b/src/StardewModdingAPI/Framework/Serialisation/SFieldConverter.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
@@ -76,12 +76,8 @@ namespace StardewModdingAPI.Framework.Serialisation
{
string uniqueID = obj.Value<string>(nameof(IManifestDependency.UniqueID));
string minVersion = obj.Value<string>(nameof(IManifestDependency.MinimumVersion));
-#if SMAPI_1_x
- result.Add(new ManifestDependency(uniqueID, minVersion));
-#else
bool required = obj.Value<bool?>(nameof(IManifestDependency.IsRequired)) ?? true;
result.Add(new ManifestDependency(uniqueID, minVersion, required));
-#endif
}
return result.ToArray();
}
diff --git a/src/StardewModdingAPI/Framework/Utilities/ContextHash.cs b/src/StardewModdingAPI/Framework/Utilities/ContextHash.cs
index 0d8487bb..6c0fdc90 100644
--- a/src/StardewModdingAPI/Framework/Utilities/ContextHash.cs
+++ b/src/StardewModdingAPI/Framework/Utilities/ContextHash.cs
@@ -1,5 +1,4 @@
using System;
-using System.Collections;
using System.Collections.Generic;
namespace StardewModdingAPI.Framework.Utilities
@@ -25,7 +24,7 @@ namespace StardewModdingAPI.Framework.Utilities
/// <exception cref="InvalidOperationException">The specified key is already added.</exception>
public void Track(T key, Action action)
{
- if(this.Contains(key))
+ if (this.Contains(key))
throw new InvalidOperationException($"Can't track context for key {key} because it's already added.");
this.Add(key);