From 2e7c233f6c9bf6430672b39f970a3324deba79dd Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 6 Apr 2022 21:48:55 -0400 Subject: enable nullable annotations by default (#837) This adds `#nullable disable` to all existing code (except where null is impossible like enum files), so it can be migrated incrementally. --- src/SMAPI/Framework/ModHelpers/TranslationHelper.cs | 2 ++ 1 file changed, 2 insertions(+) (limited to 'src/SMAPI/Framework/ModHelpers/TranslationHelper.cs') diff --git a/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs b/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs index 869664fe..37345a76 100644 --- a/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using StardewValley; -- cgit From 6e9e8aef1ef97e1a4ef4410ce300cb1c47eca986 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 13 Apr 2022 19:00:24 -0400 Subject: enable nullable annotations in SMAPI where no changes are needed (#837) --- src/SMAPI/Context.cs | 2 -- src/SMAPI/Events/AssetReadyEventArgs.cs | 2 -- src/SMAPI/Events/AssetsInvalidatedEventArgs.cs | 2 -- src/SMAPI/Events/BuildingListChangedEventArgs.cs | 2 -- src/SMAPI/Events/ButtonPressedEventArgs.cs | 2 -- src/SMAPI/Events/ButtonReleasedEventArgs.cs | 2 -- src/SMAPI/Events/ButtonsChangedEventArgs.cs | 2 -- src/SMAPI/Events/ChestInventoryChangedEventArgs.cs | 2 -- src/SMAPI/Events/CursorMovedEventArgs.cs | 2 -- src/SMAPI/Events/DebrisListChangedEventArgs.cs | 2 -- src/SMAPI/Events/FurnitureListChangedEventArgs.cs | 2 -- src/SMAPI/Events/IContentEvents.cs | 2 -- src/SMAPI/Events/IDisplayEvents.cs | 2 -- src/SMAPI/Events/IGameLoopEvents.cs | 2 -- src/SMAPI/Events/IInputEvents.cs | 2 -- src/SMAPI/Events/IModEvents.cs | 2 -- src/SMAPI/Events/IMultiplayerEvents.cs | 2 -- src/SMAPI/Events/IPlayerEvents.cs | 2 -- src/SMAPI/Events/ISpecialisedEvents.cs | 2 -- src/SMAPI/Events/IWorldEvents.cs | 2 -- src/SMAPI/Events/InventoryChangedEventArgs.cs | 2 -- src/SMAPI/Events/ItemStackSizeChange.cs | 2 -- src/SMAPI/Events/LargeTerrainFeatureListChangedEventArgs.cs | 2 -- src/SMAPI/Events/LevelChangedEventArgs.cs | 2 -- src/SMAPI/Events/LocaleChangedEventArgs.cs | 2 -- src/SMAPI/Events/LocationListChangedEventArgs.cs | 2 -- src/SMAPI/Events/NpcListChangedEventArgs.cs | 2 -- src/SMAPI/Events/ObjectListChangedEventArgs.cs | 2 -- src/SMAPI/Events/PeerConnectedEventArgs.cs | 2 -- src/SMAPI/Events/PeerContextReceivedEventArgs.cs | 2 -- src/SMAPI/Events/PeerDisconnectedEventArgs.cs | 2 -- src/SMAPI/Events/RenderedActiveMenuEventArgs.cs | 2 -- src/SMAPI/Events/RenderedEventArgs.cs | 2 -- src/SMAPI/Events/RenderedHudEventArgs.cs | 2 -- src/SMAPI/Events/RenderedWorldEventArgs.cs | 2 -- src/SMAPI/Events/RenderingActiveMenuEventArgs.cs | 2 -- src/SMAPI/Events/RenderingEventArgs.cs | 2 -- src/SMAPI/Events/RenderingHudEventArgs.cs | 2 -- src/SMAPI/Events/RenderingWorldEventArgs.cs | 2 -- src/SMAPI/Events/TerrainFeatureListChangedEventArgs.cs | 2 -- src/SMAPI/Events/WarpedEventArgs.cs | 2 -- src/SMAPI/Framework/Commands/IInternalCommand.cs | 2 -- src/SMAPI/Framework/Commands/ReloadI18nCommand.cs | 2 -- src/SMAPI/Framework/Content/AssetOperationGroup.cs | 2 -- src/SMAPI/Framework/Content/TilesheetReference.cs | 2 -- src/SMAPI/Framework/DeprecationWarning.cs | 2 -- src/SMAPI/Framework/Events/EventManager.cs | 2 -- src/SMAPI/Framework/Events/IManagedEvent.cs | 2 -- src/SMAPI/Framework/Events/ModContentEvents.cs | 2 -- src/SMAPI/Framework/Events/ModDisplayEvents.cs | 2 -- src/SMAPI/Framework/Events/ModEvents.cs | 2 -- src/SMAPI/Framework/Events/ModEventsBase.cs | 2 -- src/SMAPI/Framework/Events/ModGameLoopEvents.cs | 2 -- src/SMAPI/Framework/Events/ModInputEvents.cs | 2 -- src/SMAPI/Framework/Events/ModMultiplayerEvents.cs | 2 -- src/SMAPI/Framework/Events/ModPlayerEvents.cs | 2 -- src/SMAPI/Framework/Events/ModSpecialisedEvents.cs | 2 -- src/SMAPI/Framework/Events/ModWorldEvents.cs | 2 -- src/SMAPI/Framework/Exceptions/SAssemblyLoadFailedException.cs | 2 -- src/SMAPI/Framework/Input/IInputStateBuilder.cs | 2 -- src/SMAPI/Framework/Input/KeyboardStateBuilder.cs | 4 +--- src/SMAPI/Framework/Input/MouseStateBuilder.cs | 2 -- src/SMAPI/Framework/ModHelpers/BaseHelper.cs | 2 -- src/SMAPI/Framework/ModHelpers/ContentPackHelper.cs | 2 -- src/SMAPI/Framework/ModHelpers/InputHelper.cs | 2 -- src/SMAPI/Framework/ModHelpers/ModHelper.cs | 2 -- src/SMAPI/Framework/ModHelpers/TranslationHelper.cs | 2 -- src/SMAPI/Framework/ModLinked.cs | 2 -- src/SMAPI/Framework/ModLoading/AssemblyLoadStatus.cs | 2 -- src/SMAPI/Framework/ModLoading/IInstructionHandler.cs | 2 -- src/SMAPI/Framework/ModLoading/IncompatibleInstructionException.cs | 2 -- src/SMAPI/Framework/ModLoading/PlatformAssemblyMap.cs | 2 -- src/SMAPI/Framework/ModLoading/RewriteFacades/SpriteBatchFacade.cs | 5 ++--- .../Framework/ModLoading/Rewriters/ArchitectureAssemblyRewriter.cs | 2 -- src/SMAPI/Framework/ModLoading/Symbols/SymbolReader.cs | 2 -- src/SMAPI/Framework/ModLoading/Symbols/SymbolWriterProvider.cs | 2 -- src/SMAPI/Framework/Monitor.cs | 2 -- src/SMAPI/Framework/Networking/SGalaxyNetClient.cs | 2 -- src/SMAPI/Framework/Networking/SGalaxyNetServer.cs | 2 -- src/SMAPI/Framework/Networking/SLidgrenClient.cs | 2 -- src/SMAPI/Framework/Networking/SLidgrenServer.cs | 2 -- src/SMAPI/Framework/Reflection/InterfaceProxyFactory.cs | 2 -- src/SMAPI/Framework/SChatBox.cs | 2 -- src/SMAPI/Framework/SGameRunner.cs | 4 +--- src/SMAPI/Framework/Singleton.cs | 2 -- .../Framework/StateTracking/FieldWatchers/BaseDisposableWatcher.cs | 2 -- .../Framework/StateTracking/FieldWatchers/ComparableListWatcher.cs | 2 -- .../StateTracking/FieldWatchers/ImmutableCollectionWatcher.cs | 2 -- .../Framework/StateTracking/FieldWatchers/NetCollectionWatcher.cs | 2 -- src/SMAPI/Framework/StateTracking/FieldWatchers/NetListWatcher.cs | 2 -- src/SMAPI/Framework/StateTracking/FieldWatchers/NetValueWatcher.cs | 2 -- src/SMAPI/Framework/StateTracking/ICollectionWatcher.cs | 2 -- src/SMAPI/Framework/StateTracking/IDictionaryWatcher.cs | 2 -- src/SMAPI/Framework/StateTracking/IValueWatcher.cs | 2 -- src/SMAPI/Framework/StateTracking/IWatcher.cs | 2 -- src/SMAPI/Framework/Utilities/ContextHash.cs | 2 -- src/SMAPI/GamePlatform.cs | 2 -- src/SMAPI/IAssetDataForDictionary.cs | 2 -- src/SMAPI/IAssetDataForImage.cs | 2 -- src/SMAPI/IAssetDataForMap.cs | 2 -- src/SMAPI/IAssetEditor.cs | 2 -- src/SMAPI/IAssetLoader.cs | 2 -- src/SMAPI/ICommandHelper.cs | 2 -- src/SMAPI/IContentPackHelper.cs | 2 -- src/SMAPI/ICursorPosition.cs | 2 -- src/SMAPI/IInputHelper.cs | 2 -- src/SMAPI/IModHelper.cs | 2 -- src/SMAPI/IModInfo.cs | 2 -- src/SMAPI/IModLinked.cs | 2 -- src/SMAPI/IMonitor.cs | 2 -- src/SMAPI/IMultiplayerPeerMod.cs | 2 -- src/SMAPI/ITranslationHelper.cs | 4 +--- 112 files changed, 5 insertions(+), 228 deletions(-) (limited to 'src/SMAPI/Framework/ModHelpers/TranslationHelper.cs') diff --git a/src/SMAPI/Context.cs b/src/SMAPI/Context.cs index e906375b..aa4ecf35 100644 --- a/src/SMAPI/Context.cs +++ b/src/SMAPI/Context.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Collections.Generic; using StardewModdingAPI.Enums; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Events/AssetReadyEventArgs.cs b/src/SMAPI/Events/AssetReadyEventArgs.cs index 19e5a9df..2c308f18 100644 --- a/src/SMAPI/Events/AssetReadyEventArgs.cs +++ b/src/SMAPI/Events/AssetReadyEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/AssetsInvalidatedEventArgs.cs b/src/SMAPI/Events/AssetsInvalidatedEventArgs.cs index bd0df598..614cdf49 100644 --- a/src/SMAPI/Events/AssetsInvalidatedEventArgs.cs +++ b/src/SMAPI/Events/AssetsInvalidatedEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Collections.Immutable; diff --git a/src/SMAPI/Events/BuildingListChangedEventArgs.cs b/src/SMAPI/Events/BuildingListChangedEventArgs.cs index ba9574cc..74f37710 100644 --- a/src/SMAPI/Events/BuildingListChangedEventArgs.cs +++ b/src/SMAPI/Events/BuildingListChangedEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Events/ButtonPressedEventArgs.cs b/src/SMAPI/Events/ButtonPressedEventArgs.cs index 94684513..1b30fd23 100644 --- a/src/SMAPI/Events/ButtonPressedEventArgs.cs +++ b/src/SMAPI/Events/ButtonPressedEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using StardewModdingAPI.Framework.Input; diff --git a/src/SMAPI/Events/ButtonReleasedEventArgs.cs b/src/SMAPI/Events/ButtonReleasedEventArgs.cs index 6ff3727d..40ec1cc1 100644 --- a/src/SMAPI/Events/ButtonReleasedEventArgs.cs +++ b/src/SMAPI/Events/ButtonReleasedEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using StardewModdingAPI.Framework.Input; diff --git a/src/SMAPI/Events/ButtonsChangedEventArgs.cs b/src/SMAPI/Events/ButtonsChangedEventArgs.cs index c63d34e6..a5e87735 100644 --- a/src/SMAPI/Events/ButtonsChangedEventArgs.cs +++ b/src/SMAPI/Events/ButtonsChangedEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Events/ChestInventoryChangedEventArgs.cs b/src/SMAPI/Events/ChestInventoryChangedEventArgs.cs index bc8ac0c0..4b4c4210 100644 --- a/src/SMAPI/Events/ChestInventoryChangedEventArgs.cs +++ b/src/SMAPI/Events/ChestInventoryChangedEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using StardewValley; diff --git a/src/SMAPI/Events/CursorMovedEventArgs.cs b/src/SMAPI/Events/CursorMovedEventArgs.cs index f3e7513b..43ff90ce 100644 --- a/src/SMAPI/Events/CursorMovedEventArgs.cs +++ b/src/SMAPI/Events/CursorMovedEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/DebrisListChangedEventArgs.cs b/src/SMAPI/Events/DebrisListChangedEventArgs.cs index 56b1f30a..61b7590a 100644 --- a/src/SMAPI/Events/DebrisListChangedEventArgs.cs +++ b/src/SMAPI/Events/DebrisListChangedEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Events/FurnitureListChangedEventArgs.cs b/src/SMAPI/Events/FurnitureListChangedEventArgs.cs index cda1b6cc..683f4620 100644 --- a/src/SMAPI/Events/FurnitureListChangedEventArgs.cs +++ b/src/SMAPI/Events/FurnitureListChangedEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Events/IContentEvents.cs b/src/SMAPI/Events/IContentEvents.cs index 109f9753..d537db70 100644 --- a/src/SMAPI/Events/IContentEvents.cs +++ b/src/SMAPI/Events/IContentEvents.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/IDisplayEvents.cs b/src/SMAPI/Events/IDisplayEvents.cs index b8b89120..dbf8d90f 100644 --- a/src/SMAPI/Events/IDisplayEvents.cs +++ b/src/SMAPI/Events/IDisplayEvents.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using StardewValley; diff --git a/src/SMAPI/Events/IGameLoopEvents.cs b/src/SMAPI/Events/IGameLoopEvents.cs index 52bac3f8..6855737b 100644 --- a/src/SMAPI/Events/IGameLoopEvents.cs +++ b/src/SMAPI/Events/IGameLoopEvents.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/IInputEvents.cs b/src/SMAPI/Events/IInputEvents.cs index 01ceb224..081c40c0 100644 --- a/src/SMAPI/Events/IInputEvents.cs +++ b/src/SMAPI/Events/IInputEvents.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/IModEvents.cs b/src/SMAPI/Events/IModEvents.cs index a1aacbce..2603961b 100644 --- a/src/SMAPI/Events/IModEvents.cs +++ b/src/SMAPI/Events/IModEvents.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI.Events { /// Manages access to events raised by SMAPI. diff --git a/src/SMAPI/Events/IMultiplayerEvents.cs b/src/SMAPI/Events/IMultiplayerEvents.cs index c50eaf04..af9b5f17 100644 --- a/src/SMAPI/Events/IMultiplayerEvents.cs +++ b/src/SMAPI/Events/IMultiplayerEvents.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/IPlayerEvents.cs b/src/SMAPI/Events/IPlayerEvents.cs index 9d18bfad..81e17b1a 100644 --- a/src/SMAPI/Events/IPlayerEvents.cs +++ b/src/SMAPI/Events/IPlayerEvents.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/ISpecialisedEvents.cs b/src/SMAPI/Events/ISpecialisedEvents.cs index 0ec5bf54..bf70956d 100644 --- a/src/SMAPI/Events/ISpecialisedEvents.cs +++ b/src/SMAPI/Events/ISpecialisedEvents.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/IWorldEvents.cs b/src/SMAPI/Events/IWorldEvents.cs index 785dfa8f..c023e1f0 100644 --- a/src/SMAPI/Events/IWorldEvents.cs +++ b/src/SMAPI/Events/IWorldEvents.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/InventoryChangedEventArgs.cs b/src/SMAPI/Events/InventoryChangedEventArgs.cs index 58c0ff8f..40cd4128 100644 --- a/src/SMAPI/Events/InventoryChangedEventArgs.cs +++ b/src/SMAPI/Events/InventoryChangedEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using StardewValley; diff --git a/src/SMAPI/Events/ItemStackSizeChange.cs b/src/SMAPI/Events/ItemStackSizeChange.cs index 5d0986aa..35369be2 100644 --- a/src/SMAPI/Events/ItemStackSizeChange.cs +++ b/src/SMAPI/Events/ItemStackSizeChange.cs @@ -1,5 +1,3 @@ -#nullable disable - using StardewValley; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/LargeTerrainFeatureListChangedEventArgs.cs b/src/SMAPI/Events/LargeTerrainFeatureListChangedEventArgs.cs index aedb0e46..59d79f0f 100644 --- a/src/SMAPI/Events/LargeTerrainFeatureListChangedEventArgs.cs +++ b/src/SMAPI/Events/LargeTerrainFeatureListChangedEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Events/LevelChangedEventArgs.cs b/src/SMAPI/Events/LevelChangedEventArgs.cs index 3beb9fd5..c7303603 100644 --- a/src/SMAPI/Events/LevelChangedEventArgs.cs +++ b/src/SMAPI/Events/LevelChangedEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using StardewModdingAPI.Enums; using StardewValley; diff --git a/src/SMAPI/Events/LocaleChangedEventArgs.cs b/src/SMAPI/Events/LocaleChangedEventArgs.cs index 015e7ec8..09d3f6e5 100644 --- a/src/SMAPI/Events/LocaleChangedEventArgs.cs +++ b/src/SMAPI/Events/LocaleChangedEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using LanguageCode = StardewValley.LocalizedContentManager.LanguageCode; diff --git a/src/SMAPI/Events/LocationListChangedEventArgs.cs b/src/SMAPI/Events/LocationListChangedEventArgs.cs index 055463dd..1ebb3e2d 100644 --- a/src/SMAPI/Events/LocationListChangedEventArgs.cs +++ b/src/SMAPI/Events/LocationListChangedEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Events/NpcListChangedEventArgs.cs b/src/SMAPI/Events/NpcListChangedEventArgs.cs index fb6dc1c5..3a37f1e7 100644 --- a/src/SMAPI/Events/NpcListChangedEventArgs.cs +++ b/src/SMAPI/Events/NpcListChangedEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Events/ObjectListChangedEventArgs.cs b/src/SMAPI/Events/ObjectListChangedEventArgs.cs index b1a636aa..b21d2867 100644 --- a/src/SMAPI/Events/ObjectListChangedEventArgs.cs +++ b/src/SMAPI/Events/ObjectListChangedEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Events/PeerConnectedEventArgs.cs b/src/SMAPI/Events/PeerConnectedEventArgs.cs index 3d11a3b5..bfaa2bd3 100644 --- a/src/SMAPI/Events/PeerConnectedEventArgs.cs +++ b/src/SMAPI/Events/PeerConnectedEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/PeerContextReceivedEventArgs.cs b/src/SMAPI/Events/PeerContextReceivedEventArgs.cs index 35a4b20d..151a295c 100644 --- a/src/SMAPI/Events/PeerContextReceivedEventArgs.cs +++ b/src/SMAPI/Events/PeerContextReceivedEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/PeerDisconnectedEventArgs.cs b/src/SMAPI/Events/PeerDisconnectedEventArgs.cs index 0675b8fe..8517988a 100644 --- a/src/SMAPI/Events/PeerDisconnectedEventArgs.cs +++ b/src/SMAPI/Events/PeerDisconnectedEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/RenderedActiveMenuEventArgs.cs b/src/SMAPI/Events/RenderedActiveMenuEventArgs.cs index 3da0b4b4..efd4163b 100644 --- a/src/SMAPI/Events/RenderedActiveMenuEventArgs.cs +++ b/src/SMAPI/Events/RenderedActiveMenuEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using Microsoft.Xna.Framework.Graphics; using StardewValley; diff --git a/src/SMAPI/Events/RenderedEventArgs.cs b/src/SMAPI/Events/RenderedEventArgs.cs index e8beaaac..d6341b19 100644 --- a/src/SMAPI/Events/RenderedEventArgs.cs +++ b/src/SMAPI/Events/RenderedEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using Microsoft.Xna.Framework.Graphics; using StardewValley; diff --git a/src/SMAPI/Events/RenderedHudEventArgs.cs b/src/SMAPI/Events/RenderedHudEventArgs.cs index b25ecd4c..46e89013 100644 --- a/src/SMAPI/Events/RenderedHudEventArgs.cs +++ b/src/SMAPI/Events/RenderedHudEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using Microsoft.Xna.Framework.Graphics; using StardewValley; diff --git a/src/SMAPI/Events/RenderedWorldEventArgs.cs b/src/SMAPI/Events/RenderedWorldEventArgs.cs index a99d6ab3..56145381 100644 --- a/src/SMAPI/Events/RenderedWorldEventArgs.cs +++ b/src/SMAPI/Events/RenderedWorldEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using Microsoft.Xna.Framework.Graphics; using StardewValley; diff --git a/src/SMAPI/Events/RenderingActiveMenuEventArgs.cs b/src/SMAPI/Events/RenderingActiveMenuEventArgs.cs index 3e3f3258..103f56df 100644 --- a/src/SMAPI/Events/RenderingActiveMenuEventArgs.cs +++ b/src/SMAPI/Events/RenderingActiveMenuEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using Microsoft.Xna.Framework.Graphics; using StardewValley; diff --git a/src/SMAPI/Events/RenderingEventArgs.cs b/src/SMAPI/Events/RenderingEventArgs.cs index 8f6b3557..5acbef09 100644 --- a/src/SMAPI/Events/RenderingEventArgs.cs +++ b/src/SMAPI/Events/RenderingEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using Microsoft.Xna.Framework.Graphics; using StardewValley; diff --git a/src/SMAPI/Events/RenderingHudEventArgs.cs b/src/SMAPI/Events/RenderingHudEventArgs.cs index 87269b90..84c96ecd 100644 --- a/src/SMAPI/Events/RenderingHudEventArgs.cs +++ b/src/SMAPI/Events/RenderingHudEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using Microsoft.Xna.Framework.Graphics; using StardewValley; diff --git a/src/SMAPI/Events/RenderingWorldEventArgs.cs b/src/SMAPI/Events/RenderingWorldEventArgs.cs index 2fc9964f..d0d44789 100644 --- a/src/SMAPI/Events/RenderingWorldEventArgs.cs +++ b/src/SMAPI/Events/RenderingWorldEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using Microsoft.Xna.Framework.Graphics; using StardewValley; diff --git a/src/SMAPI/Events/TerrainFeatureListChangedEventArgs.cs b/src/SMAPI/Events/TerrainFeatureListChangedEventArgs.cs index 77a73102..cdf1e6dc 100644 --- a/src/SMAPI/Events/TerrainFeatureListChangedEventArgs.cs +++ b/src/SMAPI/Events/TerrainFeatureListChangedEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Events/WarpedEventArgs.cs b/src/SMAPI/Events/WarpedEventArgs.cs index 92a8ea77..9afe4a4e 100644 --- a/src/SMAPI/Events/WarpedEventArgs.cs +++ b/src/SMAPI/Events/WarpedEventArgs.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using StardewValley; diff --git a/src/SMAPI/Framework/Commands/IInternalCommand.cs b/src/SMAPI/Framework/Commands/IInternalCommand.cs index 32e3e9f1..abf105b6 100644 --- a/src/SMAPI/Framework/Commands/IInternalCommand.cs +++ b/src/SMAPI/Framework/Commands/IInternalCommand.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI.Framework.Commands { /// A core SMAPI console command. diff --git a/src/SMAPI/Framework/Commands/ReloadI18nCommand.cs b/src/SMAPI/Framework/Commands/ReloadI18nCommand.cs index 2043b35e..12328bb6 100644 --- a/src/SMAPI/Framework/Commands/ReloadI18nCommand.cs +++ b/src/SMAPI/Framework/Commands/ReloadI18nCommand.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; namespace StardewModdingAPI.Framework.Commands diff --git a/src/SMAPI/Framework/Content/AssetOperationGroup.cs b/src/SMAPI/Framework/Content/AssetOperationGroup.cs index e3c3f92c..a2fcb722 100644 --- a/src/SMAPI/Framework/Content/AssetOperationGroup.cs +++ b/src/SMAPI/Framework/Content/AssetOperationGroup.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI.Framework.Content { /// A set of operations to apply to an asset for a given or implementation. diff --git a/src/SMAPI/Framework/Content/TilesheetReference.cs b/src/SMAPI/Framework/Content/TilesheetReference.cs index cdc4bc62..0339b802 100644 --- a/src/SMAPI/Framework/Content/TilesheetReference.cs +++ b/src/SMAPI/Framework/Content/TilesheetReference.cs @@ -1,5 +1,3 @@ -#nullable disable - using xTile.Dimensions; namespace StardewModdingAPI.Framework.Content diff --git a/src/SMAPI/Framework/DeprecationWarning.cs b/src/SMAPI/Framework/DeprecationWarning.cs index f155358b..5201b06c 100644 --- a/src/SMAPI/Framework/DeprecationWarning.cs +++ b/src/SMAPI/Framework/DeprecationWarning.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI.Framework { /// A deprecation warning for a mod. diff --git a/src/SMAPI/Framework/Events/EventManager.cs b/src/SMAPI/Framework/Events/EventManager.cs index c977e73d..41540047 100644 --- a/src/SMAPI/Framework/Events/EventManager.cs +++ b/src/SMAPI/Framework/Events/EventManager.cs @@ -1,5 +1,3 @@ -#nullable disable - using StardewModdingAPI.Events; namespace StardewModdingAPI.Framework.Events diff --git a/src/SMAPI/Framework/Events/IManagedEvent.cs b/src/SMAPI/Framework/Events/IManagedEvent.cs index 57277576..e4e3ca08 100644 --- a/src/SMAPI/Framework/Events/IManagedEvent.cs +++ b/src/SMAPI/Framework/Events/IManagedEvent.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI.Framework.Events { /// Metadata for an event raised by SMAPI. diff --git a/src/SMAPI/Framework/Events/ModContentEvents.cs b/src/SMAPI/Framework/Events/ModContentEvents.cs index f198b793..beb96031 100644 --- a/src/SMAPI/Framework/Events/ModContentEvents.cs +++ b/src/SMAPI/Framework/Events/ModContentEvents.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Framework/Events/ModDisplayEvents.cs b/src/SMAPI/Framework/Events/ModDisplayEvents.cs index b2110cce..48f55324 100644 --- a/src/SMAPI/Framework/Events/ModDisplayEvents.cs +++ b/src/SMAPI/Framework/Events/ModDisplayEvents.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Framework/Events/ModEvents.cs b/src/SMAPI/Framework/Events/ModEvents.cs index e8f8885d..1fb3482c 100644 --- a/src/SMAPI/Framework/Events/ModEvents.cs +++ b/src/SMAPI/Framework/Events/ModEvents.cs @@ -1,5 +1,3 @@ -#nullable disable - using StardewModdingAPI.Events; namespace StardewModdingAPI.Framework.Events diff --git a/src/SMAPI/Framework/Events/ModEventsBase.cs b/src/SMAPI/Framework/Events/ModEventsBase.cs index 295caa0d..77708fc1 100644 --- a/src/SMAPI/Framework/Events/ModEventsBase.cs +++ b/src/SMAPI/Framework/Events/ModEventsBase.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI.Framework.Events { /// An internal base class for event API classes. diff --git a/src/SMAPI/Framework/Events/ModGameLoopEvents.cs b/src/SMAPI/Framework/Events/ModGameLoopEvents.cs index 51803daf..5f0db369 100644 --- a/src/SMAPI/Framework/Events/ModGameLoopEvents.cs +++ b/src/SMAPI/Framework/Events/ModGameLoopEvents.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Framework/Events/ModInputEvents.cs b/src/SMAPI/Framework/Events/ModInputEvents.cs index 6af79c59..40edf806 100644 --- a/src/SMAPI/Framework/Events/ModInputEvents.cs +++ b/src/SMAPI/Framework/Events/ModInputEvents.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Framework/Events/ModMultiplayerEvents.cs b/src/SMAPI/Framework/Events/ModMultiplayerEvents.cs index 7d3ce510..b90f64fa 100644 --- a/src/SMAPI/Framework/Events/ModMultiplayerEvents.cs +++ b/src/SMAPI/Framework/Events/ModMultiplayerEvents.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Framework/Events/ModPlayerEvents.cs b/src/SMAPI/Framework/Events/ModPlayerEvents.cs index dac8f05b..b2d89e9a 100644 --- a/src/SMAPI/Framework/Events/ModPlayerEvents.cs +++ b/src/SMAPI/Framework/Events/ModPlayerEvents.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Framework/Events/ModSpecialisedEvents.cs b/src/SMAPI/Framework/Events/ModSpecialisedEvents.cs index 4b438034..7980208b 100644 --- a/src/SMAPI/Framework/Events/ModSpecialisedEvents.cs +++ b/src/SMAPI/Framework/Events/ModSpecialisedEvents.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Framework/Events/ModWorldEvents.cs b/src/SMAPI/Framework/Events/ModWorldEvents.cs index 614945c7..a7b7d799 100644 --- a/src/SMAPI/Framework/Events/ModWorldEvents.cs +++ b/src/SMAPI/Framework/Events/ModWorldEvents.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Framework/Exceptions/SAssemblyLoadFailedException.cs b/src/SMAPI/Framework/Exceptions/SAssemblyLoadFailedException.cs index 4e03a687..ec9279f1 100644 --- a/src/SMAPI/Framework/Exceptions/SAssemblyLoadFailedException.cs +++ b/src/SMAPI/Framework/Exceptions/SAssemblyLoadFailedException.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; namespace StardewModdingAPI.Framework.Exceptions diff --git a/src/SMAPI/Framework/Input/IInputStateBuilder.cs b/src/SMAPI/Framework/Input/IInputStateBuilder.cs index 3fb62686..28d62439 100644 --- a/src/SMAPI/Framework/Input/IInputStateBuilder.cs +++ b/src/SMAPI/Framework/Input/IInputStateBuilder.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Collections.Generic; namespace StardewModdingAPI.Framework.Input diff --git a/src/SMAPI/Framework/Input/KeyboardStateBuilder.cs b/src/SMAPI/Framework/Input/KeyboardStateBuilder.cs index 81ca0ebb..f66fbd07 100644 --- a/src/SMAPI/Framework/Input/KeyboardStateBuilder.cs +++ b/src/SMAPI/Framework/Input/KeyboardStateBuilder.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework.Input; @@ -29,7 +27,7 @@ namespace StardewModdingAPI.Framework.Input this.State = state; this.PressedButtons.Clear(); - foreach (var button in state.GetPressedKeys()) + foreach (Keys button in state.GetPressedKeys()) this.PressedButtons.Add(button); } diff --git a/src/SMAPI/Framework/Input/MouseStateBuilder.cs b/src/SMAPI/Framework/Input/MouseStateBuilder.cs index 85b38d32..c2a0891b 100644 --- a/src/SMAPI/Framework/Input/MouseStateBuilder.cs +++ b/src/SMAPI/Framework/Input/MouseStateBuilder.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Collections.Generic; using Microsoft.Xna.Framework.Input; diff --git a/src/SMAPI/Framework/ModHelpers/BaseHelper.cs b/src/SMAPI/Framework/ModHelpers/BaseHelper.cs index 1cd1a6b3..5a3d4bed 100644 --- a/src/SMAPI/Framework/ModHelpers/BaseHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/BaseHelper.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI.Framework.ModHelpers { /// The common base class for mod helpers. diff --git a/src/SMAPI/Framework/ModHelpers/ContentPackHelper.cs b/src/SMAPI/Framework/ModHelpers/ContentPackHelper.cs index 336214e2..d39abc7d 100644 --- a/src/SMAPI/Framework/ModHelpers/ContentPackHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/ContentPackHelper.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.IO; diff --git a/src/SMAPI/Framework/ModHelpers/InputHelper.cs b/src/SMAPI/Framework/ModHelpers/InputHelper.cs index 29f80d87..88caf4c3 100644 --- a/src/SMAPI/Framework/ModHelpers/InputHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/InputHelper.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using StardewModdingAPI.Framework.Input; using StardewModdingAPI.Utilities; diff --git a/src/SMAPI/Framework/ModHelpers/ModHelper.cs b/src/SMAPI/Framework/ModHelpers/ModHelper.cs index 3cfe52bf..e1529a75 100644 --- a/src/SMAPI/Framework/ModHelpers/ModHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/ModHelper.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.IO; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs b/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs index 37345a76..869664fe 100644 --- a/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Collections.Generic; using StardewValley; diff --git a/src/SMAPI/Framework/ModLinked.cs b/src/SMAPI/Framework/ModLinked.cs index 5a3e38ca..8cfe6f5f 100644 --- a/src/SMAPI/Framework/ModLinked.cs +++ b/src/SMAPI/Framework/ModLinked.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI.Framework { /// A generic tuple which links something to a mod. diff --git a/src/SMAPI/Framework/ModLoading/AssemblyLoadStatus.cs b/src/SMAPI/Framework/ModLoading/AssemblyLoadStatus.cs index d2d5d83b..11be19fc 100644 --- a/src/SMAPI/Framework/ModLoading/AssemblyLoadStatus.cs +++ b/src/SMAPI/Framework/ModLoading/AssemblyLoadStatus.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI.Framework.ModLoading { /// Indicates the result of an assembly load. diff --git a/src/SMAPI/Framework/ModLoading/IInstructionHandler.cs b/src/SMAPI/Framework/ModLoading/IInstructionHandler.cs index 126504e3..d41732f8 100644 --- a/src/SMAPI/Framework/ModLoading/IInstructionHandler.cs +++ b/src/SMAPI/Framework/ModLoading/IInstructionHandler.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using Mono.Cecil; diff --git a/src/SMAPI/Framework/ModLoading/IncompatibleInstructionException.cs b/src/SMAPI/Framework/ModLoading/IncompatibleInstructionException.cs index 29406f2a..1f9add30 100644 --- a/src/SMAPI/Framework/ModLoading/IncompatibleInstructionException.cs +++ b/src/SMAPI/Framework/ModLoading/IncompatibleInstructionException.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; namespace StardewModdingAPI.Framework.ModLoading diff --git a/src/SMAPI/Framework/ModLoading/PlatformAssemblyMap.cs b/src/SMAPI/Framework/ModLoading/PlatformAssemblyMap.cs index 0898f095..d4366294 100644 --- a/src/SMAPI/Framework/ModLoading/PlatformAssemblyMap.cs +++ b/src/SMAPI/Framework/ModLoading/PlatformAssemblyMap.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/ModLoading/RewriteFacades/SpriteBatchFacade.cs b/src/SMAPI/Framework/ModLoading/RewriteFacades/SpriteBatchFacade.cs index 20a30f8f..67569424 100644 --- a/src/SMAPI/Framework/ModLoading/RewriteFacades/SpriteBatchFacade.cs +++ b/src/SMAPI/Framework/ModLoading/RewriteFacades/SpriteBatchFacade.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Diagnostics.CodeAnalysis; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; @@ -20,7 +18,8 @@ namespace StardewModdingAPI.Framework.ModLoading.RewriteFacades ** Public methods *********/ /// Construct an instance. - public SpriteBatchFacade(GraphicsDevice graphicsDevice) : base(graphicsDevice) { } + public SpriteBatchFacade(GraphicsDevice graphicsDevice) + : base(graphicsDevice) { } /**** diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/ArchitectureAssemblyRewriter.cs b/src/SMAPI/Framework/ModLoading/Rewriters/ArchitectureAssemblyRewriter.cs index 4985d72a..cc830216 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/ArchitectureAssemblyRewriter.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/ArchitectureAssemblyRewriter.cs @@ -1,5 +1,3 @@ -#nullable disable - using Mono.Cecil; using StardewModdingAPI.Framework.ModLoading.Framework; diff --git a/src/SMAPI/Framework/ModLoading/Symbols/SymbolReader.cs b/src/SMAPI/Framework/ModLoading/Symbols/SymbolReader.cs index 55b7e0c8..2171895d 100644 --- a/src/SMAPI/Framework/ModLoading/Symbols/SymbolReader.cs +++ b/src/SMAPI/Framework/ModLoading/Symbols/SymbolReader.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.IO; using Mono.Cecil; using Mono.Cecil.Cil; diff --git a/src/SMAPI/Framework/ModLoading/Symbols/SymbolWriterProvider.cs b/src/SMAPI/Framework/ModLoading/Symbols/SymbolWriterProvider.cs index c2ac4cd6..8f7e05d1 100644 --- a/src/SMAPI/Framework/ModLoading/Symbols/SymbolWriterProvider.cs +++ b/src/SMAPI/Framework/ModLoading/Symbols/SymbolWriterProvider.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.IO; using Mono.Cecil; using Mono.Cecil.Cil; diff --git a/src/SMAPI/Framework/Monitor.cs b/src/SMAPI/Framework/Monitor.cs index de145d1d..6b53daff 100644 --- a/src/SMAPI/Framework/Monitor.cs +++ b/src/SMAPI/Framework/Monitor.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/Networking/SGalaxyNetClient.cs b/src/SMAPI/Framework/Networking/SGalaxyNetClient.cs index 8e19b4a7..01095c66 100644 --- a/src/SMAPI/Framework/Networking/SGalaxyNetClient.cs +++ b/src/SMAPI/Framework/Networking/SGalaxyNetClient.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using Galaxy.Api; using StardewValley.Network; diff --git a/src/SMAPI/Framework/Networking/SGalaxyNetServer.cs b/src/SMAPI/Framework/Networking/SGalaxyNetServer.cs index 07a004a2..71e11576 100644 --- a/src/SMAPI/Framework/Networking/SGalaxyNetServer.cs +++ b/src/SMAPI/Framework/Networking/SGalaxyNetServer.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Diagnostics.CodeAnalysis; using System.IO; diff --git a/src/SMAPI/Framework/Networking/SLidgrenClient.cs b/src/SMAPI/Framework/Networking/SLidgrenClient.cs index ecf18cbd..39876744 100644 --- a/src/SMAPI/Framework/Networking/SLidgrenClient.cs +++ b/src/SMAPI/Framework/Networking/SLidgrenClient.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using StardewValley.Network; diff --git a/src/SMAPI/Framework/Networking/SLidgrenServer.cs b/src/SMAPI/Framework/Networking/SLidgrenServer.cs index c0b247c8..ff871e64 100644 --- a/src/SMAPI/Framework/Networking/SLidgrenServer.cs +++ b/src/SMAPI/Framework/Networking/SLidgrenServer.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Diagnostics.CodeAnalysis; using System.IO; diff --git a/src/SMAPI/Framework/Reflection/InterfaceProxyFactory.cs b/src/SMAPI/Framework/Reflection/InterfaceProxyFactory.cs index 4c49e219..40adde8e 100644 --- a/src/SMAPI/Framework/Reflection/InterfaceProxyFactory.cs +++ b/src/SMAPI/Framework/Reflection/InterfaceProxyFactory.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Reflection; using System.Reflection.Emit; using Nanoray.Pintail; diff --git a/src/SMAPI/Framework/SChatBox.cs b/src/SMAPI/Framework/SChatBox.cs index d6286c12..e000d1cd 100644 --- a/src/SMAPI/Framework/SChatBox.cs +++ b/src/SMAPI/Framework/SChatBox.cs @@ -1,5 +1,3 @@ -#nullable disable - using StardewValley; using StardewValley.Menus; diff --git a/src/SMAPI/Framework/SGameRunner.cs b/src/SMAPI/Framework/SGameRunner.cs index dae314af..213fe561 100644 --- a/src/SMAPI/Framework/SGameRunner.cs +++ b/src/SMAPI/Framework/SGameRunner.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Linq; @@ -150,7 +148,7 @@ namespace StardewModdingAPI.Framework /// Update metadata when a split screen is added or removed. private void UpdateForSplitScreenChanges() { - HashSet oldScreenIds = new HashSet(Context.ActiveScreenIds); + HashSet oldScreenIds = new(Context.ActiveScreenIds); // track active screens Context.ActiveScreenIds.Clear(); diff --git a/src/SMAPI/Framework/Singleton.cs b/src/SMAPI/Framework/Singleton.cs index da16c48e..1bf318c4 100644 --- a/src/SMAPI/Framework/Singleton.cs +++ b/src/SMAPI/Framework/Singleton.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI.Framework { /// Provides singleton instances of a given type. diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/BaseDisposableWatcher.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/BaseDisposableWatcher.cs index 03bf84d9..60006c51 100644 --- a/src/SMAPI/Framework/StateTracking/FieldWatchers/BaseDisposableWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/BaseDisposableWatcher.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableListWatcher.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableListWatcher.cs index 52e1dbad..256370ce 100644 --- a/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableListWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableListWatcher.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/ImmutableCollectionWatcher.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/ImmutableCollectionWatcher.cs index 94ce0c8e..84340fbf 100644 --- a/src/SMAPI/Framework/StateTracking/FieldWatchers/ImmutableCollectionWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/ImmutableCollectionWatcher.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/NetCollectionWatcher.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/NetCollectionWatcher.cs index e662c433..676c9fb4 100644 --- a/src/SMAPI/Framework/StateTracking/FieldWatchers/NetCollectionWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/NetCollectionWatcher.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Collections.Generic; using Netcode; diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/NetListWatcher.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/NetListWatcher.cs index a97e754c..0b4d3030 100644 --- a/src/SMAPI/Framework/StateTracking/FieldWatchers/NetListWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/NetListWatcher.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Collections.Generic; using Netcode; using StardewModdingAPI.Framework.StateTracking.Comparers; diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/NetValueWatcher.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/NetValueWatcher.cs index 26641750..48d5d681 100644 --- a/src/SMAPI/Framework/StateTracking/FieldWatchers/NetValueWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/NetValueWatcher.cs @@ -1,5 +1,3 @@ -#nullable disable - using Netcode; namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers diff --git a/src/SMAPI/Framework/StateTracking/ICollectionWatcher.cs b/src/SMAPI/Framework/StateTracking/ICollectionWatcher.cs index 74c9313b..7a7759e3 100644 --- a/src/SMAPI/Framework/StateTracking/ICollectionWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/ICollectionWatcher.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Collections.Generic; namespace StardewModdingAPI.Framework.StateTracking diff --git a/src/SMAPI/Framework/StateTracking/IDictionaryWatcher.cs b/src/SMAPI/Framework/StateTracking/IDictionaryWatcher.cs index 81fb7460..691ed377 100644 --- a/src/SMAPI/Framework/StateTracking/IDictionaryWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/IDictionaryWatcher.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Collections.Generic; namespace StardewModdingAPI.Framework.StateTracking diff --git a/src/SMAPI/Framework/StateTracking/IValueWatcher.cs b/src/SMAPI/Framework/StateTracking/IValueWatcher.cs index 7d46053c..4afca972 100644 --- a/src/SMAPI/Framework/StateTracking/IValueWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/IValueWatcher.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI.Framework.StateTracking { /// A watcher which tracks changes to a value. diff --git a/src/SMAPI/Framework/StateTracking/IWatcher.cs b/src/SMAPI/Framework/StateTracking/IWatcher.cs index 3603b6f8..8c7fa51c 100644 --- a/src/SMAPI/Framework/StateTracking/IWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/IWatcher.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; namespace StardewModdingAPI.Framework.StateTracking diff --git a/src/SMAPI/Framework/Utilities/ContextHash.cs b/src/SMAPI/Framework/Utilities/ContextHash.cs index 46b9099e..6c0fdc90 100644 --- a/src/SMAPI/Framework/Utilities/ContextHash.cs +++ b/src/SMAPI/Framework/Utilities/ContextHash.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; diff --git a/src/SMAPI/GamePlatform.cs b/src/SMAPI/GamePlatform.cs index 8013faa9..cce5ed8d 100644 --- a/src/SMAPI/GamePlatform.cs +++ b/src/SMAPI/GamePlatform.cs @@ -1,5 +1,3 @@ -#nullable disable - using StardewModdingAPI.Toolkit.Utilities; namespace StardewModdingAPI diff --git a/src/SMAPI/IAssetDataForDictionary.cs b/src/SMAPI/IAssetDataForDictionary.cs index 82ba25cb..1136316f 100644 --- a/src/SMAPI/IAssetDataForDictionary.cs +++ b/src/SMAPI/IAssetDataForDictionary.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Collections.Generic; namespace StardewModdingAPI diff --git a/src/SMAPI/IAssetDataForImage.cs b/src/SMAPI/IAssetDataForImage.cs index 1416592e..6f8a4719 100644 --- a/src/SMAPI/IAssetDataForImage.cs +++ b/src/SMAPI/IAssetDataForImage.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; diff --git a/src/SMAPI/IAssetDataForMap.cs b/src/SMAPI/IAssetDataForMap.cs index 0b637baf..19bdf3b2 100644 --- a/src/SMAPI/IAssetDataForMap.cs +++ b/src/SMAPI/IAssetDataForMap.cs @@ -1,5 +1,3 @@ -#nullable disable - using Microsoft.Xna.Framework; using xTile; diff --git a/src/SMAPI/IAssetEditor.cs b/src/SMAPI/IAssetEditor.cs index f3d91bd0..9f22ed83 100644 --- a/src/SMAPI/IAssetEditor.cs +++ b/src/SMAPI/IAssetEditor.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/IAssetLoader.cs b/src/SMAPI/IAssetLoader.cs index 0d52a481..96b98793 100644 --- a/src/SMAPI/IAssetLoader.cs +++ b/src/SMAPI/IAssetLoader.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/ICommandHelper.cs b/src/SMAPI/ICommandHelper.cs index a0c524d6..9f1c345c 100644 --- a/src/SMAPI/ICommandHelper.cs +++ b/src/SMAPI/ICommandHelper.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; namespace StardewModdingAPI diff --git a/src/SMAPI/IContentPackHelper.cs b/src/SMAPI/IContentPackHelper.cs index 5464df22..c48a4f86 100644 --- a/src/SMAPI/IContentPackHelper.cs +++ b/src/SMAPI/IContentPackHelper.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Collections.Generic; namespace StardewModdingAPI diff --git a/src/SMAPI/ICursorPosition.cs b/src/SMAPI/ICursorPosition.cs index da6cbb62..99c1b84d 100644 --- a/src/SMAPI/ICursorPosition.cs +++ b/src/SMAPI/ICursorPosition.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using Microsoft.Xna.Framework; using StardewValley; diff --git a/src/SMAPI/IInputHelper.cs b/src/SMAPI/IInputHelper.cs index b7ed0838..2b907b0d 100644 --- a/src/SMAPI/IInputHelper.cs +++ b/src/SMAPI/IInputHelper.cs @@ -1,5 +1,3 @@ -#nullable disable - using StardewModdingAPI.Utilities; namespace StardewModdingAPI diff --git a/src/SMAPI/IModHelper.cs b/src/SMAPI/IModHelper.cs index 5e4246aa..15e4ed8d 100644 --- a/src/SMAPI/IModHelper.cs +++ b/src/SMAPI/IModHelper.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/IModInfo.cs b/src/SMAPI/IModInfo.cs index 2788e4fc..3c85d454 100644 --- a/src/SMAPI/IModInfo.cs +++ b/src/SMAPI/IModInfo.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI { /// Metadata for a loaded mod. diff --git a/src/SMAPI/IModLinked.cs b/src/SMAPI/IModLinked.cs index cf08c9c5..172ee30c 100644 --- a/src/SMAPI/IModLinked.cs +++ b/src/SMAPI/IModLinked.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI { /// An instance linked to a mod. diff --git a/src/SMAPI/IMonitor.cs b/src/SMAPI/IMonitor.cs index 535f56e3..c400a211 100644 --- a/src/SMAPI/IMonitor.cs +++ b/src/SMAPI/IMonitor.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI { /// Encapsulates monitoring and logging for a given module. diff --git a/src/SMAPI/IMultiplayerPeerMod.cs b/src/SMAPI/IMultiplayerPeerMod.cs index 81978bef..005408b1 100644 --- a/src/SMAPI/IMultiplayerPeerMod.cs +++ b/src/SMAPI/IMultiplayerPeerMod.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI { /// Metadata about a mod installed by a connected player. diff --git a/src/SMAPI/ITranslationHelper.cs b/src/SMAPI/ITranslationHelper.cs index 3c297731..32199910 100644 --- a/src/SMAPI/ITranslationHelper.cs +++ b/src/SMAPI/ITranslationHelper.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Collections.Generic; using StardewValley; @@ -11,7 +9,7 @@ namespace StardewModdingAPI /********* ** Accessors *********/ - /// The current locale. + /// The current locale code like fr-FR, or an empty string for English. string Locale { get; } /// The game's current language code. -- cgit From 7c411b29bbe1323145d130eb8771c67617b6d3ee Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Wed, 13 Apr 2022 21:07:58 -0400 Subject: fix spelling warnings --- src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs | 2 ++ src/SMAPI.sln.DotSettings | 15 +++++++++++++++ src/SMAPI/Framework/ModHelpers/TranslationHelper.cs | 2 +- src/SMAPI/Framework/SChatBox.cs | 2 +- 4 files changed, 19 insertions(+), 2 deletions(-) (limited to 'src/SMAPI/Framework/ModHelpers/TranslationHelper.cs') diff --git a/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs b/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs index 4f872f1c..8e1538a5 100644 --- a/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs +++ b/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Xml.Linq; @@ -13,6 +14,7 @@ using Microsoft.Win32; namespace StardewModdingAPI.Toolkit.Framework.GameScanning { /// Finds installed game folders. + [SuppressMessage("ReSharper", "StringLiteralTypo", Justification = "These are valid game install paths.")] public class GameScanner { /********* diff --git a/src/SMAPI.sln.DotSettings b/src/SMAPI.sln.DotSettings index 866f2ed3..ad546665 100644 --- a/src/SMAPI.sln.DotSettings +++ b/src/SMAPI.sln.DotSettings @@ -25,8 +25,12 @@ True True True + True + True + True True True + True True True True @@ -36,6 +40,7 @@ True True True + True True True True @@ -45,6 +50,8 @@ True True True + True + True True True True @@ -57,8 +64,11 @@ True True True + True True True + True + True True True True @@ -67,15 +77,20 @@ True True True + True True True True + True True True True True True + True True + True True True + True \ No newline at end of file diff --git a/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs b/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs index 869664fe..d00ff279 100644 --- a/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs @@ -69,7 +69,7 @@ namespace StardewModdingAPI.Framework.ModHelpers return this; } - /// Set the current locale and precache translations. + /// Set the current locale and pre-cache translations. /// The current locale. /// The game's current language code. internal void SetLocale(string locale, LocalizedContentManager.LanguageCode localeEnum) diff --git a/src/SMAPI/Framework/SChatBox.cs b/src/SMAPI/Framework/SChatBox.cs index e000d1cd..7d6f2e5f 100644 --- a/src/SMAPI/Framework/SChatBox.cs +++ b/src/SMAPI/Framework/SChatBox.cs @@ -3,7 +3,7 @@ using StardewValley.Menus; namespace StardewModdingAPI.Framework { - /// SMAPI's implementation of the chatbox which intercepts errors for logging. + /// SMAPI's implementation of the chat box which intercepts errors for logging. internal class SChatBox : ChatBox { /********* -- cgit From 4de18b516fb12c3f842e72560b4d41aae7b7eff9 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 14 Apr 2022 18:13:27 -0400 Subject: fix nullable annotation (#837) --- src/SMAPI/Framework/ModHelpers/TranslationHelper.cs | 2 +- src/SMAPI/Framework/Translator.cs | 2 +- src/SMAPI/ITranslationHelper.cs | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) (limited to 'src/SMAPI/Framework/ModHelpers/TranslationHelper.cs') diff --git a/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs b/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs index d00ff279..684837ff 100644 --- a/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs @@ -50,7 +50,7 @@ namespace StardewModdingAPI.Framework.ModHelpers } /// - public Translation Get(string key, object tokens) + public Translation Get(string key, object? tokens) { return this.Translator.Get(key, tokens); } diff --git a/src/SMAPI/Framework/Translator.cs b/src/SMAPI/Framework/Translator.cs index 794e3cde..b230a727 100644 --- a/src/SMAPI/Framework/Translator.cs +++ b/src/SMAPI/Framework/Translator.cs @@ -72,7 +72,7 @@ namespace StardewModdingAPI.Framework /// Get a translation for the current locale. /// The translation key. /// An object containing token key/value pairs. This can be an anonymous object (like new { value = 42, name = "Cranberries" }), a dictionary, or a class instance. - public Translation Get(string key, object tokens) + public Translation Get(string key, object? tokens) { return this.Get(key).Tokens(tokens); } diff --git a/src/SMAPI/ITranslationHelper.cs b/src/SMAPI/ITranslationHelper.cs index 32199910..8be8d2c1 100644 --- a/src/SMAPI/ITranslationHelper.cs +++ b/src/SMAPI/ITranslationHelper.cs @@ -29,7 +29,7 @@ namespace StardewModdingAPI /// Get a translation for the current locale. /// The translation key. /// An object containing token key/value pairs. This can be an anonymous object (like new { value = 42, name = "Cranberries" }), a dictionary, or a class instance. - Translation Get(string key, object tokens); + Translation Get(string key, object? tokens); /// Get a translation in every locale for which it's defined. /// The translation key. -- cgit From 1a3befa93e073b45e63781cc546cd7c52f316d7c Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 14 Apr 2022 23:00:30 -0400 Subject: track mod metadata reference in APIs for upcoming deprecation changes --- src/SMAPI.Tests/Core/TranslationTests.cs | 32 ++++++++++++++++++-- src/SMAPI/Framework/ModHelpers/BaseHelper.cs | 15 +++++++--- src/SMAPI/Framework/ModHelpers/CommandHelper.cs | 6 +--- src/SMAPI/Framework/ModHelpers/ContentHelper.cs | 8 ++--- .../Framework/ModHelpers/ContentPackHelper.cs | 6 ++-- src/SMAPI/Framework/ModHelpers/DataHelper.cs | 6 ++-- .../Framework/ModHelpers/GameContentHelper.cs | 8 ++--- src/SMAPI/Framework/ModHelpers/InputHelper.cs | 6 ++-- src/SMAPI/Framework/ModHelpers/ModContentHelper.cs | 8 ++--- src/SMAPI/Framework/ModHelpers/ModHelper.cs | 8 ++--- .../Framework/ModHelpers/ModRegistryHelper.cs | 6 ++-- .../Framework/ModHelpers/MultiplayerHelper.cs | 6 ++-- src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs | 6 ++-- .../Framework/ModHelpers/TranslationHelper.cs | 6 ++-- src/SMAPI/Framework/SCore.cs | 34 +++++++++++----------- 15 files changed, 95 insertions(+), 66 deletions(-) (limited to 'src/SMAPI/Framework/ModHelpers/TranslationHelper.cs') diff --git a/src/SMAPI.Tests/Core/TranslationTests.cs b/src/SMAPI.Tests/Core/TranslationTests.cs index ced1525a..a52df607 100644 --- a/src/SMAPI.Tests/Core/TranslationTests.cs +++ b/src/SMAPI.Tests/Core/TranslationTests.cs @@ -1,10 +1,14 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; +using System.IO; using System.Linq; using NUnit.Framework; using StardewModdingAPI; +using StardewModdingAPI.Framework; using StardewModdingAPI.Framework.ModHelpers; +using StardewModdingAPI.Framework.ModLoading; +using StardewModdingAPI.Toolkit.Serialization.Models; using StardewValley; namespace SMAPI.Tests.Core @@ -33,7 +37,7 @@ namespace SMAPI.Tests.Core var data = new Dictionary>(); // act - ITranslationHelper helper = new TranslationHelper("ModID", "en", LocalizedContentManager.LanguageCode.en).SetTranslations(data); + ITranslationHelper helper = new TranslationHelper(this.CreateModMetadata(), "en", LocalizedContentManager.LanguageCode.en).SetTranslations(data); Translation translation = helper.Get("key"); Translation[]? translationList = helper.GetTranslations()?.ToArray(); @@ -56,7 +60,7 @@ namespace SMAPI.Tests.Core // act var actual = new Dictionary(); - TranslationHelper helper = new TranslationHelper("ModID", "en", LocalizedContentManager.LanguageCode.en).SetTranslations(data); + TranslationHelper helper = new TranslationHelper(this.CreateModMetadata(), "en", LocalizedContentManager.LanguageCode.en).SetTranslations(data); foreach (string locale in expected.Keys) { this.AssertSetLocale(helper, locale, LocalizedContentManager.LanguageCode.en); @@ -80,7 +84,7 @@ namespace SMAPI.Tests.Core // act var actual = new Dictionary(); - TranslationHelper helper = new TranslationHelper("ModID", "en", LocalizedContentManager.LanguageCode.en).SetTranslations(data); + TranslationHelper helper = new TranslationHelper(this.CreateModMetadata(), "en", LocalizedContentManager.LanguageCode.en).SetTranslations(data); foreach (string locale in expected.Keys) { this.AssertSetLocale(helper, locale, LocalizedContentManager.LanguageCode.en); @@ -325,6 +329,28 @@ namespace SMAPI.Tests.Core return string.Format(Translation.PlaceholderText, key); } + /// Create a fake mod manifest. + private IModMetadata CreateModMetadata() + { + string id = $"smapi.unit-tests.fake-mod-{Guid.NewGuid():N}"; + + string tempPath = Path.Combine(Path.GetTempPath(), id); + return new ModMetadata( + displayName: "Mod Display Name", + directoryPath: tempPath, + rootPath: tempPath, + manifest: new Manifest( + uniqueID: id, + name: "Mod Name", + author: "Mod Author", + description: "Mod Description", + version: new SemanticVersion(1, 0, 0) + ), + dataRecord: null, + isIgnored: false + ); + } + /********* ** Test models diff --git a/src/SMAPI/Framework/ModHelpers/BaseHelper.cs b/src/SMAPI/Framework/ModHelpers/BaseHelper.cs index 5a3d4bed..12390976 100644 --- a/src/SMAPI/Framework/ModHelpers/BaseHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/BaseHelper.cs @@ -3,21 +3,28 @@ namespace StardewModdingAPI.Framework.ModHelpers /// The common base class for mod helpers. internal abstract class BaseHelper : IModLinked { + /********* + ** Fields + *********/ + /// The mod using this instance. + protected readonly IModMetadata Mod; + + /********* ** Accessors *********/ /// - public string ModID { get; } + public string ModID => this.Mod.Manifest.UniqueID; /********* ** Protected methods *********/ /// Construct an instance. - /// The unique ID of the relevant mod. - protected BaseHelper(string modID) + /// The mod using this instance. + protected BaseHelper(IModMetadata mod) { - this.ModID = modID; + this.Mod = mod; } } } diff --git a/src/SMAPI/Framework/ModHelpers/CommandHelper.cs b/src/SMAPI/Framework/ModHelpers/CommandHelper.cs index 7d25979c..319922a9 100644 --- a/src/SMAPI/Framework/ModHelpers/CommandHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/CommandHelper.cs @@ -8,9 +8,6 @@ namespace StardewModdingAPI.Framework.ModHelpers /********* ** Fields *********/ - /// The mod using this instance. - private readonly IModMetadata Mod; - /// Manages console commands. private readonly CommandManager CommandManager; @@ -22,9 +19,8 @@ namespace StardewModdingAPI.Framework.ModHelpers /// The mod using this instance. /// Manages console commands. public CommandHelper(IModMetadata mod, CommandManager commandManager) - : base(mod.Manifest.UniqueID) + : base(mod) { - this.Mod = mod; this.CommandManager = commandManager; } diff --git a/src/SMAPI/Framework/ModHelpers/ContentHelper.cs b/src/SMAPI/Framework/ModHelpers/ContentHelper.cs index b610b395..7cffcee1 100644 --- a/src/SMAPI/Framework/ModHelpers/ContentHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/ContentHelper.cs @@ -93,14 +93,14 @@ namespace StardewModdingAPI.Framework.ModHelpers /// Construct an instance. /// SMAPI's core content logic. /// The absolute path to the mod folder. - /// The unique ID of the relevant mod. + /// The mod using this instance. /// The friendly mod name for use in errors. /// Encapsulates monitoring and logging. /// Simplifies access to private code. - public ContentHelper(ContentCoordinator contentCore, string modFolderPath, string modID, string modName, IMonitor monitor, Reflector reflection) - : base(modID) + public ContentHelper(ContentCoordinator contentCore, string modFolderPath, IModMetadata mod, string modName, IMonitor monitor, Reflector reflection) + : base(mod) { - string managedAssetPrefix = contentCore.GetManagedAssetPrefix(modID); + string managedAssetPrefix = contentCore.GetManagedAssetPrefix(mod.Manifest.UniqueID); this.ContentCore = contentCore; this.GameContentManager = contentCore.CreateGameContentManager(managedAssetPrefix + ".content"); diff --git a/src/SMAPI/Framework/ModHelpers/ContentPackHelper.cs b/src/SMAPI/Framework/ModHelpers/ContentPackHelper.cs index d39abc7d..9f4a7ceb 100644 --- a/src/SMAPI/Framework/ModHelpers/ContentPackHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/ContentPackHelper.cs @@ -22,11 +22,11 @@ namespace StardewModdingAPI.Framework.ModHelpers ** Public methods *********/ /// Construct an instance. - /// The unique ID of the relevant mod. + /// The mod using this instance. /// The content packs loaded for this mod. /// Create a temporary content pack. - public ContentPackHelper(string modID, Lazy contentPacks, Func createContentPack) - : base(modID) + public ContentPackHelper(IModMetadata mod, Lazy contentPacks, Func createContentPack) + : base(mod) { this.ContentPacks = contentPacks; this.CreateContentPack = createContentPack; diff --git a/src/SMAPI/Framework/ModHelpers/DataHelper.cs b/src/SMAPI/Framework/ModHelpers/DataHelper.cs index 92b3b398..2eaa940a 100644 --- a/src/SMAPI/Framework/ModHelpers/DataHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/DataHelper.cs @@ -26,11 +26,11 @@ namespace StardewModdingAPI.Framework.ModHelpers ** Public methods *********/ /// Construct an instance. - /// The unique ID of the relevant mod. + /// The mod using this instance. /// The absolute path to the mod folder. /// The absolute path to the mod folder. - public DataHelper(string modID, string modFolderPath, JsonHelper jsonHelper) - : base(modID) + public DataHelper(IModMetadata mod, string modFolderPath, JsonHelper jsonHelper) + : base(mod) { this.ModFolderPath = modFolderPath; this.JsonHelper = jsonHelper; diff --git a/src/SMAPI/Framework/ModHelpers/GameContentHelper.cs b/src/SMAPI/Framework/ModHelpers/GameContentHelper.cs index 4c1cde02..232e9287 100644 --- a/src/SMAPI/Framework/ModHelpers/GameContentHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/GameContentHelper.cs @@ -45,14 +45,14 @@ namespace StardewModdingAPI.Framework.ModHelpers *********/ /// Construct an instance. /// SMAPI's core content logic. - /// The unique ID of the relevant mod. + /// The mod using this instance. /// The friendly mod name for use in errors. /// Encapsulates monitoring and logging. /// Simplifies access to private code. - public GameContentHelper(ContentCoordinator contentCore, string modID, string modName, IMonitor monitor, Reflector reflection) - : base(modID) + public GameContentHelper(ContentCoordinator contentCore, IModMetadata mod, string modName, IMonitor monitor, Reflector reflection) + : base(mod) { - string managedAssetPrefix = contentCore.GetManagedAssetPrefix(modID); + string managedAssetPrefix = contentCore.GetManagedAssetPrefix(mod.Manifest.UniqueID); this.ContentCore = contentCore; this.GameContentManager = contentCore.CreateGameContentManager(managedAssetPrefix + ".content"); diff --git a/src/SMAPI/Framework/ModHelpers/InputHelper.cs b/src/SMAPI/Framework/ModHelpers/InputHelper.cs index 88caf4c3..6c158258 100644 --- a/src/SMAPI/Framework/ModHelpers/InputHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/InputHelper.cs @@ -18,10 +18,10 @@ namespace StardewModdingAPI.Framework.ModHelpers ** Public methods *********/ /// Construct an instance. - /// The unique ID of the relevant mod. + /// The mod using this instance. /// Manages the game's input state for the current player instance. That may not be the main player in split-screen mode. - public InputHelper(string modID, Func currentInputState) - : base(modID) + public InputHelper(IModMetadata mod, Func currentInputState) + : base(mod) { this.CurrentInputState = currentInputState; } diff --git a/src/SMAPI/Framework/ModHelpers/ModContentHelper.cs b/src/SMAPI/Framework/ModHelpers/ModContentHelper.cs index fc47f269..4a058a48 100644 --- a/src/SMAPI/Framework/ModHelpers/ModContentHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/ModContentHelper.cs @@ -36,15 +36,15 @@ namespace StardewModdingAPI.Framework.ModHelpers /// Construct an instance. /// SMAPI's core content logic. /// The absolute path to the mod folder. - /// The unique ID of the relevant mod. + /// The mod using this instance. /// The friendly mod name for use in errors. /// The game content manager used for map tilesheets not provided by the mod. /// A case-insensitive lookup of relative paths within the . /// Simplifies access to private code. - public ModContentHelper(ContentCoordinator contentCore, string modFolderPath, string modID, string modName, IContentManager gameContentManager, CaseInsensitivePathCache relativePathCache, Reflector reflection) - : base(modID) + public ModContentHelper(ContentCoordinator contentCore, string modFolderPath, IModMetadata mod, string modName, IContentManager gameContentManager, CaseInsensitivePathCache relativePathCache, Reflector reflection) + : base(mod) { - string managedAssetPrefix = contentCore.GetManagedAssetPrefix(modID); + string managedAssetPrefix = contentCore.GetManagedAssetPrefix(mod.Manifest.UniqueID); this.ContentCore = contentCore; this.ModContentManager = contentCore.CreateModContentManager(managedAssetPrefix, modName, modFolderPath, gameContentManager); diff --git a/src/SMAPI/Framework/ModHelpers/ModHelper.cs b/src/SMAPI/Framework/ModHelpers/ModHelper.cs index e1529a75..4eb91f05 100644 --- a/src/SMAPI/Framework/ModHelpers/ModHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/ModHelper.cs @@ -77,7 +77,7 @@ namespace StardewModdingAPI.Framework.ModHelpers ** Public methods *********/ /// Construct an instance. - /// The mod's unique ID. + /// The mod using this instance. /// The full path to the mod's folder. /// Manages the game's input state for the current player instance. That may not be the main player in split-screen mode. /// Manages access to events raised by SMAPI. @@ -94,13 +94,13 @@ namespace StardewModdingAPI.Framework.ModHelpers /// An argument is null or empty. /// The path does not exist on disk. public ModHelper( - string modID, string modDirectory, Func currentInputState, IModEvents events, + IModMetadata mod, string modDirectory, Func currentInputState, IModEvents events, #pragma warning disable CS0612 // deprecated code ContentHelper contentHelper, #pragma warning restore CS0612 IGameContentHelper gameContentHelper, IModContentHelper modContentHelper, IContentPackHelper contentPackHelper, ICommandHelper commandHelper, IDataHelper dataHelper, IModRegistry modRegistry, IReflectionHelper reflectionHelper, IMultiplayerHelper multiplayer, ITranslationHelper translationHelper ) - : base(modID) + : base(mod) { // validate directory if (string.IsNullOrWhiteSpace(modDirectory)) @@ -117,7 +117,7 @@ namespace StardewModdingAPI.Framework.ModHelpers this.ModContent = modContentHelper ?? throw new ArgumentNullException(nameof(modContentHelper)); this.ContentPacks = contentPackHelper ?? throw new ArgumentNullException(nameof(contentPackHelper)); this.Data = dataHelper ?? throw new ArgumentNullException(nameof(dataHelper)); - this.Input = new InputHelper(modID, currentInputState); + this.Input = new InputHelper(mod, currentInputState); this.ModRegistry = modRegistry ?? throw new ArgumentNullException(nameof(modRegistry)); this.ConsoleCommands = commandHelper ?? throw new ArgumentNullException(nameof(commandHelper)); this.Reflection = reflectionHelper ?? throw new ArgumentNullException(nameof(reflectionHelper)); diff --git a/src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs b/src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs index 84899610..39cef758 100644 --- a/src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs @@ -26,12 +26,12 @@ namespace StardewModdingAPI.Framework.ModHelpers ** Public methods *********/ /// Construct an instance. - /// The unique ID of the relevant mod. + /// The mod using this instance. /// The underlying mod registry. /// Generates proxy classes to access mod APIs through an arbitrary interface. /// Encapsulates monitoring and logging for the mod. - public ModRegistryHelper(string modID, ModRegistry registry, InterfaceProxyFactory proxyFactory, IMonitor monitor) - : base(modID) + public ModRegistryHelper(IModMetadata mod, ModRegistry registry, InterfaceProxyFactory proxyFactory, IMonitor monitor) + : base(mod) { this.Registry = registry; this.ProxyFactory = proxyFactory; diff --git a/src/SMAPI/Framework/ModHelpers/MultiplayerHelper.cs b/src/SMAPI/Framework/ModHelpers/MultiplayerHelper.cs index a419327e..6900a1d2 100644 --- a/src/SMAPI/Framework/ModHelpers/MultiplayerHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/MultiplayerHelper.cs @@ -18,10 +18,10 @@ namespace StardewModdingAPI.Framework.ModHelpers ** Public methods *********/ /// Construct an instance. - /// The unique ID of the relevant mod. + /// The mod using this instance. /// SMAPI's core multiplayer utility. - public MultiplayerHelper(string modID, SMultiplayer multiplayer) - : base(modID) + public MultiplayerHelper(IModMetadata mod, SMultiplayer multiplayer) + : base(mod) { this.Multiplayer = multiplayer; } diff --git a/src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs b/src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs index af018c87..a559906b 100644 --- a/src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs @@ -22,11 +22,11 @@ namespace StardewModdingAPI.Framework.ModHelpers ** Public methods *********/ /// Construct an instance. - /// The unique ID of the relevant mod. + /// The mod using this instance. /// The mod name for error messages. /// The underlying reflection helper. - public ReflectionHelper(string modID, string modName, Reflector reflector) - : base(modID) + public ReflectionHelper(IModMetadata mod, string modName, Reflector reflector) + : base(mod) { this.ModName = modName; this.Reflector = reflector; diff --git a/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs b/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs index 684837ff..ae49d651 100644 --- a/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs @@ -27,11 +27,11 @@ namespace StardewModdingAPI.Framework.ModHelpers ** Public methods *********/ /// Construct an instance. - /// The unique ID of the relevant mod. + /// The mod using this instance. /// The initial locale. /// The game's current language code. - public TranslationHelper(string modID, string locale, LocalizedContentManager.LanguageCode languageCode) - : base(modID) + public TranslationHelper(IModMetadata mod, string locale, LocalizedContentManager.LanguageCode languageCode) + : base(mod) { this.Translator = new Translator(); this.Translator.SetLocale(locale, languageCode); diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs index bce7cffa..814ac56f 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -1749,9 +1749,9 @@ namespace StardewModdingAPI.Framework { IMonitor monitor = this.LogManager.GetMonitor(mod.DisplayName); CaseInsensitivePathCache relativePathCache = this.ContentCore.GetCaseInsensitivePathCache(mod.DirectoryPath); - GameContentHelper gameContentHelper = new(this.ContentCore, manifest.UniqueID, mod.DisplayName, monitor, this.Reflection); - IModContentHelper modContentHelper = new ModContentHelper(this.ContentCore, mod.DirectoryPath, manifest.UniqueID, mod.DisplayName, gameContentHelper.GetUnderlyingContentManager(), relativePathCache, this.Reflection); - TranslationHelper translationHelper = new(manifest.UniqueID, contentCore.GetLocale(), contentCore.Language); + GameContentHelper gameContentHelper = new(this.ContentCore, mod, mod.DisplayName, monitor, this.Reflection); + IModContentHelper modContentHelper = new ModContentHelper(this.ContentCore, mod.DirectoryPath, mod, mod.DisplayName, gameContentHelper.GetUnderlyingContentManager(), relativePathCache, this.Reflection); + TranslationHelper translationHelper = new(mod, contentCore.GetLocale(), contentCore.Language); IContentPack contentPack = new ContentPack(mod.DirectoryPath, manifest, modContentHelper, translationHelper, jsonHelper, relativePathCache); mod.SetMod(contentPack, monitor, translationHelper); this.ModRegistry.Add(mod); @@ -1823,7 +1823,7 @@ namespace StardewModdingAPI.Framework // init mod helpers IMonitor monitor = this.LogManager.GetMonitor(mod.DisplayName); - TranslationHelper translationHelper = new(manifest.UniqueID, contentCore.GetLocale(), contentCore.Language); + TranslationHelper translationHelper = new(mod, contentCore.GetLocale(), contentCore.Language); IModHelper modHelper; { IContentPack CreateFakeContentPack(string packDirPath, IManifest packManifest) @@ -1832,9 +1832,9 @@ namespace StardewModdingAPI.Framework CaseInsensitivePathCache relativePathCache = this.ContentCore.GetCaseInsensitivePathCache(packDirPath); - GameContentHelper gameContentHelper = new(contentCore, packManifest.UniqueID, packManifest.Name, packMonitor, this.Reflection); - IModContentHelper packContentHelper = new ModContentHelper(contentCore, packDirPath, packManifest.UniqueID, packManifest.Name, gameContentHelper.GetUnderlyingContentManager(), relativePathCache, this.Reflection); - TranslationHelper packTranslationHelper = new(packManifest.UniqueID, contentCore.GetLocale(), contentCore.Language); + GameContentHelper gameContentHelper = new(contentCore, mod, packManifest.Name, packMonitor, this.Reflection); + IModContentHelper packContentHelper = new ModContentHelper(contentCore, packDirPath, mod, packManifest.Name, gameContentHelper.GetUnderlyingContentManager(), relativePathCache, this.Reflection); + TranslationHelper packTranslationHelper = new(mod, contentCore.GetLocale(), contentCore.Language); ContentPack contentPack = new(packDirPath, packManifest, packContentHelper, packTranslationHelper, this.Toolkit.JsonHelper, relativePathCache); this.ReloadTranslationsForTemporaryContentPack(mod, contentPack); @@ -1846,17 +1846,17 @@ namespace StardewModdingAPI.Framework ICommandHelper commandHelper = new CommandHelper(mod, this.CommandManager); CaseInsensitivePathCache relativePathCache = this.ContentCore.GetCaseInsensitivePathCache(mod.DirectoryPath); #pragma warning disable CS0612 // deprecated code - ContentHelper contentHelper = new(contentCore, mod.DirectoryPath, manifest.UniqueID, mod.DisplayName, monitor, this.Reflection); + ContentHelper contentHelper = new(contentCore, mod.DirectoryPath, mod, mod.DisplayName, monitor, this.Reflection); #pragma warning restore CS0612 - GameContentHelper gameContentHelper = new(contentCore, manifest.UniqueID, mod.DisplayName, monitor, this.Reflection); - IModContentHelper modContentHelper = new ModContentHelper(contentCore, mod.DirectoryPath, manifest.UniqueID, mod.DisplayName, gameContentHelper.GetUnderlyingContentManager(), relativePathCache, this.Reflection); - IContentPackHelper contentPackHelper = new ContentPackHelper(manifest.UniqueID, new Lazy(GetContentPacks), CreateFakeContentPack); - IDataHelper dataHelper = new DataHelper(manifest.UniqueID, mod.DirectoryPath, jsonHelper); - IReflectionHelper reflectionHelper = new ReflectionHelper(manifest.UniqueID, mod.DisplayName, this.Reflection); - IModRegistry modRegistryHelper = new ModRegistryHelper(manifest.UniqueID, this.ModRegistry, proxyFactory, monitor); - IMultiplayerHelper multiplayerHelper = new MultiplayerHelper(manifest.UniqueID, this.Multiplayer); - - modHelper = new ModHelper(manifest.UniqueID, mod.DirectoryPath, () => this.GetCurrentGameInstance().Input, events, contentHelper, gameContentHelper, modContentHelper, contentPackHelper, commandHelper, dataHelper, modRegistryHelper, reflectionHelper, multiplayerHelper, translationHelper); + GameContentHelper gameContentHelper = new(contentCore, mod, mod.DisplayName, monitor, this.Reflection); + IModContentHelper modContentHelper = new ModContentHelper(contentCore, mod.DirectoryPath, mod, mod.DisplayName, gameContentHelper.GetUnderlyingContentManager(), relativePathCache, this.Reflection); + IContentPackHelper contentPackHelper = new ContentPackHelper(mod, new Lazy(GetContentPacks), CreateFakeContentPack); + IDataHelper dataHelper = new DataHelper(mod, mod.DirectoryPath, jsonHelper); + IReflectionHelper reflectionHelper = new ReflectionHelper(mod, mod.DisplayName, this.Reflection); + IModRegistry modRegistryHelper = new ModRegistryHelper(mod, this.ModRegistry, proxyFactory, monitor); + IMultiplayerHelper multiplayerHelper = new MultiplayerHelper(mod, this.Multiplayer); + + modHelper = new ModHelper(mod, mod.DirectoryPath, () => this.GetCurrentGameInstance().Input, events, contentHelper, gameContentHelper, modContentHelper, contentPackHelper, commandHelper, dataHelper, modRegistryHelper, reflectionHelper, multiplayerHelper, translationHelper); } // init mod -- cgit