From ba42bb97d1f1df07e87b02ee0e03eef0227ea5a7 Mon Sep 17 00:00:00 2001 From: Shockah Date: Wed, 16 Feb 2022 19:08:40 +0100 Subject: move proxying to a separate NuGet library --- build/common.targets | 1 + 1 file changed, 1 insertion(+) (limited to 'build/common.targets') diff --git a/build/common.targets b/build/common.targets index 86624b62..bcb0e9e1 100644 --- a/build/common.targets +++ b/build/common.targets @@ -53,6 +53,7 @@ + -- cgit 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. --- build/common.targets | 1 + src/SMAPI.Installer/Framework/InstallerContext.cs | 2 ++ src/SMAPI.Installer/Framework/InstallerPaths.cs | 2 ++ src/SMAPI.Installer/InteractiveInstaller.cs | 2 ++ src/SMAPI.Installer/Program.cs | 2 ++ src/SMAPI.Internal.Patching/BasePatcher.cs | 2 ++ src/SMAPI.Internal.Patching/HarmonyPatcher.cs | 2 ++ src/SMAPI.Internal.Patching/IPatcher.cs | 2 ++ src/SMAPI.Internal.Patching/PatchHelper.cs | 2 ++ src/SMAPI.Internal/ConsoleWriting/ColorSchemeConfig.cs | 2 ++ src/SMAPI.Internal/ConsoleWriting/ColorfulConsoleWriter.cs | 2 ++ src/SMAPI.Internal/ConsoleWriting/IConsoleWriter.cs | 2 ++ src/SMAPI.Internal/ExceptionHelper.cs | 2 ++ .../Framework/DiagnosticResult.cs | 2 ++ .../Framework/DiagnosticVerifier.Helper.cs | 2 ++ .../Framework/DiagnosticVerifier.cs | 2 ++ .../Mock/Netcode/NetCollection.cs | 2 ++ .../Mock/Netcode/NetFieldBase.cs | 2 ++ src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetInt.cs | 2 ++ src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetList.cs | 2 ++ .../Mock/Netcode/NetObjectList.cs | 2 ++ .../Mock/StardewValley/Farmer.cs | 2 ++ src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/StardewValley/Item.cs | 2 ++ .../Mock/StardewValley/Object.cs | 2 ++ src/SMAPI.ModBuildConfig.Analyzer.Tests/NetFieldAnalyzerTests.cs | 2 ++ .../ObsoleteFieldAnalyzerTests.cs | 2 ++ src/SMAPI.ModBuildConfig.Analyzer/AnalyzerUtilities.cs | 2 ++ src/SMAPI.ModBuildConfig.Analyzer/NetFieldAnalyzer.cs | 2 ++ src/SMAPI.ModBuildConfig.Analyzer/ObsoleteFieldAnalyzer.cs | 2 ++ src/SMAPI.ModBuildConfig/DeployModTask.cs | 2 ++ src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs | 2 ++ src/SMAPI.ModBuildConfig/Framework/UserErrorException.cs | 2 ++ src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs | 2 ++ src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ConsoleCommand.cs | 2 ++ .../Framework/Commands/IConsoleCommand.cs | 2 ++ .../Framework/Commands/Other/ApplySaveFixCommand.cs | 2 ++ .../Framework/Commands/Other/DebugCommand.cs | 2 ++ .../Framework/Commands/Other/RegenerateBundles.cs | 2 ++ .../Framework/Commands/Other/ShowDataFilesCommand.cs | 2 ++ .../Framework/Commands/Other/ShowGameFilesCommand.cs | 2 ++ .../Framework/Commands/Other/TestInputCommand.cs | 2 ++ .../Framework/Commands/Player/AddCommand.cs | 2 ++ .../Framework/Commands/Player/ListItemTypesCommand.cs | 2 ++ .../Framework/Commands/Player/ListItemsCommand.cs | 2 ++ .../Framework/Commands/Player/SetColorCommand.cs | 2 ++ .../Framework/Commands/Player/SetFarmTypeCommand.cs | 2 ++ .../Framework/Commands/Player/SetHealthCommand.cs | 2 ++ .../Framework/Commands/Player/SetImmunityCommand.cs | 2 ++ .../Framework/Commands/Player/SetMaxHealthCommand.cs | 2 ++ .../Framework/Commands/Player/SetMaxStaminaCommand.cs | 2 ++ .../Framework/Commands/Player/SetMoneyCommand.cs | 2 ++ .../Framework/Commands/Player/SetNameCommand.cs | 2 ++ .../Framework/Commands/Player/SetStaminaCommand.cs | 2 ++ .../Framework/Commands/Player/SetStyleCommand.cs | 2 ++ .../Framework/Commands/World/ClearCommand.cs | 2 ++ .../Framework/Commands/World/DownMineLevelCommand.cs | 2 ++ .../Framework/Commands/World/FreezeTimeCommand.cs | 2 ++ .../Framework/Commands/World/HurryAllCommand.cs | 2 ++ .../Framework/Commands/World/SetDayCommand.cs | 2 ++ .../Framework/Commands/World/SetMineLevelCommand.cs | 2 ++ .../Framework/Commands/World/SetSeasonCommand.cs | 2 ++ .../Framework/Commands/World/SetTimeCommand.cs | 2 ++ .../Framework/Commands/World/SetYearCommand.cs | 2 ++ src/SMAPI.Mods.ConsoleCommands/Framework/ItemData/SearchableItem.cs | 2 ++ src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs | 2 ++ src/SMAPI.Mods.ConsoleCommands/ModEntry.cs | 2 ++ src/SMAPI.Mods.ErrorHandler/ModEntry.cs | 2 ++ src/SMAPI.Mods.ErrorHandler/Patches/DialoguePatcher.cs | 2 ++ src/SMAPI.Mods.ErrorHandler/Patches/EventPatcher.cs | 2 ++ src/SMAPI.Mods.ErrorHandler/Patches/GameLocationPatcher.cs | 2 ++ src/SMAPI.Mods.ErrorHandler/Patches/IClickableMenuPatcher.cs | 2 ++ src/SMAPI.Mods.ErrorHandler/Patches/NpcPatcher.cs | 2 ++ src/SMAPI.Mods.ErrorHandler/Patches/ObjectPatcher.cs | 2 ++ src/SMAPI.Mods.ErrorHandler/Patches/SaveGamePatcher.cs | 2 ++ src/SMAPI.Mods.ErrorHandler/Patches/SpriteBatchPatcher.cs | 2 ++ src/SMAPI.Mods.ErrorHandler/Patches/UtilityPatcher.cs | 2 ++ src/SMAPI.Mods.SaveBackup/ModEntry.cs | 2 ++ src/SMAPI.Tests.ModApiConsumer/ApiConsumer.cs | 2 ++ src/SMAPI.Tests.ModApiConsumer/Interfaces/ISimpleApi.cs | 2 ++ src/SMAPI.Tests.ModApiProvider/Framework/BaseApi.cs | 2 ++ src/SMAPI.Tests.ModApiProvider/Framework/SimpleApi.cs | 2 ++ src/SMAPI.Tests.ModApiProvider/ProviderMod.cs | 2 ++ src/SMAPI.Tests/Core/AssetNameTests.cs | 2 ++ src/SMAPI.Tests/Core/InterfaceProxyTests.cs | 2 ++ src/SMAPI.Tests/Core/ModResolverTests.cs | 2 ++ src/SMAPI.Tests/Core/TranslationTests.cs | 2 ++ src/SMAPI.Tests/Sample.cs | 2 ++ src/SMAPI.Tests/Utilities/KeybindListTests.cs | 2 ++ src/SMAPI.Tests/Utilities/PathUtilitiesTests.cs | 2 ++ src/SMAPI.Tests/Utilities/SDateTests.cs | 2 ++ src/SMAPI.Tests/Utilities/SemanticVersionTests.cs | 2 ++ src/SMAPI.Tests/WikiClient/ChangeDescriptorTests.cs | 2 ++ src/SMAPI.Toolkit.CoreInterfaces/IManifest.cs | 2 ++ src/SMAPI.Toolkit.CoreInterfaces/IManifestContentPackFor.cs | 2 ++ src/SMAPI.Toolkit.CoreInterfaces/IManifestDependency.cs | 2 ++ src/SMAPI.Toolkit.CoreInterfaces/ISemanticVersion.cs | 2 ++ src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryModel.cs | 2 ++ src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryVersionModel.cs | 2 ++ .../Framework/Clients/WebApi/ModExtendedMetadataModel.cs | 2 ++ src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchEntryModel.cs | 2 ++ src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchModel.cs | 2 ++ src/SMAPI.Toolkit/Framework/Clients/WebApi/WebApiClient.cs | 2 ++ src/SMAPI.Toolkit/Framework/Clients/Wiki/ChangeDescriptor.cs | 2 ++ src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs | 2 ++ src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiCompatibilityInfo.cs | 2 ++ src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiCompatibilityStatus.cs | 2 ++ src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiDataOverrideEntry.cs | 2 -- src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModEntry.cs | 2 ++ src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModList.cs | 2 ++ src/SMAPI.Toolkit/Framework/Constants.cs | 2 ++ src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs | 2 ++ src/SMAPI.Toolkit/Framework/LowLevelEnvironmentUtility.cs | 2 ++ src/SMAPI.Toolkit/Framework/ModData/MetadataModel.cs | 2 ++ src/SMAPI.Toolkit/Framework/ModData/ModDataField.cs | 2 ++ src/SMAPI.Toolkit/Framework/ModData/ModDataModel.cs | 2 ++ src/SMAPI.Toolkit/Framework/ModData/ModDataRecord.cs | 2 ++ src/SMAPI.Toolkit/Framework/ModData/ModDataRecordVersionedFields.cs | 2 ++ src/SMAPI.Toolkit/Framework/ModData/ModDatabase.cs | 2 ++ src/SMAPI.Toolkit/Framework/ModScanning/ModFolder.cs | 2 ++ src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs | 2 ++ src/SMAPI.Toolkit/Framework/SemanticVersionReader.cs | 2 ++ src/SMAPI.Toolkit/Framework/UpdateData/UpdateKey.cs | 2 ++ src/SMAPI.Toolkit/ModToolkit.cs | 2 ++ src/SMAPI.Toolkit/SemanticVersion.cs | 2 ++ src/SMAPI.Toolkit/SemanticVersionComparer.cs | 2 ++ .../Serialization/Converters/ManifestContentPackForConverter.cs | 2 ++ .../Serialization/Converters/ManifestDependencyArrayConverter.cs | 2 ++ .../Serialization/Converters/SemanticVersionConverter.cs | 2 ++ .../Serialization/Converters/SimpleReadOnlyConverter.cs | 2 ++ src/SMAPI.Toolkit/Serialization/InternalExtensions.cs | 2 ++ src/SMAPI.Toolkit/Serialization/JsonHelper.cs | 2 ++ src/SMAPI.Toolkit/Serialization/Models/Manifest.cs | 2 ++ src/SMAPI.Toolkit/Serialization/Models/ManifestContentPackFor.cs | 2 ++ src/SMAPI.Toolkit/Serialization/Models/ManifestDependency.cs | 2 ++ src/SMAPI.Toolkit/Serialization/SParseException.cs | 2 ++ src/SMAPI.Toolkit/Utilities/EnvironmentUtility.cs | 2 ++ src/SMAPI.Toolkit/Utilities/FileUtilities.cs | 2 ++ src/SMAPI.Toolkit/Utilities/PathUtilities.cs | 2 ++ src/SMAPI.Web/BackgroundService.cs | 2 ++ src/SMAPI.Web/Controllers/IndexController.cs | 2 ++ src/SMAPI.Web/Controllers/JsonValidatorController.cs | 2 ++ src/SMAPI.Web/Controllers/LogParserController.cs | 2 ++ src/SMAPI.Web/Controllers/ModsApiController.cs | 2 ++ src/SMAPI.Web/Controllers/ModsController.cs | 2 ++ src/SMAPI.Web/Framework/AllowLargePostsAttribute.cs | 2 ++ src/SMAPI.Web/Framework/Caching/Cached.cs | 2 ++ src/SMAPI.Web/Framework/Caching/Mods/IModCacheRepository.cs | 2 ++ src/SMAPI.Web/Framework/Caching/Mods/ModCacheMemoryRepository.cs | 2 ++ src/SMAPI.Web/Framework/Caching/Wiki/IWikiCacheRepository.cs | 2 ++ src/SMAPI.Web/Framework/Caching/Wiki/WikiCacheMemoryRepository.cs | 2 ++ src/SMAPI.Web/Framework/Caching/Wiki/WikiMetadata.cs | 2 ++ src/SMAPI.Web/Framework/Clients/Chucklefish/ChucklefishClient.cs | 2 ++ src/SMAPI.Web/Framework/Clients/CurseForge/CurseForgeClient.cs | 2 ++ .../Framework/Clients/CurseForge/ResponseModels/ModFileModel.cs | 2 ++ .../Framework/Clients/CurseForge/ResponseModels/ModModel.cs | 2 ++ src/SMAPI.Web/Framework/Clients/GenericModDownload.cs | 2 ++ src/SMAPI.Web/Framework/Clients/GenericModPage.cs | 2 ++ src/SMAPI.Web/Framework/Clients/GitHub/GitAsset.cs | 2 ++ src/SMAPI.Web/Framework/Clients/GitHub/GitHubClient.cs | 2 ++ src/SMAPI.Web/Framework/Clients/GitHub/GitLicense.cs | 2 ++ src/SMAPI.Web/Framework/Clients/GitHub/GitRelease.cs | 2 ++ src/SMAPI.Web/Framework/Clients/GitHub/GitRepo.cs | 2 ++ src/SMAPI.Web/Framework/Clients/GitHub/IGitHubClient.cs | 2 ++ src/SMAPI.Web/Framework/Clients/IModSiteClient.cs | 2 ++ src/SMAPI.Web/Framework/Clients/ModDrop/ModDropClient.cs | 2 ++ .../Framework/Clients/ModDrop/ResponseModels/FileDataModel.cs | 2 ++ .../Framework/Clients/ModDrop/ResponseModels/ModDataModel.cs | 2 ++ .../Framework/Clients/ModDrop/ResponseModels/ModListModel.cs | 2 ++ src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModModel.cs | 2 ++ src/SMAPI.Web/Framework/Clients/Nexus/NexusClient.cs | 2 ++ src/SMAPI.Web/Framework/Clients/Nexus/ResponseModels/NexusMod.cs | 2 ++ src/SMAPI.Web/Framework/Clients/Pastebin/IPastebinClient.cs | 2 ++ src/SMAPI.Web/Framework/Clients/Pastebin/PasteInfo.cs | 2 ++ src/SMAPI.Web/Framework/Clients/Pastebin/PastebinClient.cs | 2 ++ src/SMAPI.Web/Framework/Compression/GzipHelper.cs | 2 ++ src/SMAPI.Web/Framework/Compression/IGzipHelper.cs | 2 ++ src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs | 2 ++ src/SMAPI.Web/Framework/ConfigModels/ModOverrideConfig.cs | 2 ++ src/SMAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs | 2 ++ src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs | 2 ++ src/SMAPI.Web/Framework/ConfigModels/SmapiInfoConfig.cs | 2 ++ src/SMAPI.Web/Framework/Extensions.cs | 2 ++ src/SMAPI.Web/Framework/IModDownload.cs | 2 ++ src/SMAPI.Web/Framework/IModPage.cs | 2 ++ src/SMAPI.Web/Framework/InternalControllerFeatureProvider.cs | 2 ++ src/SMAPI.Web/Framework/JobDashboardAuthorizationFilter.cs | 2 ++ src/SMAPI.Web/Framework/LogParsing/LogMessageBuilder.cs | 2 ++ src/SMAPI.Web/Framework/LogParsing/LogParseException.cs | 5 ++++- src/SMAPI.Web/Framework/LogParsing/LogParser.cs | 2 ++ src/SMAPI.Web/Framework/LogParsing/Models/LogMessage.cs | 2 ++ src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs | 2 ++ src/SMAPI.Web/Framework/LogParsing/Models/ParsedLog.cs | 2 ++ src/SMAPI.Web/Framework/ModInfoModel.cs | 2 ++ src/SMAPI.Web/Framework/ModSiteManager.cs | 2 ++ src/SMAPI.Web/Framework/RedirectRules/RedirectHostsToUrlsRule.cs | 2 ++ src/SMAPI.Web/Framework/RedirectRules/RedirectMatchRule.cs | 2 ++ src/SMAPI.Web/Framework/RedirectRules/RedirectPathsToUrlsRule.cs | 2 ++ src/SMAPI.Web/Framework/RedirectRules/RedirectToHttpsRule.cs | 2 ++ src/SMAPI.Web/Framework/Storage/IStorageProvider.cs | 2 ++ src/SMAPI.Web/Framework/Storage/StorageProvider.cs | 2 ++ src/SMAPI.Web/Framework/Storage/StoredFileInfo.cs | 2 ++ src/SMAPI.Web/Framework/Storage/UploadResult.cs | 2 ++ src/SMAPI.Web/Framework/VersionConstraint.cs | 2 ++ src/SMAPI.Web/Program.cs | 2 ++ src/SMAPI.Web/Startup.cs | 2 ++ src/SMAPI.Web/ViewModels/IndexModel.cs | 2 ++ src/SMAPI.Web/ViewModels/IndexVersionModel.cs | 2 ++ src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorErrorModel.cs | 2 ++ src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorModel.cs | 2 ++ src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorRequestModel.cs | 2 ++ src/SMAPI.Web/ViewModels/LogParserModel.cs | 2 ++ src/SMAPI.Web/ViewModels/ModCompatibilityModel.cs | 2 ++ src/SMAPI.Web/ViewModels/ModLinkModel.cs | 2 ++ src/SMAPI.Web/ViewModels/ModListModel.cs | 2 ++ src/SMAPI.Web/ViewModels/ModModel.cs | 2 ++ src/SMAPI.Web/Views/Index/Index.cshtml | 4 ++++ src/SMAPI.Web/Views/Index/Privacy.cshtml | 4 ++++ src/SMAPI.Web/Views/JsonValidator/Index.cshtml | 4 ++++ src/SMAPI.Web/Views/LogParser/Index.cshtml | 4 ++++ src/SMAPI.Web/Views/Mods/Index.cshtml | 4 ++++ src/SMAPI.Web/Views/Shared/_Layout.cshtml | 4 ++++ src/SMAPI.Web/Views/_ViewStart.cshtml | 6 +++++- src/SMAPI/Constants.cs | 2 ++ src/SMAPI/Context.cs | 2 ++ src/SMAPI/Events/AssetReadyEventArgs.cs | 2 ++ src/SMAPI/Events/AssetRequestedEventArgs.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/MenuChangedEventArgs.cs | 2 ++ src/SMAPI/Events/ModMessageReceivedEventArgs.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/Command.cs | 2 ++ src/SMAPI/Framework/CommandManager.cs | 2 ++ src/SMAPI/Framework/Commands/HarmonySummaryCommand.cs | 2 ++ src/SMAPI/Framework/Commands/HelpCommand.cs | 2 ++ src/SMAPI/Framework/Commands/IInternalCommand.cs | 2 ++ src/SMAPI/Framework/Commands/ReloadI18nCommand.cs | 2 ++ src/SMAPI/Framework/Content/AssetData.cs | 2 ++ src/SMAPI/Framework/Content/AssetDataForDictionary.cs | 2 ++ src/SMAPI/Framework/Content/AssetDataForImage.cs | 2 ++ src/SMAPI/Framework/Content/AssetDataForMap.cs | 2 ++ src/SMAPI/Framework/Content/AssetDataForObject.cs | 2 ++ src/SMAPI/Framework/Content/AssetEditOperation.cs | 2 ++ src/SMAPI/Framework/Content/AssetInfo.cs | 2 ++ src/SMAPI/Framework/Content/AssetInterceptorChange.cs | 2 ++ src/SMAPI/Framework/Content/AssetLoadOperation.cs | 2 ++ src/SMAPI/Framework/Content/AssetName.cs | 2 ++ src/SMAPI/Framework/Content/AssetOperationGroup.cs | 2 ++ src/SMAPI/Framework/Content/ContentCache.cs | 2 ++ src/SMAPI/Framework/Content/TilesheetReference.cs | 2 ++ src/SMAPI/Framework/ContentCoordinator.cs | 2 ++ src/SMAPI/Framework/ContentManagers/BaseContentManager.cs | 2 ++ src/SMAPI/Framework/ContentManagers/GameContentManager.cs | 2 ++ .../ContentManagers/GameContentManagerForAssetPropagation.cs | 2 ++ src/SMAPI/Framework/ContentManagers/IContentManager.cs | 2 ++ src/SMAPI/Framework/ContentManagers/ModContentManager.cs | 2 ++ src/SMAPI/Framework/ContentPack.cs | 2 ++ src/SMAPI/Framework/CursorPosition.cs | 2 ++ src/SMAPI/Framework/DeprecationManager.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/ManagedEvent.cs | 2 ++ src/SMAPI/Framework/Events/ManagedEventHandler.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/Exceptions/SContentLoadException.cs | 4 +++- src/SMAPI/Framework/GameVersion.cs | 2 ++ src/SMAPI/Framework/IModMetadata.cs | 2 ++ src/SMAPI/Framework/Input/GamePadStateBuilder.cs | 2 ++ src/SMAPI/Framework/Input/IInputStateBuilder.cs | 2 ++ src/SMAPI/Framework/Input/KeyboardStateBuilder.cs | 2 ++ src/SMAPI/Framework/Input/MouseStateBuilder.cs | 2 ++ src/SMAPI/Framework/Input/SInputState.cs | 2 ++ src/SMAPI/Framework/InternalExtensions.cs | 2 ++ src/SMAPI/Framework/Logging/InterceptingTextWriter.cs | 2 ++ src/SMAPI/Framework/Logging/LogFileManager.cs | 2 ++ src/SMAPI/Framework/Logging/LogManager.cs | 2 ++ src/SMAPI/Framework/ModHelpers/BaseHelper.cs | 2 ++ src/SMAPI/Framework/ModHelpers/CommandHelper.cs | 2 ++ src/SMAPI/Framework/ModHelpers/ContentHelper.cs | 2 ++ src/SMAPI/Framework/ModHelpers/ContentPackHelper.cs | 2 ++ src/SMAPI/Framework/ModHelpers/DataHelper.cs | 2 ++ src/SMAPI/Framework/ModHelpers/GameContentHelper.cs | 2 ++ src/SMAPI/Framework/ModHelpers/InputHelper.cs | 2 ++ src/SMAPI/Framework/ModHelpers/ModContentHelper.cs | 2 ++ src/SMAPI/Framework/ModHelpers/ModHelper.cs | 2 ++ src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs | 2 ++ src/SMAPI/Framework/ModHelpers/MultiplayerHelper.cs | 2 ++ src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs | 2 ++ src/SMAPI/Framework/ModHelpers/TranslationHelper.cs | 2 ++ src/SMAPI/Framework/ModLinked.cs | 2 ++ src/SMAPI/Framework/ModLoading/AssemblyDefinitionResolver.cs | 2 ++ src/SMAPI/Framework/ModLoading/AssemblyLoadStatus.cs | 2 ++ src/SMAPI/Framework/ModLoading/AssemblyLoader.cs | 2 ++ src/SMAPI/Framework/ModLoading/AssemblyParseResult.cs | 2 ++ src/SMAPI/Framework/ModLoading/Finders/EventFinder.cs | 2 ++ src/SMAPI/Framework/ModLoading/Finders/FieldFinder.cs | 2 ++ src/SMAPI/Framework/ModLoading/Finders/MethodFinder.cs | 2 ++ src/SMAPI/Framework/ModLoading/Finders/PropertyFinder.cs | 2 ++ .../ModLoading/Finders/ReferenceToMemberWithUnexpectedTypeFinder.cs | 2 ++ .../Framework/ModLoading/Finders/ReferenceToMissingMemberFinder.cs | 2 ++ src/SMAPI/Framework/ModLoading/Finders/TypeAssemblyFinder.cs | 2 ++ src/SMAPI/Framework/ModLoading/Finders/TypeFinder.cs | 2 ++ src/SMAPI/Framework/ModLoading/Framework/BaseInstructionHandler.cs | 2 ++ src/SMAPI/Framework/ModLoading/Framework/RecursiveRewriter.cs | 2 ++ src/SMAPI/Framework/ModLoading/Framework/RewriteHelper.cs | 2 ++ src/SMAPI/Framework/ModLoading/IInstructionHandler.cs | 2 ++ src/SMAPI/Framework/ModLoading/IncompatibleInstructionException.cs | 2 ++ src/SMAPI/Framework/ModLoading/InvalidModStateException.cs | 2 ++ src/SMAPI/Framework/ModLoading/ModMetadata.cs | 2 ++ src/SMAPI/Framework/ModLoading/ModResolver.cs | 2 ++ src/SMAPI/Framework/ModLoading/PlatformAssemblyMap.cs | 2 ++ src/SMAPI/Framework/ModLoading/RewriteFacades/AccessToolsFacade.cs | 2 ++ .../Framework/ModLoading/RewriteFacades/HarmonyInstanceFacade.cs | 2 ++ .../Framework/ModLoading/RewriteFacades/HarmonyMethodFacade.cs | 2 ++ src/SMAPI/Framework/ModLoading/RewriteFacades/SpriteBatchFacade.cs | 2 ++ .../Framework/ModLoading/Rewriters/ArchitectureAssemblyRewriter.cs | 2 ++ src/SMAPI/Framework/ModLoading/Rewriters/FieldReplaceRewriter.cs | 2 ++ src/SMAPI/Framework/ModLoading/Rewriters/HarmonyRewriter.cs | 2 ++ src/SMAPI/Framework/ModLoading/Rewriters/HeuristicFieldRewriter.cs | 2 ++ src/SMAPI/Framework/ModLoading/Rewriters/HeuristicMethodRewriter.cs | 2 ++ src/SMAPI/Framework/ModLoading/Rewriters/MethodParentRewriter.cs | 2 ++ src/SMAPI/Framework/ModLoading/Rewriters/TypeReferenceRewriter.cs | 2 ++ src/SMAPI/Framework/ModLoading/Symbols/SymbolReader.cs | 2 ++ src/SMAPI/Framework/ModLoading/Symbols/SymbolReaderProvider.cs | 2 ++ src/SMAPI/Framework/ModLoading/Symbols/SymbolWriterProvider.cs | 2 ++ src/SMAPI/Framework/ModLoading/TypeReferenceComparer.cs | 2 ++ src/SMAPI/Framework/ModRegistry.cs | 2 ++ src/SMAPI/Framework/Models/SConfig.cs | 2 ++ src/SMAPI/Framework/Monitor.cs | 2 ++ src/SMAPI/Framework/Networking/ModMessageModel.cs | 2 ++ src/SMAPI/Framework/Networking/MultiplayerPeer.cs | 2 ++ src/SMAPI/Framework/Networking/MultiplayerPeerMod.cs | 2 ++ src/SMAPI/Framework/Networking/RemoteContextModModel.cs | 2 ++ src/SMAPI/Framework/Networking/RemoteContextModel.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/CacheEntry.cs | 2 ++ src/SMAPI/Framework/Reflection/InterfaceProxyFactory.cs | 2 ++ src/SMAPI/Framework/Reflection/ReflectedField.cs | 2 ++ src/SMAPI/Framework/Reflection/ReflectedMethod.cs | 2 ++ src/SMAPI/Framework/Reflection/ReflectedProperty.cs | 2 ++ src/SMAPI/Framework/Reflection/Reflector.cs | 2 ++ src/SMAPI/Framework/Rendering/SDisplayDevice.cs | 2 ++ src/SMAPI/Framework/Rendering/SXnaDisplayDevice.cs | 2 ++ src/SMAPI/Framework/RequestExitDelegate.cs | 2 ++ src/SMAPI/Framework/SChatBox.cs | 2 ++ src/SMAPI/Framework/SCore.cs | 2 ++ src/SMAPI/Framework/SGame.cs | 2 ++ src/SMAPI/Framework/SGameRunner.cs | 2 ++ src/SMAPI/Framework/SModHooks.cs | 2 ++ src/SMAPI/Framework/SMultiplayer.cs | 2 ++ src/SMAPI/Framework/Serialization/ColorConverter.cs | 2 ++ src/SMAPI/Framework/Serialization/KeybindConverter.cs | 2 ++ src/SMAPI/Framework/Serialization/PointConverter.cs | 2 ++ src/SMAPI/Framework/Serialization/RectangleConverter.cs | 2 ++ src/SMAPI/Framework/Serialization/Vector2Converter.cs | 2 ++ src/SMAPI/Framework/Singleton.cs | 2 ++ src/SMAPI/Framework/SnapshotDiff.cs | 2 ++ src/SMAPI/Framework/SnapshotItemListDiff.cs | 2 ++ src/SMAPI/Framework/SnapshotListDiff.cs | 2 ++ src/SMAPI/Framework/StateTracking/ChestTracker.cs | 2 ++ src/SMAPI/Framework/StateTracking/Comparers/EquatableComparer.cs | 2 ++ .../Framework/StateTracking/Comparers/GenericEqualsComparer.cs | 2 ++ .../Framework/StateTracking/Comparers/ObjectReferenceComparer.cs | 2 ++ .../Framework/StateTracking/FieldWatchers/BaseDisposableWatcher.cs | 2 ++ .../Framework/StateTracking/FieldWatchers/ComparableListWatcher.cs | 2 ++ .../Framework/StateTracking/FieldWatchers/ComparableWatcher.cs | 2 ++ .../StateTracking/FieldWatchers/ImmutableCollectionWatcher.cs | 2 ++ .../Framework/StateTracking/FieldWatchers/NetCollectionWatcher.cs | 2 ++ .../Framework/StateTracking/FieldWatchers/NetDictionaryWatcher.cs | 2 ++ src/SMAPI/Framework/StateTracking/FieldWatchers/NetListWatcher.cs | 2 ++ src/SMAPI/Framework/StateTracking/FieldWatchers/NetValueWatcher.cs | 2 ++ .../StateTracking/FieldWatchers/ObservableCollectionWatcher.cs | 2 ++ src/SMAPI/Framework/StateTracking/FieldWatchers/WatcherFactory.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/StateTracking/LocationTracker.cs | 2 ++ src/SMAPI/Framework/StateTracking/PlayerTracker.cs | 2 ++ src/SMAPI/Framework/StateTracking/Snapshots/LocationSnapshot.cs | 2 ++ src/SMAPI/Framework/StateTracking/Snapshots/PlayerSnapshot.cs | 2 ++ src/SMAPI/Framework/StateTracking/Snapshots/WatcherSnapshot.cs | 2 ++ .../Framework/StateTracking/Snapshots/WorldLocationsSnapshot.cs | 2 ++ src/SMAPI/Framework/StateTracking/WorldLocationsTracker.cs | 2 ++ src/SMAPI/Framework/TemporaryHacks/MiniMonoModHotfix.cs | 2 ++ src/SMAPI/Framework/Translator.cs | 2 ++ src/SMAPI/Framework/Utilities/ContextHash.cs | 2 ++ src/SMAPI/Framework/Utilities/Countdown.cs | 2 +- src/SMAPI/Framework/Utilities/TickCacheDictionary.cs | 2 ++ src/SMAPI/Framework/WatcherCore.cs | 2 ++ src/SMAPI/GamePlatform.cs | 2 ++ src/SMAPI/IAssetData.cs | 2 ++ src/SMAPI/IAssetDataForDictionary.cs | 2 ++ src/SMAPI/IAssetDataForImage.cs | 2 ++ src/SMAPI/IAssetDataForMap.cs | 2 ++ src/SMAPI/IAssetEditor.cs | 2 ++ src/SMAPI/IAssetInfo.cs | 2 ++ src/SMAPI/IAssetLoader.cs | 2 ++ src/SMAPI/IAssetName.cs | 2 ++ src/SMAPI/ICommandHelper.cs | 2 ++ src/SMAPI/IContentHelper.cs | 2 ++ src/SMAPI/IContentPack.cs | 2 ++ src/SMAPI/IContentPackHelper.cs | 2 ++ src/SMAPI/ICursorPosition.cs | 2 ++ src/SMAPI/IDataHelper.cs | 2 ++ src/SMAPI/IGameContentHelper.cs | 2 ++ src/SMAPI/IInputHelper.cs | 2 ++ src/SMAPI/IMod.cs | 2 ++ src/SMAPI/IModContentHelper.cs | 2 ++ src/SMAPI/IModHelper.cs | 2 ++ src/SMAPI/IModInfo.cs | 2 ++ src/SMAPI/IModLinked.cs | 2 ++ src/SMAPI/IModRegistry.cs | 2 ++ src/SMAPI/IMonitor.cs | 2 ++ src/SMAPI/IMultiplayerHelper.cs | 2 ++ src/SMAPI/IMultiplayerPeer.cs | 2 ++ src/SMAPI/IMultiplayerPeerMod.cs | 2 ++ src/SMAPI/IReflectedField.cs | 4 +++- src/SMAPI/IReflectedMethod.cs | 4 +++- src/SMAPI/IReflectedProperty.cs | 2 ++ src/SMAPI/IReflectionHelper.cs | 2 ++ src/SMAPI/ITranslationHelper.cs | 2 ++ src/SMAPI/Metadata/CoreAssetPropagator.cs | 2 ++ src/SMAPI/Metadata/InstructionMetadata.cs | 2 ++ src/SMAPI/Mod.cs | 2 ++ src/SMAPI/Patches/Game1Patcher.cs | 2 ++ src/SMAPI/Patches/TitleMenuPatcher.cs | 2 ++ src/SMAPI/Program.cs | 2 ++ src/SMAPI/SemanticVersion.cs | 2 ++ src/SMAPI/Translation.cs | 2 ++ src/SMAPI/Utilities/CaseInsensitivePathCache.cs | 2 ++ src/SMAPI/Utilities/Keybind.cs | 2 ++ src/SMAPI/Utilities/KeybindList.cs | 2 ++ src/SMAPI/Utilities/PathUtilities.cs | 2 ++ src/SMAPI/Utilities/PerScreen.cs | 2 ++ src/SMAPI/Utilities/SDate.cs | 2 ++ 486 files changed, 988 insertions(+), 8 deletions(-) (limited to 'build/common.targets') diff --git a/build/common.targets b/build/common.targets index bcb0e9e1..258b48f2 100644 --- a/build/common.targets +++ b/build/common.targets @@ -5,6 +5,7 @@ SMAPI latest $(AssemblySearchPaths);{GAC} + enable $(DefineConstants);SMAPI_FOR_WINDOWS diff --git a/src/SMAPI.Installer/Framework/InstallerContext.cs b/src/SMAPI.Installer/Framework/InstallerContext.cs index abc7adde..23d5b17c 100644 --- a/src/SMAPI.Installer/Framework/InstallerContext.cs +++ b/src/SMAPI.Installer/Framework/InstallerContext.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.IO; using StardewModdingAPI.Toolkit; using StardewModdingAPI.Toolkit.Framework.GameScanning; diff --git a/src/SMAPI.Installer/Framework/InstallerPaths.cs b/src/SMAPI.Installer/Framework/InstallerPaths.cs index 0976eceb..fd9d1be6 100644 --- a/src/SMAPI.Installer/Framework/InstallerPaths.cs +++ b/src/SMAPI.Installer/Framework/InstallerPaths.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.IO; using StardewModdingAPI.Toolkit.Framework; diff --git a/src/SMAPI.Installer/InteractiveInstaller.cs b/src/SMAPI.Installer/InteractiveInstaller.cs index 09183b5d..b07c0461 100644 --- a/src/SMAPI.Installer/InteractiveInstaller.cs +++ b/src/SMAPI.Installer/InteractiveInstaller.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/SMAPI.Installer/Program.cs b/src/SMAPI.Installer/Program.cs index 2c9b2c0a..5139513f 100644 --- a/src/SMAPI.Installer/Program.cs +++ b/src/SMAPI.Installer/Program.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Diagnostics.CodeAnalysis; using System.IO; diff --git a/src/SMAPI.Internal.Patching/BasePatcher.cs b/src/SMAPI.Internal.Patching/BasePatcher.cs index 87155d7f..6d019b52 100644 --- a/src/SMAPI.Internal.Patching/BasePatcher.cs +++ b/src/SMAPI.Internal.Patching/BasePatcher.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Reflection; using HarmonyLib; diff --git a/src/SMAPI.Internal.Patching/HarmonyPatcher.cs b/src/SMAPI.Internal.Patching/HarmonyPatcher.cs index 6f30c241..fc239fd2 100644 --- a/src/SMAPI.Internal.Patching/HarmonyPatcher.cs +++ b/src/SMAPI.Internal.Patching/HarmonyPatcher.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using HarmonyLib; diff --git a/src/SMAPI.Internal.Patching/IPatcher.cs b/src/SMAPI.Internal.Patching/IPatcher.cs index a732d64f..5b373117 100644 --- a/src/SMAPI.Internal.Patching/IPatcher.cs +++ b/src/SMAPI.Internal.Patching/IPatcher.cs @@ -1,3 +1,5 @@ +#nullable disable + using HarmonyLib; namespace StardewModdingAPI.Internal.Patching diff --git a/src/SMAPI.Internal.Patching/PatchHelper.cs b/src/SMAPI.Internal.Patching/PatchHelper.cs index c9758616..52b15fd1 100644 --- a/src/SMAPI.Internal.Patching/PatchHelper.cs +++ b/src/SMAPI.Internal.Patching/PatchHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Linq; using System.Reflection; diff --git a/src/SMAPI.Internal/ConsoleWriting/ColorSchemeConfig.cs b/src/SMAPI.Internal/ConsoleWriting/ColorSchemeConfig.cs index 001840bf..b22aa231 100644 --- a/src/SMAPI.Internal/ConsoleWriting/ColorSchemeConfig.cs +++ b/src/SMAPI.Internal/ConsoleWriting/ColorSchemeConfig.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; diff --git a/src/SMAPI.Internal/ConsoleWriting/ColorfulConsoleWriter.cs b/src/SMAPI.Internal/ConsoleWriting/ColorfulConsoleWriter.cs index bfe155e0..19a31c7b 100644 --- a/src/SMAPI.Internal/ConsoleWriting/ColorfulConsoleWriter.cs +++ b/src/SMAPI.Internal/ConsoleWriting/ColorfulConsoleWriter.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using StardewModdingAPI.Toolkit.Utilities; diff --git a/src/SMAPI.Internal/ConsoleWriting/IConsoleWriter.cs b/src/SMAPI.Internal/ConsoleWriting/IConsoleWriter.cs index fbcf161c..84e17207 100644 --- a/src/SMAPI.Internal/ConsoleWriting/IConsoleWriter.cs +++ b/src/SMAPI.Internal/ConsoleWriting/IConsoleWriter.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Internal.ConsoleWriting { /// Writes text to the console. diff --git a/src/SMAPI.Internal/ExceptionHelper.cs b/src/SMAPI.Internal/ExceptionHelper.cs index 6bd1d579..a856cf71 100644 --- a/src/SMAPI.Internal/ExceptionHelper.cs +++ b/src/SMAPI.Internal/ExceptionHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Reflection; using System.Text.RegularExpressions; diff --git a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Framework/DiagnosticResult.cs b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Framework/DiagnosticResult.cs index 896c2cb8..8c24eda9 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Framework/DiagnosticResult.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Framework/DiagnosticResult.cs @@ -1,3 +1,5 @@ +#nullable disable + // using Microsoft.CodeAnalysis; using System; diff --git a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Framework/DiagnosticVerifier.Helper.cs b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Framework/DiagnosticVerifier.Helper.cs index 0247288e..8d72fea1 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Framework/DiagnosticVerifier.Helper.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Framework/DiagnosticVerifier.Helper.cs @@ -1,3 +1,5 @@ +#nullable disable + // using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; diff --git a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Framework/DiagnosticVerifier.cs b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Framework/DiagnosticVerifier.cs index 49697dfa..09d3a3f8 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Framework/DiagnosticVerifier.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Framework/DiagnosticVerifier.cs @@ -1,3 +1,5 @@ +#nullable disable + // using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetCollection.cs b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetCollection.cs index d160610e..54aa1c6c 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetCollection.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetCollection.cs @@ -1,3 +1,5 @@ +#nullable disable + // ReSharper disable CheckNamespace -- matches Stardew Valley's code using System.Collections; using System.Collections.Generic; diff --git a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetFieldBase.cs b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetFieldBase.cs index 140c6f59..1c349a0b 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetFieldBase.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetFieldBase.cs @@ -1,3 +1,5 @@ +#nullable disable + // ReSharper disable CheckNamespace -- matches Stardew Valley's code namespace Netcode { diff --git a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetInt.cs b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetInt.cs index b3abc467..e8e1dc63 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetInt.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetInt.cs @@ -1,3 +1,5 @@ +#nullable disable + // ReSharper disable CheckNamespace -- matches Stardew Valley's code namespace Netcode { diff --git a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetList.cs b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetList.cs index 1699f71c..f7fb9617 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetList.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetList.cs @@ -1,3 +1,5 @@ +#nullable disable + // ReSharper disable CheckNamespace -- matches Stardew Valley's code using System.Collections; using System.Collections.Generic; diff --git a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetObjectList.cs b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetObjectList.cs index 7814e7d6..74c17843 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetObjectList.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/Netcode/NetObjectList.cs @@ -1,3 +1,5 @@ +#nullable disable + // ReSharper disable CheckNamespace -- matches Stardew Valley's code namespace Netcode { diff --git a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/StardewValley/Farmer.cs b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/StardewValley/Farmer.cs index 13fab069..bdbf9b45 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/StardewValley/Farmer.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/StardewValley/Farmer.cs @@ -1,3 +1,5 @@ +#nullable disable + // ReSharper disable CheckNamespace, InconsistentNaming -- matches Stardew Valley's code #pragma warning disable 649 // (never assigned) -- only used to test type conversions using System.Collections.Generic; diff --git a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/StardewValley/Item.cs b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/StardewValley/Item.cs index e8da92fa..d1f0afc4 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/StardewValley/Item.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/StardewValley/Item.cs @@ -1,3 +1,5 @@ +#nullable disable + // ReSharper disable CheckNamespace, InconsistentNaming -- matches Stardew Valley's code using Netcode; diff --git a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/StardewValley/Object.cs b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/StardewValley/Object.cs index 151010a7..f54b22fe 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/StardewValley/Object.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/Mock/StardewValley/Object.cs @@ -1,3 +1,5 @@ +#nullable disable + // ReSharper disable CheckNamespace, InconsistentNaming -- matches Stardew Valley's code using Netcode; diff --git a/src/SMAPI.ModBuildConfig.Analyzer.Tests/NetFieldAnalyzerTests.cs b/src/SMAPI.ModBuildConfig.Analyzer.Tests/NetFieldAnalyzerTests.cs index f11a59d3..29f3b956 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer.Tests/NetFieldAnalyzerTests.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/NetFieldAnalyzerTests.cs @@ -1,3 +1,5 @@ +#nullable disable + using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; using NUnit.Framework; diff --git a/src/SMAPI.ModBuildConfig.Analyzer.Tests/ObsoleteFieldAnalyzerTests.cs b/src/SMAPI.ModBuildConfig.Analyzer.Tests/ObsoleteFieldAnalyzerTests.cs index 76607b8e..1cf7369f 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer.Tests/ObsoleteFieldAnalyzerTests.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/ObsoleteFieldAnalyzerTests.cs @@ -1,3 +1,5 @@ +#nullable disable + using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.Diagnostics; using NUnit.Framework; diff --git a/src/SMAPI.ModBuildConfig.Analyzer/AnalyzerUtilities.cs b/src/SMAPI.ModBuildConfig.Analyzer/AnalyzerUtilities.cs index a1ad8aa4..1cc37b38 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer/AnalyzerUtilities.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer/AnalyzerUtilities.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; diff --git a/src/SMAPI.ModBuildConfig.Analyzer/NetFieldAnalyzer.cs b/src/SMAPI.ModBuildConfig.Analyzer/NetFieldAnalyzer.cs index 553aae99..cb2856da 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer/NetFieldAnalyzer.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer/NetFieldAnalyzer.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Collections.Immutable; diff --git a/src/SMAPI.ModBuildConfig.Analyzer/ObsoleteFieldAnalyzer.cs b/src/SMAPI.ModBuildConfig.Analyzer/ObsoleteFieldAnalyzer.cs index ba089513..158d7243 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer/ObsoleteFieldAnalyzer.cs +++ b/src/SMAPI.ModBuildConfig.Analyzer/ObsoleteFieldAnalyzer.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Collections.Immutable; diff --git a/src/SMAPI.ModBuildConfig/DeployModTask.cs b/src/SMAPI.ModBuildConfig/DeployModTask.cs index c7026ee1..43fac9d5 100644 --- a/src/SMAPI.ModBuildConfig/DeployModTask.cs +++ b/src/SMAPI.ModBuildConfig/DeployModTask.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs b/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs index 80955f67..ad2c0de3 100644 --- a/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs +++ b/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/src/SMAPI.ModBuildConfig/Framework/UserErrorException.cs b/src/SMAPI.ModBuildConfig/Framework/UserErrorException.cs index 64e31c29..588118ef 100644 --- a/src/SMAPI.ModBuildConfig/Framework/UserErrorException.cs +++ b/src/SMAPI.ModBuildConfig/Framework/UserErrorException.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.ModBuildConfig.Framework diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs index 7e157c38..8fcbf711 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections; using System.Collections.Generic; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ConsoleCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ConsoleCommand.cs index 44b7824e..a8dd41f5 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ConsoleCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ConsoleCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/IConsoleCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/IConsoleCommand.cs index 9c82bbd3..4c6df538 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/IConsoleCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/IConsoleCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands { /// A console command to register. diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/ApplySaveFixCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/ApplySaveFixCommand.cs index b02ba4b1..f31457ed 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/ApplySaveFixCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/ApplySaveFixCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/DebugCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/DebugCommand.cs index cf1dcbce..f289c669 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/DebugCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/DebugCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Diagnostics.CodeAnalysis; using StardewValley; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/RegenerateBundles.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/RegenerateBundles.cs index 159d7c4a..81a8c570 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/RegenerateBundles.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/RegenerateBundles.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/ShowDataFilesCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/ShowDataFilesCommand.cs index a233d588..d762d8bf 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/ShowDataFilesCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/ShowDataFilesCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Diagnostics; using System.Diagnostics.CodeAnalysis; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/ShowGameFilesCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/ShowGameFilesCommand.cs index 745b821b..b5733eb9 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/ShowGameFilesCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/ShowGameFilesCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Diagnostics; using System.Diagnostics.CodeAnalysis; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/TestInputCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/TestInputCommand.cs index 8bf9f5db..5484fc7c 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/TestInputCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/TestInputCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Diagnostics.CodeAnalysis; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/AddCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/AddCommand.cs index fae31c23..0d8db870 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/AddCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/AddCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Linq; using StardewModdingAPI.Mods.ConsoleCommands.Framework.ItemData; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/ListItemTypesCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/ListItemTypesCommand.cs index ef35ad19..e57d4065 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/ListItemTypesCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/ListItemTypesCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Diagnostics.CodeAnalysis; using System.Linq; using StardewModdingAPI.Mods.ConsoleCommands.Framework.ItemData; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/ListItemsCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/ListItemsCommand.cs index 5cc464fe..5a21b459 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/ListItemsCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/ListItemsCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetColorCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetColorCommand.cs index af7f2d18..e8605163 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetColorCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetColorCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Diagnostics.CodeAnalysis; using Microsoft.Xna.Framework; using StardewValley; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetFarmTypeCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetFarmTypeCommand.cs index 2809df9c..02670911 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetFarmTypeCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetFarmTypeCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections; using System.Collections.Generic; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetHealthCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetHealthCommand.cs index f169159f..1a1a9eab 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetHealthCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetHealthCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Diagnostics.CodeAnalysis; using System.Linq; using StardewValley; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetImmunityCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetImmunityCommand.cs index 1065bd21..d1dede1f 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetImmunityCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetImmunityCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Diagnostics.CodeAnalysis; using System.Linq; using StardewValley; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetMaxHealthCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetMaxHealthCommand.cs index c2c4931d..2b3b140c 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetMaxHealthCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetMaxHealthCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Diagnostics.CodeAnalysis; using System.Linq; using StardewValley; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetMaxStaminaCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetMaxStaminaCommand.cs index 8c794e75..f9ed6c58 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetMaxStaminaCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetMaxStaminaCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Diagnostics.CodeAnalysis; using System.Linq; using StardewValley; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetMoneyCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetMoneyCommand.cs index 3afcc62b..56447a65 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetMoneyCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetMoneyCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Diagnostics.CodeAnalysis; using System.Linq; using StardewValley; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetNameCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetNameCommand.cs index 12d6b6e8..4ce7e1f8 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetNameCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetNameCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Diagnostics.CodeAnalysis; using StardewValley; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetStaminaCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetStaminaCommand.cs index 24718ace..ea8d74c2 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetStaminaCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetStaminaCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Diagnostics.CodeAnalysis; using System.Linq; using StardewValley; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetStyleCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetStyleCommand.cs index 558c327d..84625a34 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetStyleCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetStyleCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Diagnostics.CodeAnalysis; using StardewValley; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs index eeb95553..92c73e08 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Diagnostics.CodeAnalysis; using System.Linq; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/DownMineLevelCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/DownMineLevelCommand.cs index 5b1a4a13..0f18c760 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/DownMineLevelCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/DownMineLevelCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Diagnostics.CodeAnalysis; using StardewValley; using StardewValley.Locations; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/FreezeTimeCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/FreezeTimeCommand.cs index 16faa2fe..8808fe35 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/FreezeTimeCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/FreezeTimeCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Linq; using StardewValley; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/HurryAllCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/HurryAllCommand.cs index 09531720..f9810dc3 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/HurryAllCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/HurryAllCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Diagnostics.CodeAnalysis; using StardewValley; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetDayCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetDayCommand.cs index 399fd934..8aa27d93 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetDayCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetDayCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Diagnostics.CodeAnalysis; using System.Linq; using StardewModdingAPI.Utilities; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetMineLevelCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetMineLevelCommand.cs index f977fce3..ad6ac777 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetMineLevelCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetMineLevelCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Diagnostics.CodeAnalysis; using StardewValley; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetSeasonCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetSeasonCommand.cs index d839c037..ebe58913 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetSeasonCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetSeasonCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Diagnostics.CodeAnalysis; using System.Linq; using StardewModdingAPI.Utilities; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetTimeCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetTimeCommand.cs index 8c4458dd..1e6bab96 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetTimeCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetTimeCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Diagnostics.CodeAnalysis; using System.Linq; using Microsoft.Xna.Framework; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetYearCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetYearCommand.cs index a666a634..995f222e 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetYearCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/SetYearCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Diagnostics.CodeAnalysis; using System.Linq; using StardewModdingAPI.Utilities; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemData/SearchableItem.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemData/SearchableItem.cs index 3675a963..ab0b2e05 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemData/SearchableItem.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemData/SearchableItem.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewValley; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs index 3915db9a..7d2a1662 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/SMAPI.Mods.ConsoleCommands/ModEntry.cs b/src/SMAPI.Mods.ConsoleCommands/ModEntry.cs index 5e594984..e3ca1a39 100644 --- a/src/SMAPI.Mods.ConsoleCommands/ModEntry.cs +++ b/src/SMAPI.Mods.ConsoleCommands/ModEntry.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI.Mods.ErrorHandler/ModEntry.cs b/src/SMAPI.Mods.ErrorHandler/ModEntry.cs index 2d6242cf..fa171012 100644 --- a/src/SMAPI.Mods.ErrorHandler/ModEntry.cs +++ b/src/SMAPI.Mods.ErrorHandler/ModEntry.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Reflection; using StardewModdingAPI.Events; diff --git a/src/SMAPI.Mods.ErrorHandler/Patches/DialoguePatcher.cs b/src/SMAPI.Mods.ErrorHandler/Patches/DialoguePatcher.cs index 7a3af39c..b05c8cca 100644 --- a/src/SMAPI.Mods.ErrorHandler/Patches/DialoguePatcher.cs +++ b/src/SMAPI.Mods.ErrorHandler/Patches/DialoguePatcher.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Diagnostics.CodeAnalysis; using HarmonyLib; diff --git a/src/SMAPI.Mods.ErrorHandler/Patches/EventPatcher.cs b/src/SMAPI.Mods.ErrorHandler/Patches/EventPatcher.cs index 1b706147..63674d09 100644 --- a/src/SMAPI.Mods.ErrorHandler/Patches/EventPatcher.cs +++ b/src/SMAPI.Mods.ErrorHandler/Patches/EventPatcher.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Diagnostics.CodeAnalysis; using HarmonyLib; diff --git a/src/SMAPI.Mods.ErrorHandler/Patches/GameLocationPatcher.cs b/src/SMAPI.Mods.ErrorHandler/Patches/GameLocationPatcher.cs index 7df6b0a2..98aa4a38 100644 --- a/src/SMAPI.Mods.ErrorHandler/Patches/GameLocationPatcher.cs +++ b/src/SMAPI.Mods.ErrorHandler/Patches/GameLocationPatcher.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Diagnostics.CodeAnalysis; using HarmonyLib; diff --git a/src/SMAPI.Mods.ErrorHandler/Patches/IClickableMenuPatcher.cs b/src/SMAPI.Mods.ErrorHandler/Patches/IClickableMenuPatcher.cs index b65a695a..85ce8ac4 100644 --- a/src/SMAPI.Mods.ErrorHandler/Patches/IClickableMenuPatcher.cs +++ b/src/SMAPI.Mods.ErrorHandler/Patches/IClickableMenuPatcher.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Diagnostics.CodeAnalysis; using HarmonyLib; using StardewModdingAPI.Internal.Patching; diff --git a/src/SMAPI.Mods.ErrorHandler/Patches/NpcPatcher.cs b/src/SMAPI.Mods.ErrorHandler/Patches/NpcPatcher.cs index 275bb5bf..5354f724 100644 --- a/src/SMAPI.Mods.ErrorHandler/Patches/NpcPatcher.cs +++ b/src/SMAPI.Mods.ErrorHandler/Patches/NpcPatcher.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/SMAPI.Mods.ErrorHandler/Patches/ObjectPatcher.cs b/src/SMAPI.Mods.ErrorHandler/Patches/ObjectPatcher.cs index fd4ea35c..499718b0 100644 --- a/src/SMAPI.Mods.ErrorHandler/Patches/ObjectPatcher.cs +++ b/src/SMAPI.Mods.ErrorHandler/Patches/ObjectPatcher.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/SMAPI.Mods.ErrorHandler/Patches/SaveGamePatcher.cs b/src/SMAPI.Mods.ErrorHandler/Patches/SaveGamePatcher.cs index 01bfb888..1941d2a8 100644 --- a/src/SMAPI.Mods.ErrorHandler/Patches/SaveGamePatcher.cs +++ b/src/SMAPI.Mods.ErrorHandler/Patches/SaveGamePatcher.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/SMAPI.Mods.ErrorHandler/Patches/SpriteBatchPatcher.cs b/src/SMAPI.Mods.ErrorHandler/Patches/SpriteBatchPatcher.cs index f243c6d1..b4c03bb9 100644 --- a/src/SMAPI.Mods.ErrorHandler/Patches/SpriteBatchPatcher.cs +++ b/src/SMAPI.Mods.ErrorHandler/Patches/SpriteBatchPatcher.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Diagnostics.CodeAnalysis; using HarmonyLib; diff --git a/src/SMAPI.Mods.ErrorHandler/Patches/UtilityPatcher.cs b/src/SMAPI.Mods.ErrorHandler/Patches/UtilityPatcher.cs index ce85d0c2..108ed585 100644 --- a/src/SMAPI.Mods.ErrorHandler/Patches/UtilityPatcher.cs +++ b/src/SMAPI.Mods.ErrorHandler/Patches/UtilityPatcher.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Diagnostics.CodeAnalysis; using HarmonyLib; diff --git a/src/SMAPI.Mods.SaveBackup/ModEntry.cs b/src/SMAPI.Mods.SaveBackup/ModEntry.cs index 273b1434..b2b41ca6 100644 --- a/src/SMAPI.Mods.SaveBackup/ModEntry.cs +++ b/src/SMAPI.Mods.SaveBackup/ModEntry.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Diagnostics; using System.IO; diff --git a/src/SMAPI.Tests.ModApiConsumer/ApiConsumer.cs b/src/SMAPI.Tests.ModApiConsumer/ApiConsumer.cs index ac7bd338..285dd259 100644 --- a/src/SMAPI.Tests.ModApiConsumer/ApiConsumer.cs +++ b/src/SMAPI.Tests.ModApiConsumer/ApiConsumer.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using SMAPI.Tests.ModApiConsumer.Interfaces; diff --git a/src/SMAPI.Tests.ModApiConsumer/Interfaces/ISimpleApi.cs b/src/SMAPI.Tests.ModApiConsumer/Interfaces/ISimpleApi.cs index 7f94e137..23491fd1 100644 --- a/src/SMAPI.Tests.ModApiConsumer/Interfaces/ISimpleApi.cs +++ b/src/SMAPI.Tests.ModApiConsumer/Interfaces/ISimpleApi.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Reflection; diff --git a/src/SMAPI.Tests.ModApiProvider/Framework/BaseApi.cs b/src/SMAPI.Tests.ModApiProvider/Framework/BaseApi.cs index 8092e3e7..b5870baa 100644 --- a/src/SMAPI.Tests.ModApiProvider/Framework/BaseApi.cs +++ b/src/SMAPI.Tests.ModApiProvider/Framework/BaseApi.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace SMAPI.Tests.ModApiProvider.Framework { /// The base class for . diff --git a/src/SMAPI.Tests.ModApiProvider/Framework/SimpleApi.cs b/src/SMAPI.Tests.ModApiProvider/Framework/SimpleApi.cs index 1100af36..82e902f5 100644 --- a/src/SMAPI.Tests.ModApiProvider/Framework/SimpleApi.cs +++ b/src/SMAPI.Tests.ModApiProvider/Framework/SimpleApi.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Reflection; diff --git a/src/SMAPI.Tests.ModApiProvider/ProviderMod.cs b/src/SMAPI.Tests.ModApiProvider/ProviderMod.cs index c36e1c6d..3fc8d749 100644 --- a/src/SMAPI.Tests.ModApiProvider/ProviderMod.cs +++ b/src/SMAPI.Tests.ModApiProvider/ProviderMod.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.Reflection; using SMAPI.Tests.ModApiProvider.Framework; diff --git a/src/SMAPI.Tests/Core/AssetNameTests.cs b/src/SMAPI.Tests/Core/AssetNameTests.cs index 7b817d13..b7e34191 100644 --- a/src/SMAPI.Tests/Core/AssetNameTests.cs +++ b/src/SMAPI.Tests/Core/AssetNameTests.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using FluentAssertions; diff --git a/src/SMAPI.Tests/Core/InterfaceProxyTests.cs b/src/SMAPI.Tests/Core/InterfaceProxyTests.cs index 99c1298f..1bf2ed68 100644 --- a/src/SMAPI.Tests/Core/InterfaceProxyTests.cs +++ b/src/SMAPI.Tests/Core/InterfaceProxyTests.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/SMAPI.Tests/Core/ModResolverTests.cs b/src/SMAPI.Tests/Core/ModResolverTests.cs index 86c50606..2ce1c74e 100644 --- a/src/SMAPI.Tests/Core/ModResolverTests.cs +++ b/src/SMAPI.Tests/Core/ModResolverTests.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/src/SMAPI.Tests/Core/TranslationTests.cs b/src/SMAPI.Tests/Core/TranslationTests.cs index 58bc59b1..f8f0e315 100644 --- a/src/SMAPI.Tests/Core/TranslationTests.cs +++ b/src/SMAPI.Tests/Core/TranslationTests.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI.Tests/Sample.cs b/src/SMAPI.Tests/Sample.cs index 9587a100..6d4339ca 100644 --- a/src/SMAPI.Tests/Sample.cs +++ b/src/SMAPI.Tests/Sample.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace SMAPI.Tests diff --git a/src/SMAPI.Tests/Utilities/KeybindListTests.cs b/src/SMAPI.Tests/Utilities/KeybindListTests.cs index 0bd6ec17..f5c156c4 100644 --- a/src/SMAPI.Tests/Utilities/KeybindListTests.cs +++ b/src/SMAPI.Tests/Utilities/KeybindListTests.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using NUnit.Framework; diff --git a/src/SMAPI.Tests/Utilities/PathUtilitiesTests.cs b/src/SMAPI.Tests/Utilities/PathUtilitiesTests.cs index 94819c2e..ae2cc6ce 100644 --- a/src/SMAPI.Tests/Utilities/PathUtilitiesTests.cs +++ b/src/SMAPI.Tests/Utilities/PathUtilitiesTests.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.IO; using NUnit.Framework; using StardewModdingAPI.Toolkit.Utilities; diff --git a/src/SMAPI.Tests/Utilities/SDateTests.cs b/src/SMAPI.Tests/Utilities/SDateTests.cs index 886f25cd..a4a36828 100644 --- a/src/SMAPI.Tests/Utilities/SDateTests.cs +++ b/src/SMAPI.Tests/Utilities/SDateTests.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs b/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs index 142c9814..66181ea6 100644 --- a/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs +++ b/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Diagnostics.CodeAnalysis; using Newtonsoft.Json; diff --git a/src/SMAPI.Tests/WikiClient/ChangeDescriptorTests.cs b/src/SMAPI.Tests/WikiClient/ChangeDescriptorTests.cs index 84cae8df..7695fbf8 100644 --- a/src/SMAPI.Tests/WikiClient/ChangeDescriptorTests.cs +++ b/src/SMAPI.Tests/WikiClient/ChangeDescriptorTests.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using NUnit.Framework; using StardewModdingAPI; diff --git a/src/SMAPI.Toolkit.CoreInterfaces/IManifest.cs b/src/SMAPI.Toolkit.CoreInterfaces/IManifest.cs index 7375f005..a9251446 100644 --- a/src/SMAPI.Toolkit.CoreInterfaces/IManifest.cs +++ b/src/SMAPI.Toolkit.CoreInterfaces/IManifest.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; namespace StardewModdingAPI diff --git a/src/SMAPI.Toolkit.CoreInterfaces/IManifestContentPackFor.cs b/src/SMAPI.Toolkit.CoreInterfaces/IManifestContentPackFor.cs index f05a3873..d898b716 100644 --- a/src/SMAPI.Toolkit.CoreInterfaces/IManifestContentPackFor.cs +++ b/src/SMAPI.Toolkit.CoreInterfaces/IManifestContentPackFor.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI { /// Indicates which mod can read the content pack represented by the containing manifest. diff --git a/src/SMAPI.Toolkit.CoreInterfaces/IManifestDependency.cs b/src/SMAPI.Toolkit.CoreInterfaces/IManifestDependency.cs index e86cd1f4..49b7aed6 100644 --- a/src/SMAPI.Toolkit.CoreInterfaces/IManifestDependency.cs +++ b/src/SMAPI.Toolkit.CoreInterfaces/IManifestDependency.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI { /// A mod dependency listed in a mod manifest. diff --git a/src/SMAPI.Toolkit.CoreInterfaces/ISemanticVersion.cs b/src/SMAPI.Toolkit.CoreInterfaces/ISemanticVersion.cs index b228b2d1..52cec52e 100644 --- a/src/SMAPI.Toolkit.CoreInterfaces/ISemanticVersion.cs +++ b/src/SMAPI.Toolkit.CoreInterfaces/ISemanticVersion.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI diff --git a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryModel.cs b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryModel.cs index 0115fbf3..d5ca2034 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryModel.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryModel.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi diff --git a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryVersionModel.cs b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryVersionModel.cs index 188db31d..9aac7fd3 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryVersionModel.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryVersionModel.cs @@ -1,3 +1,5 @@ +#nullable disable + using Newtonsoft.Json; using StardewModdingAPI.Toolkit.Serialization.Converters; diff --git a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModExtendedMetadataModel.cs b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModExtendedMetadataModel.cs index 0fa4a74d..eb54ec78 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModExtendedMetadataModel.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModExtendedMetadataModel.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchEntryModel.cs b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchEntryModel.cs index 404d4618..8fe8fa2a 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchEntryModel.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchEntryModel.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi diff --git a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchModel.cs b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchModel.cs index 73698173..393391f7 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchModel.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchModel.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Linq; using StardewModdingAPI.Toolkit.Utilities; diff --git a/src/SMAPI.Toolkit/Framework/Clients/WebApi/WebApiClient.cs b/src/SMAPI.Toolkit/Framework/Clients/WebApi/WebApiClient.cs index f7d26d21..56acb768 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/WebApi/WebApiClient.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/WebApi/WebApiClient.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI.Toolkit/Framework/Clients/Wiki/ChangeDescriptor.cs b/src/SMAPI.Toolkit/Framework/Clients/Wiki/ChangeDescriptor.cs index 2ed255c8..910bf793 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/Wiki/ChangeDescriptor.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/Wiki/ChangeDescriptor.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs index c936bb3e..86c3bd75 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiCompatibilityInfo.cs b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiCompatibilityInfo.cs index 204acd2b..30e76d04 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiCompatibilityInfo.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiCompatibilityInfo.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki { /// Compatibility info for a mod. diff --git a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiCompatibilityStatus.cs b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiCompatibilityStatus.cs index 5cdf489f..2c222b71 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiCompatibilityStatus.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiCompatibilityStatus.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki { /// The compatibility status for a mod. diff --git a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiDataOverrideEntry.cs b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiDataOverrideEntry.cs index 03c0d214..a6f5a88f 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiDataOverrideEntry.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiDataOverrideEntry.cs @@ -1,7 +1,5 @@ using System; -#nullable enable - namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki { /// The data overrides to apply to matching mods. diff --git a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModEntry.cs b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModEntry.cs index 4e0104da..91943ff9 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModEntry.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModEntry.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki { /// A mod entry in the wiki list. diff --git a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModList.cs b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModList.cs index 0d614f28..1787197a 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModList.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModList.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki { /// Metadata from the wiki's mod compatibility list. diff --git a/src/SMAPI.Toolkit/Framework/Constants.cs b/src/SMAPI.Toolkit/Framework/Constants.cs index 55f26582..c3a787c7 100644 --- a/src/SMAPI.Toolkit/Framework/Constants.cs +++ b/src/SMAPI.Toolkit/Framework/Constants.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Toolkit.Framework { /// Contains the SMAPI installer's constants and assumptions. diff --git a/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs b/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs index 768beba1..ac6fe411 100644 --- a/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs +++ b/src/SMAPI.Toolkit/Framework/GameScanning/GameScanner.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/src/SMAPI.Toolkit/Framework/LowLevelEnvironmentUtility.cs b/src/SMAPI.Toolkit/Framework/LowLevelEnvironmentUtility.cs index c0332331..9998edec 100644 --- a/src/SMAPI.Toolkit/Framework/LowLevelEnvironmentUtility.cs +++ b/src/SMAPI.Toolkit/Framework/LowLevelEnvironmentUtility.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Diagnostics; using System.Diagnostics.CodeAnalysis; diff --git a/src/SMAPI.Toolkit/Framework/ModData/MetadataModel.cs b/src/SMAPI.Toolkit/Framework/ModData/MetadataModel.cs index ef6d4dd9..3fa70615 100644 --- a/src/SMAPI.Toolkit/Framework/ModData/MetadataModel.cs +++ b/src/SMAPI.Toolkit/Framework/ModData/MetadataModel.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; namespace StardewModdingAPI.Toolkit.Framework.ModData diff --git a/src/SMAPI.Toolkit/Framework/ModData/ModDataField.cs b/src/SMAPI.Toolkit/Framework/ModData/ModDataField.cs index b02be3e4..46cb81e1 100644 --- a/src/SMAPI.Toolkit/Framework/ModData/ModDataField.cs +++ b/src/SMAPI.Toolkit/Framework/ModData/ModDataField.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Linq; namespace StardewModdingAPI.Toolkit.Framework.ModData diff --git a/src/SMAPI.Toolkit/Framework/ModData/ModDataModel.cs b/src/SMAPI.Toolkit/Framework/ModData/ModDataModel.cs index 2167d3e5..4d96a555 100644 --- a/src/SMAPI.Toolkit/Framework/ModData/ModDataModel.cs +++ b/src/SMAPI.Toolkit/Framework/ModData/ModDataModel.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI.Toolkit/Framework/ModData/ModDataRecord.cs b/src/SMAPI.Toolkit/Framework/ModData/ModDataRecord.cs index 7e07ffde..4c09e1ba 100644 --- a/src/SMAPI.Toolkit/Framework/ModData/ModDataRecord.cs +++ b/src/SMAPI.Toolkit/Framework/ModData/ModDataRecord.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI.Toolkit/Framework/ModData/ModDataRecordVersionedFields.cs b/src/SMAPI.Toolkit/Framework/ModData/ModDataRecordVersionedFields.cs index 5aaabd51..b599b343 100644 --- a/src/SMAPI.Toolkit/Framework/ModData/ModDataRecordVersionedFields.cs +++ b/src/SMAPI.Toolkit/Framework/ModData/ModDataRecordVersionedFields.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Toolkit.Framework.ModData { /// The versioned fields from a for a specific manifest. diff --git a/src/SMAPI.Toolkit/Framework/ModData/ModDatabase.cs b/src/SMAPI.Toolkit/Framework/ModData/ModDatabase.cs index 9bb3f558..a5237334 100644 --- a/src/SMAPI.Toolkit/Framework/ModData/ModDatabase.cs +++ b/src/SMAPI.Toolkit/Framework/ModData/ModDatabase.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI.Toolkit/Framework/ModScanning/ModFolder.cs b/src/SMAPI.Toolkit/Framework/ModScanning/ModFolder.cs index 825b98e5..81d72c0b 100644 --- a/src/SMAPI.Toolkit/Framework/ModScanning/ModFolder.cs +++ b/src/SMAPI.Toolkit/Framework/ModScanning/ModFolder.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs b/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs index e16af3a8..4deaf19b 100644 --- a/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs +++ b/src/SMAPI.Toolkit/Framework/ModScanning/ModScanner.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/src/SMAPI.Toolkit/Framework/SemanticVersionReader.cs b/src/SMAPI.Toolkit/Framework/SemanticVersionReader.cs index 489e1c4d..57eea2f7 100644 --- a/src/SMAPI.Toolkit/Framework/SemanticVersionReader.cs +++ b/src/SMAPI.Toolkit/Framework/SemanticVersionReader.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Toolkit.Framework { /// Reads strings into a semantic version. diff --git a/src/SMAPI.Toolkit/Framework/UpdateData/UpdateKey.cs b/src/SMAPI.Toolkit/Framework/UpdateData/UpdateKey.cs index 077c0361..ec94ed51 100644 --- a/src/SMAPI.Toolkit/Framework/UpdateData/UpdateKey.cs +++ b/src/SMAPI.Toolkit/Framework/UpdateData/UpdateKey.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Toolkit.Framework.UpdateData diff --git a/src/SMAPI.Toolkit/ModToolkit.cs b/src/SMAPI.Toolkit/ModToolkit.cs index 80008df7..9ae8cd1c 100644 --- a/src/SMAPI.Toolkit/ModToolkit.cs +++ b/src/SMAPI.Toolkit/ModToolkit.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.IO; using System.Linq; diff --git a/src/SMAPI.Toolkit/SemanticVersion.cs b/src/SMAPI.Toolkit/SemanticVersion.cs index 2f3e282b..97b92555 100644 --- a/src/SMAPI.Toolkit/SemanticVersion.cs +++ b/src/SMAPI.Toolkit/SemanticVersion.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Text.RegularExpressions; using StardewModdingAPI.Toolkit.Framework; diff --git a/src/SMAPI.Toolkit/SemanticVersionComparer.cs b/src/SMAPI.Toolkit/SemanticVersionComparer.cs index 8eba2c9f..a0472f62 100644 --- a/src/SMAPI.Toolkit/SemanticVersionComparer.cs +++ b/src/SMAPI.Toolkit/SemanticVersionComparer.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; namespace StardewModdingAPI.Toolkit diff --git a/src/SMAPI.Toolkit/Serialization/Converters/ManifestContentPackForConverter.cs b/src/SMAPI.Toolkit/Serialization/Converters/ManifestContentPackForConverter.cs index 5cabe9d8..d2dc0d22 100644 --- a/src/SMAPI.Toolkit/Serialization/Converters/ManifestContentPackForConverter.cs +++ b/src/SMAPI.Toolkit/Serialization/Converters/ManifestContentPackForConverter.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using Newtonsoft.Json; using StardewModdingAPI.Toolkit.Serialization.Models; diff --git a/src/SMAPI.Toolkit/Serialization/Converters/ManifestDependencyArrayConverter.cs b/src/SMAPI.Toolkit/Serialization/Converters/ManifestDependencyArrayConverter.cs index 7b88d6b7..2c3c2ee7 100644 --- a/src/SMAPI.Toolkit/Serialization/Converters/ManifestDependencyArrayConverter.cs +++ b/src/SMAPI.Toolkit/Serialization/Converters/ManifestDependencyArrayConverter.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using Newtonsoft.Json; diff --git a/src/SMAPI.Toolkit/Serialization/Converters/SemanticVersionConverter.cs b/src/SMAPI.Toolkit/Serialization/Converters/SemanticVersionConverter.cs index cf69104d..9205cebe 100644 --- a/src/SMAPI.Toolkit/Serialization/Converters/SemanticVersionConverter.cs +++ b/src/SMAPI.Toolkit/Serialization/Converters/SemanticVersionConverter.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using Newtonsoft.Json; using Newtonsoft.Json.Linq; diff --git a/src/SMAPI.Toolkit/Serialization/Converters/SimpleReadOnlyConverter.cs b/src/SMAPI.Toolkit/Serialization/Converters/SimpleReadOnlyConverter.cs index ccc5158b..c923350c 100644 --- a/src/SMAPI.Toolkit/Serialization/Converters/SimpleReadOnlyConverter.cs +++ b/src/SMAPI.Toolkit/Serialization/Converters/SimpleReadOnlyConverter.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using Newtonsoft.Json; using Newtonsoft.Json.Linq; diff --git a/src/SMAPI.Toolkit/Serialization/InternalExtensions.cs b/src/SMAPI.Toolkit/Serialization/InternalExtensions.cs index 10f88dde..1fce5f9d 100644 --- a/src/SMAPI.Toolkit/Serialization/InternalExtensions.cs +++ b/src/SMAPI.Toolkit/Serialization/InternalExtensions.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using Newtonsoft.Json.Linq; diff --git a/src/SMAPI.Toolkit/Serialization/JsonHelper.cs b/src/SMAPI.Toolkit/Serialization/JsonHelper.cs index 91c2e9d3..9700e712 100644 --- a/src/SMAPI.Toolkit/Serialization/JsonHelper.cs +++ b/src/SMAPI.Toolkit/Serialization/JsonHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/src/SMAPI.Toolkit/Serialization/Models/Manifest.cs b/src/SMAPI.Toolkit/Serialization/Models/Manifest.cs index 4ad97b6d..a5dbf604 100644 --- a/src/SMAPI.Toolkit/Serialization/Models/Manifest.cs +++ b/src/SMAPI.Toolkit/Serialization/Models/Manifest.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Runtime.Serialization; diff --git a/src/SMAPI.Toolkit/Serialization/Models/ManifestContentPackFor.cs b/src/SMAPI.Toolkit/Serialization/Models/ManifestContentPackFor.cs index 1eb80889..ea5f0e6c 100644 --- a/src/SMAPI.Toolkit/Serialization/Models/ManifestContentPackFor.cs +++ b/src/SMAPI.Toolkit/Serialization/Models/ManifestContentPackFor.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Toolkit.Serialization.Models { /// Indicates which mod can read the content pack represented by the containing manifest. diff --git a/src/SMAPI.Toolkit/Serialization/Models/ManifestDependency.cs b/src/SMAPI.Toolkit/Serialization/Models/ManifestDependency.cs index 00f168f4..f52dd5ee 100644 --- a/src/SMAPI.Toolkit/Serialization/Models/ManifestDependency.cs +++ b/src/SMAPI.Toolkit/Serialization/Models/ManifestDependency.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Toolkit.Serialization.Models { /// A mod dependency listed in a mod manifest. diff --git a/src/SMAPI.Toolkit/Serialization/SParseException.cs b/src/SMAPI.Toolkit/Serialization/SParseException.cs index 5f58b5b8..1581e027 100644 --- a/src/SMAPI.Toolkit/Serialization/SParseException.cs +++ b/src/SMAPI.Toolkit/Serialization/SParseException.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Toolkit.Serialization diff --git a/src/SMAPI.Toolkit/Utilities/EnvironmentUtility.cs b/src/SMAPI.Toolkit/Utilities/EnvironmentUtility.cs index 7536337a..f14678be 100644 --- a/src/SMAPI.Toolkit/Utilities/EnvironmentUtility.cs +++ b/src/SMAPI.Toolkit/Utilities/EnvironmentUtility.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Diagnostics.CodeAnalysis; using StardewModdingAPI.Toolkit.Framework; diff --git a/src/SMAPI.Toolkit/Utilities/FileUtilities.cs b/src/SMAPI.Toolkit/Utilities/FileUtilities.cs index a6bf5929..ba2d0f47 100644 --- a/src/SMAPI.Toolkit/Utilities/FileUtilities.cs +++ b/src/SMAPI.Toolkit/Utilities/FileUtilities.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.IO; using System.Security.Cryptography; diff --git a/src/SMAPI.Toolkit/Utilities/PathUtilities.cs b/src/SMAPI.Toolkit/Utilities/PathUtilities.cs index 85e12bfa..9a0e2ea7 100644 --- a/src/SMAPI.Toolkit/Utilities/PathUtilities.cs +++ b/src/SMAPI.Toolkit/Utilities/PathUtilities.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Diagnostics.Contracts; using System.IO; diff --git a/src/SMAPI.Web/BackgroundService.cs b/src/SMAPI.Web/BackgroundService.cs index 64bd5ca5..7706b276 100644 --- a/src/SMAPI.Web/BackgroundService.cs +++ b/src/SMAPI.Web/BackgroundService.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Diagnostics.CodeAnalysis; using System.Threading; diff --git a/src/SMAPI.Web/Controllers/IndexController.cs b/src/SMAPI.Web/Controllers/IndexController.cs index 69b54f47..f7834b9c 100644 --- a/src/SMAPI.Web/Controllers/IndexController.cs +++ b/src/SMAPI.Web/Controllers/IndexController.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI.Web/Controllers/JsonValidatorController.cs b/src/SMAPI.Web/Controllers/JsonValidatorController.cs index 985f91ae..5791d834 100644 --- a/src/SMAPI.Web/Controllers/JsonValidatorController.cs +++ b/src/SMAPI.Web/Controllers/JsonValidatorController.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/src/SMAPI.Web/Controllers/LogParserController.cs b/src/SMAPI.Web/Controllers/LogParserController.cs index db53d942..524cfbcc 100644 --- a/src/SMAPI.Web/Controllers/LogParserController.cs +++ b/src/SMAPI.Web/Controllers/LogParserController.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Linq; using System.Text; diff --git a/src/SMAPI.Web/Controllers/ModsApiController.cs b/src/SMAPI.Web/Controllers/ModsApiController.cs index 5329df99..3dc1e366 100644 --- a/src/SMAPI.Web/Controllers/ModsApiController.cs +++ b/src/SMAPI.Web/Controllers/ModsApiController.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/src/SMAPI.Web/Controllers/ModsController.cs b/src/SMAPI.Web/Controllers/ModsController.cs index c62ed605..5292e1ce 100644 --- a/src/SMAPI.Web/Controllers/ModsController.cs +++ b/src/SMAPI.Web/Controllers/ModsController.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Linq; using System.Text.RegularExpressions; using Microsoft.AspNetCore.Mvc; diff --git a/src/SMAPI.Web/Framework/AllowLargePostsAttribute.cs b/src/SMAPI.Web/Framework/AllowLargePostsAttribute.cs index 864aa215..108ceff7 100644 --- a/src/SMAPI.Web/Framework/AllowLargePostsAttribute.cs +++ b/src/SMAPI.Web/Framework/AllowLargePostsAttribute.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Mvc.Filters; diff --git a/src/SMAPI.Web/Framework/Caching/Cached.cs b/src/SMAPI.Web/Framework/Caching/Cached.cs index 52041a16..aabbf146 100644 --- a/src/SMAPI.Web/Framework/Caching/Cached.cs +++ b/src/SMAPI.Web/Framework/Caching/Cached.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Web.Framework.Caching diff --git a/src/SMAPI.Web/Framework/Caching/Mods/IModCacheRepository.cs b/src/SMAPI.Web/Framework/Caching/Mods/IModCacheRepository.cs index a16e6b73..2020d747 100644 --- a/src/SMAPI.Web/Framework/Caching/Mods/IModCacheRepository.cs +++ b/src/SMAPI.Web/Framework/Caching/Mods/IModCacheRepository.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewModdingAPI.Toolkit.Framework.UpdateData; diff --git a/src/SMAPI.Web/Framework/Caching/Mods/ModCacheMemoryRepository.cs b/src/SMAPI.Web/Framework/Caching/Mods/ModCacheMemoryRepository.cs index f871a9da..338562d8 100644 --- a/src/SMAPI.Web/Framework/Caching/Mods/ModCacheMemoryRepository.cs +++ b/src/SMAPI.Web/Framework/Caching/Mods/ModCacheMemoryRepository.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI.Web/Framework/Caching/Wiki/IWikiCacheRepository.cs b/src/SMAPI.Web/Framework/Caching/Wiki/IWikiCacheRepository.cs index 2ab7ea5a..6edafddc 100644 --- a/src/SMAPI.Web/Framework/Caching/Wiki/IWikiCacheRepository.cs +++ b/src/SMAPI.Web/Framework/Caching/Wiki/IWikiCacheRepository.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using StardewModdingAPI.Toolkit.Framework.Clients.Wiki; diff --git a/src/SMAPI.Web/Framework/Caching/Wiki/WikiCacheMemoryRepository.cs b/src/SMAPI.Web/Framework/Caching/Wiki/WikiCacheMemoryRepository.cs index d037a123..d1ccb9c7 100644 --- a/src/SMAPI.Web/Framework/Caching/Wiki/WikiCacheMemoryRepository.cs +++ b/src/SMAPI.Web/Framework/Caching/Wiki/WikiCacheMemoryRepository.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI.Web/Framework/Caching/Wiki/WikiMetadata.cs b/src/SMAPI.Web/Framework/Caching/Wiki/WikiMetadata.cs index c04de4a5..6ae42488 100644 --- a/src/SMAPI.Web/Framework/Caching/Wiki/WikiMetadata.cs +++ b/src/SMAPI.Web/Framework/Caching/Wiki/WikiMetadata.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Web.Framework.Caching.Wiki { /// The model for cached wiki metadata. diff --git a/src/SMAPI.Web/Framework/Clients/Chucklefish/ChucklefishClient.cs b/src/SMAPI.Web/Framework/Clients/Chucklefish/ChucklefishClient.cs index 269a04d4..4d041c1b 100644 --- a/src/SMAPI.Web/Framework/Clients/Chucklefish/ChucklefishClient.cs +++ b/src/SMAPI.Web/Framework/Clients/Chucklefish/ChucklefishClient.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Net; using System.Threading.Tasks; diff --git a/src/SMAPI.Web/Framework/Clients/CurseForge/CurseForgeClient.cs b/src/SMAPI.Web/Framework/Clients/CurseForge/CurseForgeClient.cs index 50a3336d..5ef369d5 100644 --- a/src/SMAPI.Web/Framework/Clients/CurseForge/CurseForgeClient.cs +++ b/src/SMAPI.Web/Framework/Clients/CurseForge/CurseForgeClient.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.Text.RegularExpressions; using System.Threading.Tasks; diff --git a/src/SMAPI.Web/Framework/Clients/CurseForge/ResponseModels/ModFileModel.cs b/src/SMAPI.Web/Framework/Clients/CurseForge/ResponseModels/ModFileModel.cs index 9de74847..eabef9f0 100644 --- a/src/SMAPI.Web/Framework/Clients/CurseForge/ResponseModels/ModFileModel.cs +++ b/src/SMAPI.Web/Framework/Clients/CurseForge/ResponseModels/ModFileModel.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Web.Framework.Clients.CurseForge.ResponseModels { /// Metadata from the CurseForge API about a mod file. diff --git a/src/SMAPI.Web/Framework/Clients/CurseForge/ResponseModels/ModModel.cs b/src/SMAPI.Web/Framework/Clients/CurseForge/ResponseModels/ModModel.cs index 48cd185b..a95df7f1 100644 --- a/src/SMAPI.Web/Framework/Clients/CurseForge/ResponseModels/ModModel.cs +++ b/src/SMAPI.Web/Framework/Clients/CurseForge/ResponseModels/ModModel.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Web.Framework.Clients.CurseForge.ResponseModels { /// An mod from the CurseForge API. diff --git a/src/SMAPI.Web/Framework/Clients/GenericModDownload.cs b/src/SMAPI.Web/Framework/Clients/GenericModDownload.cs index f08b471c..919072b0 100644 --- a/src/SMAPI.Web/Framework/Clients/GenericModDownload.cs +++ b/src/SMAPI.Web/Framework/Clients/GenericModDownload.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Web.Framework.Clients { /// Generic metadata about a file download on a mod page. diff --git a/src/SMAPI.Web/Framework/Clients/GenericModPage.cs b/src/SMAPI.Web/Framework/Clients/GenericModPage.cs index a5f7c9b9..4788aa2a 100644 --- a/src/SMAPI.Web/Framework/Clients/GenericModPage.cs +++ b/src/SMAPI.Web/Framework/Clients/GenericModPage.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI.Web/Framework/Clients/GitHub/GitAsset.cs b/src/SMAPI.Web/Framework/Clients/GitHub/GitAsset.cs index 73ce4025..39ebf94e 100644 --- a/src/SMAPI.Web/Framework/Clients/GitHub/GitAsset.cs +++ b/src/SMAPI.Web/Framework/Clients/GitHub/GitAsset.cs @@ -1,3 +1,5 @@ +#nullable disable + using Newtonsoft.Json; namespace StardewModdingAPI.Web.Framework.Clients.GitHub diff --git a/src/SMAPI.Web/Framework/Clients/GitHub/GitHubClient.cs b/src/SMAPI.Web/Framework/Clients/GitHub/GitHubClient.cs index 671f077c..0e68e2c2 100644 --- a/src/SMAPI.Web/Framework/Clients/GitHub/GitHubClient.cs +++ b/src/SMAPI.Web/Framework/Clients/GitHub/GitHubClient.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Linq; using System.Net; diff --git a/src/SMAPI.Web/Framework/Clients/GitHub/GitLicense.cs b/src/SMAPI.Web/Framework/Clients/GitHub/GitLicense.cs index 736efbe6..275c775a 100644 --- a/src/SMAPI.Web/Framework/Clients/GitHub/GitLicense.cs +++ b/src/SMAPI.Web/Framework/Clients/GitHub/GitLicense.cs @@ -1,3 +1,5 @@ +#nullable disable + using Newtonsoft.Json; namespace StardewModdingAPI.Web.Framework.Clients.GitHub diff --git a/src/SMAPI.Web/Framework/Clients/GitHub/GitRelease.cs b/src/SMAPI.Web/Framework/Clients/GitHub/GitRelease.cs index d0db5297..383775d2 100644 --- a/src/SMAPI.Web/Framework/Clients/GitHub/GitRelease.cs +++ b/src/SMAPI.Web/Framework/Clients/GitHub/GitRelease.cs @@ -1,3 +1,5 @@ +#nullable disable + using Newtonsoft.Json; namespace StardewModdingAPI.Web.Framework.Clients.GitHub diff --git a/src/SMAPI.Web/Framework/Clients/GitHub/GitRepo.cs b/src/SMAPI.Web/Framework/Clients/GitHub/GitRepo.cs index 7d80576e..5b5ce6a6 100644 --- a/src/SMAPI.Web/Framework/Clients/GitHub/GitRepo.cs +++ b/src/SMAPI.Web/Framework/Clients/GitHub/GitRepo.cs @@ -1,3 +1,5 @@ +#nullable disable + using Newtonsoft.Json; namespace StardewModdingAPI.Web.Framework.Clients.GitHub diff --git a/src/SMAPI.Web/Framework/Clients/GitHub/IGitHubClient.cs b/src/SMAPI.Web/Framework/Clients/GitHub/IGitHubClient.cs index 0d6f4643..e1961416 100644 --- a/src/SMAPI.Web/Framework/Clients/GitHub/IGitHubClient.cs +++ b/src/SMAPI.Web/Framework/Clients/GitHub/IGitHubClient.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Threading.Tasks; diff --git a/src/SMAPI.Web/Framework/Clients/IModSiteClient.cs b/src/SMAPI.Web/Framework/Clients/IModSiteClient.cs index 33277711..2cd1f635 100644 --- a/src/SMAPI.Web/Framework/Clients/IModSiteClient.cs +++ b/src/SMAPI.Web/Framework/Clients/IModSiteClient.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Threading.Tasks; using StardewModdingAPI.Toolkit.Framework.UpdateData; diff --git a/src/SMAPI.Web/Framework/Clients/ModDrop/ModDropClient.cs b/src/SMAPI.Web/Framework/Clients/ModDrop/ModDropClient.cs index 3a1c5b9d..1a11a606 100644 --- a/src/SMAPI.Web/Framework/Clients/ModDrop/ModDropClient.cs +++ b/src/SMAPI.Web/Framework/Clients/ModDrop/ModDropClient.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.Threading.Tasks; using Pathoschild.Http.Client; diff --git a/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/FileDataModel.cs b/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/FileDataModel.cs index b01196f4..dd6a95e0 100644 --- a/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/FileDataModel.cs +++ b/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/FileDataModel.cs @@ -1,3 +1,5 @@ +#nullable disable + using Newtonsoft.Json; namespace StardewModdingAPI.Web.Framework.Clients.ModDrop.ResponseModels diff --git a/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModDataModel.cs b/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModDataModel.cs index cfdd6a4e..6cae16d9 100644 --- a/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModDataModel.cs +++ b/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModDataModel.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Web.Framework.Clients.ModDrop.ResponseModels { /// Metadata about a mod from the ModDrop API. diff --git a/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModListModel.cs b/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModListModel.cs index 7f692ca1..445e25cb 100644 --- a/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModListModel.cs +++ b/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModListModel.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; namespace StardewModdingAPI.Web.Framework.Clients.ModDrop.ResponseModels diff --git a/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModModel.cs b/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModModel.cs index 9f4b2c6f..8869193e 100644 --- a/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModModel.cs +++ b/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModModel.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Web.Framework.Clients.ModDrop.ResponseModels { /// An entry in a mod list from the ModDrop API. diff --git a/src/SMAPI.Web/Framework/Clients/Nexus/NexusClient.cs b/src/SMAPI.Web/Framework/Clients/Nexus/NexusClient.cs index a6da0c1c..dd0bb94f 100644 --- a/src/SMAPI.Web/Framework/Clients/Nexus/NexusClient.cs +++ b/src/SMAPI.Web/Framework/Clients/Nexus/NexusClient.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI.Web/Framework/Clients/Nexus/ResponseModels/NexusMod.cs b/src/SMAPI.Web/Framework/Clients/Nexus/ResponseModels/NexusMod.cs index aef90ede..358c4633 100644 --- a/src/SMAPI.Web/Framework/Clients/Nexus/ResponseModels/NexusMod.cs +++ b/src/SMAPI.Web/Framework/Clients/Nexus/ResponseModels/NexusMod.cs @@ -1,3 +1,5 @@ +#nullable disable + using Newtonsoft.Json; namespace StardewModdingAPI.Web.Framework.Clients.Nexus.ResponseModels diff --git a/src/SMAPI.Web/Framework/Clients/Pastebin/IPastebinClient.cs b/src/SMAPI.Web/Framework/Clients/Pastebin/IPastebinClient.cs index 431fed7b..03c78e01 100644 --- a/src/SMAPI.Web/Framework/Clients/Pastebin/IPastebinClient.cs +++ b/src/SMAPI.Web/Framework/Clients/Pastebin/IPastebinClient.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Threading.Tasks; diff --git a/src/SMAPI.Web/Framework/Clients/Pastebin/PasteInfo.cs b/src/SMAPI.Web/Framework/Clients/Pastebin/PasteInfo.cs index 813ea115..2d48a7ae 100644 --- a/src/SMAPI.Web/Framework/Clients/Pastebin/PasteInfo.cs +++ b/src/SMAPI.Web/Framework/Clients/Pastebin/PasteInfo.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Web.Framework.Clients.Pastebin { /// The response for a get-paste request. diff --git a/src/SMAPI.Web/Framework/Clients/Pastebin/PastebinClient.cs b/src/SMAPI.Web/Framework/Clients/Pastebin/PastebinClient.cs index 1be00be7..d0cdf374 100644 --- a/src/SMAPI.Web/Framework/Clients/Pastebin/PastebinClient.cs +++ b/src/SMAPI.Web/Framework/Clients/Pastebin/PastebinClient.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Net; using System.Threading.Tasks; diff --git a/src/SMAPI.Web/Framework/Compression/GzipHelper.cs b/src/SMAPI.Web/Framework/Compression/GzipHelper.cs index 93cde9d3..843b7735 100644 --- a/src/SMAPI.Web/Framework/Compression/GzipHelper.cs +++ b/src/SMAPI.Web/Framework/Compression/GzipHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.IO; using System.IO.Compression; diff --git a/src/SMAPI.Web/Framework/Compression/IGzipHelper.cs b/src/SMAPI.Web/Framework/Compression/IGzipHelper.cs index a000865e..e1ec9b67 100644 --- a/src/SMAPI.Web/Framework/Compression/IGzipHelper.cs +++ b/src/SMAPI.Web/Framework/Compression/IGzipHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Web.Framework.Compression { /// Handles GZip compression logic. diff --git a/src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs b/src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs index 878130bf..3730a9db 100644 --- a/src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs +++ b/src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Web.Framework.ConfigModels { /// The config settings for the API clients. diff --git a/src/SMAPI.Web/Framework/ConfigModels/ModOverrideConfig.cs b/src/SMAPI.Web/Framework/ConfigModels/ModOverrideConfig.cs index f382d7b5..682c97e6 100644 --- a/src/SMAPI.Web/Framework/ConfigModels/ModOverrideConfig.cs +++ b/src/SMAPI.Web/Framework/ConfigModels/ModOverrideConfig.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Web.Framework.ConfigModels { /// Override update-check metadata for a mod. diff --git a/src/SMAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs b/src/SMAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs index aea695b8..e525e09a 100644 --- a/src/SMAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs +++ b/src/SMAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Web.Framework.ConfigModels { /// The config settings for mod update checks. diff --git a/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs b/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs index 664dbef3..ef6c2659 100644 --- a/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs +++ b/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Web.Framework.ConfigModels { /// The site config settings. diff --git a/src/SMAPI.Web/Framework/ConfigModels/SmapiInfoConfig.cs b/src/SMAPI.Web/Framework/ConfigModels/SmapiInfoConfig.cs index d69fabb3..dbf58817 100644 --- a/src/SMAPI.Web/Framework/ConfigModels/SmapiInfoConfig.cs +++ b/src/SMAPI.Web/Framework/ConfigModels/SmapiInfoConfig.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Web.Framework.ConfigModels { /// The update-check config for SMAPI's own update checks. diff --git a/src/SMAPI.Web/Framework/Extensions.cs b/src/SMAPI.Web/Framework/Extensions.cs index 2e767b3d..a72c12c1 100644 --- a/src/SMAPI.Web/Framework/Extensions.cs +++ b/src/SMAPI.Web/Framework/Extensions.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using JetBrains.Annotations; using Microsoft.AspNetCore.Html; diff --git a/src/SMAPI.Web/Framework/IModDownload.cs b/src/SMAPI.Web/Framework/IModDownload.cs index dc058bcb..b8d1f62c 100644 --- a/src/SMAPI.Web/Framework/IModDownload.cs +++ b/src/SMAPI.Web/Framework/IModDownload.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Web.Framework { /// Generic metadata about a file download on a mod page. diff --git a/src/SMAPI.Web/Framework/IModPage.cs b/src/SMAPI.Web/Framework/IModPage.cs index e66d401f..68220b49 100644 --- a/src/SMAPI.Web/Framework/IModPage.cs +++ b/src/SMAPI.Web/Framework/IModPage.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using StardewModdingAPI.Toolkit.Framework.UpdateData; diff --git a/src/SMAPI.Web/Framework/InternalControllerFeatureProvider.cs b/src/SMAPI.Web/Framework/InternalControllerFeatureProvider.cs index 2c24c610..98738a82 100644 --- a/src/SMAPI.Web/Framework/InternalControllerFeatureProvider.cs +++ b/src/SMAPI.Web/Framework/InternalControllerFeatureProvider.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Reflection; using Microsoft.AspNetCore.Mvc; diff --git a/src/SMAPI.Web/Framework/JobDashboardAuthorizationFilter.cs b/src/SMAPI.Web/Framework/JobDashboardAuthorizationFilter.cs index 3c1405eb..8db43dca 100644 --- a/src/SMAPI.Web/Framework/JobDashboardAuthorizationFilter.cs +++ b/src/SMAPI.Web/Framework/JobDashboardAuthorizationFilter.cs @@ -1,3 +1,5 @@ +#nullable disable + using Hangfire.Dashboard; namespace StardewModdingAPI.Web.Framework diff --git a/src/SMAPI.Web/Framework/LogParsing/LogMessageBuilder.cs b/src/SMAPI.Web/Framework/LogParsing/LogMessageBuilder.cs index 9da27d61..1b692e63 100644 --- a/src/SMAPI.Web/Framework/LogParsing/LogMessageBuilder.cs +++ b/src/SMAPI.Web/Framework/LogParsing/LogMessageBuilder.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Text; using StardewModdingAPI.Web.Framework.LogParsing.Models; diff --git a/src/SMAPI.Web/Framework/LogParsing/LogParseException.cs b/src/SMAPI.Web/Framework/LogParsing/LogParseException.cs index 5d4c8c08..4ee58433 100644 --- a/src/SMAPI.Web/Framework/LogParsing/LogParseException.cs +++ b/src/SMAPI.Web/Framework/LogParsing/LogParseException.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Web.Framework.LogParsing @@ -10,6 +12,7 @@ namespace StardewModdingAPI.Web.Framework.LogParsing *********/ /// Construct an instance. /// The user-friendly error message. - public LogParseException(string message) : base(message) { } + public LogParseException(string message) + : base(message) { } } } diff --git a/src/SMAPI.Web/Framework/LogParsing/LogParser.cs b/src/SMAPI.Web/Framework/LogParsing/LogParser.cs index 864caef1..4e61ac95 100644 --- a/src/SMAPI.Web/Framework/LogParsing/LogParser.cs +++ b/src/SMAPI.Web/Framework/LogParsing/LogParser.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/src/SMAPI.Web/Framework/LogParsing/Models/LogMessage.cs b/src/SMAPI.Web/Framework/LogParsing/Models/LogMessage.cs index 1e08be78..57d28755 100644 --- a/src/SMAPI.Web/Framework/LogParsing/Models/LogMessage.cs +++ b/src/SMAPI.Web/Framework/LogParsing/Models/LogMessage.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Web.Framework.LogParsing.Models { /// A parsed log message. diff --git a/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs b/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs index 92bfe5c7..349312df 100644 --- a/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs +++ b/src/SMAPI.Web/Framework/LogParsing/Models/LogModInfo.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Web.Framework.LogParsing.Models { /// Metadata about a mod or content pack in the log. diff --git a/src/SMAPI.Web/Framework/LogParsing/Models/ParsedLog.cs b/src/SMAPI.Web/Framework/LogParsing/Models/ParsedLog.cs index 693a16ec..dae91d84 100644 --- a/src/SMAPI.Web/Framework/LogParsing/Models/ParsedLog.cs +++ b/src/SMAPI.Web/Framework/LogParsing/Models/ParsedLog.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Web.Framework.LogParsing.Models diff --git a/src/SMAPI.Web/Framework/ModInfoModel.cs b/src/SMAPI.Web/Framework/ModInfoModel.cs index 86f70788..021d14fb 100644 --- a/src/SMAPI.Web/Framework/ModInfoModel.cs +++ b/src/SMAPI.Web/Framework/ModInfoModel.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Web.Framework { /// Generic metadata about a mod. diff --git a/src/SMAPI.Web/Framework/ModSiteManager.cs b/src/SMAPI.Web/Framework/ModSiteManager.cs index a2b92aa4..2d6755d8 100644 --- a/src/SMAPI.Web/Framework/ModSiteManager.cs +++ b/src/SMAPI.Web/Framework/ModSiteManager.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI.Web/Framework/RedirectRules/RedirectHostsToUrlsRule.cs b/src/SMAPI.Web/Framework/RedirectRules/RedirectHostsToUrlsRule.cs index d67b5156..fe601524 100644 --- a/src/SMAPI.Web/Framework/RedirectRules/RedirectHostsToUrlsRule.cs +++ b/src/SMAPI.Web/Framework/RedirectRules/RedirectHostsToUrlsRule.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Net; using Microsoft.AspNetCore.Rewrite; diff --git a/src/SMAPI.Web/Framework/RedirectRules/RedirectMatchRule.cs b/src/SMAPI.Web/Framework/RedirectRules/RedirectMatchRule.cs index 6e81c4ca..81a265c9 100644 --- a/src/SMAPI.Web/Framework/RedirectRules/RedirectMatchRule.cs +++ b/src/SMAPI.Web/Framework/RedirectRules/RedirectMatchRule.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Net; using Microsoft.AspNetCore.Http; diff --git a/src/SMAPI.Web/Framework/RedirectRules/RedirectPathsToUrlsRule.cs b/src/SMAPI.Web/Framework/RedirectRules/RedirectPathsToUrlsRule.cs index d9d44641..cb3e53ef 100644 --- a/src/SMAPI.Web/Framework/RedirectRules/RedirectPathsToUrlsRule.cs +++ b/src/SMAPI.Web/Framework/RedirectRules/RedirectPathsToUrlsRule.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.Linq; using System.Net; diff --git a/src/SMAPI.Web/Framework/RedirectRules/RedirectToHttpsRule.cs b/src/SMAPI.Web/Framework/RedirectRules/RedirectToHttpsRule.cs index 265a605f..dd7c836f 100644 --- a/src/SMAPI.Web/Framework/RedirectRules/RedirectToHttpsRule.cs +++ b/src/SMAPI.Web/Framework/RedirectRules/RedirectToHttpsRule.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Net; using Microsoft.AspNetCore.Http; diff --git a/src/SMAPI.Web/Framework/Storage/IStorageProvider.cs b/src/SMAPI.Web/Framework/Storage/IStorageProvider.cs index dfc1fb47..2eca4845 100644 --- a/src/SMAPI.Web/Framework/Storage/IStorageProvider.cs +++ b/src/SMAPI.Web/Framework/Storage/IStorageProvider.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Threading.Tasks; namespace StardewModdingAPI.Web.Framework.Storage diff --git a/src/SMAPI.Web/Framework/Storage/StorageProvider.cs b/src/SMAPI.Web/Framework/Storage/StorageProvider.cs index 1104df89..0177e602 100644 --- a/src/SMAPI.Web/Framework/Storage/StorageProvider.cs +++ b/src/SMAPI.Web/Framework/Storage/StorageProvider.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/src/SMAPI.Web/Framework/Storage/StoredFileInfo.cs b/src/SMAPI.Web/Framework/Storage/StoredFileInfo.cs index 30676c88..cd941c94 100644 --- a/src/SMAPI.Web/Framework/Storage/StoredFileInfo.cs +++ b/src/SMAPI.Web/Framework/Storage/StoredFileInfo.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Web.Framework.Storage diff --git a/src/SMAPI.Web/Framework/Storage/UploadResult.cs b/src/SMAPI.Web/Framework/Storage/UploadResult.cs index 483c1769..b1eedd59 100644 --- a/src/SMAPI.Web/Framework/Storage/UploadResult.cs +++ b/src/SMAPI.Web/Framework/Storage/UploadResult.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Web.Framework.Storage { /// The result of an attempt to upload a file. diff --git a/src/SMAPI.Web/Framework/VersionConstraint.cs b/src/SMAPI.Web/Framework/VersionConstraint.cs index f0c57c41..f230a95b 100644 --- a/src/SMAPI.Web/Framework/VersionConstraint.cs +++ b/src/SMAPI.Web/Framework/VersionConstraint.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing; diff --git a/src/SMAPI.Web/Program.cs b/src/SMAPI.Web/Program.cs index 1fdd3185..5134791a 100644 --- a/src/SMAPI.Web/Program.cs +++ b/src/SMAPI.Web/Program.cs @@ -1,3 +1,5 @@ +#nullable disable + using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; diff --git a/src/SMAPI.Web/Startup.cs b/src/SMAPI.Web/Startup.cs index 6d9591ee..0199938d 100644 --- a/src/SMAPI.Web/Startup.cs +++ b/src/SMAPI.Web/Startup.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.Net; using Hangfire; diff --git a/src/SMAPI.Web/ViewModels/IndexModel.cs b/src/SMAPI.Web/ViewModels/IndexModel.cs index d8d2d27f..2283acd9 100644 --- a/src/SMAPI.Web/ViewModels/IndexModel.cs +++ b/src/SMAPI.Web/ViewModels/IndexModel.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Web.ViewModels { /// The view model for the index page. diff --git a/src/SMAPI.Web/ViewModels/IndexVersionModel.cs b/src/SMAPI.Web/ViewModels/IndexVersionModel.cs index 4f63b979..1f5d4ec0 100644 --- a/src/SMAPI.Web/ViewModels/IndexVersionModel.cs +++ b/src/SMAPI.Web/ViewModels/IndexVersionModel.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Web.ViewModels { /// The fields for a SMAPI version. diff --git a/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorErrorModel.cs b/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorErrorModel.cs index 62b95501..3c63b730 100644 --- a/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorErrorModel.cs +++ b/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorErrorModel.cs @@ -1,3 +1,5 @@ +#nullable disable + using Newtonsoft.Json.Schema; namespace StardewModdingAPI.Web.ViewModels.JsonValidator diff --git a/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorModel.cs b/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorModel.cs index e659b389..2543807f 100644 --- a/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorModel.cs +++ b/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorModel.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorRequestModel.cs b/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorRequestModel.cs index c8e851bf..43114d94 100644 --- a/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorRequestModel.cs +++ b/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorRequestModel.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Web.ViewModels.JsonValidator { /// The view model for a JSON validation request. diff --git a/src/SMAPI.Web/ViewModels/LogParserModel.cs b/src/SMAPI.Web/ViewModels/LogParserModel.cs index 5aa2fd92..c768a08c 100644 --- a/src/SMAPI.Web/ViewModels/LogParserModel.cs +++ b/src/SMAPI.Web/ViewModels/LogParserModel.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI.Web/ViewModels/ModCompatibilityModel.cs b/src/SMAPI.Web/ViewModels/ModCompatibilityModel.cs index 85bf1e46..2af30cc3 100644 --- a/src/SMAPI.Web/ViewModels/ModCompatibilityModel.cs +++ b/src/SMAPI.Web/ViewModels/ModCompatibilityModel.cs @@ -1,3 +1,5 @@ +#nullable disable + using StardewModdingAPI.Toolkit.Framework.Clients.Wiki; namespace StardewModdingAPI.Web.ViewModels diff --git a/src/SMAPI.Web/ViewModels/ModLinkModel.cs b/src/SMAPI.Web/ViewModels/ModLinkModel.cs index 97dd215c..3039702e 100644 --- a/src/SMAPI.Web/ViewModels/ModLinkModel.cs +++ b/src/SMAPI.Web/ViewModels/ModLinkModel.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Web.ViewModels { /// Metadata about a link. diff --git a/src/SMAPI.Web/ViewModels/ModListModel.cs b/src/SMAPI.Web/ViewModels/ModListModel.cs index 6b8279c1..f0cf0c3a 100644 --- a/src/SMAPI.Web/ViewModels/ModListModel.cs +++ b/src/SMAPI.Web/ViewModels/ModListModel.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI.Web/ViewModels/ModModel.cs b/src/SMAPI.Web/ViewModels/ModModel.cs index 575d596a..d0d7373b 100644 --- a/src/SMAPI.Web/ViewModels/ModModel.cs +++ b/src/SMAPI.Web/ViewModels/ModModel.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.Linq; using StardewModdingAPI.Toolkit.Framework.Clients.Wiki; diff --git a/src/SMAPI.Web/Views/Index/Index.cshtml b/src/SMAPI.Web/Views/Index/Index.cshtml index 669cfd99..9841ca42 100644 --- a/src/SMAPI.Web/Views/Index/Index.cshtml +++ b/src/SMAPI.Web/Views/Index/Index.cshtml @@ -1,3 +1,7 @@ +@{ + #nullable disable +} + @using Microsoft.Extensions.Options @using StardewModdingAPI.Web.Framework @using StardewModdingAPI.Web.Framework.ConfigModels diff --git a/src/SMAPI.Web/Views/Index/Privacy.cshtml b/src/SMAPI.Web/Views/Index/Privacy.cshtml index fd78f908..1dc327d7 100644 --- a/src/SMAPI.Web/Views/Index/Privacy.cshtml +++ b/src/SMAPI.Web/Views/Index/Privacy.cshtml @@ -1,3 +1,7 @@ +@{ + #nullable disable +} + @using Microsoft.Extensions.Options @using StardewModdingAPI.Web.Framework @using StardewModdingAPI.Web.Framework.ConfigModels diff --git a/src/SMAPI.Web/Views/JsonValidator/Index.cshtml b/src/SMAPI.Web/Views/JsonValidator/Index.cshtml index 1db79857..5e38e4dc 100644 --- a/src/SMAPI.Web/Views/JsonValidator/Index.cshtml +++ b/src/SMAPI.Web/Views/JsonValidator/Index.cshtml @@ -1,3 +1,7 @@ +@{ + #nullable disable +} + @using Humanizer @using StardewModdingAPI.Web.Framework @using StardewModdingAPI.Web.ViewModels.JsonValidator diff --git a/src/SMAPI.Web/Views/LogParser/Index.cshtml b/src/SMAPI.Web/Views/LogParser/Index.cshtml index 3ddc6303..c26ec230 100644 --- a/src/SMAPI.Web/Views/LogParser/Index.cshtml +++ b/src/SMAPI.Web/Views/LogParser/Index.cshtml @@ -1,3 +1,7 @@ +@{ + #nullable disable +} + @using Humanizer @using StardewModdingAPI.Toolkit.Utilities @using StardewModdingAPI.Web.Framework diff --git a/src/SMAPI.Web/Views/Mods/Index.cshtml b/src/SMAPI.Web/Views/Mods/Index.cshtml index 416468e4..4b6400ad 100644 --- a/src/SMAPI.Web/Views/Mods/Index.cshtml +++ b/src/SMAPI.Web/Views/Mods/Index.cshtml @@ -1,3 +1,7 @@ +@{ + #nullable disable +} + @using Humanizer @using Humanizer.Localisation @using StardewModdingAPI.Web.Framework diff --git a/src/SMAPI.Web/Views/Shared/_Layout.cshtml b/src/SMAPI.Web/Views/Shared/_Layout.cshtml index 67dcd3b3..7c86a68c 100644 --- a/src/SMAPI.Web/Views/Shared/_Layout.cshtml +++ b/src/SMAPI.Web/Views/Shared/_Layout.cshtml @@ -1,3 +1,7 @@ +@{ + #nullable disable +} + @using Microsoft.Extensions.Options @using StardewModdingAPI.Web.Framework @using StardewModdingAPI.Web.Framework.ConfigModels diff --git a/src/SMAPI.Web/Views/_ViewStart.cshtml b/src/SMAPI.Web/Views/_ViewStart.cshtml index a5f10045..0dbac246 100644 --- a/src/SMAPI.Web/Views/_ViewStart.cshtml +++ b/src/SMAPI.Web/Views/_ViewStart.cshtml @@ -1,3 +1,7 @@ -@{ +@{ + #nullable disable +} + +@{ Layout = "_Layout"; } diff --git a/src/SMAPI/Constants.cs b/src/SMAPI/Constants.cs index 2fac8c94..2d9ab666 100644 --- a/src/SMAPI/Constants.cs +++ b/src/SMAPI/Constants.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/src/SMAPI/Context.cs b/src/SMAPI/Context.cs index aa4ecf35..e906375b 100644 --- a/src/SMAPI/Context.cs +++ b/src/SMAPI/Context.cs @@ -1,3 +1,5 @@ +#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 2c308f18..19e5a9df 100644 --- a/src/SMAPI/Events/AssetReadyEventArgs.cs +++ b/src/SMAPI/Events/AssetReadyEventArgs.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/AssetRequestedEventArgs.cs b/src/SMAPI/Events/AssetRequestedEventArgs.cs index c0cbd8fb..82b59290 100644 --- a/src/SMAPI/Events/AssetRequestedEventArgs.cs +++ b/src/SMAPI/Events/AssetRequestedEventArgs.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using Microsoft.Xna.Framework.Graphics; diff --git a/src/SMAPI/Events/AssetsInvalidatedEventArgs.cs b/src/SMAPI/Events/AssetsInvalidatedEventArgs.cs index 614cdf49..bd0df598 100644 --- a/src/SMAPI/Events/AssetsInvalidatedEventArgs.cs +++ b/src/SMAPI/Events/AssetsInvalidatedEventArgs.cs @@ -1,3 +1,5 @@ +#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 74f37710..ba9574cc 100644 --- a/src/SMAPI/Events/BuildingListChangedEventArgs.cs +++ b/src/SMAPI/Events/BuildingListChangedEventArgs.cs @@ -1,3 +1,5 @@ +#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 1b30fd23..94684513 100644 --- a/src/SMAPI/Events/ButtonPressedEventArgs.cs +++ b/src/SMAPI/Events/ButtonPressedEventArgs.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewModdingAPI.Framework.Input; diff --git a/src/SMAPI/Events/ButtonReleasedEventArgs.cs b/src/SMAPI/Events/ButtonReleasedEventArgs.cs index 40ec1cc1..6ff3727d 100644 --- a/src/SMAPI/Events/ButtonReleasedEventArgs.cs +++ b/src/SMAPI/Events/ButtonReleasedEventArgs.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewModdingAPI.Framework.Input; diff --git a/src/SMAPI/Events/ButtonsChangedEventArgs.cs b/src/SMAPI/Events/ButtonsChangedEventArgs.cs index a5e87735..c63d34e6 100644 --- a/src/SMAPI/Events/ButtonsChangedEventArgs.cs +++ b/src/SMAPI/Events/ButtonsChangedEventArgs.cs @@ -1,3 +1,5 @@ +#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 4b4c4210..bc8ac0c0 100644 --- a/src/SMAPI/Events/ChestInventoryChangedEventArgs.cs +++ b/src/SMAPI/Events/ChestInventoryChangedEventArgs.cs @@ -1,3 +1,5 @@ +#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 43ff90ce..f3e7513b 100644 --- a/src/SMAPI/Events/CursorMovedEventArgs.cs +++ b/src/SMAPI/Events/CursorMovedEventArgs.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/DebrisListChangedEventArgs.cs b/src/SMAPI/Events/DebrisListChangedEventArgs.cs index 61b7590a..56b1f30a 100644 --- a/src/SMAPI/Events/DebrisListChangedEventArgs.cs +++ b/src/SMAPI/Events/DebrisListChangedEventArgs.cs @@ -1,3 +1,5 @@ +#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 683f4620..cda1b6cc 100644 --- a/src/SMAPI/Events/FurnitureListChangedEventArgs.cs +++ b/src/SMAPI/Events/FurnitureListChangedEventArgs.cs @@ -1,3 +1,5 @@ +#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 d537db70..109f9753 100644 --- a/src/SMAPI/Events/IContentEvents.cs +++ b/src/SMAPI/Events/IContentEvents.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/IDisplayEvents.cs b/src/SMAPI/Events/IDisplayEvents.cs index dbf8d90f..b8b89120 100644 --- a/src/SMAPI/Events/IDisplayEvents.cs +++ b/src/SMAPI/Events/IDisplayEvents.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewValley; diff --git a/src/SMAPI/Events/IGameLoopEvents.cs b/src/SMAPI/Events/IGameLoopEvents.cs index 6855737b..52bac3f8 100644 --- a/src/SMAPI/Events/IGameLoopEvents.cs +++ b/src/SMAPI/Events/IGameLoopEvents.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/IInputEvents.cs b/src/SMAPI/Events/IInputEvents.cs index 081c40c0..01ceb224 100644 --- a/src/SMAPI/Events/IInputEvents.cs +++ b/src/SMAPI/Events/IInputEvents.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/IModEvents.cs b/src/SMAPI/Events/IModEvents.cs index 2603961b..a1aacbce 100644 --- a/src/SMAPI/Events/IModEvents.cs +++ b/src/SMAPI/Events/IModEvents.cs @@ -1,3 +1,5 @@ +#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 af9b5f17..c50eaf04 100644 --- a/src/SMAPI/Events/IMultiplayerEvents.cs +++ b/src/SMAPI/Events/IMultiplayerEvents.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/IPlayerEvents.cs b/src/SMAPI/Events/IPlayerEvents.cs index 81e17b1a..9d18bfad 100644 --- a/src/SMAPI/Events/IPlayerEvents.cs +++ b/src/SMAPI/Events/IPlayerEvents.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/ISpecialisedEvents.cs b/src/SMAPI/Events/ISpecialisedEvents.cs index bf70956d..0ec5bf54 100644 --- a/src/SMAPI/Events/ISpecialisedEvents.cs +++ b/src/SMAPI/Events/ISpecialisedEvents.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/IWorldEvents.cs b/src/SMAPI/Events/IWorldEvents.cs index c023e1f0..785dfa8f 100644 --- a/src/SMAPI/Events/IWorldEvents.cs +++ b/src/SMAPI/Events/IWorldEvents.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/InventoryChangedEventArgs.cs b/src/SMAPI/Events/InventoryChangedEventArgs.cs index 40cd4128..58c0ff8f 100644 --- a/src/SMAPI/Events/InventoryChangedEventArgs.cs +++ b/src/SMAPI/Events/InventoryChangedEventArgs.cs @@ -1,3 +1,5 @@ +#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 35369be2..5d0986aa 100644 --- a/src/SMAPI/Events/ItemStackSizeChange.cs +++ b/src/SMAPI/Events/ItemStackSizeChange.cs @@ -1,3 +1,5 @@ +#nullable disable + using StardewValley; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/LargeTerrainFeatureListChangedEventArgs.cs b/src/SMAPI/Events/LargeTerrainFeatureListChangedEventArgs.cs index 59d79f0f..aedb0e46 100644 --- a/src/SMAPI/Events/LargeTerrainFeatureListChangedEventArgs.cs +++ b/src/SMAPI/Events/LargeTerrainFeatureListChangedEventArgs.cs @@ -1,3 +1,5 @@ +#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 c7303603..3beb9fd5 100644 --- a/src/SMAPI/Events/LevelChangedEventArgs.cs +++ b/src/SMAPI/Events/LevelChangedEventArgs.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewModdingAPI.Enums; using StardewValley; diff --git a/src/SMAPI/Events/LocaleChangedEventArgs.cs b/src/SMAPI/Events/LocaleChangedEventArgs.cs index 09d3f6e5..015e7ec8 100644 --- a/src/SMAPI/Events/LocaleChangedEventArgs.cs +++ b/src/SMAPI/Events/LocaleChangedEventArgs.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using LanguageCode = StardewValley.LocalizedContentManager.LanguageCode; diff --git a/src/SMAPI/Events/LocationListChangedEventArgs.cs b/src/SMAPI/Events/LocationListChangedEventArgs.cs index 1ebb3e2d..055463dd 100644 --- a/src/SMAPI/Events/LocationListChangedEventArgs.cs +++ b/src/SMAPI/Events/LocationListChangedEventArgs.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Events/MenuChangedEventArgs.cs b/src/SMAPI/Events/MenuChangedEventArgs.cs index 977ba38b..362accec 100644 --- a/src/SMAPI/Events/MenuChangedEventArgs.cs +++ b/src/SMAPI/Events/MenuChangedEventArgs.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewValley.Menus; diff --git a/src/SMAPI/Events/ModMessageReceivedEventArgs.cs b/src/SMAPI/Events/ModMessageReceivedEventArgs.cs index d75a7540..671bdf38 100644 --- a/src/SMAPI/Events/ModMessageReceivedEventArgs.cs +++ b/src/SMAPI/Events/ModMessageReceivedEventArgs.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewModdingAPI.Framework.Networking; using StardewModdingAPI.Toolkit.Serialization; diff --git a/src/SMAPI/Events/NpcListChangedEventArgs.cs b/src/SMAPI/Events/NpcListChangedEventArgs.cs index 3a37f1e7..fb6dc1c5 100644 --- a/src/SMAPI/Events/NpcListChangedEventArgs.cs +++ b/src/SMAPI/Events/NpcListChangedEventArgs.cs @@ -1,3 +1,5 @@ +#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 b21d2867..b1a636aa 100644 --- a/src/SMAPI/Events/ObjectListChangedEventArgs.cs +++ b/src/SMAPI/Events/ObjectListChangedEventArgs.cs @@ -1,3 +1,5 @@ +#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 bfaa2bd3..3d11a3b5 100644 --- a/src/SMAPI/Events/PeerConnectedEventArgs.cs +++ b/src/SMAPI/Events/PeerConnectedEventArgs.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/PeerContextReceivedEventArgs.cs b/src/SMAPI/Events/PeerContextReceivedEventArgs.cs index 151a295c..35a4b20d 100644 --- a/src/SMAPI/Events/PeerContextReceivedEventArgs.cs +++ b/src/SMAPI/Events/PeerContextReceivedEventArgs.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/PeerDisconnectedEventArgs.cs b/src/SMAPI/Events/PeerDisconnectedEventArgs.cs index 8517988a..0675b8fe 100644 --- a/src/SMAPI/Events/PeerDisconnectedEventArgs.cs +++ b/src/SMAPI/Events/PeerDisconnectedEventArgs.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Events diff --git a/src/SMAPI/Events/RenderedActiveMenuEventArgs.cs b/src/SMAPI/Events/RenderedActiveMenuEventArgs.cs index efd4163b..3da0b4b4 100644 --- a/src/SMAPI/Events/RenderedActiveMenuEventArgs.cs +++ b/src/SMAPI/Events/RenderedActiveMenuEventArgs.cs @@ -1,3 +1,5 @@ +#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 d6341b19..e8beaaac 100644 --- a/src/SMAPI/Events/RenderedEventArgs.cs +++ b/src/SMAPI/Events/RenderedEventArgs.cs @@ -1,3 +1,5 @@ +#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 46e89013..b25ecd4c 100644 --- a/src/SMAPI/Events/RenderedHudEventArgs.cs +++ b/src/SMAPI/Events/RenderedHudEventArgs.cs @@ -1,3 +1,5 @@ +#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 56145381..a99d6ab3 100644 --- a/src/SMAPI/Events/RenderedWorldEventArgs.cs +++ b/src/SMAPI/Events/RenderedWorldEventArgs.cs @@ -1,3 +1,5 @@ +#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 103f56df..3e3f3258 100644 --- a/src/SMAPI/Events/RenderingActiveMenuEventArgs.cs +++ b/src/SMAPI/Events/RenderingActiveMenuEventArgs.cs @@ -1,3 +1,5 @@ +#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 5acbef09..8f6b3557 100644 --- a/src/SMAPI/Events/RenderingEventArgs.cs +++ b/src/SMAPI/Events/RenderingEventArgs.cs @@ -1,3 +1,5 @@ +#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 84c96ecd..87269b90 100644 --- a/src/SMAPI/Events/RenderingHudEventArgs.cs +++ b/src/SMAPI/Events/RenderingHudEventArgs.cs @@ -1,3 +1,5 @@ +#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 d0d44789..2fc9964f 100644 --- a/src/SMAPI/Events/RenderingWorldEventArgs.cs +++ b/src/SMAPI/Events/RenderingWorldEventArgs.cs @@ -1,3 +1,5 @@ +#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 cdf1e6dc..77a73102 100644 --- a/src/SMAPI/Events/TerrainFeatureListChangedEventArgs.cs +++ b/src/SMAPI/Events/TerrainFeatureListChangedEventArgs.cs @@ -1,3 +1,5 @@ +#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 9afe4a4e..92a8ea77 100644 --- a/src/SMAPI/Events/WarpedEventArgs.cs +++ b/src/SMAPI/Events/WarpedEventArgs.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewValley; diff --git a/src/SMAPI/Framework/Command.cs b/src/SMAPI/Framework/Command.cs index 8c9df47d..776ba238 100644 --- a/src/SMAPI/Framework/Command.cs +++ b/src/SMAPI/Framework/Command.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Framework diff --git a/src/SMAPI/Framework/CommandManager.cs b/src/SMAPI/Framework/CommandManager.cs index 0c0f6685..df798b0c 100644 --- a/src/SMAPI/Framework/CommandManager.cs +++ b/src/SMAPI/Framework/CommandManager.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/Commands/HarmonySummaryCommand.cs b/src/SMAPI/Framework/Commands/HarmonySummaryCommand.cs index 643267ce..fcfa928e 100644 --- a/src/SMAPI/Framework/Commands/HarmonySummaryCommand.cs +++ b/src/SMAPI/Framework/Commands/HarmonySummaryCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/Commands/HelpCommand.cs b/src/SMAPI/Framework/Commands/HelpCommand.cs index baf3116e..eb6c74f5 100644 --- a/src/SMAPI/Framework/Commands/HelpCommand.cs +++ b/src/SMAPI/Framework/Commands/HelpCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Linq; namespace StardewModdingAPI.Framework.Commands diff --git a/src/SMAPI/Framework/Commands/IInternalCommand.cs b/src/SMAPI/Framework/Commands/IInternalCommand.cs index abf105b6..32e3e9f1 100644 --- a/src/SMAPI/Framework/Commands/IInternalCommand.cs +++ b/src/SMAPI/Framework/Commands/IInternalCommand.cs @@ -1,3 +1,5 @@ +#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 12328bb6..2043b35e 100644 --- a/src/SMAPI/Framework/Commands/ReloadI18nCommand.cs +++ b/src/SMAPI/Framework/Commands/ReloadI18nCommand.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Framework.Commands diff --git a/src/SMAPI/Framework/Content/AssetData.cs b/src/SMAPI/Framework/Content/AssetData.cs index 05be8a3b..be4a7ce6 100644 --- a/src/SMAPI/Framework/Content/AssetData.cs +++ b/src/SMAPI/Framework/Content/AssetData.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Framework.Content diff --git a/src/SMAPI/Framework/Content/AssetDataForDictionary.cs b/src/SMAPI/Framework/Content/AssetDataForDictionary.cs index 735b651c..06dbe259 100644 --- a/src/SMAPI/Framework/Content/AssetDataForDictionary.cs +++ b/src/SMAPI/Framework/Content/AssetDataForDictionary.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; diff --git a/src/SMAPI/Framework/Content/AssetDataForImage.cs b/src/SMAPI/Framework/Content/AssetDataForImage.cs index b0f1b5c7..8e59cd27 100644 --- a/src/SMAPI/Framework/Content/AssetDataForImage.cs +++ b/src/SMAPI/Framework/Content/AssetDataForImage.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; diff --git a/src/SMAPI/Framework/Content/AssetDataForMap.cs b/src/SMAPI/Framework/Content/AssetDataForMap.cs index 5986e797..0425e195 100644 --- a/src/SMAPI/Framework/Content/AssetDataForMap.cs +++ b/src/SMAPI/Framework/Content/AssetDataForMap.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/Content/AssetDataForObject.cs b/src/SMAPI/Framework/Content/AssetDataForObject.cs index bafd8941..4a6df64b 100644 --- a/src/SMAPI/Framework/Content/AssetDataForObject.cs +++ b/src/SMAPI/Framework/Content/AssetDataForObject.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using Microsoft.Xna.Framework.Graphics; diff --git a/src/SMAPI/Framework/Content/AssetEditOperation.cs b/src/SMAPI/Framework/Content/AssetEditOperation.cs index 818209fa..1b7d0c93 100644 --- a/src/SMAPI/Framework/Content/AssetEditOperation.cs +++ b/src/SMAPI/Framework/Content/AssetEditOperation.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Framework/Content/AssetInfo.cs b/src/SMAPI/Framework/Content/AssetInfo.cs index f5da5d69..51dcc61f 100644 --- a/src/SMAPI/Framework/Content/AssetInfo.cs +++ b/src/SMAPI/Framework/Content/AssetInfo.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using Microsoft.Xna.Framework.Graphics; diff --git a/src/SMAPI/Framework/Content/AssetInterceptorChange.cs b/src/SMAPI/Framework/Content/AssetInterceptorChange.cs index 03d6da5a..7f53db9b 100644 --- a/src/SMAPI/Framework/Content/AssetInterceptorChange.cs +++ b/src/SMAPI/Framework/Content/AssetInterceptorChange.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Reflection; using StardewModdingAPI.Internal; diff --git a/src/SMAPI/Framework/Content/AssetLoadOperation.cs b/src/SMAPI/Framework/Content/AssetLoadOperation.cs index b12958d6..73e60e24 100644 --- a/src/SMAPI/Framework/Content/AssetLoadOperation.cs +++ b/src/SMAPI/Framework/Content/AssetLoadOperation.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Framework/Content/AssetName.cs b/src/SMAPI/Framework/Content/AssetName.cs index 4973b444..4d583d82 100644 --- a/src/SMAPI/Framework/Content/AssetName.cs +++ b/src/SMAPI/Framework/Content/AssetName.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewModdingAPI.Toolkit.Utilities; using StardewValley; diff --git a/src/SMAPI/Framework/Content/AssetOperationGroup.cs b/src/SMAPI/Framework/Content/AssetOperationGroup.cs index a2fcb722..e3c3f92c 100644 --- a/src/SMAPI/Framework/Content/AssetOperationGroup.cs +++ b/src/SMAPI/Framework/Content/AssetOperationGroup.cs @@ -1,3 +1,5 @@ +#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/ContentCache.cs b/src/SMAPI/Framework/Content/ContentCache.cs index 8e0c6228..4e620d28 100644 --- a/src/SMAPI/Framework/Content/ContentCache.cs +++ b/src/SMAPI/Framework/Content/ContentCache.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.Contracts; diff --git a/src/SMAPI/Framework/Content/TilesheetReference.cs b/src/SMAPI/Framework/Content/TilesheetReference.cs index 0339b802..cdc4bc62 100644 --- a/src/SMAPI/Framework/Content/TilesheetReference.cs +++ b/src/SMAPI/Framework/Content/TilesheetReference.cs @@ -1,3 +1,5 @@ +#nullable disable + using xTile.Dimensions; namespace StardewModdingAPI.Framework.Content diff --git a/src/SMAPI/Framework/ContentCoordinator.cs b/src/SMAPI/Framework/ContentCoordinator.cs index 88ed96da..bfde649a 100644 --- a/src/SMAPI/Framework/ContentCoordinator.cs +++ b/src/SMAPI/Framework/ContentCoordinator.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/SMAPI/Framework/ContentManagers/BaseContentManager.cs b/src/SMAPI/Framework/ContentManagers/BaseContentManager.cs index c803905a..4594d235 100644 --- a/src/SMAPI/Framework/ContentManagers/BaseContentManager.cs +++ b/src/SMAPI/Framework/ContentManagers/BaseContentManager.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/SMAPI/Framework/ContentManagers/GameContentManager.cs b/src/SMAPI/Framework/ContentManagers/GameContentManager.cs index cad5f6db..f4e1bda4 100644 --- a/src/SMAPI/Framework/ContentManagers/GameContentManager.cs +++ b/src/SMAPI/Framework/ContentManagers/GameContentManager.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Globalization; diff --git a/src/SMAPI/Framework/ContentManagers/GameContentManagerForAssetPropagation.cs b/src/SMAPI/Framework/ContentManagers/GameContentManagerForAssetPropagation.cs index 3f7188da..46d5d24e 100644 --- a/src/SMAPI/Framework/ContentManagers/GameContentManagerForAssetPropagation.cs +++ b/src/SMAPI/Framework/ContentManagers/GameContentManagerForAssetPropagation.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Globalization; using Microsoft.Xna.Framework.Graphics; diff --git a/src/SMAPI/Framework/ContentManagers/IContentManager.cs b/src/SMAPI/Framework/ContentManagers/IContentManager.cs index 90095492..c4625761 100644 --- a/src/SMAPI/Framework/ContentManagers/IContentManager.cs +++ b/src/SMAPI/Framework/ContentManagers/IContentManager.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using Microsoft.Xna.Framework.Content; diff --git a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs index e0c85265..8051c296 100644 --- a/src/SMAPI/Framework/ContentManagers/ModContentManager.cs +++ b/src/SMAPI/Framework/ContentManagers/ModContentManager.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Globalization; using System.IO; diff --git a/src/SMAPI/Framework/ContentPack.cs b/src/SMAPI/Framework/ContentPack.cs index e02ef88b..2d33a22e 100644 --- a/src/SMAPI/Framework/ContentPack.cs +++ b/src/SMAPI/Framework/ContentPack.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.IO; using StardewModdingAPI.Framework.ModHelpers; diff --git a/src/SMAPI/Framework/CursorPosition.cs b/src/SMAPI/Framework/CursorPosition.cs index 107481e7..8f36a554 100644 --- a/src/SMAPI/Framework/CursorPosition.cs +++ b/src/SMAPI/Framework/CursorPosition.cs @@ -1,3 +1,5 @@ +#nullable disable + using Microsoft.Xna.Framework; using StardewValley; diff --git a/src/SMAPI/Framework/DeprecationManager.cs b/src/SMAPI/Framework/DeprecationManager.cs index ad6a3677..fe1b623f 100644 --- a/src/SMAPI/Framework/DeprecationManager.cs +++ b/src/SMAPI/Framework/DeprecationManager.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/DeprecationWarning.cs b/src/SMAPI/Framework/DeprecationWarning.cs index 5201b06c..f155358b 100644 --- a/src/SMAPI/Framework/DeprecationWarning.cs +++ b/src/SMAPI/Framework/DeprecationWarning.cs @@ -1,3 +1,5 @@ +#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 41540047..c977e73d 100644 --- a/src/SMAPI/Framework/Events/EventManager.cs +++ b/src/SMAPI/Framework/Events/EventManager.cs @@ -1,3 +1,5 @@ +#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 e4e3ca08..57277576 100644 --- a/src/SMAPI/Framework/Events/IManagedEvent.cs +++ b/src/SMAPI/Framework/Events/IManagedEvent.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Framework.Events { /// Metadata for an event raised by SMAPI. diff --git a/src/SMAPI/Framework/Events/ManagedEvent.cs b/src/SMAPI/Framework/Events/ManagedEvent.cs index 1c8b9d04..8fa31165 100644 --- a/src/SMAPI/Framework/Events/ManagedEvent.cs +++ b/src/SMAPI/Framework/Events/ManagedEvent.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/Events/ManagedEventHandler.cs b/src/SMAPI/Framework/Events/ManagedEventHandler.cs index 97040f76..f31bc04d 100644 --- a/src/SMAPI/Framework/Events/ManagedEventHandler.cs +++ b/src/SMAPI/Framework/Events/ManagedEventHandler.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Framework/Events/ModContentEvents.cs b/src/SMAPI/Framework/Events/ModContentEvents.cs index beb96031..f198b793 100644 --- a/src/SMAPI/Framework/Events/ModContentEvents.cs +++ b/src/SMAPI/Framework/Events/ModContentEvents.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Framework/Events/ModDisplayEvents.cs b/src/SMAPI/Framework/Events/ModDisplayEvents.cs index 48f55324..b2110cce 100644 --- a/src/SMAPI/Framework/Events/ModDisplayEvents.cs +++ b/src/SMAPI/Framework/Events/ModDisplayEvents.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Framework/Events/ModEvents.cs b/src/SMAPI/Framework/Events/ModEvents.cs index 1fb3482c..e8f8885d 100644 --- a/src/SMAPI/Framework/Events/ModEvents.cs +++ b/src/SMAPI/Framework/Events/ModEvents.cs @@ -1,3 +1,5 @@ +#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 77708fc1..295caa0d 100644 --- a/src/SMAPI/Framework/Events/ModEventsBase.cs +++ b/src/SMAPI/Framework/Events/ModEventsBase.cs @@ -1,3 +1,5 @@ +#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 5f0db369..51803daf 100644 --- a/src/SMAPI/Framework/Events/ModGameLoopEvents.cs +++ b/src/SMAPI/Framework/Events/ModGameLoopEvents.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Framework/Events/ModInputEvents.cs b/src/SMAPI/Framework/Events/ModInputEvents.cs index 40edf806..6af79c59 100644 --- a/src/SMAPI/Framework/Events/ModInputEvents.cs +++ b/src/SMAPI/Framework/Events/ModInputEvents.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Framework/Events/ModMultiplayerEvents.cs b/src/SMAPI/Framework/Events/ModMultiplayerEvents.cs index b90f64fa..7d3ce510 100644 --- a/src/SMAPI/Framework/Events/ModMultiplayerEvents.cs +++ b/src/SMAPI/Framework/Events/ModMultiplayerEvents.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Framework/Events/ModPlayerEvents.cs b/src/SMAPI/Framework/Events/ModPlayerEvents.cs index b2d89e9a..dac8f05b 100644 --- a/src/SMAPI/Framework/Events/ModPlayerEvents.cs +++ b/src/SMAPI/Framework/Events/ModPlayerEvents.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Framework/Events/ModSpecialisedEvents.cs b/src/SMAPI/Framework/Events/ModSpecialisedEvents.cs index 7980208b..4b438034 100644 --- a/src/SMAPI/Framework/Events/ModSpecialisedEvents.cs +++ b/src/SMAPI/Framework/Events/ModSpecialisedEvents.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Framework/Events/ModWorldEvents.cs b/src/SMAPI/Framework/Events/ModWorldEvents.cs index a7b7d799..614945c7 100644 --- a/src/SMAPI/Framework/Events/ModWorldEvents.cs +++ b/src/SMAPI/Framework/Events/ModWorldEvents.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Framework/Exceptions/SAssemblyLoadFailedException.cs b/src/SMAPI/Framework/Exceptions/SAssemblyLoadFailedException.cs index ec9279f1..4e03a687 100644 --- a/src/SMAPI/Framework/Exceptions/SAssemblyLoadFailedException.cs +++ b/src/SMAPI/Framework/Exceptions/SAssemblyLoadFailedException.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Framework.Exceptions diff --git a/src/SMAPI/Framework/Exceptions/SContentLoadException.cs b/src/SMAPI/Framework/Exceptions/SContentLoadException.cs index 85d85e3d..c21a6b0e 100644 --- a/src/SMAPI/Framework/Exceptions/SContentLoadException.cs +++ b/src/SMAPI/Framework/Exceptions/SContentLoadException.cs @@ -1,4 +1,6 @@ -using System; +#nullable disable + +using System; using Microsoft.Xna.Framework.Content; namespace StardewModdingAPI.Framework.Exceptions diff --git a/src/SMAPI/Framework/GameVersion.cs b/src/SMAPI/Framework/GameVersion.cs index b69c6757..aa91d8f3 100644 --- a/src/SMAPI/Framework/GameVersion.cs +++ b/src/SMAPI/Framework/GameVersion.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; diff --git a/src/SMAPI/Framework/IModMetadata.cs b/src/SMAPI/Framework/IModMetadata.cs index cb876ee4..800b198a 100644 --- a/src/SMAPI/Framework/IModMetadata.cs +++ b/src/SMAPI/Framework/IModMetadata.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using StardewModdingAPI.Framework.ModHelpers; diff --git a/src/SMAPI/Framework/Input/GamePadStateBuilder.cs b/src/SMAPI/Framework/Input/GamePadStateBuilder.cs index ad254828..21168b7a 100644 --- a/src/SMAPI/Framework/Input/GamePadStateBuilder.cs +++ b/src/SMAPI/Framework/Input/GamePadStateBuilder.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework; diff --git a/src/SMAPI/Framework/Input/IInputStateBuilder.cs b/src/SMAPI/Framework/Input/IInputStateBuilder.cs index 28d62439..3fb62686 100644 --- a/src/SMAPI/Framework/Input/IInputStateBuilder.cs +++ b/src/SMAPI/Framework/Input/IInputStateBuilder.cs @@ -1,3 +1,5 @@ +#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 09bc48b6..81ca0ebb 100644 --- a/src/SMAPI/Framework/Input/KeyboardStateBuilder.cs +++ b/src/SMAPI/Framework/Input/KeyboardStateBuilder.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.Linq; using Microsoft.Xna.Framework.Input; diff --git a/src/SMAPI/Framework/Input/MouseStateBuilder.cs b/src/SMAPI/Framework/Input/MouseStateBuilder.cs index c2a0891b..85b38d32 100644 --- a/src/SMAPI/Framework/Input/MouseStateBuilder.cs +++ b/src/SMAPI/Framework/Input/MouseStateBuilder.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using Microsoft.Xna.Framework.Input; diff --git a/src/SMAPI/Framework/Input/SInputState.cs b/src/SMAPI/Framework/Input/SInputState.cs index 72adca02..37b3c8ef 100644 --- a/src/SMAPI/Framework/Input/SInputState.cs +++ b/src/SMAPI/Framework/Input/SInputState.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/InternalExtensions.cs b/src/SMAPI/Framework/InternalExtensions.cs index 54aeffd7..a1d87487 100644 --- a/src/SMAPI/Framework/InternalExtensions.cs +++ b/src/SMAPI/Framework/InternalExtensions.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/Logging/InterceptingTextWriter.cs b/src/SMAPI/Framework/Logging/InterceptingTextWriter.cs index bad69a2a..a0957b90 100644 --- a/src/SMAPI/Framework/Logging/InterceptingTextWriter.cs +++ b/src/SMAPI/Framework/Logging/InterceptingTextWriter.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.IO; using System.Text; diff --git a/src/SMAPI/Framework/Logging/LogFileManager.cs b/src/SMAPI/Framework/Logging/LogFileManager.cs index 6ab2bdfb..0b6f9ad2 100644 --- a/src/SMAPI/Framework/Logging/LogFileManager.cs +++ b/src/SMAPI/Framework/Logging/LogFileManager.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.IO; diff --git a/src/SMAPI/Framework/Logging/LogManager.cs b/src/SMAPI/Framework/Logging/LogManager.cs index a8a8b6ee..dab7f554 100644 --- a/src/SMAPI/Framework/Logging/LogManager.cs +++ b/src/SMAPI/Framework/Logging/LogManager.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/SMAPI/Framework/ModHelpers/BaseHelper.cs b/src/SMAPI/Framework/ModHelpers/BaseHelper.cs index 5a3d4bed..1cd1a6b3 100644 --- a/src/SMAPI/Framework/ModHelpers/BaseHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/BaseHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Framework.ModHelpers { /// The common base class for mod helpers. diff --git a/src/SMAPI/Framework/ModHelpers/CommandHelper.cs b/src/SMAPI/Framework/ModHelpers/CommandHelper.cs index 69382009..c2b5092e 100644 --- a/src/SMAPI/Framework/ModHelpers/CommandHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/CommandHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Framework.ModHelpers diff --git a/src/SMAPI/Framework/ModHelpers/ContentHelper.cs b/src/SMAPI/Framework/ModHelpers/ContentHelper.cs index 14aa74c2..e72e397e 100644 --- a/src/SMAPI/Framework/ModHelpers/ContentHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/ContentHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/src/SMAPI/Framework/ModHelpers/ContentPackHelper.cs b/src/SMAPI/Framework/ModHelpers/ContentPackHelper.cs index d39abc7d..336214e2 100644 --- a/src/SMAPI/Framework/ModHelpers/ContentPackHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/ContentPackHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/src/SMAPI/Framework/ModHelpers/DataHelper.cs b/src/SMAPI/Framework/ModHelpers/DataHelper.cs index 4cbfd73f..86a34ee8 100644 --- a/src/SMAPI/Framework/ModHelpers/DataHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/DataHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/src/SMAPI/Framework/ModHelpers/GameContentHelper.cs b/src/SMAPI/Framework/ModHelpers/GameContentHelper.cs index 0eb385d4..ed0c46d5 100644 --- a/src/SMAPI/Framework/ModHelpers/GameContentHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/GameContentHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Linq; using StardewModdingAPI.Framework.Content; diff --git a/src/SMAPI/Framework/ModHelpers/InputHelper.cs b/src/SMAPI/Framework/ModHelpers/InputHelper.cs index 88caf4c3..29f80d87 100644 --- a/src/SMAPI/Framework/ModHelpers/InputHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/InputHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewModdingAPI.Framework.Input; using StardewModdingAPI.Utilities; diff --git a/src/SMAPI/Framework/ModHelpers/ModContentHelper.cs b/src/SMAPI/Framework/ModHelpers/ModContentHelper.cs index 7468cda1..90064354 100644 --- a/src/SMAPI/Framework/ModHelpers/ModContentHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/ModContentHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using Microsoft.Xna.Framework.Content; using StardewModdingAPI.Framework.Content; diff --git a/src/SMAPI/Framework/ModHelpers/ModHelper.cs b/src/SMAPI/Framework/ModHelpers/ModHelper.cs index 5b567ee0..2a8aeb3a 100644 --- a/src/SMAPI/Framework/ModHelpers/ModHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/ModHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.IO; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs b/src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs index 09a392a6..e277e6fa 100644 --- a/src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/ModRegistryHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using StardewModdingAPI.Framework.Reflection; diff --git a/src/SMAPI/Framework/ModHelpers/MultiplayerHelper.cs b/src/SMAPI/Framework/ModHelpers/MultiplayerHelper.cs index a7ce8692..96b074e2 100644 --- a/src/SMAPI/Framework/ModHelpers/MultiplayerHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/MultiplayerHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using StardewModdingAPI.Framework.Networking; using StardewValley; diff --git a/src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs b/src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs index 5a4ea742..24cbd01c 100644 --- a/src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/ReflectionHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Reflection; using StardewModdingAPI.Framework.Reflection; 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; diff --git a/src/SMAPI/Framework/ModLinked.cs b/src/SMAPI/Framework/ModLinked.cs index 8cfe6f5f..5a3e38ca 100644 --- a/src/SMAPI/Framework/ModLinked.cs +++ b/src/SMAPI/Framework/ModLinked.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Framework { /// A generic tuple which links something to a mod. diff --git a/src/SMAPI/Framework/ModLoading/AssemblyDefinitionResolver.cs b/src/SMAPI/Framework/ModLoading/AssemblyDefinitionResolver.cs index 8e2f5ef3..1d4ddf72 100644 --- a/src/SMAPI/Framework/ModLoading/AssemblyDefinitionResolver.cs +++ b/src/SMAPI/Framework/ModLoading/AssemblyDefinitionResolver.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using Mono.Cecil; diff --git a/src/SMAPI/Framework/ModLoading/AssemblyLoadStatus.cs b/src/SMAPI/Framework/ModLoading/AssemblyLoadStatus.cs index 11be19fc..d2d5d83b 100644 --- a/src/SMAPI/Framework/ModLoading/AssemblyLoadStatus.cs +++ b/src/SMAPI/Framework/ModLoading/AssemblyLoadStatus.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Framework.ModLoading { /// Indicates the result of an assembly load. diff --git a/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs b/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs index 24214c96..070ee803 100644 --- a/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs +++ b/src/SMAPI/Framework/ModLoading/AssemblyLoader.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/src/SMAPI/Framework/ModLoading/AssemblyParseResult.cs b/src/SMAPI/Framework/ModLoading/AssemblyParseResult.cs index b56a776c..56bd5a8b 100644 --- a/src/SMAPI/Framework/ModLoading/AssemblyParseResult.cs +++ b/src/SMAPI/Framework/ModLoading/AssemblyParseResult.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.IO; using Mono.Cecil; diff --git a/src/SMAPI/Framework/ModLoading/Finders/EventFinder.cs b/src/SMAPI/Framework/ModLoading/Finders/EventFinder.cs index 124951a5..7c94beb7 100644 --- a/src/SMAPI/Framework/ModLoading/Finders/EventFinder.cs +++ b/src/SMAPI/Framework/ModLoading/Finders/EventFinder.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.Linq; using Mono.Cecil; diff --git a/src/SMAPI/Framework/ModLoading/Finders/FieldFinder.cs b/src/SMAPI/Framework/ModLoading/Finders/FieldFinder.cs index 68415123..96b4098a 100644 --- a/src/SMAPI/Framework/ModLoading/Finders/FieldFinder.cs +++ b/src/SMAPI/Framework/ModLoading/Finders/FieldFinder.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.Linq; using Mono.Cecil; diff --git a/src/SMAPI/Framework/ModLoading/Finders/MethodFinder.cs b/src/SMAPI/Framework/ModLoading/Finders/MethodFinder.cs index d2340f01..7d3c1fd7 100644 --- a/src/SMAPI/Framework/ModLoading/Finders/MethodFinder.cs +++ b/src/SMAPI/Framework/ModLoading/Finders/MethodFinder.cs @@ -1,3 +1,5 @@ +#nullable disable + using Mono.Cecil; using Mono.Cecil.Cil; using StardewModdingAPI.Framework.ModLoading.Framework; diff --git a/src/SMAPI/Framework/ModLoading/Finders/PropertyFinder.cs b/src/SMAPI/Framework/ModLoading/Finders/PropertyFinder.cs index 99344848..b2f2e193 100644 --- a/src/SMAPI/Framework/ModLoading/Finders/PropertyFinder.cs +++ b/src/SMAPI/Framework/ModLoading/Finders/PropertyFinder.cs @@ -1,3 +1,5 @@ +#nullable disable + using Mono.Cecil; using Mono.Cecil.Cil; using StardewModdingAPI.Framework.ModLoading.Framework; diff --git a/src/SMAPI/Framework/ModLoading/Finders/ReferenceToMemberWithUnexpectedTypeFinder.cs b/src/SMAPI/Framework/ModLoading/Finders/ReferenceToMemberWithUnexpectedTypeFinder.cs index 8c1cae2b..81f90498 100644 --- a/src/SMAPI/Framework/ModLoading/Finders/ReferenceToMemberWithUnexpectedTypeFinder.cs +++ b/src/SMAPI/Framework/ModLoading/Finders/ReferenceToMemberWithUnexpectedTypeFinder.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.Linq; using Mono.Cecil; diff --git a/src/SMAPI/Framework/ModLoading/Finders/ReferenceToMissingMemberFinder.cs b/src/SMAPI/Framework/ModLoading/Finders/ReferenceToMissingMemberFinder.cs index d305daf4..001d1986 100644 --- a/src/SMAPI/Framework/ModLoading/Finders/ReferenceToMissingMemberFinder.cs +++ b/src/SMAPI/Framework/ModLoading/Finders/ReferenceToMissingMemberFinder.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using Mono.Cecil; using Mono.Cecil.Cil; diff --git a/src/SMAPI/Framework/ModLoading/Finders/TypeAssemblyFinder.cs b/src/SMAPI/Framework/ModLoading/Finders/TypeAssemblyFinder.cs index 24ab2eca..4c589ed8 100644 --- a/src/SMAPI/Framework/ModLoading/Finders/TypeAssemblyFinder.cs +++ b/src/SMAPI/Framework/ModLoading/Finders/TypeAssemblyFinder.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using Mono.Cecil; using StardewModdingAPI.Framework.ModLoading.Framework; diff --git a/src/SMAPI/Framework/ModLoading/Finders/TypeFinder.cs b/src/SMAPI/Framework/ModLoading/Finders/TypeFinder.cs index 260a8df8..04a5b970 100644 --- a/src/SMAPI/Framework/ModLoading/Finders/TypeFinder.cs +++ b/src/SMAPI/Framework/ModLoading/Finders/TypeFinder.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using Mono.Cecil; diff --git a/src/SMAPI/Framework/ModLoading/Framework/BaseInstructionHandler.cs b/src/SMAPI/Framework/ModLoading/Framework/BaseInstructionHandler.cs index d5d1b38e..bea786cd 100644 --- a/src/SMAPI/Framework/ModLoading/Framework/BaseInstructionHandler.cs +++ b/src/SMAPI/Framework/ModLoading/Framework/BaseInstructionHandler.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using Mono.Cecil; diff --git a/src/SMAPI/Framework/ModLoading/Framework/RecursiveRewriter.cs b/src/SMAPI/Framework/ModLoading/Framework/RecursiveRewriter.cs index 4f14a579..09ff78f7 100644 --- a/src/SMAPI/Framework/ModLoading/Framework/RecursiveRewriter.cs +++ b/src/SMAPI/Framework/ModLoading/Framework/RecursiveRewriter.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/ModLoading/Framework/RewriteHelper.cs b/src/SMAPI/Framework/ModLoading/Framework/RewriteHelper.cs index d7cb2471..8f47fbdd 100644 --- a/src/SMAPI/Framework/ModLoading/Framework/RewriteHelper.cs +++ b/src/SMAPI/Framework/ModLoading/Framework/RewriteHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Linq; using System.Reflection; diff --git a/src/SMAPI/Framework/ModLoading/IInstructionHandler.cs b/src/SMAPI/Framework/ModLoading/IInstructionHandler.cs index d41732f8..126504e3 100644 --- a/src/SMAPI/Framework/ModLoading/IInstructionHandler.cs +++ b/src/SMAPI/Framework/ModLoading/IInstructionHandler.cs @@ -1,3 +1,5 @@ +#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 1f9add30..29406f2a 100644 --- a/src/SMAPI/Framework/ModLoading/IncompatibleInstructionException.cs +++ b/src/SMAPI/Framework/ModLoading/IncompatibleInstructionException.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Framework.ModLoading diff --git a/src/SMAPI/Framework/ModLoading/InvalidModStateException.cs b/src/SMAPI/Framework/ModLoading/InvalidModStateException.cs index 075e237a..9dca9bc4 100644 --- a/src/SMAPI/Framework/ModLoading/InvalidModStateException.cs +++ b/src/SMAPI/Framework/ModLoading/InvalidModStateException.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Framework.ModLoading diff --git a/src/SMAPI/Framework/ModLoading/ModMetadata.cs b/src/SMAPI/Framework/ModLoading/ModMetadata.cs index 9e6bc61f..0e698bfd 100644 --- a/src/SMAPI/Framework/ModLoading/ModMetadata.cs +++ b/src/SMAPI/Framework/ModLoading/ModMetadata.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/src/SMAPI/Framework/ModLoading/ModResolver.cs b/src/SMAPI/Framework/ModLoading/ModResolver.cs index d52cdbb4..51463048 100644 --- a/src/SMAPI/Framework/ModLoading/ModResolver.cs +++ b/src/SMAPI/Framework/ModLoading/ModResolver.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/src/SMAPI/Framework/ModLoading/PlatformAssemblyMap.cs b/src/SMAPI/Framework/ModLoading/PlatformAssemblyMap.cs index d4366294..0898f095 100644 --- a/src/SMAPI/Framework/ModLoading/PlatformAssemblyMap.cs +++ b/src/SMAPI/Framework/ModLoading/PlatformAssemblyMap.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/ModLoading/RewriteFacades/AccessToolsFacade.cs b/src/SMAPI/Framework/ModLoading/RewriteFacades/AccessToolsFacade.cs index be2a1c58..c05005b8 100644 --- a/src/SMAPI/Framework/ModLoading/RewriteFacades/AccessToolsFacade.cs +++ b/src/SMAPI/Framework/ModLoading/RewriteFacades/AccessToolsFacade.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/SMAPI/Framework/ModLoading/RewriteFacades/HarmonyInstanceFacade.cs b/src/SMAPI/Framework/ModLoading/RewriteFacades/HarmonyInstanceFacade.cs index 135bd218..fea8c100 100644 --- a/src/SMAPI/Framework/ModLoading/RewriteFacades/HarmonyInstanceFacade.cs +++ b/src/SMAPI/Framework/ModLoading/RewriteFacades/HarmonyInstanceFacade.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/SMAPI/Framework/ModLoading/RewriteFacades/HarmonyMethodFacade.cs b/src/SMAPI/Framework/ModLoading/RewriteFacades/HarmonyMethodFacade.cs index 5162dda4..93124591 100644 --- a/src/SMAPI/Framework/ModLoading/RewriteFacades/HarmonyMethodFacade.cs +++ b/src/SMAPI/Framework/ModLoading/RewriteFacades/HarmonyMethodFacade.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Diagnostics.CodeAnalysis; using System.Reflection; diff --git a/src/SMAPI/Framework/ModLoading/RewriteFacades/SpriteBatchFacade.cs b/src/SMAPI/Framework/ModLoading/RewriteFacades/SpriteBatchFacade.cs index 5f68f8d9..20a30f8f 100644 --- a/src/SMAPI/Framework/ModLoading/RewriteFacades/SpriteBatchFacade.cs +++ b/src/SMAPI/Framework/ModLoading/RewriteFacades/SpriteBatchFacade.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Diagnostics.CodeAnalysis; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/ArchitectureAssemblyRewriter.cs b/src/SMAPI/Framework/ModLoading/Rewriters/ArchitectureAssemblyRewriter.cs index cc830216..4985d72a 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/ArchitectureAssemblyRewriter.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/ArchitectureAssemblyRewriter.cs @@ -1,3 +1,5 @@ +#nullable disable + using Mono.Cecil; using StardewModdingAPI.Framework.ModLoading.Framework; diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/FieldReplaceRewriter.cs b/src/SMAPI/Framework/ModLoading/Rewriters/FieldReplaceRewriter.cs index 857a2230..806fca62 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/FieldReplaceRewriter.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/FieldReplaceRewriter.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Reflection; diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/HarmonyRewriter.cs b/src/SMAPI/Framework/ModLoading/Rewriters/HarmonyRewriter.cs index f715fb6b..92397c58 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/HarmonyRewriter.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/HarmonyRewriter.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using HarmonyLib; using Mono.Cecil; diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/HeuristicFieldRewriter.cs b/src/SMAPI/Framework/ModLoading/Rewriters/HeuristicFieldRewriter.cs index 2eee8ff9..fc06e779 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/HeuristicFieldRewriter.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/HeuristicFieldRewriter.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.Linq; using Mono.Cecil; diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/HeuristicMethodRewriter.cs b/src/SMAPI/Framework/ModLoading/Rewriters/HeuristicMethodRewriter.cs index 89de437e..4860072c 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/HeuristicMethodRewriter.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/HeuristicMethodRewriter.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.Linq; using Mono.Cecil; diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/MethodParentRewriter.cs b/src/SMAPI/Framework/ModLoading/Rewriters/MethodParentRewriter.cs index 9933e2ca..00daf337 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/MethodParentRewriter.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/MethodParentRewriter.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Linq; using Mono.Cecil; diff --git a/src/SMAPI/Framework/ModLoading/Rewriters/TypeReferenceRewriter.cs b/src/SMAPI/Framework/ModLoading/Rewriters/TypeReferenceRewriter.cs index ad5cb96f..bdc4c4f3 100644 --- a/src/SMAPI/Framework/ModLoading/Rewriters/TypeReferenceRewriter.cs +++ b/src/SMAPI/Framework/ModLoading/Rewriters/TypeReferenceRewriter.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; 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 2171895d..55b7e0c8 100644 --- a/src/SMAPI/Framework/ModLoading/Symbols/SymbolReader.cs +++ b/src/SMAPI/Framework/ModLoading/Symbols/SymbolReader.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.IO; using Mono.Cecil; using Mono.Cecil.Cil; diff --git a/src/SMAPI/Framework/ModLoading/Symbols/SymbolReaderProvider.cs b/src/SMAPI/Framework/ModLoading/Symbols/SymbolReaderProvider.cs index d28c4a22..4af7c1e7 100644 --- a/src/SMAPI/Framework/ModLoading/Symbols/SymbolReaderProvider.cs +++ b/src/SMAPI/Framework/ModLoading/Symbols/SymbolReaderProvider.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/src/SMAPI/Framework/ModLoading/Symbols/SymbolWriterProvider.cs b/src/SMAPI/Framework/ModLoading/Symbols/SymbolWriterProvider.cs index 8f7e05d1..c2ac4cd6 100644 --- a/src/SMAPI/Framework/ModLoading/Symbols/SymbolWriterProvider.cs +++ b/src/SMAPI/Framework/ModLoading/Symbols/SymbolWriterProvider.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.IO; using Mono.Cecil; using Mono.Cecil.Cil; diff --git a/src/SMAPI/Framework/ModLoading/TypeReferenceComparer.cs b/src/SMAPI/Framework/ModLoading/TypeReferenceComparer.cs index a4ac54e2..248c29fc 100644 --- a/src/SMAPI/Framework/ModLoading/TypeReferenceComparer.cs +++ b/src/SMAPI/Framework/ModLoading/TypeReferenceComparer.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/ModRegistry.cs b/src/SMAPI/Framework/ModRegistry.cs index c0f8d537..cae38637 100644 --- a/src/SMAPI/Framework/ModRegistry.cs +++ b/src/SMAPI/Framework/ModRegistry.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics; diff --git a/src/SMAPI/Framework/Models/SConfig.cs b/src/SMAPI/Framework/Models/SConfig.cs index 1e78f316..e74d73b5 100644 --- a/src/SMAPI/Framework/Models/SConfig.cs +++ b/src/SMAPI/Framework/Models/SConfig.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/Monitor.cs b/src/SMAPI/Framework/Monitor.cs index 6b53daff..de145d1d 100644 --- a/src/SMAPI/Framework/Monitor.cs +++ b/src/SMAPI/Framework/Monitor.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/Networking/ModMessageModel.cs b/src/SMAPI/Framework/Networking/ModMessageModel.cs index 4f694f9c..4e7d01eb 100644 --- a/src/SMAPI/Framework/Networking/ModMessageModel.cs +++ b/src/SMAPI/Framework/Networking/ModMessageModel.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Linq; using Newtonsoft.Json.Linq; diff --git a/src/SMAPI/Framework/Networking/MultiplayerPeer.cs b/src/SMAPI/Framework/Networking/MultiplayerPeer.cs index 3923700f..8ee5c309 100644 --- a/src/SMAPI/Framework/Networking/MultiplayerPeer.cs +++ b/src/SMAPI/Framework/Networking/MultiplayerPeer.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/Networking/MultiplayerPeerMod.cs b/src/SMAPI/Framework/Networking/MultiplayerPeerMod.cs index 8087dc7e..6fdb9e54 100644 --- a/src/SMAPI/Framework/Networking/MultiplayerPeerMod.cs +++ b/src/SMAPI/Framework/Networking/MultiplayerPeerMod.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Framework.Networking { internal class MultiplayerPeerMod : IMultiplayerPeerMod diff --git a/src/SMAPI/Framework/Networking/RemoteContextModModel.cs b/src/SMAPI/Framework/Networking/RemoteContextModModel.cs index 9795d971..0383576c 100644 --- a/src/SMAPI/Framework/Networking/RemoteContextModModel.cs +++ b/src/SMAPI/Framework/Networking/RemoteContextModModel.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Framework.Networking { /// Metadata about an installed mod exchanged with connected computers. diff --git a/src/SMAPI/Framework/Networking/RemoteContextModel.cs b/src/SMAPI/Framework/Networking/RemoteContextModel.cs index 7befb151..37fafa67 100644 --- a/src/SMAPI/Framework/Networking/RemoteContextModel.cs +++ b/src/SMAPI/Framework/Networking/RemoteContextModel.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Framework.Networking { /// Metadata about the game, SMAPI, and installed mods exchanged with connected computers. diff --git a/src/SMAPI/Framework/Networking/SGalaxyNetClient.cs b/src/SMAPI/Framework/Networking/SGalaxyNetClient.cs index 01095c66..8e19b4a7 100644 --- a/src/SMAPI/Framework/Networking/SGalaxyNetClient.cs +++ b/src/SMAPI/Framework/Networking/SGalaxyNetClient.cs @@ -1,3 +1,5 @@ +#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 71e11576..07a004a2 100644 --- a/src/SMAPI/Framework/Networking/SGalaxyNetServer.cs +++ b/src/SMAPI/Framework/Networking/SGalaxyNetServer.cs @@ -1,3 +1,5 @@ +#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 39876744..ecf18cbd 100644 --- a/src/SMAPI/Framework/Networking/SLidgrenClient.cs +++ b/src/SMAPI/Framework/Networking/SLidgrenClient.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewValley.Network; diff --git a/src/SMAPI/Framework/Networking/SLidgrenServer.cs b/src/SMAPI/Framework/Networking/SLidgrenServer.cs index ff871e64..c0b247c8 100644 --- a/src/SMAPI/Framework/Networking/SLidgrenServer.cs +++ b/src/SMAPI/Framework/Networking/SLidgrenServer.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Diagnostics.CodeAnalysis; using System.IO; diff --git a/src/SMAPI/Framework/Reflection/CacheEntry.cs b/src/SMAPI/Framework/Reflection/CacheEntry.cs index 912662e3..6b18d204 100644 --- a/src/SMAPI/Framework/Reflection/CacheEntry.cs +++ b/src/SMAPI/Framework/Reflection/CacheEntry.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Reflection; namespace StardewModdingAPI.Framework.Reflection diff --git a/src/SMAPI/Framework/Reflection/InterfaceProxyFactory.cs b/src/SMAPI/Framework/Reflection/InterfaceProxyFactory.cs index 40adde8e..4c49e219 100644 --- a/src/SMAPI/Framework/Reflection/InterfaceProxyFactory.cs +++ b/src/SMAPI/Framework/Reflection/InterfaceProxyFactory.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Reflection; using System.Reflection.Emit; using Nanoray.Pintail; diff --git a/src/SMAPI/Framework/Reflection/ReflectedField.cs b/src/SMAPI/Framework/Reflection/ReflectedField.cs index 3c4da4fc..921876b9 100644 --- a/src/SMAPI/Framework/Reflection/ReflectedField.cs +++ b/src/SMAPI/Framework/Reflection/ReflectedField.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Reflection; diff --git a/src/SMAPI/Framework/Reflection/ReflectedMethod.cs b/src/SMAPI/Framework/Reflection/ReflectedMethod.cs index 26112806..50f89b40 100644 --- a/src/SMAPI/Framework/Reflection/ReflectedMethod.cs +++ b/src/SMAPI/Framework/Reflection/ReflectedMethod.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Reflection; diff --git a/src/SMAPI/Framework/Reflection/ReflectedProperty.cs b/src/SMAPI/Framework/Reflection/ReflectedProperty.cs index 42d7bb59..a6d8c75c 100644 --- a/src/SMAPI/Framework/Reflection/ReflectedProperty.cs +++ b/src/SMAPI/Framework/Reflection/ReflectedProperty.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Reflection; diff --git a/src/SMAPI/Framework/Reflection/Reflector.cs b/src/SMAPI/Framework/Reflection/Reflector.cs index 3a93ab5d..d5938c3f 100644 --- a/src/SMAPI/Framework/Reflection/Reflector.cs +++ b/src/SMAPI/Framework/Reflection/Reflector.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Linq; using System.Reflection; diff --git a/src/SMAPI/Framework/Rendering/SDisplayDevice.cs b/src/SMAPI/Framework/Rendering/SDisplayDevice.cs index 85e69ae6..8718bcb1 100644 --- a/src/SMAPI/Framework/Rendering/SDisplayDevice.cs +++ b/src/SMAPI/Framework/Rendering/SDisplayDevice.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Content; diff --git a/src/SMAPI/Framework/Rendering/SXnaDisplayDevice.cs b/src/SMAPI/Framework/Rendering/SXnaDisplayDevice.cs index cb499c6b..21edaedd 100644 --- a/src/SMAPI/Framework/Rendering/SXnaDisplayDevice.cs +++ b/src/SMAPI/Framework/Rendering/SXnaDisplayDevice.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/SMAPI/Framework/RequestExitDelegate.cs b/src/SMAPI/Framework/RequestExitDelegate.cs index 810c399b..93ef1cf9 100644 --- a/src/SMAPI/Framework/RequestExitDelegate.cs +++ b/src/SMAPI/Framework/RequestExitDelegate.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Framework { /// A delegate which requests that SMAPI immediately exit the game. This should only be invoked when an irrecoverable fatal error happens that risks save corruption or game-breaking bugs. diff --git a/src/SMAPI/Framework/SChatBox.cs b/src/SMAPI/Framework/SChatBox.cs index e000d1cd..d6286c12 100644 --- a/src/SMAPI/Framework/SChatBox.cs +++ b/src/SMAPI/Framework/SChatBox.cs @@ -1,3 +1,5 @@ +#nullable disable + using StardewValley; using StardewValley.Menus; diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs index b471c383..8a5c10f6 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Concurrent; using System.Collections.Generic; diff --git a/src/SMAPI/Framework/SGame.cs b/src/SMAPI/Framework/SGame.cs index 989b59d8..7ca89eec 100644 --- a/src/SMAPI/Framework/SGame.cs +++ b/src/SMAPI/Framework/SGame.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.ObjectModel; using System.Diagnostics.CodeAnalysis; diff --git a/src/SMAPI/Framework/SGameRunner.cs b/src/SMAPI/Framework/SGameRunner.cs index 81cac145..dae314af 100644 --- a/src/SMAPI/Framework/SGameRunner.cs +++ b/src/SMAPI/Framework/SGameRunner.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/SModHooks.cs b/src/SMAPI/Framework/SModHooks.cs index 101e022a..7941e102 100644 --- a/src/SMAPI/Framework/SModHooks.cs +++ b/src/SMAPI/Framework/SModHooks.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Threading.Tasks; using StardewValley; diff --git a/src/SMAPI/Framework/SMultiplayer.cs b/src/SMAPI/Framework/SMultiplayer.cs index bcf97006..de3c25a5 100644 --- a/src/SMAPI/Framework/SMultiplayer.cs +++ b/src/SMAPI/Framework/SMultiplayer.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/src/SMAPI/Framework/Serialization/ColorConverter.cs b/src/SMAPI/Framework/Serialization/ColorConverter.cs index 3b3720b5..8fb6cd9c 100644 --- a/src/SMAPI/Framework/Serialization/ColorConverter.cs +++ b/src/SMAPI/Framework/Serialization/ColorConverter.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using Microsoft.Xna.Framework; using Newtonsoft.Json.Linq; diff --git a/src/SMAPI/Framework/Serialization/KeybindConverter.cs b/src/SMAPI/Framework/Serialization/KeybindConverter.cs index 7c5db3ad..9cf52228 100644 --- a/src/SMAPI/Framework/Serialization/KeybindConverter.cs +++ b/src/SMAPI/Framework/Serialization/KeybindConverter.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using Newtonsoft.Json; using Newtonsoft.Json.Linq; diff --git a/src/SMAPI/Framework/Serialization/PointConverter.cs b/src/SMAPI/Framework/Serialization/PointConverter.cs index 21d1f845..b48d757a 100644 --- a/src/SMAPI/Framework/Serialization/PointConverter.cs +++ b/src/SMAPI/Framework/Serialization/PointConverter.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using Microsoft.Xna.Framework; using Newtonsoft.Json.Linq; diff --git a/src/SMAPI/Framework/Serialization/RectangleConverter.cs b/src/SMAPI/Framework/Serialization/RectangleConverter.cs index 31f3ad77..7f060e3a 100644 --- a/src/SMAPI/Framework/Serialization/RectangleConverter.cs +++ b/src/SMAPI/Framework/Serialization/RectangleConverter.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Text.RegularExpressions; using Microsoft.Xna.Framework; diff --git a/src/SMAPI/Framework/Serialization/Vector2Converter.cs b/src/SMAPI/Framework/Serialization/Vector2Converter.cs index 589febf8..bcd483d3 100644 --- a/src/SMAPI/Framework/Serialization/Vector2Converter.cs +++ b/src/SMAPI/Framework/Serialization/Vector2Converter.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using Microsoft.Xna.Framework; using Newtonsoft.Json.Linq; diff --git a/src/SMAPI/Framework/Singleton.cs b/src/SMAPI/Framework/Singleton.cs index 1bf318c4..da16c48e 100644 --- a/src/SMAPI/Framework/Singleton.cs +++ b/src/SMAPI/Framework/Singleton.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI.Framework { /// Provides singleton instances of a given type. diff --git a/src/SMAPI/Framework/SnapshotDiff.cs b/src/SMAPI/Framework/SnapshotDiff.cs index 5b6288ff..eb2aebe1 100644 --- a/src/SMAPI/Framework/SnapshotDiff.cs +++ b/src/SMAPI/Framework/SnapshotDiff.cs @@ -1,3 +1,5 @@ +#nullable disable + using StardewModdingAPI.Framework.StateTracking; namespace StardewModdingAPI.Framework diff --git a/src/SMAPI/Framework/SnapshotItemListDiff.cs b/src/SMAPI/Framework/SnapshotItemListDiff.cs index e8ab1b1e..97942783 100644 --- a/src/SMAPI/Framework/SnapshotItemListDiff.cs +++ b/src/SMAPI/Framework/SnapshotItemListDiff.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.Linq; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Framework/SnapshotListDiff.cs b/src/SMAPI/Framework/SnapshotListDiff.cs index 1c3ebfba..1d585c15 100644 --- a/src/SMAPI/Framework/SnapshotListDiff.cs +++ b/src/SMAPI/Framework/SnapshotListDiff.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using StardewModdingAPI.Framework.StateTracking; diff --git a/src/SMAPI/Framework/StateTracking/ChestTracker.cs b/src/SMAPI/Framework/StateTracking/ChestTracker.cs index 56aeeb3c..28335200 100644 --- a/src/SMAPI/Framework/StateTracking/ChestTracker.cs +++ b/src/SMAPI/Framework/StateTracking/ChestTracker.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/StateTracking/Comparers/EquatableComparer.cs b/src/SMAPI/Framework/StateTracking/Comparers/EquatableComparer.cs index a96ffdb6..987e1820 100644 --- a/src/SMAPI/Framework/StateTracking/Comparers/EquatableComparer.cs +++ b/src/SMAPI/Framework/StateTracking/Comparers/EquatableComparer.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Runtime.CompilerServices; diff --git a/src/SMAPI/Framework/StateTracking/Comparers/GenericEqualsComparer.cs b/src/SMAPI/Framework/StateTracking/Comparers/GenericEqualsComparer.cs index cc1d6553..f6b04583 100644 --- a/src/SMAPI/Framework/StateTracking/Comparers/GenericEqualsComparer.cs +++ b/src/SMAPI/Framework/StateTracking/Comparers/GenericEqualsComparer.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.Runtime.CompilerServices; diff --git a/src/SMAPI/Framework/StateTracking/Comparers/ObjectReferenceComparer.cs b/src/SMAPI/Framework/StateTracking/Comparers/ObjectReferenceComparer.cs index ef9adafb..8d3a7eb9 100644 --- a/src/SMAPI/Framework/StateTracking/Comparers/ObjectReferenceComparer.cs +++ b/src/SMAPI/Framework/StateTracking/Comparers/ObjectReferenceComparer.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.Runtime.CompilerServices; diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/BaseDisposableWatcher.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/BaseDisposableWatcher.cs index 60006c51..03bf84d9 100644 --- a/src/SMAPI/Framework/StateTracking/FieldWatchers/BaseDisposableWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/BaseDisposableWatcher.cs @@ -1,3 +1,5 @@ +#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 256370ce..52e1dbad 100644 --- a/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableListWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableListWatcher.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableWatcher.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableWatcher.cs index 5ca4b9f4..4f94294c 100644 --- a/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/ComparableWatcher.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/ImmutableCollectionWatcher.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/ImmutableCollectionWatcher.cs index 84340fbf..94ce0c8e 100644 --- a/src/SMAPI/Framework/StateTracking/FieldWatchers/ImmutableCollectionWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/ImmutableCollectionWatcher.cs @@ -1,3 +1,5 @@ +#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 676c9fb4..e662c433 100644 --- a/src/SMAPI/Framework/StateTracking/FieldWatchers/NetCollectionWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/NetCollectionWatcher.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using Netcode; diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/NetDictionaryWatcher.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/NetDictionaryWatcher.cs index e6882f7e..0d7f2ad2 100644 --- a/src/SMAPI/Framework/StateTracking/FieldWatchers/NetDictionaryWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/NetDictionaryWatcher.cs @@ -1,3 +1,5 @@ +#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 0b4d3030..a97e754c 100644 --- a/src/SMAPI/Framework/StateTracking/FieldWatchers/NetListWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/NetListWatcher.cs @@ -1,3 +1,5 @@ +#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 48d5d681..26641750 100644 --- a/src/SMAPI/Framework/StateTracking/FieldWatchers/NetValueWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/NetValueWatcher.cs @@ -1,3 +1,5 @@ +#nullable disable + using Netcode; namespace StardewModdingAPI.Framework.StateTracking.FieldWatchers diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/ObservableCollectionWatcher.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/ObservableCollectionWatcher.cs index 3e9fa8b1..82e5387e 100644 --- a/src/SMAPI/Framework/StateTracking/FieldWatchers/ObservableCollectionWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/ObservableCollectionWatcher.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.Collections.ObjectModel; using System.Collections.Specialized; diff --git a/src/SMAPI/Framework/StateTracking/FieldWatchers/WatcherFactory.cs b/src/SMAPI/Framework/StateTracking/FieldWatchers/WatcherFactory.cs index bde43486..0b99914c 100644 --- a/src/SMAPI/Framework/StateTracking/FieldWatchers/WatcherFactory.cs +++ b/src/SMAPI/Framework/StateTracking/FieldWatchers/WatcherFactory.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Collections.ObjectModel; diff --git a/src/SMAPI/Framework/StateTracking/ICollectionWatcher.cs b/src/SMAPI/Framework/StateTracking/ICollectionWatcher.cs index 7a7759e3..74c9313b 100644 --- a/src/SMAPI/Framework/StateTracking/ICollectionWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/ICollectionWatcher.cs @@ -1,3 +1,5 @@ +#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 691ed377..81fb7460 100644 --- a/src/SMAPI/Framework/StateTracking/IDictionaryWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/IDictionaryWatcher.cs @@ -1,3 +1,5 @@ +#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 4afca972..7d46053c 100644 --- a/src/SMAPI/Framework/StateTracking/IValueWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/IValueWatcher.cs @@ -1,3 +1,5 @@ +#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 8c7fa51c..3603b6f8 100644 --- a/src/SMAPI/Framework/StateTracking/IWatcher.cs +++ b/src/SMAPI/Framework/StateTracking/IWatcher.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI.Framework.StateTracking diff --git a/src/SMAPI/Framework/StateTracking/LocationTracker.cs b/src/SMAPI/Framework/StateTracking/LocationTracker.cs index f86f86ee..9c2ff7f0 100644 --- a/src/SMAPI/Framework/StateTracking/LocationTracker.cs +++ b/src/SMAPI/Framework/StateTracking/LocationTracker.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/StateTracking/PlayerTracker.cs b/src/SMAPI/Framework/StateTracking/PlayerTracker.cs index 3d470b5c..367eafea 100644 --- a/src/SMAPI/Framework/StateTracking/PlayerTracker.cs +++ b/src/SMAPI/Framework/StateTracking/PlayerTracker.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/StateTracking/Snapshots/LocationSnapshot.cs b/src/SMAPI/Framework/StateTracking/Snapshots/LocationSnapshot.cs index 2563d10c..3d13f92b 100644 --- a/src/SMAPI/Framework/StateTracking/Snapshots/LocationSnapshot.cs +++ b/src/SMAPI/Framework/StateTracking/Snapshots/LocationSnapshot.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using Microsoft.Xna.Framework; using StardewValley; diff --git a/src/SMAPI/Framework/StateTracking/Snapshots/PlayerSnapshot.cs b/src/SMAPI/Framework/StateTracking/Snapshots/PlayerSnapshot.cs index e113d27c..bf81a35e 100644 --- a/src/SMAPI/Framework/StateTracking/Snapshots/PlayerSnapshot.cs +++ b/src/SMAPI/Framework/StateTracking/Snapshots/PlayerSnapshot.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/StateTracking/Snapshots/WatcherSnapshot.cs b/src/SMAPI/Framework/StateTracking/Snapshots/WatcherSnapshot.cs index afea7fb4..1d43ef26 100644 --- a/src/SMAPI/Framework/StateTracking/Snapshots/WatcherSnapshot.cs +++ b/src/SMAPI/Framework/StateTracking/Snapshots/WatcherSnapshot.cs @@ -1,3 +1,5 @@ +#nullable disable + using Microsoft.Xna.Framework; using StardewValley; using StardewValley.Menus; diff --git a/src/SMAPI/Framework/StateTracking/Snapshots/WorldLocationsSnapshot.cs b/src/SMAPI/Framework/StateTracking/Snapshots/WorldLocationsSnapshot.cs index 7dee09ca..88aac0df 100644 --- a/src/SMAPI/Framework/StateTracking/Snapshots/WorldLocationsSnapshot.cs +++ b/src/SMAPI/Framework/StateTracking/Snapshots/WorldLocationsSnapshot.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.Linq; using StardewModdingAPI.Framework.StateTracking.Comparers; diff --git a/src/SMAPI/Framework/StateTracking/WorldLocationsTracker.cs b/src/SMAPI/Framework/StateTracking/WorldLocationsTracker.cs index e968d79c..ab02d7d5 100644 --- a/src/SMAPI/Framework/StateTracking/WorldLocationsTracker.cs +++ b/src/SMAPI/Framework/StateTracking/WorldLocationsTracker.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.Collections.ObjectModel; using System.Linq; diff --git a/src/SMAPI/Framework/TemporaryHacks/MiniMonoModHotfix.cs b/src/SMAPI/Framework/TemporaryHacks/MiniMonoModHotfix.cs index c0f119f1..5f0ecfa0 100644 --- a/src/SMAPI/Framework/TemporaryHacks/MiniMonoModHotfix.cs +++ b/src/SMAPI/Framework/TemporaryHacks/MiniMonoModHotfix.cs @@ -1,3 +1,5 @@ +#nullable disable + // This temporary utility fixes an esoteric issue in XNA Framework where deserialization depends on // the order of fields returned by Type.GetFields, but that order changes after Harmony/MonoMod use // reflection to access the fields due to an issue in .NET Framework. diff --git a/src/SMAPI/Framework/Translator.cs b/src/SMAPI/Framework/Translator.cs index 4492b17f..144b043c 100644 --- a/src/SMAPI/Framework/Translator.cs +++ b/src/SMAPI/Framework/Translator.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Framework/Utilities/ContextHash.cs b/src/SMAPI/Framework/Utilities/ContextHash.cs index 6c0fdc90..46b9099e 100644 --- a/src/SMAPI/Framework/Utilities/ContextHash.cs +++ b/src/SMAPI/Framework/Utilities/ContextHash.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; diff --git a/src/SMAPI/Framework/Utilities/Countdown.cs b/src/SMAPI/Framework/Utilities/Countdown.cs index 342b4258..94c69e73 100644 --- a/src/SMAPI/Framework/Utilities/Countdown.cs +++ b/src/SMAPI/Framework/Utilities/Countdown.cs @@ -1,4 +1,4 @@ -namespace StardewModdingAPI.Framework.Utilities +namespace StardewModdingAPI.Framework.Utilities { /// Counts down from a baseline value. internal class Countdown diff --git a/src/SMAPI/Framework/Utilities/TickCacheDictionary.cs b/src/SMAPI/Framework/Utilities/TickCacheDictionary.cs index d0f276d2..94ce0069 100644 --- a/src/SMAPI/Framework/Utilities/TickCacheDictionary.cs +++ b/src/SMAPI/Framework/Utilities/TickCacheDictionary.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; diff --git a/src/SMAPI/Framework/WatcherCore.cs b/src/SMAPI/Framework/WatcherCore.cs index a1612e75..bd8d3367 100644 --- a/src/SMAPI/Framework/WatcherCore.cs +++ b/src/SMAPI/Framework/WatcherCore.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using System.Collections.ObjectModel; using Microsoft.Xna.Framework; diff --git a/src/SMAPI/GamePlatform.cs b/src/SMAPI/GamePlatform.cs index cce5ed8d..8013faa9 100644 --- a/src/SMAPI/GamePlatform.cs +++ b/src/SMAPI/GamePlatform.cs @@ -1,3 +1,5 @@ +#nullable disable + using StardewModdingAPI.Toolkit.Utilities; namespace StardewModdingAPI diff --git a/src/SMAPI/IAssetData.cs b/src/SMAPI/IAssetData.cs index 8df59e53..f07340e4 100644 --- a/src/SMAPI/IAssetData.cs +++ b/src/SMAPI/IAssetData.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI diff --git a/src/SMAPI/IAssetDataForDictionary.cs b/src/SMAPI/IAssetDataForDictionary.cs index 1136316f..82ba25cb 100644 --- a/src/SMAPI/IAssetDataForDictionary.cs +++ b/src/SMAPI/IAssetDataForDictionary.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; namespace StardewModdingAPI diff --git a/src/SMAPI/IAssetDataForImage.cs b/src/SMAPI/IAssetDataForImage.cs index 27ed9267..388caa68 100644 --- a/src/SMAPI/IAssetDataForImage.cs +++ b/src/SMAPI/IAssetDataForImage.cs @@ -1,3 +1,5 @@ +#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 47a33de8..89ee28f2 100644 --- a/src/SMAPI/IAssetDataForMap.cs +++ b/src/SMAPI/IAssetDataForMap.cs @@ -1,3 +1,5 @@ +#nullable disable + using Microsoft.Xna.Framework; using xTile; diff --git a/src/SMAPI/IAssetEditor.cs b/src/SMAPI/IAssetEditor.cs index 9f22ed83..f3d91bd0 100644 --- a/src/SMAPI/IAssetEditor.cs +++ b/src/SMAPI/IAssetEditor.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/IAssetInfo.cs b/src/SMAPI/IAssetInfo.cs index 64d10b35..5b4ac479 100644 --- a/src/SMAPI/IAssetInfo.cs +++ b/src/SMAPI/IAssetInfo.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI diff --git a/src/SMAPI/IAssetLoader.cs b/src/SMAPI/IAssetLoader.cs index 96b98793..0d52a481 100644 --- a/src/SMAPI/IAssetLoader.cs +++ b/src/SMAPI/IAssetLoader.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/IAssetName.cs b/src/SMAPI/IAssetName.cs index c91da266..22f5c6b7 100644 --- a/src/SMAPI/IAssetName.cs +++ b/src/SMAPI/IAssetName.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewValley; diff --git a/src/SMAPI/ICommandHelper.cs b/src/SMAPI/ICommandHelper.cs index 9f1c345c..a0c524d6 100644 --- a/src/SMAPI/ICommandHelper.cs +++ b/src/SMAPI/ICommandHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI diff --git a/src/SMAPI/IContentHelper.cs b/src/SMAPI/IContentHelper.cs index 48f6bfd8..0ad209ab 100644 --- a/src/SMAPI/IContentHelper.cs +++ b/src/SMAPI/IContentHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.Contracts; diff --git a/src/SMAPI/IContentPack.cs b/src/SMAPI/IContentPack.cs index 3c66faff..f853e2b4 100644 --- a/src/SMAPI/IContentPack.cs +++ b/src/SMAPI/IContentPack.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; diff --git a/src/SMAPI/IContentPackHelper.cs b/src/SMAPI/IContentPackHelper.cs index c48a4f86..5464df22 100644 --- a/src/SMAPI/IContentPackHelper.cs +++ b/src/SMAPI/IContentPackHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; namespace StardewModdingAPI diff --git a/src/SMAPI/ICursorPosition.cs b/src/SMAPI/ICursorPosition.cs index 99c1b84d..da6cbb62 100644 --- a/src/SMAPI/ICursorPosition.cs +++ b/src/SMAPI/ICursorPosition.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using Microsoft.Xna.Framework; using StardewValley; diff --git a/src/SMAPI/IDataHelper.cs b/src/SMAPI/IDataHelper.cs index 901266d7..4c96367b 100644 --- a/src/SMAPI/IDataHelper.cs +++ b/src/SMAPI/IDataHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI diff --git a/src/SMAPI/IGameContentHelper.cs b/src/SMAPI/IGameContentHelper.cs index 86bc3e0e..4b967993 100644 --- a/src/SMAPI/IGameContentHelper.cs +++ b/src/SMAPI/IGameContentHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; diff --git a/src/SMAPI/IInputHelper.cs b/src/SMAPI/IInputHelper.cs index 2b907b0d..b7ed0838 100644 --- a/src/SMAPI/IInputHelper.cs +++ b/src/SMAPI/IInputHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using StardewModdingAPI.Utilities; namespace StardewModdingAPI diff --git a/src/SMAPI/IMod.cs b/src/SMAPI/IMod.cs index 44ef32c9..0de4961e 100644 --- a/src/SMAPI/IMod.cs +++ b/src/SMAPI/IMod.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI { /// The implementation for a Stardew Valley mod. diff --git a/src/SMAPI/IModContentHelper.cs b/src/SMAPI/IModContentHelper.cs index e3431365..815d6848 100644 --- a/src/SMAPI/IModContentHelper.cs +++ b/src/SMAPI/IModContentHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using Microsoft.Xna.Framework.Content; using Microsoft.Xna.Framework.Graphics; diff --git a/src/SMAPI/IModHelper.cs b/src/SMAPI/IModHelper.cs index 15e4ed8d..5e4246aa 100644 --- a/src/SMAPI/IModHelper.cs +++ b/src/SMAPI/IModHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using StardewModdingAPI.Events; diff --git a/src/SMAPI/IModInfo.cs b/src/SMAPI/IModInfo.cs index 3c85d454..2788e4fc 100644 --- a/src/SMAPI/IModInfo.cs +++ b/src/SMAPI/IModInfo.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI { /// Metadata for a loaded mod. diff --git a/src/SMAPI/IModLinked.cs b/src/SMAPI/IModLinked.cs index 172ee30c..cf08c9c5 100644 --- a/src/SMAPI/IModLinked.cs +++ b/src/SMAPI/IModLinked.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI { /// An instance linked to a mod. diff --git a/src/SMAPI/IModRegistry.cs b/src/SMAPI/IModRegistry.cs index 10b3121e..9cab08a1 100644 --- a/src/SMAPI/IModRegistry.cs +++ b/src/SMAPI/IModRegistry.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; namespace StardewModdingAPI diff --git a/src/SMAPI/IMonitor.cs b/src/SMAPI/IMonitor.cs index c400a211..535f56e3 100644 --- a/src/SMAPI/IMonitor.cs +++ b/src/SMAPI/IMonitor.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI { /// Encapsulates monitoring and logging for a given module. diff --git a/src/SMAPI/IMultiplayerHelper.cs b/src/SMAPI/IMultiplayerHelper.cs index 4067a676..77a0f3f4 100644 --- a/src/SMAPI/IMultiplayerHelper.cs +++ b/src/SMAPI/IMultiplayerHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using StardewValley; diff --git a/src/SMAPI/IMultiplayerPeer.cs b/src/SMAPI/IMultiplayerPeer.cs index 47084174..e487f100 100644 --- a/src/SMAPI/IMultiplayerPeer.cs +++ b/src/SMAPI/IMultiplayerPeer.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; namespace StardewModdingAPI diff --git a/src/SMAPI/IMultiplayerPeerMod.cs b/src/SMAPI/IMultiplayerPeerMod.cs index 005408b1..81978bef 100644 --- a/src/SMAPI/IMultiplayerPeerMod.cs +++ b/src/SMAPI/IMultiplayerPeerMod.cs @@ -1,3 +1,5 @@ +#nullable disable + namespace StardewModdingAPI { /// Metadata about a mod installed by a connected player. diff --git a/src/SMAPI/IReflectedField.cs b/src/SMAPI/IReflectedField.cs index 7ff61f29..94dbe6a3 100644 --- a/src/SMAPI/IReflectedField.cs +++ b/src/SMAPI/IReflectedField.cs @@ -1,4 +1,6 @@ -using System.Reflection; +#nullable disable + +using System.Reflection; namespace StardewModdingAPI { diff --git a/src/SMAPI/IReflectedMethod.cs b/src/SMAPI/IReflectedMethod.cs index 646e7301..78e66cb1 100644 --- a/src/SMAPI/IReflectedMethod.cs +++ b/src/SMAPI/IReflectedMethod.cs @@ -1,4 +1,6 @@ -using System.Reflection; +#nullable disable + +using System.Reflection; namespace StardewModdingAPI { diff --git a/src/SMAPI/IReflectedProperty.cs b/src/SMAPI/IReflectedProperty.cs index 73ad9f30..edbf0b21 100644 --- a/src/SMAPI/IReflectedProperty.cs +++ b/src/SMAPI/IReflectedProperty.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Reflection; namespace StardewModdingAPI diff --git a/src/SMAPI/IReflectionHelper.cs b/src/SMAPI/IReflectionHelper.cs index a2b9eb32..bf7270cf 100644 --- a/src/SMAPI/IReflectionHelper.cs +++ b/src/SMAPI/IReflectionHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI diff --git a/src/SMAPI/ITranslationHelper.cs b/src/SMAPI/ITranslationHelper.cs index b30d9b14..3c297731 100644 --- a/src/SMAPI/ITranslationHelper.cs +++ b/src/SMAPI/ITranslationHelper.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using StardewValley; diff --git a/src/SMAPI/Metadata/CoreAssetPropagator.cs b/src/SMAPI/Metadata/CoreAssetPropagator.cs index 159e19fd..b7cec72c 100644 --- a/src/SMAPI/Metadata/CoreAssetPropagator.cs +++ b/src/SMAPI/Metadata/CoreAssetPropagator.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; diff --git a/src/SMAPI/Metadata/InstructionMetadata.cs b/src/SMAPI/Metadata/InstructionMetadata.cs index 367372b2..5617fd13 100644 --- a/src/SMAPI/Metadata/InstructionMetadata.cs +++ b/src/SMAPI/Metadata/InstructionMetadata.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Collections.Generic; using Microsoft.Xna.Framework.Graphics; using StardewModdingAPI.Events; diff --git a/src/SMAPI/Mod.cs b/src/SMAPI/Mod.cs index 9af55cd4..2b3750d5 100644 --- a/src/SMAPI/Mod.cs +++ b/src/SMAPI/Mod.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; namespace StardewModdingAPI diff --git a/src/SMAPI/Patches/Game1Patcher.cs b/src/SMAPI/Patches/Game1Patcher.cs index 173a2055..c5d98e9e 100644 --- a/src/SMAPI/Patches/Game1Patcher.cs +++ b/src/SMAPI/Patches/Game1Patcher.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Diagnostics.CodeAnalysis; using HarmonyLib; diff --git a/src/SMAPI/Patches/TitleMenuPatcher.cs b/src/SMAPI/Patches/TitleMenuPatcher.cs index b4320ce0..56e5597c 100644 --- a/src/SMAPI/Patches/TitleMenuPatcher.cs +++ b/src/SMAPI/Patches/TitleMenuPatcher.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Diagnostics.CodeAnalysis; using HarmonyLib; diff --git a/src/SMAPI/Program.cs b/src/SMAPI/Program.cs index 1039cc9a..a8664160 100644 --- a/src/SMAPI/Program.cs +++ b/src/SMAPI/Program.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/src/SMAPI/SemanticVersion.cs b/src/SMAPI/SemanticVersion.cs index ae616419..4e484633 100644 --- a/src/SMAPI/SemanticVersion.cs +++ b/src/SMAPI/SemanticVersion.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using Newtonsoft.Json; diff --git a/src/SMAPI/Translation.cs b/src/SMAPI/Translation.cs index 5ab432f0..ef98a00f 100644 --- a/src/SMAPI/Translation.cs +++ b/src/SMAPI/Translation.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections; using System.Collections.Generic; diff --git a/src/SMAPI/Utilities/CaseInsensitivePathCache.cs b/src/SMAPI/Utilities/CaseInsensitivePathCache.cs index 1d947b53..4596fdce 100644 --- a/src/SMAPI/Utilities/CaseInsensitivePathCache.cs +++ b/src/SMAPI/Utilities/CaseInsensitivePathCache.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.IO; diff --git a/src/SMAPI/Utilities/Keybind.cs b/src/SMAPI/Utilities/Keybind.cs index 7aefe686..7b1acf1d 100644 --- a/src/SMAPI/Utilities/Keybind.cs +++ b/src/SMAPI/Utilities/Keybind.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Utilities/KeybindList.cs b/src/SMAPI/Utilities/KeybindList.cs index f24976f7..7b2c396b 100644 --- a/src/SMAPI/Utilities/KeybindList.cs +++ b/src/SMAPI/Utilities/KeybindList.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Utilities/PathUtilities.cs b/src/SMAPI/Utilities/PathUtilities.cs index 541b163c..e8ab9645 100644 --- a/src/SMAPI/Utilities/PathUtilities.cs +++ b/src/SMAPI/Utilities/PathUtilities.cs @@ -1,3 +1,5 @@ +#nullable disable + using System.Diagnostics.Contracts; using ToolkitPathUtilities = StardewModdingAPI.Toolkit.Utilities.PathUtilities; diff --git a/src/SMAPI/Utilities/PerScreen.cs b/src/SMAPI/Utilities/PerScreen.cs index 6b7153ac..afe3ba91 100644 --- a/src/SMAPI/Utilities/PerScreen.cs +++ b/src/SMAPI/Utilities/PerScreen.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Collections.Generic; using System.Linq; diff --git a/src/SMAPI/Utilities/SDate.cs b/src/SMAPI/Utilities/SDate.cs index e10a59f8..b10bc3da 100644 --- a/src/SMAPI/Utilities/SDate.cs +++ b/src/SMAPI/Utilities/SDate.cs @@ -1,3 +1,5 @@ +#nullable disable + using System; using System.Linq; using Newtonsoft.Json; -- cgit From 238045ba9c5937f684cad3c55a8f9b9c2733e45f Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Thu, 7 Apr 2022 22:19:48 -0400 Subject: reverse mod build package migration to .NET 5 (#837) The migrated package didn't work consistently in VIsual Studio, so this suppresses nullable annotations in .NET Standard instead. --- build/common.targets | 5 ++- docs/technical/mod-package.md | 10 ------ .../SMAPI.ModBuildConfig.Analyzer.csproj | 2 +- .../SMAPI.ModBuildConfig.csproj | 2 +- .../SMAPI.Toolkit.CoreInterfaces.csproj | 2 +- .../Framework/SemanticVersionReader.cs | 7 +++- .../Framework/UpdateData/UpdateKey.cs | 2 ++ src/SMAPI.Toolkit/SMAPI.Toolkit.csproj | 2 +- src/SMAPI.Toolkit/SemanticVersion.cs | 14 ++++++-- src/SMAPI.Toolkit/Serialization/JsonHelper.cs | 7 +++- src/SMAPI.Toolkit/Serialization/Models/Manifest.cs | 2 ++ .../Serialization/Models/ManifestContentPackFor.cs | 2 ++ .../Serialization/Models/ManifestDependency.cs | 2 ++ src/SMAPI.Toolkit/Utilities/PathUtilities.cs | 42 +++++++++++++++++++++- 14 files changed, 81 insertions(+), 20 deletions(-) (limited to 'build/common.targets') diff --git a/build/common.targets b/build/common.targets index 258b48f2..c227190a 100644 --- a/build/common.targets +++ b/build/common.targets @@ -5,7 +5,10 @@ SMAPI latest $(AssemblySearchPaths);{GAC} - enable + + + enable + $(NoWarn);CS8632 $(DefineConstants);SMAPI_FOR_WINDOWS diff --git a/docs/technical/mod-package.md b/docs/technical/mod-package.md index 6123b28f..4c31f69b 100644 --- a/docs/technical/mod-package.md +++ b/docs/technical/mod-package.md @@ -413,19 +413,9 @@ when you compile it. ## Release notes ## Upcoming release -* Migrated from .NET Standard 2.0 to .NET 5.0. * Added detection for Xbox app game folders. * Internal refactoring. -**Troubleshooting:** -Due to the framework change, you might see build errors like _task failed unexpectedly_ that mentions `System.Runtime Version=5.0.0`. If so: - -1. Make sure you have Visual Studio 2022 or later. -2. Exit all instances of Visual Studio. -3. Delete the hidden `.vs` folder in your solution folder. -4. Delete the `bin` and `obj` folders in each project folder. -5. Reopen the solution and rebuild, and now it should work fine. - ## 4.0.0 Released 30 November 2021. diff --git a/src/SMAPI.ModBuildConfig.Analyzer/SMAPI.ModBuildConfig.Analyzer.csproj b/src/SMAPI.ModBuildConfig.Analyzer/SMAPI.ModBuildConfig.Analyzer.csproj index 69fd3dbd..7ac3277e 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer/SMAPI.ModBuildConfig.Analyzer.csproj +++ b/src/SMAPI.ModBuildConfig.Analyzer/SMAPI.ModBuildConfig.Analyzer.csproj @@ -2,7 +2,7 @@ StardewModdingAPI.ModBuildConfig.Analyzer 3.0.0 - net5.0 + netstandard2.0 false bin latest diff --git a/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj b/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj index 8e70293e..82eac7f6 100644 --- a/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj +++ b/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj @@ -2,7 +2,7 @@ StardewModdingAPI.ModBuildConfig - net5.0 + netstandard2.0 latest true true diff --git a/src/SMAPI.Toolkit.CoreInterfaces/SMAPI.Toolkit.CoreInterfaces.csproj b/src/SMAPI.Toolkit.CoreInterfaces/SMAPI.Toolkit.CoreInterfaces.csproj index d69d53d5..4c92b4db 100644 --- a/src/SMAPI.Toolkit.CoreInterfaces/SMAPI.Toolkit.CoreInterfaces.csproj +++ b/src/SMAPI.Toolkit.CoreInterfaces/SMAPI.Toolkit.CoreInterfaces.csproj @@ -2,7 +2,7 @@ StardewModdingAPI Provides toolkit interfaces which are available to SMAPI mods. - net5.0 + net5.0; netstandard2.0 true diff --git a/src/SMAPI.Toolkit/Framework/SemanticVersionReader.cs b/src/SMAPI.Toolkit/Framework/SemanticVersionReader.cs index 836b1134..939be771 100644 --- a/src/SMAPI.Toolkit/Framework/SemanticVersionReader.cs +++ b/src/SMAPI.Toolkit/Framework/SemanticVersionReader.cs @@ -105,7 +105,12 @@ namespace StardewModdingAPI.Toolkit.Framework /// The raw characters to parse. /// The index of the next character to read. /// The parsed tag. - private static bool TryParseTag(char[] raw, ref int index, [NotNullWhen(true)] out string? tag) + private static bool TryParseTag(char[] raw, ref int index, +#if NET5_0_OR_GREATER + [NotNullWhen(true)] +#endif + out string? tag + ) { // read tag length int length = 0; diff --git a/src/SMAPI.Toolkit/Framework/UpdateData/UpdateKey.cs b/src/SMAPI.Toolkit/Framework/UpdateData/UpdateKey.cs index d40d8f2b..4c9ca2ff 100644 --- a/src/SMAPI.Toolkit/Framework/UpdateData/UpdateKey.cs +++ b/src/SMAPI.Toolkit/Framework/UpdateData/UpdateKey.cs @@ -16,7 +16,9 @@ namespace StardewModdingAPI.Toolkit.Framework.UpdateData public ModSiteKey Site { get; } /// The mod ID within the repository. +#if NET5_0_OR_GREATER [MemberNotNullWhen(true, nameof(LooksValid))] +#endif public string? ID { get; } /// If specified, a substring in download names/descriptions to match. diff --git a/src/SMAPI.Toolkit/SMAPI.Toolkit.csproj b/src/SMAPI.Toolkit/SMAPI.Toolkit.csproj index 6a8c4c43..ec27bf79 100644 --- a/src/SMAPI.Toolkit/SMAPI.Toolkit.csproj +++ b/src/SMAPI.Toolkit/SMAPI.Toolkit.csproj @@ -2,7 +2,7 @@ StardewModdingAPI.Toolkit A library which encapsulates mod-handling logic for mod managers and tools. Not intended for use by mods. - net5.0 + net5.0; netstandard2.0 true diff --git a/src/SMAPI.Toolkit/SemanticVersion.cs b/src/SMAPI.Toolkit/SemanticVersion.cs index cbdd7a85..2cb27e11 100644 --- a/src/SMAPI.Toolkit/SemanticVersion.cs +++ b/src/SMAPI.Toolkit/SemanticVersion.cs @@ -198,7 +198,12 @@ namespace StardewModdingAPI.Toolkit /// The version string. /// The parsed representation. /// Returns whether parsing the version succeeded. - public static bool TryParse(string? version, [NotNullWhen(true)] out ISemanticVersion? parsed) + public static bool TryParse(string? version, +#if NET5_0_OR_GREATER + [NotNullWhen(true)] +#endif + out ISemanticVersion? parsed + ) { return SemanticVersion.TryParse(version, allowNonStandard: false, out parsed); } @@ -208,7 +213,12 @@ namespace StardewModdingAPI.Toolkit /// Whether to allow non-standard extensions to semantic versioning. /// The parsed representation. /// Returns whether parsing the version succeeded. - public static bool TryParse(string? version, bool allowNonStandard, [NotNullWhen(true)] out ISemanticVersion? parsed) + public static bool TryParse(string? version, bool allowNonStandard, +#if NET5_0_OR_GREATER + [NotNullWhen(true)] +#endif + out ISemanticVersion? parsed + ) { if (version == null) { diff --git a/src/SMAPI.Toolkit/Serialization/JsonHelper.cs b/src/SMAPI.Toolkit/Serialization/JsonHelper.cs index 7d1804e5..3c9308f2 100644 --- a/src/SMAPI.Toolkit/Serialization/JsonHelper.cs +++ b/src/SMAPI.Toolkit/Serialization/JsonHelper.cs @@ -37,7 +37,12 @@ namespace StardewModdingAPI.Toolkit.Serialization /// Returns false if the file doesn't exist, else true. /// The given is empty or invalid. /// The file contains invalid JSON. - public bool ReadJsonFileIfExists(string fullPath, [NotNullWhen(true)] out TModel? result) + public bool ReadJsonFileIfExists(string fullPath, +#if NET5_0_OR_GREATER + [NotNullWhen(true)] +#endif + out TModel? result + ) { // validate if (string.IsNullOrWhiteSpace(fullPath)) diff --git a/src/SMAPI.Toolkit/Serialization/Models/Manifest.cs b/src/SMAPI.Toolkit/Serialization/Models/Manifest.cs index 3ab5edfb..01010602 100644 --- a/src/SMAPI.Toolkit/Serialization/Models/Manifest.cs +++ b/src/SMAPI.Toolkit/Serialization/Models/Manifest.cs @@ -115,7 +115,9 @@ namespace StardewModdingAPI.Toolkit.Serialization.Models *********/ /// Normalize whitespace in a raw string. /// The input to strip. +#if NET5_0_OR_GREATER [return: NotNullIfNotNull("input")] +#endif private string? NormalizeWhitespace(string? input) { return input diff --git a/src/SMAPI.Toolkit/Serialization/Models/ManifestContentPackFor.cs b/src/SMAPI.Toolkit/Serialization/Models/ManifestContentPackFor.cs index dcdbcf74..f7dc8aa8 100644 --- a/src/SMAPI.Toolkit/Serialization/Models/ManifestContentPackFor.cs +++ b/src/SMAPI.Toolkit/Serialization/Models/ManifestContentPackFor.cs @@ -33,7 +33,9 @@ namespace StardewModdingAPI.Toolkit.Serialization.Models *********/ /// Normalize whitespace in a raw string. /// The input to strip. +#if NET5_0_OR_GREATER [return: NotNullIfNotNull("input")] +#endif private string? NormalizeWhitespace(string? input) { return input?.Trim(); diff --git a/src/SMAPI.Toolkit/Serialization/Models/ManifestDependency.cs b/src/SMAPI.Toolkit/Serialization/Models/ManifestDependency.cs index 5d1b73b1..fa254ea7 100644 --- a/src/SMAPI.Toolkit/Serialization/Models/ManifestDependency.cs +++ b/src/SMAPI.Toolkit/Serialization/Models/ManifestDependency.cs @@ -54,7 +54,9 @@ namespace StardewModdingAPI.Toolkit.Serialization.Models *********/ /// Normalize whitespace in a raw string. /// The input to strip. +#if NET5_0_OR_GREATER [return: NotNullIfNotNull("input")] +#endif private string? NormalizeWhitespace(string? input) { return input?.Trim(); diff --git a/src/SMAPI.Toolkit/Utilities/PathUtilities.cs b/src/SMAPI.Toolkit/Utilities/PathUtilities.cs index 9b7a78a0..136279f2 100644 --- a/src/SMAPI.Toolkit/Utilities/PathUtilities.cs +++ b/src/SMAPI.Toolkit/Utilities/PathUtilities.cs @@ -50,7 +50,9 @@ namespace StardewModdingAPI.Toolkit.Utilities /// Normalize an asset name to match how MonoGame's content APIs would normalize and cache it. /// The asset name to normalize. [Pure] +#if NET5_0_OR_GREATER [return: NotNullIfNotNull("assetName")] +#endif public static string? NormalizeAssetName(string? assetName) { assetName = assetName?.Trim(); @@ -64,7 +66,9 @@ namespace StardewModdingAPI.Toolkit.Utilities /// The file path to normalize. /// This should only be used for file paths. For asset names, use instead. [Pure] +#if NET5_0_OR_GREATER [return: NotNullIfNotNull("path")] +#endif public static string? NormalizePath(string? path) { path = path?.Trim(); @@ -89,7 +93,7 @@ namespace StardewModdingAPI.Toolkit.Utilities } // keep trailing separator - if ((!hasRoot || segments.Any()) && PathUtilities.PossiblePathSeparators.Contains(path[^1])) + if ((!hasRoot || segments.Any()) && PathUtilities.PossiblePathSeparators.Contains(path[path.Length - 1])) newPath += PathUtilities.PreferredPathSeparator; return newPath; @@ -101,7 +105,43 @@ namespace StardewModdingAPI.Toolkit.Utilities [Pure] public static string GetRelativePath(string sourceDir, string targetPath) { +#if NET5_0 return Path.GetRelativePath(sourceDir, targetPath); +#else + // NOTE: + // this is a heuristic implementation that works in the cases SMAPI needs it for, but it + // doesn't handle all edge cases (e.g. case-sensitivity on Linux, or traversing between + // UNC paths on Windows). SMAPI and mods will use the more robust .NET 5 version anyway + // though, this is only for compatibility with the mod build package. + + // convert to URIs + Uri from = new(sourceDir.TrimEnd(PathUtilities.PossiblePathSeparators) + "/"); + Uri to = new(targetPath.TrimEnd(PathUtilities.PossiblePathSeparators) + "/"); + if (from.Scheme != to.Scheme) + throw new InvalidOperationException($"Can't get path for '{targetPath}' relative to '{sourceDir}'."); + + // get relative path + string rawUrl = Uri.UnescapeDataString(from.MakeRelativeUri(to).ToString()); + if (rawUrl.StartsWith("file://")) + rawUrl = PathUtilities.WindowsUncRoot + rawUrl.Substring("file://".Length); + string relative = PathUtilities.NormalizePath(rawUrl); + + // normalize + if (relative == "") + relative = "."; + else + { + // trim trailing slash from URL + if (relative.EndsWith(PathUtilities.PreferredPathSeparator.ToString())) + relative = relative.Substring(0, relative.Length - 1); + + // fix root + if (relative.StartsWith("file:") && !targetPath.Contains("file:")) + relative = relative.Substring("file:".Length); + } + + return relative; +#endif } /// Get whether a path is relative and doesn't try to climb out of its containing folder (e.g. doesn't contain ../). -- cgit From 0b48c1748b354458059c7607415288de072b01e9 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 12 Apr 2022 19:15:39 -0400 Subject: enable nullable annotations in the web project & related code (#837) --- build/common.targets | 4 +- .../ISemanticVersion.cs | 4 + .../Framework/Clients/WebApi/ModEntryModel.cs | 19 ++- .../Clients/WebApi/ModEntryVersionModel.cs | 9 +- .../Clients/WebApi/ModExtendedMetadataModel.cs | 36 +++-- .../Clients/WebApi/ModSearchEntryModel.cs | 27 ++-- .../Framework/Clients/WebApi/ModSearchModel.cs | 10 +- .../Framework/Clients/WebApi/WebApiClient.cs | 5 +- .../Framework/Clients/Wiki/ChangeDescriptor.cs | 12 +- .../Framework/Clients/Wiki/WikiClient.cs | 159 +++++++++++---------- .../Clients/Wiki/WikiCompatibilityInfo.cs | 33 +++-- .../Clients/Wiki/WikiCompatibilityStatus.cs | 2 - .../Framework/Clients/Wiki/WikiModEntry.cs | 96 ++++++++++--- .../Framework/Clients/Wiki/WikiModList.cs | 23 ++- src/SMAPI.Toolkit/SemanticVersion.cs | 3 + src/SMAPI.Toolkit/SemanticVersionComparer.cs | 2 +- src/SMAPI.Web/BackgroundService.cs | 24 +++- src/SMAPI.Web/Controllers/IndexController.cs | 12 +- .../Controllers/JsonValidatorController.cs | 46 +++--- src/SMAPI.Web/Controllers/LogParserController.cs | 6 +- src/SMAPI.Web/Controllers/ModsApiController.cs | 70 ++++----- src/SMAPI.Web/Controllers/ModsController.cs | 7 +- .../Framework/AllowLargePostsAttribute.cs | 4 +- src/SMAPI.Web/Framework/Caching/Cached.cs | 11 +- .../Framework/Caching/Mods/IModCacheRepository.cs | 5 +- .../Caching/Mods/ModCacheMemoryRepository.cs | 5 +- .../Framework/Caching/Wiki/IWikiCacheRepository.cs | 9 +- .../Caching/Wiki/WikiCacheMemoryRepository.cs | 11 +- .../Framework/Caching/Wiki/WikiMetadata.cs | 11 +- .../Clients/Chucklefish/ChucklefishClient.cs | 12 +- .../Clients/CurseForge/CurseForgeClient.cs | 14 +- .../CurseForge/ResponseModels/ModFileModel.cs | 22 ++- .../Clients/CurseForge/ResponseModels/ModModel.cs | 30 +++- .../Framework/Clients/GenericModDownload.cs | 13 +- src/SMAPI.Web/Framework/Clients/GenericModPage.cs | 23 +-- src/SMAPI.Web/Framework/Clients/GitHub/GitAsset.cs | 26 +++- .../Framework/Clients/GitHub/GitHubClient.cs | 30 ++-- .../Framework/Clients/GitHub/GitLicense.cs | 26 +++- .../Framework/Clients/GitHub/GitRelease.cs | 36 +++-- src/SMAPI.Web/Framework/Clients/GitHub/GitRepo.cs | 26 +++- .../Framework/Clients/GitHub/IGitHubClient.cs | 6 +- src/SMAPI.Web/Framework/Clients/IModSiteClient.cs | 4 +- .../Framework/Clients/ModDrop/ModDropClient.cs | 20 +-- .../ModDrop/ResponseModels/FileDataModel.cs | 42 ++++-- .../Clients/ModDrop/ResponseModels/ModDataModel.cs | 24 +++- .../Clients/ModDrop/ResponseModels/ModListModel.cs | 7 +- .../Clients/ModDrop/ResponseModels/ModModel.cs | 22 ++- .../Framework/Clients/Nexus/NexusClient.cs | 63 ++++---- .../Clients/Nexus/ResponseModels/NexusMod.cs | 43 ++++-- .../Framework/Clients/Pastebin/IPastebinClient.cs | 2 - .../Framework/Clients/Pastebin/PasteInfo.cs | 28 +++- .../Framework/Clients/Pastebin/PastebinClient.cs | 14 +- src/SMAPI.Web/Framework/Compression/GzipHelper.cs | 9 +- src/SMAPI.Web/Framework/Compression/IGzipHelper.cs | 5 +- .../Framework/ConfigModels/ApiClientsConfig.cs | 36 +++-- .../Framework/ConfigModels/ModOverrideConfig.cs | 6 +- .../Framework/ConfigModels/ModUpdateCheckConfig.cs | 10 +- src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs | 6 +- .../Framework/ConfigModels/SmapiInfoConfig.cs | 8 +- src/SMAPI.Web/Framework/Extensions.cs | 8 +- src/SMAPI.Web/Framework/IModDownload.cs | 9 +- src/SMAPI.Web/Framework/IModPage.cs | 18 ++- .../Framework/InternalControllerFeatureProvider.cs | 2 - .../Framework/JobDashboardAuthorizationFilter.cs | 2 - src/SMAPI.Web/Framework/ModInfoModel.cs | 33 +++-- src/SMAPI.Web/Framework/ModSiteManager.cs | 58 ++++---- .../RedirectRules/RedirectHostsToUrlsRule.cs | 10 +- .../Framework/RedirectRules/RedirectMatchRule.cs | 6 +- .../RedirectRules/RedirectPathsToUrlsRule.cs | 6 +- .../Framework/RedirectRules/RedirectToHttpsRule.cs | 6 +- .../Framework/Storage/IStorageProvider.cs | 2 - src/SMAPI.Web/Framework/Storage/StorageProvider.cs | 52 +++---- src/SMAPI.Web/Framework/Storage/StoredFileInfo.cs | 41 +++++- src/SMAPI.Web/Framework/Storage/UploadResult.cs | 14 +- src/SMAPI.Web/Framework/VersionConstraint.cs | 6 +- src/SMAPI.Web/Program.cs | 2 - src/SMAPI.Web/Startup.cs | 4 +- src/SMAPI.Web/ViewModels/IndexModel.cs | 13 +- src/SMAPI.Web/ViewModels/IndexVersionModel.cs | 15 +- .../JsonValidator/JsonValidatorErrorModel.cs | 15 +- .../ViewModels/JsonValidator/JsonValidatorModel.cs | 29 ++-- .../JsonValidator/JsonValidatorRequestModel.cs | 19 ++- src/SMAPI.Web/ViewModels/LogParserModel.cs | 2 +- src/SMAPI.Web/ViewModels/ModCompatibilityModel.cs | 27 +++- src/SMAPI.Web/ViewModels/ModLinkModel.cs | 6 +- src/SMAPI.Web/ViewModels/ModListModel.cs | 19 +-- src/SMAPI.Web/ViewModels/ModModel.cs | 65 ++++++--- src/SMAPI.Web/Views/Index/Index.cshtml | 6 +- src/SMAPI.Web/Views/Index/Privacy.cshtml | 4 - src/SMAPI.Web/Views/JsonValidator/Index.cshtml | 12 +- src/SMAPI.Web/Views/LogParser/Index.cshtml | 2 +- src/SMAPI.Web/Views/Mods/Index.cshtml | 6 +- src/SMAPI.Web/Views/Shared/_Layout.cshtml | 4 - src/SMAPI.Web/Views/_ViewStart.cshtml | 4 - src/SMAPI.Web/appsettings.json | 3 +- src/SMAPI.sln.DotSettings | 1 + src/SMAPI/SemanticVersion.cs | 3 + 97 files changed, 1044 insertions(+), 768 deletions(-) (limited to 'build/common.targets') diff --git a/build/common.targets b/build/common.targets index c227190a..c04546d0 100644 --- a/build/common.targets +++ b/build/common.targets @@ -7,8 +7,8 @@ $(AssemblySearchPaths);{GAC} - enable - $(NoWarn);CS8632 + enable + $(NoWarn);CS8632 $(DefineConstants);SMAPI_FOR_WINDOWS diff --git a/src/SMAPI.Toolkit.CoreInterfaces/ISemanticVersion.cs b/src/SMAPI.Toolkit.CoreInterfaces/ISemanticVersion.cs index 7998272f..dc226b7c 100644 --- a/src/SMAPI.Toolkit.CoreInterfaces/ISemanticVersion.cs +++ b/src/SMAPI.Toolkit.CoreInterfaces/ISemanticVersion.cs @@ -1,4 +1,5 @@ using System; +using System.Diagnostics.CodeAnalysis; namespace StardewModdingAPI { @@ -28,6 +29,9 @@ namespace StardewModdingAPI ** Accessors *********/ /// Whether this is a prerelease version. +#if NET5_0_OR_GREATER + [MemberNotNullWhen(true, nameof(ISemanticVersion.PrereleaseTag))] +#endif bool IsPrerelease(); /// Get whether this version is older than the specified version. diff --git a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryModel.cs b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryModel.cs index d5ca2034..4fc4ea54 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryModel.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryModel.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi @@ -11,15 +9,26 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi ** Accessors *********/ /// The mod's unique ID (if known). - public string ID { get; set; } + public string ID { get; } /// The update version recommended by the web API based on its version update and mapping rules. - public ModEntryVersionModel SuggestedUpdate { get; set; } + public ModEntryVersionModel? SuggestedUpdate { get; set; } /// Optional extended data which isn't needed for update checks. - public ModExtendedMetadataModel Metadata { get; set; } + public ModExtendedMetadataModel? Metadata { get; set; } /// The errors that occurred while fetching update data. public string[] Errors { get; set; } = Array.Empty(); + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The mod's unique ID (if known). + public ModEntryModel(string id) + { + this.ID = id; + } } } diff --git a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryVersionModel.cs b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryVersionModel.cs index 9aac7fd3..a1e78986 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryVersionModel.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryVersionModel.cs @@ -1,5 +1,3 @@ -#nullable disable - using Newtonsoft.Json; using StardewModdingAPI.Toolkit.Serialization.Converters; @@ -13,18 +11,15 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi *********/ /// The version number. [JsonConverter(typeof(NonStandardSemanticVersionConverter))] - public ISemanticVersion Version { get; set; } + public ISemanticVersion Version { get; } /// The mod page URL. - public string Url { get; set; } + public string Url { get; } /********* ** Public methods *********/ - /// Construct an instance. - public ModEntryVersionModel() { } - /// Construct an instance. /// The version number. /// The mod page URL. diff --git a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModExtendedMetadataModel.cs b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModExtendedMetadataModel.cs index eb54ec78..272a2063 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModExtendedMetadataModel.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModExtendedMetadataModel.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Linq; @@ -23,7 +21,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi public string[] ID { get; set; } = Array.Empty(); /// The mod's display name. - public string Name { get; set; } + public string? Name { get; set; } /// The mod ID on Nexus. public int? NexusID { get; set; } @@ -35,31 +33,31 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi public int? CurseForgeID { get; set; } /// The mod key in the CurseForge mod repo (used in mod page URLs). - public string CurseForgeKey { get; set; } + public string? CurseForgeKey { get; set; } /// The mod ID in the ModDrop mod repo. public int? ModDropID { get; set; } /// The GitHub repository in the form 'owner/repo'. - public string GitHubRepo { get; set; } + public string? GitHubRepo { get; set; } /// The URL to a non-GitHub source repo. - public string CustomSourceUrl { get; set; } + public string? CustomSourceUrl { get; set; } /// The custom mod page URL (if applicable). - public string CustomUrl { get; set; } + public string? CustomUrl { get; set; } /// The main version. - public ModEntryVersionModel Main { get; set; } + public ModEntryVersionModel? Main { get; set; } /// The latest optional version, if newer than . - public ModEntryVersionModel Optional { get; set; } + public ModEntryVersionModel? Optional { get; set; } /// The latest unofficial version, if newer than and . - public ModEntryVersionModel Unofficial { get; set; } + public ModEntryVersionModel? Unofficial { get; set; } /// The latest unofficial version for the current Stardew Valley or SMAPI beta, if any. - public ModEntryVersionModel UnofficialForBeta { get; set; } + public ModEntryVersionModel? UnofficialForBeta { get; set; } /**** ** Stable compatibility @@ -69,10 +67,10 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi public WikiCompatibilityStatus? CompatibilityStatus { get; set; } /// The human-readable summary of the compatibility status or workaround, without HTML formatting. - public string CompatibilitySummary { get; set; } + public string? CompatibilitySummary { get; set; } /// The game or SMAPI version which broke this mod, if applicable. - public string BrokeIn { get; set; } + public string? BrokeIn { get; set; } /**** ** Beta compatibility @@ -82,22 +80,22 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi public WikiCompatibilityStatus? BetaCompatibilityStatus { get; set; } /// The human-readable summary of the compatibility status or workaround for the Stardew Valley beta (if any), without HTML formatting. - public string BetaCompatibilitySummary { get; set; } + public string? BetaCompatibilitySummary { get; set; } /// The beta game or SMAPI version which broke this mod, if applicable. - public string BetaBrokeIn { get; set; } + public string? BetaBrokeIn { get; set; } /**** ** Version mappings ****/ /// A serialized change descriptor to apply to the local version during update checks (see ). - public string ChangeLocalVersions { get; set; } + public string? ChangeLocalVersions { get; set; } /// A serialized change descriptor to apply to the remote version during update checks (see ). - public string ChangeRemoteVersions { get; set; } + public string? ChangeRemoteVersions { get; set; } /// A serialized change descriptor to apply to the update keys during update checks (see ). - public string ChangeUpdateKeys { get; set; } + public string? ChangeUpdateKeys { get; set; } /********* @@ -113,7 +111,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi /// The latest optional version, if newer than . /// The latest unofficial version, if newer than and . /// The latest unofficial version for the current Stardew Valley or SMAPI beta, if any. - public ModExtendedMetadataModel(WikiModEntry wiki, ModDataRecord db, ModEntryVersionModel main, ModEntryVersionModel optional, ModEntryVersionModel unofficial, ModEntryVersionModel unofficialForBeta) + public ModExtendedMetadataModel(WikiModEntry? wiki, ModDataRecord? db, ModEntryVersionModel? main, ModEntryVersionModel? optional, ModEntryVersionModel? unofficial, ModEntryVersionModel? unofficialForBeta) { // versions this.Main = main; diff --git a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchEntryModel.cs b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchEntryModel.cs index 8fe8fa2a..9c11e1db 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchEntryModel.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchEntryModel.cs @@ -1,6 +1,5 @@ -#nullable disable - using System; +using System.Linq; namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi { @@ -11,37 +10,39 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi ** Accessors *********/ /// The unique mod ID. - public string ID { get; set; } + public string ID { get; } /// The namespaced mod update keys (if available). - public string[] UpdateKeys { get; set; } + public string[] UpdateKeys { get; private set; } /// The mod version installed by the local player. This is used for version mapping in some cases. - public ISemanticVersion InstalledVersion { get; set; } + public ISemanticVersion? InstalledVersion { get; } /// Whether the installed version is broken or could not be loaded. - public bool IsBroken { get; set; } + public bool IsBroken { get; } /********* ** Public methods *********/ - /// Construct an empty instance. - public ModSearchEntryModel() - { - // needed for JSON deserializing - } - /// Construct an instance. /// The unique mod ID. /// The version installed by the local player. This is used for version mapping in some cases. /// The namespaced mod update keys (if available). /// Whether the installed version is broken or could not be loaded. - public ModSearchEntryModel(string id, ISemanticVersion installedVersion, string[] updateKeys, bool isBroken = false) + public ModSearchEntryModel(string id, ISemanticVersion? installedVersion, string[]? updateKeys, bool isBroken = false) { this.ID = id; this.InstalledVersion = installedVersion; this.UpdateKeys = updateKeys ?? Array.Empty(); + this.IsBroken = isBroken; + } + + /// Add update keys for the mod. + /// The update keys to add. + public void AddUpdateKeys(params string[] updateKeys) + { + this.UpdateKeys = this.UpdateKeys.Concat(updateKeys).ToArray(); } } } diff --git a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchModel.cs b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchModel.cs index 393391f7..a0cd9d4d 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchModel.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/WebApi/ModSearchModel.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Linq; using StardewModdingAPI.Toolkit.Utilities; @@ -24,18 +22,12 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi public ISemanticVersion GameVersion { get; set; } /// The OS on which the player plays. - public Platform? Platform { get; set; } + public Platform Platform { get; set; } /********* ** Public methods *********/ - /// Construct an empty instance. - public ModSearchModel() - { - // needed for JSON deserializing - } - /// Construct an instance. /// The mods to search. /// The SMAPI version installed by the player. If this is null, the API won't provide a recommended update. diff --git a/src/SMAPI.Toolkit/Framework/Clients/WebApi/WebApiClient.cs b/src/SMAPI.Toolkit/Framework/Clients/WebApi/WebApiClient.cs index 56acb768..d4282617 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/WebApi/WebApiClient.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/WebApi/WebApiClient.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Linq; @@ -72,7 +70,8 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.WebApi client.Headers["Content-Type"] = "application/json"; client.Headers["User-Agent"] = $"SMAPI/{this.Version}"; string response = client.UploadString(fullUrl, data); - return JsonConvert.DeserializeObject(response, this.JsonSettings); + return JsonConvert.DeserializeObject(response, this.JsonSettings) + ?? throw new InvalidOperationException($"Could not parse the response from POST {url}."); } } } diff --git a/src/SMAPI.Toolkit/Framework/Clients/Wiki/ChangeDescriptor.cs b/src/SMAPI.Toolkit/Framework/Clients/Wiki/ChangeDescriptor.cs index 910bf793..5978803e 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/Wiki/ChangeDescriptor.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/Wiki/ChangeDescriptor.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Collections.ObjectModel; @@ -49,7 +47,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki /// Apply the change descriptors to a comma-delimited field. /// The raw field text. /// Returns the modified field. - public string ApplyToCopy(string rawField) + public string? ApplyToCopy(string? rawField) { // get list List values = !string.IsNullOrWhiteSpace(rawField) @@ -75,12 +73,12 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki { for (int i = values.Count - 1; i >= 0; i--) { - string value = this.FormatValue(values[i]?.Trim() ?? string.Empty); + string value = this.FormatValue(values[i].Trim()); if (this.Remove.Contains(value)) values.RemoveAt(i); - else if (this.Replace.TryGetValue(value, out string newValue)) + else if (this.Replace.TryGetValue(value, out string? newValue)) values[i] = newValue; } } @@ -88,7 +86,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki // add values if (this.Add.Any()) { - HashSet curValues = new HashSet(values.Select(p => p?.Trim() ?? string.Empty), StringComparer.OrdinalIgnoreCase); + HashSet curValues = new HashSet(values.Select(p => p.Trim()), StringComparer.OrdinalIgnoreCase); foreach (string add in this.Add) { if (!curValues.Contains(add)) @@ -121,7 +119,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki /// The raw change descriptor. /// The human-readable error message describing any invalid values that were ignored. /// Format a raw value into a normalized form if needed. - public static ChangeDescriptor Parse(string descriptor, out string[] errors, Func formatValue = null) + public static ChangeDescriptor Parse(string descriptor, out string[] errors, Func? formatValue = null) { // init formatValue ??= p => p; diff --git a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs index 86c3bd75..7f06d170 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; @@ -53,8 +51,8 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki doc.LoadHtml(html); // fetch game versions - string stableVersion = doc.DocumentNode.SelectSingleNode("//div[@class='game-stable-version']")?.InnerText; - string betaVersion = doc.DocumentNode.SelectSingleNode("//div[@class='game-beta-version']")?.InnerText; + string? stableVersion = doc.DocumentNode.SelectSingleNode("//div[@class='game-stable-version']")?.InnerText; + string? betaVersion = doc.DocumentNode.SelectSingleNode("//div[@class='game-beta-version']")?.InnerText; if (betaVersion == stableVersion) betaVersion = null; @@ -65,7 +63,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki if (modNodes == null) throw new InvalidOperationException("Can't parse wiki compatibility list, no mod data overrides section found."); - foreach (var entry in this.ParseOverrideEntries(modNodes)) + foreach (WikiDataOverrideEntry entry in this.ParseOverrideEntries(modNodes)) { if (entry.Ids.Any() != true || !entry.HasChanges) continue; @@ -85,18 +83,17 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki } // build model - return new WikiModList - { - StableVersion = stableVersion, - BetaVersion = betaVersion, - Mods = mods - }; + return new WikiModList( + stableVersion: stableVersion, + betaVersion: betaVersion, + mods: mods + ); } /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. public void Dispose() { - this.Client?.Dispose(); + this.Client.Dispose(); } @@ -118,71 +115,68 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki int? nexusID = this.GetAttributeAsNullableInt(node, "data-nexus-id"); int? chucklefishID = this.GetAttributeAsNullableInt(node, "data-cf-id"); int? curseForgeID = this.GetAttributeAsNullableInt(node, "data-curseforge-id"); - string curseForgeKey = this.GetAttribute(node, "data-curseforge-key"); + string? curseForgeKey = this.GetAttribute(node, "data-curseforge-key"); int? modDropID = this.GetAttributeAsNullableInt(node, "data-moddrop-id"); - string githubRepo = this.GetAttribute(node, "data-github"); - string customSourceUrl = this.GetAttribute(node, "data-custom-source"); - string customUrl = this.GetAttribute(node, "data-url"); - string anchor = this.GetAttribute(node, "id"); - string contentPackFor = this.GetAttribute(node, "data-content-pack-for"); - string devNote = this.GetAttribute(node, "data-dev-note"); - string pullRequestUrl = this.GetAttribute(node, "data-pr"); + string? githubRepo = this.GetAttribute(node, "data-github"); + string? customSourceUrl = this.GetAttribute(node, "data-custom-source"); + string? customUrl = this.GetAttribute(node, "data-url"); + string? anchor = this.GetAttribute(node, "id"); + string? contentPackFor = this.GetAttribute(node, "data-content-pack-for"); + string? devNote = this.GetAttribute(node, "data-dev-note"); + string? pullRequestUrl = this.GetAttribute(node, "data-pr"); // parse stable compatibility - WikiCompatibilityInfo compatibility = new() - { - Status = this.GetAttributeAsEnum(node, "data-status") ?? WikiCompatibilityStatus.Ok, - BrokeIn = this.GetAttribute(node, "data-broke-in"), - UnofficialVersion = this.GetAttributeAsSemanticVersion(node, "data-unofficial-version"), - UnofficialUrl = this.GetAttribute(node, "data-unofficial-url"), - Summary = this.GetInnerHtml(node, "mod-summary")?.Trim() - }; + WikiCompatibilityInfo compatibility = new( + status: this.GetAttributeAsEnum(node, "data-status") ?? WikiCompatibilityStatus.Ok, + brokeIn: this.GetAttribute(node, "data-broke-in"), + unofficialVersion: this.GetAttributeAsSemanticVersion(node, "data-unofficial-version"), + unofficialUrl: this.GetAttribute(node, "data-unofficial-url"), + summary: this.GetInnerHtml(node, "mod-summary")?.Trim() + ); // parse beta compatibility - WikiCompatibilityInfo betaCompatibility = null; + WikiCompatibilityInfo? betaCompatibility = null; { WikiCompatibilityStatus? betaStatus = this.GetAttributeAsEnum(node, "data-beta-status"); if (betaStatus.HasValue) { - betaCompatibility = new WikiCompatibilityInfo - { - Status = betaStatus.Value, - BrokeIn = this.GetAttribute(node, "data-beta-broke-in"), - UnofficialVersion = this.GetAttributeAsSemanticVersion(node, "data-beta-unofficial-version"), - UnofficialUrl = this.GetAttribute(node, "data-beta-unofficial-url"), - Summary = this.GetInnerHtml(node, "mod-beta-summary") - }; + betaCompatibility = new WikiCompatibilityInfo( + status: betaStatus.Value, + brokeIn: this.GetAttribute(node, "data-beta-broke-in"), + unofficialVersion: this.GetAttributeAsSemanticVersion(node, "data-beta-unofficial-version"), + unofficialUrl: this.GetAttribute(node, "data-beta-unofficial-url"), + summary: this.GetInnerHtml(node, "mod-beta-summary") + ); } } // find data overrides - WikiDataOverrideEntry overrides = ids + WikiDataOverrideEntry? overrides = ids .Select(id => overridesById.TryGetValue(id, out overrides) ? overrides : null) .FirstOrDefault(p => p != null); // yield model - yield return new WikiModEntry - { - ID = ids, - Name = names, - Author = authors, - NexusID = nexusID, - ChucklefishID = chucklefishID, - CurseForgeID = curseForgeID, - CurseForgeKey = curseForgeKey, - ModDropID = modDropID, - GitHubRepo = githubRepo, - CustomSourceUrl = customSourceUrl, - CustomUrl = customUrl, - ContentPackFor = contentPackFor, - Compatibility = compatibility, - BetaCompatibility = betaCompatibility, - Warnings = warnings, - PullRequestUrl = pullRequestUrl, - DevNote = devNote, - Overrides = overrides, - Anchor = anchor - }; + yield return new WikiModEntry( + id: ids, + name: names, + author: authors, + nexusId: nexusID, + chucklefishId: chucklefishID, + curseForgeId: curseForgeID, + curseForgeKey: curseForgeKey, + modDropId: modDropID, + githubRepo: githubRepo, + customSourceUrl: customSourceUrl, + customUrl: customUrl, + contentPackFor: contentPackFor, + compatibility: compatibility, + betaCompatibility: betaCompatibility, + warnings: warnings, + pullRequestUrl: pullRequestUrl, + devNote: devNote, + overrides: overrides, + anchor: anchor + ); } } @@ -196,10 +190,10 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki { Ids = this.GetAttributeAsCsv(node, "data-id"), ChangeLocalVersions = this.GetAttributeAsChangeDescriptor(node, "data-local-version", - raw => SemanticVersion.TryParse(raw, out ISemanticVersion version) ? version.ToString() : raw + raw => SemanticVersion.TryParse(raw, out ISemanticVersion? version) ? version.ToString() : raw ), ChangeRemoteVersions = this.GetAttributeAsChangeDescriptor(node, "data-remote-version", - raw => SemanticVersion.TryParse(raw, out ISemanticVersion version) ? version.ToString() : raw + raw => SemanticVersion.TryParse(raw, out ISemanticVersion? version) ? version.ToString() : raw ), ChangeUpdateKeys = this.GetAttributeAsChangeDescriptor(node, "data-update-keys", @@ -212,7 +206,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki /// Get an attribute value. /// The element whose attributes to read. /// The attribute name. - private string GetAttribute(HtmlNode element, string name) + private string? GetAttribute(HtmlNode element, string name) { string value = element.GetAttributeValue(name, null); if (string.IsNullOrWhiteSpace(value)) @@ -225,9 +219,9 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki /// The element whose attributes to read. /// The attribute name. /// Format an raw entry value when applying changes. - private ChangeDescriptor GetAttributeAsChangeDescriptor(HtmlNode element, string name, Func formatValue) + private ChangeDescriptor? GetAttributeAsChangeDescriptor(HtmlNode element, string name, Func formatValue) { - string raw = this.GetAttribute(element, name); + string? raw = this.GetAttribute(element, name); return raw != null ? ChangeDescriptor.Parse(raw, out _, formatValue) : null; @@ -238,7 +232,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki /// The attribute name. private string[] GetAttributeAsCsv(HtmlNode element, string name) { - string raw = this.GetAttribute(element, name); + string? raw = this.GetAttribute(element, name); return !string.IsNullOrWhiteSpace(raw) ? raw.Split(new[] { ',' }, StringSplitOptions.RemoveEmptyEntries).Select(p => p.Trim()).ToArray() : Array.Empty(); @@ -250,7 +244,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki /// The attribute name. private TEnum? GetAttributeAsEnum(HtmlNode element, string name) where TEnum : struct { - string raw = this.GetAttribute(element, name); + string? raw = this.GetAttribute(element, name); if (raw == null) return null; if (!Enum.TryParse(raw, true, out TEnum value) && Enum.IsDefined(typeof(TEnum), value)) @@ -261,10 +255,10 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki /// Get an attribute value and parse it as a semantic version. /// The element whose attributes to read. /// The attribute name. - private ISemanticVersion GetAttributeAsSemanticVersion(HtmlNode element, string name) + private ISemanticVersion? GetAttributeAsSemanticVersion(HtmlNode element, string name) { - string raw = this.GetAttribute(element, name); - return SemanticVersion.TryParse(raw, out ISemanticVersion version) + string? raw = this.GetAttribute(element, name); + return SemanticVersion.TryParse(raw, out ISemanticVersion? version) ? version : null; } @@ -274,7 +268,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki /// The attribute name. private int? GetAttributeAsNullableInt(HtmlNode element, string name) { - string raw = this.GetAttribute(element, name); + string? raw = this.GetAttribute(element, name); if (raw != null && int.TryParse(raw, out int value)) return value; return null; @@ -283,7 +277,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki /// Get the text of an element with the given class name. /// The metadata container. /// The field name. - private string GetInnerHtml(HtmlNode container, string className) + private string? GetInnerHtml(HtmlNode container, string className) { return container.Descendants().FirstOrDefault(p => p.HasClass(className))?.InnerHtml; } @@ -293,8 +287,22 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Local")] private class ResponseModel { + /********* + ** Accessors + *********/ /// The parse API results. - public ResponseParseModel Parse { get; set; } + public ResponseParseModel Parse { get; } + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The parse API results. + public ResponseModel(ResponseParseModel parse) + { + this.Parse = parse; + } } /// The inner response model for the MediaWiki parse API. @@ -303,8 +311,11 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki [SuppressMessage("ReSharper", "UnusedAutoPropertyAccessor.Local")] private class ResponseParseModel { + /********* + ** Accessors + *********/ /// The parsed text. - public IDictionary Text { get; set; } + public IDictionary Text { get; } = new Dictionary(); } } } diff --git a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiCompatibilityInfo.cs b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiCompatibilityInfo.cs index 30e76d04..71c90d0c 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiCompatibilityInfo.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiCompatibilityInfo.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki { /// Compatibility info for a mod. @@ -9,18 +7,37 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki ** Accessors *********/ /// The compatibility status. - public WikiCompatibilityStatus Status { get; set; } + public WikiCompatibilityStatus Status { get; } /// The human-readable summary of the compatibility status or workaround, without HTML formatting. - public string Summary { get; set; } + public string? Summary { get; } - /// The game or SMAPI version which broke this mod (if applicable). - public string BrokeIn { get; set; } + /// The game or SMAPI version which broke this mod, if applicable. + public string? BrokeIn { get; } /// The version of the latest unofficial update, if applicable. - public ISemanticVersion UnofficialVersion { get; set; } + public ISemanticVersion? UnofficialVersion { get; } /// The URL to the latest unofficial update, if applicable. - public string UnofficialUrl { get; set; } + public string? UnofficialUrl { get; } + + + /********* + ** Accessors + *********/ + /// Construct an instance. + /// The compatibility status. + /// The human-readable summary of the compatibility status or workaround, without HTML formatting. + /// The game or SMAPI version which broke this mod, if applicable. + /// The version of the latest unofficial update, if applicable. + /// The URL to the latest unofficial update, if applicable. + public WikiCompatibilityInfo(WikiCompatibilityStatus status, string? summary, string? brokeIn, ISemanticVersion? unofficialVersion, string? unofficialUrl) + { + this.Status = status; + this.Summary = summary; + this.BrokeIn = brokeIn; + this.UnofficialVersion = unofficialVersion; + this.UnofficialUrl = unofficialUrl; + } } } diff --git a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiCompatibilityStatus.cs b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiCompatibilityStatus.cs index 2c222b71..5cdf489f 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiCompatibilityStatus.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiCompatibilityStatus.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki { /// The compatibility status for a mod. diff --git a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModEntry.cs b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModEntry.cs index 91943ff9..fc50125f 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModEntry.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModEntry.cs @@ -1,4 +1,4 @@ -#nullable disable +using System.Diagnostics.CodeAnalysis; namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki { @@ -8,64 +8,114 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki /********* ** Accessors *********/ - /// The mod's unique ID. If the mod has alternate/old IDs, they're listed in latest to newest order. - public string[] ID { get; set; } + /// The mod's unique ID. If the mod has alternate/old IDs, they're listed in latest to oldest order. + public string[] ID { get; } /// The mod's display name. If the mod has multiple names, the first one is the most canonical name. - public string[] Name { get; set; } + public string[] Name { get; } - /// The mod's author name. If the author has multiple names, the first one is the most canonical name. - public string[] Author { get; set; } + /// The mod's author name. If the author has multiple names, the first one is the most canonical name. + public string[] Author { get; } /// The mod ID on Nexus. - public int? NexusID { get; set; } + public int? NexusID { get; } /// The mod ID in the Chucklefish mod repo. - public int? ChucklefishID { get; set; } + public int? ChucklefishID { get; } /// The mod ID in the CurseForge mod repo. - public int? CurseForgeID { get; set; } + public int? CurseForgeID { get; } /// The mod key in the CurseForge mod repo (used in mod page URLs). - public string CurseForgeKey { get; set; } + public string? CurseForgeKey { get; } /// The mod ID in the ModDrop mod repo. - public int? ModDropID { get; set; } + public int? ModDropID { get; } /// The GitHub repository in the form 'owner/repo'. - public string GitHubRepo { get; set; } + public string? GitHubRepo { get; } /// The URL to a non-GitHub source repo. - public string CustomSourceUrl { get; set; } + public string? CustomSourceUrl { get; } /// The custom mod page URL (if applicable). - public string CustomUrl { get; set; } + public string? CustomUrl { get; } /// The name of the mod which loads this content pack, if applicable. - public string ContentPackFor { get; set; } + public string? ContentPackFor { get; } /// The mod's compatibility with the latest stable version of the game. - public WikiCompatibilityInfo Compatibility { get; set; } + public WikiCompatibilityInfo Compatibility { get; } /// The mod's compatibility with the latest beta version of the game (if any). - public WikiCompatibilityInfo BetaCompatibility { get; set; } + public WikiCompatibilityInfo? BetaCompatibility { get; } /// Whether a Stardew Valley or SMAPI beta which affects mod compatibility is in progress. If this is true, should be used for beta versions of SMAPI instead of . +#if NET5_0_OR_GREATER + [MemberNotNullWhen(true, nameof(WikiModEntry.BetaCompatibility))] +#endif public bool HasBetaInfo => this.BetaCompatibility != null; /// The human-readable warnings for players about this mod. - public string[] Warnings { get; set; } + public string[] Warnings { get; } /// The URL of the pull request which submits changes for an unofficial update to the author, if any. - public string PullRequestUrl { get; set; } + public string? PullRequestUrl { get; } - /// Special notes intended for developers who maintain unofficial updates or submit pull requests. - public string DevNote { get; set; } + /// Special notes intended for developers who maintain unofficial updates or submit pull requests. + public string? DevNote { get; } /// The data overrides to apply to the mod's manifest or remote mod page data, if any. - public WikiDataOverrideEntry Overrides { get; set; } + public WikiDataOverrideEntry? Overrides { get; } /// The link anchor for the mod entry in the wiki compatibility list. - public string Anchor { get; set; } + public string? Anchor { get; } + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The mod's unique ID. If the mod has alternate/old IDs, they're listed in latest to oldest order. + /// The mod's display name. If the mod has multiple names, the first one is the most canonical name. + /// The mod's author name. If the author has multiple names, the first one is the most canonical name. + /// The mod ID on Nexus. + /// The mod ID in the Chucklefish mod repo. + /// The mod ID in the CurseForge mod repo. + /// The mod ID in the CurseForge mod repo. + /// The mod ID in the ModDrop mod repo. + /// The GitHub repository in the form 'owner/repo'. + /// The URL to a non-GitHub source repo. + /// The custom mod page URL (if applicable). + /// The name of the mod which loads this content pack, if applicable. + /// The mod's compatibility with the latest stable version of the game. + /// The mod's compatibility with the latest beta version of the game (if any). + /// The human-readable warnings for players about this mod. + /// The URL of the pull request which submits changes for an unofficial update to the author, if any. + /// Special notes intended for developers who maintain unofficial updates or submit pull requests. + /// The data overrides to apply to the mod's manifest or remote mod page data, if any. + /// The link anchor for the mod entry in the wiki compatibility list. + public WikiModEntry(string[] id, string[] name, string[] author, int? nexusId, int? chucklefishId, int? curseForgeId, string? curseForgeKey, int? modDropId, string? githubRepo, string? customSourceUrl, string? customUrl, string? contentPackFor, WikiCompatibilityInfo compatibility, WikiCompatibilityInfo? betaCompatibility, string[] warnings, string? pullRequestUrl, string? devNote, WikiDataOverrideEntry? overrides, string? anchor) + { + this.ID = id; + this.Name = name; + this.Author = author; + this.NexusID = nexusId; + this.ChucklefishID = chucklefishId; + this.CurseForgeID = curseForgeId; + this.CurseForgeKey = curseForgeKey; + this.ModDropID = modDropId; + this.GitHubRepo = githubRepo; + this.CustomSourceUrl = customSourceUrl; + this.CustomUrl = customUrl; + this.ContentPackFor = contentPackFor; + this.Compatibility = compatibility; + this.BetaCompatibility = betaCompatibility; + this.Warnings = warnings; + this.PullRequestUrl = pullRequestUrl; + this.DevNote = devNote; + this.Overrides = overrides; + this.Anchor = anchor; + } } } diff --git a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModList.cs b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModList.cs index 1787197a..24548078 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModList.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModList.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki { /// Metadata from the wiki's mod compatibility list. @@ -9,12 +7,27 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki ** Accessors *********/ /// The stable game version. - public string StableVersion { get; set; } + public string? StableVersion { get; } /// The beta game version (if any). - public string BetaVersion { get; set; } + public string? BetaVersion { get; } /// The mods on the wiki. - public WikiModEntry[] Mods { get; set; } + public WikiModEntry[] Mods { get; } + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The stable game version. + /// The beta game version (if any). + /// The mods on the wiki. + public WikiModList(string? stableVersion, string? betaVersion, WikiModEntry[] mods) + { + this.StableVersion = stableVersion; + this.BetaVersion = betaVersion; + this.Mods = mods; + } } } diff --git a/src/SMAPI.Toolkit/SemanticVersion.cs b/src/SMAPI.Toolkit/SemanticVersion.cs index 2cb27e11..3713758f 100644 --- a/src/SMAPI.Toolkit/SemanticVersion.cs +++ b/src/SMAPI.Toolkit/SemanticVersion.cs @@ -119,6 +119,9 @@ namespace StardewModdingAPI.Toolkit } /// +#if NET5_0_OR_GREATER + [MemberNotNullWhen(true, nameof(SemanticVersion.PrereleaseTag))] +#endif public bool IsPrerelease() { return !string.IsNullOrWhiteSpace(this.PrereleaseTag); diff --git a/src/SMAPI.Toolkit/SemanticVersionComparer.cs b/src/SMAPI.Toolkit/SemanticVersionComparer.cs index 85c974bd..2eca30df 100644 --- a/src/SMAPI.Toolkit/SemanticVersionComparer.cs +++ b/src/SMAPI.Toolkit/SemanticVersionComparer.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; namespace StardewModdingAPI.Toolkit { /// A comparer for semantic versions based on the field. - public class SemanticVersionComparer : IComparer + public class SemanticVersionComparer : IComparer { /********* ** Accessors diff --git a/src/SMAPI.Web/BackgroundService.cs b/src/SMAPI.Web/BackgroundService.cs index 7706b276..49356f76 100644 --- a/src/SMAPI.Web/BackgroundService.cs +++ b/src/SMAPI.Web/BackgroundService.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Diagnostics.CodeAnalysis; using System.Threading; @@ -21,13 +19,17 @@ namespace StardewModdingAPI.Web ** Fields *********/ /// The background task server. - private static BackgroundJobServer JobServer; + private static BackgroundJobServer? JobServer; /// The cache in which to store wiki metadata. - private static IWikiCacheRepository WikiCache; + private static IWikiCacheRepository? WikiCache; /// The cache in which to store mod data. - private static IModCacheRepository ModCache; + private static IModCacheRepository? ModCache; + + /// Whether the service has been started. + [MemberNotNullWhen(true, nameof(BackgroundService.JobServer), nameof(BackgroundService.WikiCache), nameof(BackgroundService.ModCache))] + private static bool IsStarted { get; set; } /********* @@ -61,6 +63,8 @@ namespace StardewModdingAPI.Web RecurringJob.AddOrUpdate(() => BackgroundService.UpdateWikiAsync(), "*/10 * * * *"); // every 10 minutes RecurringJob.AddOrUpdate(() => BackgroundService.RemoveStaleModsAsync(), "0 * * * *"); // hourly + BackgroundService.IsStarted = true; + return Task.CompletedTask; } @@ -68,6 +72,8 @@ namespace StardewModdingAPI.Web /// Tracks whether the shutdown process should no longer be graceful. public async Task StopAsync(CancellationToken cancellationToken) { + BackgroundService.IsStarted = false; + if (BackgroundService.JobServer != null) await BackgroundService.JobServer.WaitForShutdownAsync(cancellationToken); } @@ -75,6 +81,8 @@ namespace StardewModdingAPI.Web /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. public void Dispose() { + BackgroundService.IsStarted = false; + BackgroundService.JobServer?.Dispose(); } @@ -85,6 +93,9 @@ namespace StardewModdingAPI.Web [AutomaticRetry(Attempts = 3, DelaysInSeconds = new[] { 30, 60, 120 })] public static async Task UpdateWikiAsync() { + if (!BackgroundService.IsStarted) + throw new InvalidOperationException($"Must call {nameof(BackgroundService.StartAsync)} before scheduling tasks."); + WikiModList wikiCompatList = await new ModToolkit().GetWikiCompatibilityListAsync(); BackgroundService.WikiCache.SaveWikiData(wikiCompatList.StableVersion, wikiCompatList.BetaVersion, wikiCompatList.Mods); } @@ -92,6 +103,9 @@ namespace StardewModdingAPI.Web /// Remove mods which haven't been requested in over 48 hours. public static Task RemoveStaleModsAsync() { + if (!BackgroundService.IsStarted) + throw new InvalidOperationException($"Must call {nameof(BackgroundService.StartAsync)} before scheduling tasks."); + BackgroundService.ModCache.RemoveStaleMods(TimeSpan.FromHours(48)); return Task.CompletedTask; } diff --git a/src/SMAPI.Web/Controllers/IndexController.cs b/src/SMAPI.Web/Controllers/IndexController.cs index f7834b9c..522d77cd 100644 --- a/src/SMAPI.Web/Controllers/IndexController.cs +++ b/src/SMAPI.Web/Controllers/IndexController.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Linq; @@ -59,8 +57,8 @@ namespace StardewModdingAPI.Web.Controllers { // choose versions ReleaseVersion[] versions = await this.GetReleaseVersionsAsync(); - ReleaseVersion stableVersion = versions.LastOrDefault(version => !version.IsForDevs); - ReleaseVersion stableVersionForDevs = versions.LastOrDefault(version => version.IsForDevs); + ReleaseVersion? stableVersion = versions.LastOrDefault(version => !version.IsForDevs); + ReleaseVersion? stableVersionForDevs = versions.LastOrDefault(version => version.IsForDevs); // render view IndexVersionModel stableVersionModel = stableVersion != null @@ -91,7 +89,7 @@ namespace StardewModdingAPI.Web.Controllers entry.AbsoluteExpiration = DateTimeOffset.UtcNow.Add(this.CacheTime); // get latest stable release - GitRelease release = await this.GitHub.GetLatestReleaseAsync(this.RepositoryName, includePrerelease: false); + GitRelease? release = await this.GitHub.GetLatestReleaseAsync(this.RepositoryName, includePrerelease: false); // strip 'noinclude' blocks from release description if (release != null) @@ -113,7 +111,7 @@ namespace StardewModdingAPI.Web.Controllers /// Get a parsed list of SMAPI downloads for a release. /// The GitHub release. - private IEnumerable ParseReleaseVersions(GitRelease release) + private IEnumerable ParseReleaseVersions(GitRelease? release) { if (release?.Assets == null) yield break; @@ -124,7 +122,7 @@ namespace StardewModdingAPI.Web.Controllers continue; Match match = Regex.Match(asset.FileName, @"SMAPI-(?[\d\.]+(?:-.+)?)-installer(?-for-developers)?.zip"); - if (!match.Success || !SemanticVersion.TryParse(match.Groups["version"].Value, out ISemanticVersion version)) + if (!match.Success || !SemanticVersion.TryParse(match.Groups["version"].Value, out ISemanticVersion? version)) continue; bool isForDevs = match.Groups["forDevs"].Success; diff --git a/src/SMAPI.Web/Controllers/JsonValidatorController.cs b/src/SMAPI.Web/Controllers/JsonValidatorController.cs index 5791d834..e78aeeb6 100644 --- a/src/SMAPI.Web/Controllers/JsonValidatorController.cs +++ b/src/SMAPI.Web/Controllers/JsonValidatorController.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.IO; @@ -66,7 +64,7 @@ namespace StardewModdingAPI.Web.Controllers [Route("json/{schemaName}")] [Route("json/{schemaName}/{id}")] [Route("json/{schemaName}/{id}/{operation}")] - public async Task Index(string schemaName = null, string id = null, string operation = null) + public async Task Index(string? schemaName = null, string? id = null, string? operation = null) { // parse arguments schemaName = this.NormalizeSchemaName(schemaName); @@ -81,7 +79,7 @@ namespace StardewModdingAPI.Web.Controllers return this.View("Index", result); // fetch raw JSON - StoredFileInfo file = await this.Storage.GetAsync(id, renew); + StoredFileInfo file = await this.Storage.GetAsync(id!, renew); if (string.IsNullOrWhiteSpace(file.Content)) return this.View("Index", result.SetUploadError("The JSON file seems to be empty.")); result.SetContent(file.Content, expiry: file.Expiry, uploadWarning: file.Warning); @@ -105,7 +103,7 @@ namespace StardewModdingAPI.Web.Controllers } catch (JsonReaderException ex) { - return this.View("Index", result.AddErrors(new JsonValidatorErrorModel(ex.LineNumber, ex.Path, ex.Message, ErrorType.None))); + return this.View("Index", result.AddErrors(new JsonValidatorErrorModel(ex.LineNumber, ex.Path!, ex.Message, ErrorType.None))); } // format JSON @@ -121,7 +119,7 @@ namespace StardewModdingAPI.Web.Controllers // load schema JSchema schema; { - FileInfo schemaFile = this.FindSchemaFile(schemaName); + FileInfo? schemaFile = this.FindSchemaFile(schemaName); if (schemaFile == null) return this.View("Index", result.SetParseError($"Invalid schema '{schemaName}'.")); schema = JSchema.Parse(System.IO.File.ReadAllText(schemaFile.FullName)); @@ -144,7 +142,7 @@ namespace StardewModdingAPI.Web.Controllers /// Save raw JSON data. [HttpPost, AllowLargePosts] [Route("json")] - public async Task PostAsync(JsonValidatorRequestModel request) + public async Task PostAsync(JsonValidatorRequestModel? request) { if (request == null) return this.View("Index", this.GetModel(null, null, isEditView: true).SetUploadError("The request seems to be invalid.")); @@ -163,7 +161,7 @@ namespace StardewModdingAPI.Web.Controllers return this.View("Index", this.GetModel(result.ID, schemaName, isEditView: true).SetContent(input, null).SetUploadError(result.UploadError)); // redirect to view - return this.Redirect(this.Url.PlainAction("Index", "JsonValidator", new { schemaName, id = result.ID })); + return this.Redirect(this.Url.PlainAction("Index", "JsonValidator", new { schemaName, id = result.ID })!); } @@ -174,14 +172,14 @@ namespace StardewModdingAPI.Web.Controllers /// The stored file ID. /// The schema name with which the JSON was validated. /// Whether to show the edit view. - private JsonValidatorModel GetModel(string pasteID, string schemaName, bool isEditView) + private JsonValidatorModel GetModel(string? pasteID, string? schemaName, bool isEditView) { return new JsonValidatorModel(pasteID, schemaName, this.SchemaFormats, isEditView); } /// Get a normalized schema name, or the if blank. /// The raw schema name to normalize. - private string NormalizeSchemaName(string schemaName) + private string NormalizeSchemaName(string? schemaName) { schemaName = schemaName?.Trim().ToLower(); return !string.IsNullOrWhiteSpace(schemaName) @@ -191,7 +189,7 @@ namespace StardewModdingAPI.Web.Controllers /// Get the schema file given its unique ID. /// The schema ID. - private FileInfo FindSchemaFile(string id) + private FileInfo? FindSchemaFile(string? id) { // normalize ID id = id?.Trim().ToLower(); @@ -216,13 +214,13 @@ namespace StardewModdingAPI.Web.Controllers // skip through transparent errors if (this.IsTransparentError(error)) { - foreach (var model in error.ChildErrors.SelectMany(this.GetErrorModels)) + foreach (JsonValidatorErrorModel model in error.ChildErrors.SelectMany(this.GetErrorModels)) yield return model; yield break; } // get message - string message = this.GetOverrideError(error); + string? message = this.GetOverrideError(error); if (message == null || message == this.TransparentToken) message = this.FlattenErrorMessage(error); @@ -236,7 +234,7 @@ namespace StardewModdingAPI.Web.Controllers private string FlattenErrorMessage(ValidationError error, int indent = 0) { // get override - string message = this.GetOverrideError(error); + string? message = this.GetOverrideError(error); if (message != null && message != this.TransparentToken) return message; @@ -257,7 +255,7 @@ namespace StardewModdingAPI.Web.Controllers break; case ErrorType.Required: - message = $"Missing required fields: {string.Join(", ", (List)error.Value)}."; + message = $"Missing required fields: {string.Join(", ", (List)error.Value!)}."; break; } @@ -274,7 +272,7 @@ namespace StardewModdingAPI.Web.Controllers if (!error.ChildErrors.Any()) return false; - string @override = this.GetOverrideError(error); + string? @override = this.GetOverrideError(error); return @override == this.TransparentToken || (error.ErrorType == ErrorType.Then && @override == null); @@ -282,18 +280,18 @@ namespace StardewModdingAPI.Web.Controllers /// Get an override error from the JSON schema, if any. /// The schema validation error. - private string GetOverrideError(ValidationError error) + private string? GetOverrideError(ValidationError error) { - string GetRawOverrideError() + string? GetRawOverrideError() { // get override errors - IDictionary errors = this.GetExtensionField>(error.Schema, "@errorMessages"); + IDictionary? errors = this.GetExtensionField>(error.Schema, "@errorMessages"); if (errors == null) return null; - errors = new Dictionary(errors, StringComparer.OrdinalIgnoreCase); + errors = new Dictionary(errors, StringComparer.OrdinalIgnoreCase); // match error by type and message - foreach ((string target, string errorMessage) in errors) + foreach ((string target, string? errorMessage) in errors) { if (!target.Contains(":")) continue; @@ -304,7 +302,7 @@ namespace StardewModdingAPI.Web.Controllers } // match by type - return errors.TryGetValue(error.ErrorType.ToString(), out string message) + return errors.TryGetValue(error.ErrorType.ToString(), out string? message) ? message?.Trim() : null; } @@ -317,7 +315,7 @@ namespace StardewModdingAPI.Web.Controllers /// The field type. /// The schema whose extension fields to search. /// The case-insensitive field key. - private T GetExtensionField(JSchema schema, string key) + private T? GetExtensionField(JSchema schema, string key) { foreach ((string curKey, JToken value) in schema.ExtensionData) { @@ -330,7 +328,7 @@ namespace StardewModdingAPI.Web.Controllers /// Format a schema value for display. /// The value to format. - private string FormatValue(object value) + private string FormatValue(object? value) { return value switch { diff --git a/src/SMAPI.Web/Controllers/LogParserController.cs b/src/SMAPI.Web/Controllers/LogParserController.cs index 93f2613e..33af5a81 100644 --- a/src/SMAPI.Web/Controllers/LogParserController.cs +++ b/src/SMAPI.Web/Controllers/LogParserController.cs @@ -69,7 +69,7 @@ namespace StardewModdingAPI.Web.Controllers case LogViewFormat.RawDownload: { - string content = file.Error ?? file.Content; + string content = file.Error ?? file.Content ?? string.Empty; return this.File(Encoding.UTF8.GetBytes(content), "plain/text", $"SMAPI log ({id}).txt"); } @@ -97,7 +97,7 @@ namespace StardewModdingAPI.Web.Controllers return this.View("Index", this.GetModel(null, uploadError: uploadResult.UploadError)); // redirect to view - return this.Redirect(this.Url.PlainAction("Index", "LogParser", new { id = uploadResult.ID })); + return this.Redirect(this.Url.PlainAction("Index", "LogParser", new { id = uploadResult.ID })!); } @@ -109,7 +109,7 @@ namespace StardewModdingAPI.Web.Controllers /// When the uploaded file will no longer be available. /// A non-blocking warning while uploading the log. /// An error which occurred while uploading the log. - private LogParserModel GetModel(string? pasteID, DateTime? expiry = null, string? uploadWarning = null, string? uploadError = null) + private LogParserModel GetModel(string? pasteID, DateTimeOffset? expiry = null, string? uploadWarning = null, string? uploadError = null) { Platform? platform = this.DetectClientPlatform(); diff --git a/src/SMAPI.Web/Controllers/ModsApiController.cs b/src/SMAPI.Web/Controllers/ModsApiController.cs index 3dc1e366..401bba4f 100644 --- a/src/SMAPI.Web/Controllers/ModsApiController.cs +++ b/src/SMAPI.Web/Controllers/ModsApiController.cs @@ -1,7 +1,6 @@ -#nullable disable - using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Threading.Tasks; @@ -78,7 +77,7 @@ namespace StardewModdingAPI.Web.Controllers /// The mod search criteria. /// The requested API version. [HttpPost] - public async Task> PostAsync([FromBody] ModSearchModel model, [FromRoute] string version) + public async Task> PostAsync([FromBody] ModSearchModel? model, [FromRoute] string version) { if (model?.Mods == null) return Array.Empty(); @@ -94,16 +93,16 @@ namespace StardewModdingAPI.Web.Controllers continue; // special case: if this is an update check for the official SMAPI repo, check the Nexus mod page for beta versions - if (mod.ID == config.SmapiInfo.ID && mod.UpdateKeys?.Any(key => key == config.SmapiInfo.DefaultUpdateKey) == true && mod.InstalledVersion?.IsPrerelease() == true) - mod.UpdateKeys = mod.UpdateKeys.Concat(config.SmapiInfo.AddBetaUpdateKeys).ToArray(); + if (mod.ID == config.SmapiInfo.ID && mod.UpdateKeys.Any(key => key == config.SmapiInfo.DefaultUpdateKey) && mod.InstalledVersion?.IsPrerelease() == true) + mod.AddUpdateKeys(config.SmapiInfo.AddBetaUpdateKeys); // fetch result ModEntryModel result = await this.GetModData(mod, wikiData, model.IncludeExtendedMetadata, model.ApiVersion); if (!model.IncludeExtendedMetadata && (model.ApiVersion == null || mod.InstalledVersion == null)) { - var errors = new List(result.Errors); - errors.Add($"This API can't suggest an update because {nameof(model.ApiVersion)} or {nameof(mod.InstalledVersion)} are null, and you didn't specify {nameof(model.IncludeExtendedMetadata)} to get other info. See the SMAPI technical docs for usage."); - result.Errors = errors.ToArray(); + result.Errors = result.Errors + .Concat(new[] { $"This API can't suggest an update because {nameof(model.ApiVersion)} or {nameof(mod.InstalledVersion)} are null, and you didn't specify {nameof(model.IncludeExtendedMetadata)} to get other info. See the SMAPI technical docs for usage." }) + .ToArray(); } mods[mod.ID] = result; @@ -123,26 +122,26 @@ namespace StardewModdingAPI.Web.Controllers /// Whether to include extended metadata for each mod. /// The SMAPI version installed by the player. /// Returns the mod data if found, else null. - private async Task GetModData(ModSearchEntryModel search, WikiModEntry[] wikiData, bool includeExtendedMetadata, ISemanticVersion apiVersion) + private async Task GetModData(ModSearchEntryModel search, WikiModEntry[] wikiData, bool includeExtendedMetadata, ISemanticVersion? apiVersion) { // cross-reference data - ModDataRecord record = this.ModDatabase.Get(search.ID); - WikiModEntry wikiEntry = wikiData.FirstOrDefault(entry => entry.ID.Contains(search.ID.Trim(), StringComparer.OrdinalIgnoreCase)); + ModDataRecord? record = this.ModDatabase.Get(search.ID); + WikiModEntry? wikiEntry = wikiData.FirstOrDefault(entry => entry.ID.Contains(search.ID.Trim(), StringComparer.OrdinalIgnoreCase)); UpdateKey[] updateKeys = this.GetUpdateKeys(search.UpdateKeys, record, wikiEntry).ToArray(); - ModOverrideConfig overrides = this.Config.Value.ModOverrides.FirstOrDefault(p => p.ID.Equals(search.ID?.Trim(), StringComparison.OrdinalIgnoreCase)); + ModOverrideConfig? overrides = this.Config.Value.ModOverrides.FirstOrDefault(p => p.ID.Equals(search.ID.Trim(), StringComparison.OrdinalIgnoreCase)); bool allowNonStandardVersions = overrides?.AllowNonStandardVersions ?? false; // SMAPI versions with a '-beta' tag indicate major changes that may need beta mod versions. // This doesn't apply to normal prerelease versions which have an '-alpha' tag. - bool isSmapiBeta = apiVersion.IsPrerelease() && apiVersion.PrereleaseTag.StartsWith("beta"); + bool isSmapiBeta = apiVersion != null && apiVersion.IsPrerelease() && apiVersion.PrereleaseTag.StartsWith("beta"); // get latest versions - ModEntryModel result = new() { ID = search.ID }; + ModEntryModel result = new(search.ID); IList errors = new List(); - ModEntryVersionModel main = null; - ModEntryVersionModel optional = null; - ModEntryVersionModel unofficial = null; - ModEntryVersionModel unofficialForBeta = null; + ModEntryVersionModel? main = null; + ModEntryVersionModel? optional = null; + ModEntryVersionModel? unofficial = null; + ModEntryVersionModel? unofficialForBeta = null; foreach (UpdateKey updateKey in updateKeys) { // validate update key @@ -162,9 +161,9 @@ namespace StardewModdingAPI.Web.Controllers // handle versions if (this.IsNewer(data.Version, main?.Version)) - main = new ModEntryVersionModel(data.Version, data.Url); + main = new ModEntryVersionModel(data.Version, data.Url!); if (this.IsNewer(data.PreviewVersion, optional?.Version)) - optional = new ModEntryVersionModel(data.PreviewVersion, data.Url); + optional = new ModEntryVersionModel(data.PreviewVersion, data.Url!); } // get unofficial version @@ -172,7 +171,7 @@ namespace StardewModdingAPI.Web.Controllers unofficial = new ModEntryVersionModel(wikiEntry.Compatibility.UnofficialVersion, $"{this.Url.PlainAction("Index", "Mods", absoluteUrl: true)}#{wikiEntry.Anchor}"); // get unofficial version for beta - if (wikiEntry?.HasBetaInfo == true) + if (wikiEntry is { HasBetaInfo: true }) { if (wikiEntry.BetaCompatibility.Status == WikiCompatibilityStatus.Unofficial) { @@ -198,13 +197,13 @@ namespace StardewModdingAPI.Web.Controllers if (overrides?.SetUrl != null) { if (main != null) - main.Url = overrides.SetUrl; + main = new(main.Version, overrides.SetUrl); if (optional != null) - optional.Url = overrides.SetUrl; + optional = new(optional.Version, overrides.SetUrl); } // get recommended update (if any) - ISemanticVersion installedVersion = this.ModSites.GetMappedVersion(search.InstalledVersion?.ToString(), wikiEntry?.Overrides?.ChangeLocalVersions, allowNonStandard: allowNonStandardVersions); + ISemanticVersion? installedVersion = this.ModSites.GetMappedVersion(search.InstalledVersion?.ToString(), wikiEntry?.Overrides?.ChangeLocalVersions, allowNonStandard: allowNonStandardVersions); if (apiVersion != null && installedVersion != null) { // get newer versions @@ -219,7 +218,7 @@ namespace StardewModdingAPI.Web.Controllers updates.Add(unofficialForBeta); // get newest version - ModEntryVersionModel newest = null; + ModEntryVersionModel? newest = null; foreach (ModEntryVersionModel update in updates) { if (newest == null || update.Version.IsNewerThan(newest.Version)) @@ -245,7 +244,7 @@ namespace StardewModdingAPI.Web.Controllers /// The current semantic version. /// The target semantic version. /// Whether the user enabled the beta channel and should be offered prerelease updates. - private bool IsRecommendedUpdate(ISemanticVersion currentVersion, ISemanticVersion newVersion, bool useBetaChannel) + private bool IsRecommendedUpdate(ISemanticVersion currentVersion, [NotNullWhen(true)] ISemanticVersion? newVersion, bool useBetaChannel) { return newVersion != null @@ -256,7 +255,7 @@ namespace StardewModdingAPI.Web.Controllers /// Get whether a version is newer than an version. /// The current version. /// The other version. - private bool IsNewer(ISemanticVersion current, ISemanticVersion other) + private bool IsNewer([NotNullWhen(true)] ISemanticVersion? current, ISemanticVersion? other) { return current != null && (other == null || other.IsOlderThan(current)); } @@ -265,17 +264,20 @@ namespace StardewModdingAPI.Web.Controllers /// The namespaced update key. /// Whether to allow non-standard versions. /// The changes to apply to remote versions for update checks. - private async Task GetInfoForUpdateKeyAsync(UpdateKey updateKey, bool allowNonStandardVersions, ChangeDescriptor mapRemoteVersions) + private async Task GetInfoForUpdateKeyAsync(UpdateKey updateKey, bool allowNonStandardVersions, ChangeDescriptor? mapRemoteVersions) { + if (!updateKey.LooksValid) + return new ModInfoModel().SetError(RemoteModStatus.DoesNotExist, $"Invalid update key '{updateKey}'."); + // get mod page IModPage page; { bool isCached = - this.ModCache.TryGetMod(updateKey.Site, updateKey.ID, out Cached cachedMod) + this.ModCache.TryGetMod(updateKey.Site, updateKey.ID, out Cached? cachedMod) && !this.ModCache.IsStale(cachedMod.LastUpdated, cachedMod.Data.Status == RemoteModStatus.TemporaryError ? this.Config.Value.ErrorCacheMinutes : this.Config.Value.SuccessCacheMinutes); if (isCached) - page = cachedMod.Data; + page = cachedMod!.Data; else { page = await this.ModSites.GetModPageAsync(updateKey); @@ -291,7 +293,7 @@ namespace StardewModdingAPI.Web.Controllers /// The specified update keys. /// The mod's entry in SMAPI's internal database. /// The mod's entry in the wiki list. - private IEnumerable GetUpdateKeys(string[] specifiedKeys, ModDataRecord record, WikiModEntry entry) + private IEnumerable GetUpdateKeys(string[]? specifiedKeys, ModDataRecord? record, WikiModEntry? entry) { // get unique update keys List updateKeys = this.GetUnfilteredUpdateKeys(specifiedKeys, record, entry) @@ -310,7 +312,7 @@ namespace StardewModdingAPI.Web.Controllers // if the list has both an update key (like "Nexus:2400") and subkey (like "Nexus:2400@subkey") for the same page, the subkey takes priority { var removeKeys = new HashSet(); - foreach (var key in updateKeys) + foreach (UpdateKey key in updateKeys) { if (key.Subkey != null) removeKeys.Add(new UpdateKey(key.Site, key.ID, null)); @@ -326,7 +328,7 @@ namespace StardewModdingAPI.Web.Controllers /// The specified update keys. /// The mod's entry in SMAPI's internal database. /// The mod's entry in the wiki list. - private IEnumerable GetUnfilteredUpdateKeys(string[] specifiedKeys, ModDataRecord record, WikiModEntry entry) + private IEnumerable GetUnfilteredUpdateKeys(string[]? specifiedKeys, ModDataRecord? record, WikiModEntry? entry) { // specified update keys foreach (string key in specifiedKeys ?? Array.Empty()) @@ -337,7 +339,7 @@ namespace StardewModdingAPI.Web.Controllers // default update key { - string defaultKey = record?.GetDefaultUpdateKey(); + string? defaultKey = record?.GetDefaultUpdateKey(); if (!string.IsNullOrWhiteSpace(defaultKey)) yield return defaultKey; } diff --git a/src/SMAPI.Web/Controllers/ModsController.cs b/src/SMAPI.Web/Controllers/ModsController.cs index 5292e1ce..919afa5b 100644 --- a/src/SMAPI.Web/Controllers/ModsController.cs +++ b/src/SMAPI.Web/Controllers/ModsController.cs @@ -1,5 +1,4 @@ -#nullable disable - +using System; using System.Linq; using System.Text.RegularExpressions; using Microsoft.AspNetCore.Mvc; @@ -54,8 +53,8 @@ namespace StardewModdingAPI.Web.Controllers public ModListModel FetchData() { // fetch cached data - if (!this.Cache.TryGetWikiMetadata(out Cached metadata)) - return new ModListModel(); + if (!this.Cache.TryGetWikiMetadata(out Cached? metadata)) + return new ModListModel(null, null, Array.Empty(), lastUpdated: DateTimeOffset.UtcNow, isStale: true); // build model return new ModListModel( diff --git a/src/SMAPI.Web/Framework/AllowLargePostsAttribute.cs b/src/SMAPI.Web/Framework/AllowLargePostsAttribute.cs index 108ceff7..bd414ea2 100644 --- a/src/SMAPI.Web/Framework/AllowLargePostsAttribute.cs +++ b/src/SMAPI.Web/Framework/AllowLargePostsAttribute.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using Microsoft.AspNetCore.Http.Features; using Microsoft.AspNetCore.Mvc.Filters; @@ -42,7 +40,7 @@ namespace StardewModdingAPI.Web.Framework public void OnAuthorization(AuthorizationFilterContext context) { IFeatureCollection features = context.HttpContext.Features; - IFormFeature formFeature = features.Get(); + IFormFeature? formFeature = features.Get(); if (formFeature?.Form == null) { diff --git a/src/SMAPI.Web/Framework/Caching/Cached.cs b/src/SMAPI.Web/Framework/Caching/Cached.cs index aabbf146..b393e1e1 100644 --- a/src/SMAPI.Web/Framework/Caching/Cached.cs +++ b/src/SMAPI.Web/Framework/Caching/Cached.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; namespace StardewModdingAPI.Web.Framework.Caching @@ -12,21 +10,18 @@ namespace StardewModdingAPI.Web.Framework.Caching ** Accessors *********/ /// The cached data. - public T Data { get; set; } + public T Data { get; } /// When the data was last updated. - public DateTimeOffset LastUpdated { get; set; } + public DateTimeOffset LastUpdated { get; } /// When the data was last requested through the mod API. - public DateTimeOffset LastRequested { get; set; } + public DateTimeOffset LastRequested { get; internal set; } /********* ** Public methods *********/ - /// Construct an empty instance. - public Cached() { } - /// Construct an instance. /// The cached data. public Cached(T data) diff --git a/src/SMAPI.Web/Framework/Caching/Mods/IModCacheRepository.cs b/src/SMAPI.Web/Framework/Caching/Mods/IModCacheRepository.cs index 2020d747..fb74e9da 100644 --- a/src/SMAPI.Web/Framework/Caching/Mods/IModCacheRepository.cs +++ b/src/SMAPI.Web/Framework/Caching/Mods/IModCacheRepository.cs @@ -1,6 +1,5 @@ -#nullable disable - using System; +using System.Diagnostics.CodeAnalysis; using StardewModdingAPI.Toolkit.Framework.UpdateData; namespace StardewModdingAPI.Web.Framework.Caching.Mods @@ -16,7 +15,7 @@ namespace StardewModdingAPI.Web.Framework.Caching.Mods /// The mod's unique ID within the . /// The fetched mod. /// Whether to update the mod's 'last requested' date. - bool TryGetMod(ModSiteKey site, string id, out Cached mod, bool markRequested = true); + bool TryGetMod(ModSiteKey site, string id, [NotNullWhen(true)] out Cached? mod, bool markRequested = true); /// Save data fetched for a mod. /// The mod site on which the mod is found. diff --git a/src/SMAPI.Web/Framework/Caching/Mods/ModCacheMemoryRepository.cs b/src/SMAPI.Web/Framework/Caching/Mods/ModCacheMemoryRepository.cs index 338562d8..4ba0bd20 100644 --- a/src/SMAPI.Web/Framework/Caching/Mods/ModCacheMemoryRepository.cs +++ b/src/SMAPI.Web/Framework/Caching/Mods/ModCacheMemoryRepository.cs @@ -1,7 +1,6 @@ -#nullable disable - using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using StardewModdingAPI.Toolkit.Framework.UpdateData; @@ -25,7 +24,7 @@ namespace StardewModdingAPI.Web.Framework.Caching.Mods /// The mod's unique ID within the . /// The fetched mod. /// Whether to update the mod's 'last requested' date. - public bool TryGetMod(ModSiteKey site, string id, out Cached mod, bool markRequested = true) + public bool TryGetMod(ModSiteKey site, string id, [NotNullWhen(true)] out Cached? mod, bool markRequested = true) { // get mod if (!this.Mods.TryGetValue(this.GetKey(site, id), out var cachedMod)) diff --git a/src/SMAPI.Web/Framework/Caching/Wiki/IWikiCacheRepository.cs b/src/SMAPI.Web/Framework/Caching/Wiki/IWikiCacheRepository.cs index 6edafddc..b8a0df34 100644 --- a/src/SMAPI.Web/Framework/Caching/Wiki/IWikiCacheRepository.cs +++ b/src/SMAPI.Web/Framework/Caching/Wiki/IWikiCacheRepository.cs @@ -1,7 +1,6 @@ -#nullable disable - using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using StardewModdingAPI.Toolkit.Framework.Clients.Wiki; namespace StardewModdingAPI.Web.Framework.Caching.Wiki @@ -14,16 +13,16 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki *********/ /// Get the cached wiki metadata. /// The fetched metadata. - bool TryGetWikiMetadata(out Cached metadata); + bool TryGetWikiMetadata([NotNullWhen(true)] out Cached? metadata); /// Get the cached wiki mods. /// A filter to apply, if any. - IEnumerable> GetWikiMods(Func filter = null); + IEnumerable> GetWikiMods(Func? filter = null); /// Save data fetched from the wiki compatibility list. /// The current stable Stardew Valley version. /// The current beta Stardew Valley version. /// The mod data. - void SaveWikiData(string stableVersion, string betaVersion, IEnumerable mods); + void SaveWikiData(string? stableVersion, string? betaVersion, IEnumerable mods); } } diff --git a/src/SMAPI.Web/Framework/Caching/Wiki/WikiCacheMemoryRepository.cs b/src/SMAPI.Web/Framework/Caching/Wiki/WikiCacheMemoryRepository.cs index d1ccb9c7..8b4338e2 100644 --- a/src/SMAPI.Web/Framework/Caching/Wiki/WikiCacheMemoryRepository.cs +++ b/src/SMAPI.Web/Framework/Caching/Wiki/WikiCacheMemoryRepository.cs @@ -1,7 +1,6 @@ -#nullable disable - using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using StardewModdingAPI.Toolkit.Framework.Clients.Wiki; @@ -14,7 +13,7 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki ** Fields *********/ /// The saved wiki metadata. - private Cached Metadata; + private Cached? Metadata; /// The cached wiki data. private Cached[] Mods = Array.Empty>(); @@ -25,7 +24,7 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki *********/ /// Get the cached wiki metadata. /// The fetched metadata. - public bool TryGetWikiMetadata(out Cached metadata) + public bool TryGetWikiMetadata([NotNullWhen(true)] out Cached? metadata) { metadata = this.Metadata; return metadata != null; @@ -33,7 +32,7 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki /// Get the cached wiki mods. /// A filter to apply, if any. - public IEnumerable> GetWikiMods(Func filter = null) + public IEnumerable> GetWikiMods(Func? filter = null) { foreach (var mod in this.Mods) { @@ -46,7 +45,7 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki /// The current stable Stardew Valley version. /// The current beta Stardew Valley version. /// The mod data. - public void SaveWikiData(string stableVersion, string betaVersion, IEnumerable mods) + public void SaveWikiData(string? stableVersion, string? betaVersion, IEnumerable mods) { this.Metadata = new Cached(new WikiMetadata(stableVersion, betaVersion)); this.Mods = mods.Select(mod => new Cached(mod)).ToArray(); diff --git a/src/SMAPI.Web/Framework/Caching/Wiki/WikiMetadata.cs b/src/SMAPI.Web/Framework/Caching/Wiki/WikiMetadata.cs index 6ae42488..f53ea201 100644 --- a/src/SMAPI.Web/Framework/Caching/Wiki/WikiMetadata.cs +++ b/src/SMAPI.Web/Framework/Caching/Wiki/WikiMetadata.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI.Web.Framework.Caching.Wiki { /// The model for cached wiki metadata. @@ -9,22 +7,19 @@ namespace StardewModdingAPI.Web.Framework.Caching.Wiki ** Accessors *********/ /// The current stable Stardew Valley version. - public string StableVersion { get; set; } + public string? StableVersion { get; } /// The current beta Stardew Valley version. - public string BetaVersion { get; set; } + public string? BetaVersion { get; } /********* ** Public methods *********/ - /// Construct an instance. - public WikiMetadata() { } - /// Construct an instance. /// The current stable Stardew Valley version. /// The current beta Stardew Valley version. - public WikiMetadata(string stableVersion, string betaVersion) + public WikiMetadata(string? stableVersion, string? betaVersion) { this.StableVersion = stableVersion; this.BetaVersion = betaVersion; diff --git a/src/SMAPI.Web/Framework/Clients/Chucklefish/ChucklefishClient.cs b/src/SMAPI.Web/Framework/Clients/Chucklefish/ChucklefishClient.cs index 4d041c1b..ce0f1122 100644 --- a/src/SMAPI.Web/Framework/Clients/Chucklefish/ChucklefishClient.cs +++ b/src/SMAPI.Web/Framework/Clients/Chucklefish/ChucklefishClient.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Net; using System.Threading.Tasks; @@ -44,7 +42,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.Chucklefish /// Get update check info about a mod. /// The mod ID. - public async Task GetModData(string id) + public async Task GetModData(string id) { IModPage page = new GenericModPage(this.SiteKey, id); @@ -53,7 +51,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.Chucklefish return page.SetError(RemoteModStatus.DoesNotExist, $"The value '{id}' isn't a valid Chucklefish mod ID, must be an integer ID."); // fetch HTML - string html; + string? html; try { html = await this.Client @@ -69,7 +67,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.Chucklefish // extract mod info string url = this.GetModUrl(parsedId); - string version = doc.DocumentNode.SelectSingleNode("//h1/span")?.InnerText; + string? version = doc.DocumentNode.SelectSingleNode("//h1/span")?.InnerText; string name = doc.DocumentNode.SelectSingleNode("//h1").ChildNodes[0].InnerText.Trim(); if (name.StartsWith("[SMAPI]")) name = name.Substring("[SMAPI]".Length).TrimStart(); @@ -81,7 +79,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.Chucklefish /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. public void Dispose() { - this.Client?.Dispose(); + this.Client.Dispose(); } @@ -92,7 +90,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.Chucklefish /// The mod ID. private string GetModUrl(uint id) { - UriBuilder builder = new(this.Client.BaseClient.BaseAddress); + UriBuilder builder = new(this.Client.BaseClient.BaseAddress!); builder.Path += string.Format(this.ModPageUrlFormat, id); return builder.Uri.ToString(); } diff --git a/src/SMAPI.Web/Framework/Clients/CurseForge/CurseForgeClient.cs b/src/SMAPI.Web/Framework/Clients/CurseForge/CurseForgeClient.cs index 5ef369d5..d351b42d 100644 --- a/src/SMAPI.Web/Framework/Clients/CurseForge/CurseForgeClient.cs +++ b/src/SMAPI.Web/Framework/Clients/CurseForge/CurseForgeClient.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Collections.Generic; using System.Text.RegularExpressions; using System.Threading.Tasks; @@ -42,7 +40,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.CurseForge /// Get update check info about a mod. /// The mod ID. - public async Task GetModData(string id) + public async Task GetModData(string id) { IModPage page = new GenericModPage(this.SiteKey, id); @@ -51,9 +49,9 @@ namespace StardewModdingAPI.Web.Framework.Clients.CurseForge return page.SetError(RemoteModStatus.DoesNotExist, $"The value '{id}' isn't a valid CurseForge mod ID, must be an integer ID."); // get raw data - ModModel mod = await this.Client + ModModel? mod = await this.Client .GetAsync($"addon/{parsedId}") - .As(); + .As(); if (mod == null) return page.SetError(RemoteModStatus.DoesNotExist, "Found no CurseForge mod with this ID."); @@ -73,7 +71,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.CurseForge /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. public void Dispose() { - this.Client?.Dispose(); + this.Client.Dispose(); } @@ -82,9 +80,9 @@ namespace StardewModdingAPI.Web.Framework.Clients.CurseForge *********/ /// Get a raw version string for a mod file, if available. /// The file whose version to get. - private string GetRawVersion(ModFileModel file) + private string? GetRawVersion(ModFileModel file) { - Match match = this.VersionInNamePattern.Match(file.DisplayName); + Match match = this.VersionInNamePattern.Match(file.DisplayName ?? ""); if (!match.Success) match = this.VersionInNamePattern.Match(file.FileName); diff --git a/src/SMAPI.Web/Framework/Clients/CurseForge/ResponseModels/ModFileModel.cs b/src/SMAPI.Web/Framework/Clients/CurseForge/ResponseModels/ModFileModel.cs index eabef9f0..e9adcf20 100644 --- a/src/SMAPI.Web/Framework/Clients/CurseForge/ResponseModels/ModFileModel.cs +++ b/src/SMAPI.Web/Framework/Clients/CurseForge/ResponseModels/ModFileModel.cs @@ -1,14 +1,28 @@ -#nullable disable - namespace StardewModdingAPI.Web.Framework.Clients.CurseForge.ResponseModels { /// Metadata from the CurseForge API about a mod file. public class ModFileModel { + /********* + ** Accessors + *********/ /// The file name as downloaded. - public string FileName { get; set; } + public string FileName { get; } /// The file display name. - public string DisplayName { get; set; } + public string? DisplayName { get; } + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The file name as downloaded. + /// The file display name. + public ModFileModel(string fileName, string? displayName) + { + this.FileName = fileName; + this.DisplayName = displayName; + } } } diff --git a/src/SMAPI.Web/Framework/Clients/CurseForge/ResponseModels/ModModel.cs b/src/SMAPI.Web/Framework/Clients/CurseForge/ResponseModels/ModModel.cs index a95df7f1..fd7796f2 100644 --- a/src/SMAPI.Web/Framework/Clients/CurseForge/ResponseModels/ModModel.cs +++ b/src/SMAPI.Web/Framework/Clients/CurseForge/ResponseModels/ModModel.cs @@ -1,20 +1,38 @@ -#nullable disable - namespace StardewModdingAPI.Web.Framework.Clients.CurseForge.ResponseModels { /// An mod from the CurseForge API. public class ModModel { + /********* + ** Accessors + *********/ /// The mod's unique ID on CurseForge. - public int ID { get; set; } + public int ID { get; } /// The mod name. - public string Name { get; set; } + public string Name { get; } /// The web URL for the mod page. - public string WebsiteUrl { get; set; } + public string WebsiteUrl { get; } /// The available file downloads. - public ModFileModel[] LatestFiles { get; set; } + public ModFileModel[] LatestFiles { get; } + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The mod's unique ID on CurseForge. + /// The mod name. + /// The web URL for the mod page. + /// The available file downloads. + public ModModel(int id, string name, string websiteUrl, ModFileModel[] latestFiles) + { + this.ID = id; + this.Name = name; + this.WebsiteUrl = websiteUrl; + this.LatestFiles = latestFiles; + } } } diff --git a/src/SMAPI.Web/Framework/Clients/GenericModDownload.cs b/src/SMAPI.Web/Framework/Clients/GenericModDownload.cs index 919072b0..548f17c3 100644 --- a/src/SMAPI.Web/Framework/Clients/GenericModDownload.cs +++ b/src/SMAPI.Web/Framework/Clients/GenericModDownload.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI.Web.Framework.Clients { /// Generic metadata about a file download on a mod page. @@ -9,26 +7,23 @@ namespace StardewModdingAPI.Web.Framework.Clients ** Accessors *********/ /// The download's display name. - public string Name { get; set; } + public string Name { get; } /// The download's description. - public string Description { get; set; } + public string? Description { get; } /// The download's file version. - public string Version { get; set; } + public string? Version { get; } /********* ** Public methods *********/ - /// Construct an empty instance. - public GenericModDownload() { } - /// Construct an instance. /// The download's display name. /// The download's description. /// The download's file version. - public GenericModDownload(string name, string description, string version) + public GenericModDownload(string name, string? description, string? version) { this.Name = name; this.Description = description; diff --git a/src/SMAPI.Web/Framework/Clients/GenericModPage.cs b/src/SMAPI.Web/Framework/Clients/GenericModPage.cs index 4788aa2a..5353c7e1 100644 --- a/src/SMAPI.Web/Framework/Clients/GenericModPage.cs +++ b/src/SMAPI.Web/Framework/Clients/GenericModPage.cs @@ -1,7 +1,6 @@ -#nullable disable - using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using StardewModdingAPI.Toolkit.Framework.UpdateData; @@ -20,30 +19,31 @@ namespace StardewModdingAPI.Web.Framework.Clients public string Id { get; set; } /// The mod name. - public string Name { get; set; } + public string? Name { get; set; } /// The mod's semantic version number. - public string Version { get; set; } + public string? Version { get; set; } /// The mod's web URL. - public string Url { get; set; } + public string? Url { get; set; } /// The mod downloads. public IModDownload[] Downloads { get; set; } = Array.Empty(); /// The mod availability status on the remote site. - public RemoteModStatus Status { get; set; } = RemoteModStatus.Ok; + public RemoteModStatus Status { get; set; } = RemoteModStatus.InvalidData; /// A user-friendly error which indicates why fetching the mod info failed (if applicable). - public string Error { get; set; } + public string? Error { get; set; } + + /// Whether the mod data is valid. + [MemberNotNullWhen(true, nameof(IModPage.Name), nameof(IModPage.Url))] + public bool IsValid => this.Status == RemoteModStatus.Ok; /********* ** Public methods *********/ - /// Construct an empty instance. - public GenericModPage() { } - /// Construct an instance. /// The mod site containing the mod. /// The mod's unique ID within the site. @@ -58,12 +58,13 @@ namespace StardewModdingAPI.Web.Framework.Clients /// The mod's semantic version number. /// The mod's web URL. /// The mod downloads. - public IModPage SetInfo(string name, string version, string url, IEnumerable downloads) + public IModPage SetInfo(string name, string? version, string url, IEnumerable downloads) { this.Name = name; this.Version = version; this.Url = url; this.Downloads = downloads.ToArray(); + this.Status = RemoteModStatus.Ok; return this; } diff --git a/src/SMAPI.Web/Framework/Clients/GitHub/GitAsset.cs b/src/SMAPI.Web/Framework/Clients/GitHub/GitAsset.cs index 39ebf94e..dbce9368 100644 --- a/src/SMAPI.Web/Framework/Clients/GitHub/GitAsset.cs +++ b/src/SMAPI.Web/Framework/Clients/GitHub/GitAsset.cs @@ -1,5 +1,3 @@ -#nullable disable - using Newtonsoft.Json; namespace StardewModdingAPI.Web.Framework.Clients.GitHub @@ -7,16 +5,34 @@ namespace StardewModdingAPI.Web.Framework.Clients.GitHub /// A GitHub download attached to a release. internal class GitAsset { + /********* + ** Accessors + *********/ /// The file name. [JsonProperty("name")] - public string FileName { get; set; } + public string FileName { get; } /// The file content type. [JsonProperty("content_type")] - public string ContentType { get; set; } + public string ContentType { get; } /// The download URL. [JsonProperty("browser_download_url")] - public string DownloadUrl { get; set; } + public string DownloadUrl { get; } + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The file name. + /// The file content type. + /// The download URL. + public GitAsset(string fileName, string contentType, string downloadUrl) + { + this.FileName = fileName; + this.ContentType = contentType; + this.DownloadUrl = downloadUrl; + } } } diff --git a/src/SMAPI.Web/Framework/Clients/GitHub/GitHubClient.cs b/src/SMAPI.Web/Framework/Clients/GitHub/GitHubClient.cs index 0e68e2c2..785979a5 100644 --- a/src/SMAPI.Web/Framework/Clients/GitHub/GitHubClient.cs +++ b/src/SMAPI.Web/Framework/Clients/GitHub/GitHubClient.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Linq; using System.Net; @@ -35,26 +33,26 @@ namespace StardewModdingAPI.Web.Framework.Clients.GitHub /// The Accept header value expected by the GitHub API. /// The username with which to authenticate to the GitHub API. /// The password with which to authenticate to the GitHub API. - public GitHubClient(string baseUrl, string userAgent, string acceptHeader, string username, string password) + public GitHubClient(string baseUrl, string userAgent, string acceptHeader, string? username, string? password) { this.Client = new FluentClient(baseUrl) .SetUserAgent(userAgent) .AddDefault(req => req.WithHeader("Accept", acceptHeader)); if (!string.IsNullOrWhiteSpace(username)) - this.Client = this.Client.SetBasicAuthentication(username, password); + this.Client = this.Client.SetBasicAuthentication(username, password!); } /// Get basic metadata for a GitHub repository, if available. /// The repository key (like Pathoschild/SMAPI). /// Returns the repository info if it exists, else null. - public async Task GetRepositoryAsync(string repo) + public async Task GetRepositoryAsync(string repo) { this.AssertKeyFormat(repo); try { return await this.Client .GetAsync($"repos/{repo}") - .As(); + .As(); } catch (ApiException ex) when (ex.Status == HttpStatusCode.NotFound) { @@ -66,7 +64,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.GitHub /// The repository key (like Pathoschild/SMAPI). /// Whether to return a prerelease version if it's latest. /// Returns the release if found, else null. - public async Task GetLatestReleaseAsync(string repo, bool includePrerelease = false) + public async Task GetLatestReleaseAsync(string repo, bool includePrerelease = false) { this.AssertKeyFormat(repo); try @@ -81,7 +79,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.GitHub return await this.Client .GetAsync($"repos/{repo}/releases/latest") - .As(); + .As(); } catch (ApiException ex) when (ex.Status == HttpStatusCode.NotFound) { @@ -91,7 +89,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.GitHub /// Get update check info about a mod. /// The mod ID. - public async Task GetModData(string id) + public async Task GetModData(string id) { IModPage page = new GenericModPage(this.SiteKey, id); @@ -99,15 +97,15 @@ namespace StardewModdingAPI.Web.Framework.Clients.GitHub return page.SetError(RemoteModStatus.DoesNotExist, $"The value '{id}' isn't a valid GitHub mod ID, must be a username and project name like 'Pathoschild/SMAPI'."); // fetch repo info - GitRepo repository = await this.GetRepositoryAsync(id); + GitRepo? repository = await this.GetRepositoryAsync(id); if (repository == null) return page.SetError(RemoteModStatus.DoesNotExist, "Found no GitHub repository for this ID."); string name = repository.FullName; string url = $"{repository.WebUrl}/releases"; // get releases - GitRelease latest; - GitRelease preview; + GitRelease? latest; + GitRelease? preview; { // get latest release (whether preview or stable) latest = await this.GetLatestReleaseAsync(id, includePrerelease: true); @@ -118,7 +116,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.GitHub preview = null; if (latest.IsPrerelease) { - GitRelease release = await this.GetLatestReleaseAsync(id, includePrerelease: false); + GitRelease? release = await this.GetLatestReleaseAsync(id, includePrerelease: false); if (release != null) { preview = latest; @@ -129,8 +127,8 @@ namespace StardewModdingAPI.Web.Framework.Clients.GitHub // get downloads IModDownload[] downloads = new[] { latest, preview } - .Where(release => release != null) - .Select(release => (IModDownload)new GenericModDownload(release.Name, release.Body, release.Tag)) + .Where(release => release is not null) + .Select(release => (IModDownload)new GenericModDownload(release!.Name, release.Body, release.Tag)) .ToArray(); // return info @@ -140,7 +138,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.GitHub /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. public void Dispose() { - this.Client?.Dispose(); + this.Client.Dispose(); } diff --git a/src/SMAPI.Web/Framework/Clients/GitHub/GitLicense.cs b/src/SMAPI.Web/Framework/Clients/GitHub/GitLicense.cs index 275c775a..24d6c3c5 100644 --- a/src/SMAPI.Web/Framework/Clients/GitHub/GitLicense.cs +++ b/src/SMAPI.Web/Framework/Clients/GitHub/GitLicense.cs @@ -1,5 +1,3 @@ -#nullable disable - using Newtonsoft.Json; namespace StardewModdingAPI.Web.Framework.Clients.GitHub @@ -7,16 +5,34 @@ namespace StardewModdingAPI.Web.Framework.Clients.GitHub /// The license info for a GitHub project. internal class GitLicense { + /********* + ** Accessors + *********/ /// The license display name. [JsonProperty("name")] - public string Name { get; set; } + public string Name { get; } /// The SPDX ID for the license. [JsonProperty("spdx_id")] - public string SpdxId { get; set; } + public string SpdxId { get; } /// The URL for the license info. [JsonProperty("url")] - public string Url { get; set; } + public string Url { get; } + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The license display name. + /// The SPDX ID for the license. + /// The URL for the license info. + public GitLicense(string name, string spdxId, string url) + { + this.Name = name; + this.SpdxId = spdxId; + this.Url = url; + } } } diff --git a/src/SMAPI.Web/Framework/Clients/GitHub/GitRelease.cs b/src/SMAPI.Web/Framework/Clients/GitHub/GitRelease.cs index 383775d2..9de6f020 100644 --- a/src/SMAPI.Web/Framework/Clients/GitHub/GitRelease.cs +++ b/src/SMAPI.Web/Framework/Clients/GitHub/GitRelease.cs @@ -1,5 +1,4 @@ -#nullable disable - +using System; using Newtonsoft.Json; namespace StardewModdingAPI.Web.Framework.Clients.GitHub @@ -12,24 +11,45 @@ namespace StardewModdingAPI.Web.Framework.Clients.GitHub *********/ /// The display name. [JsonProperty("name")] - public string Name { get; set; } + public string Name { get; } /// The semantic version string. [JsonProperty("tag_name")] - public string Tag { get; set; } + public string Tag { get; } /// The Markdown description for the release. - public string Body { get; set; } + public string Body { get; internal set; } /// Whether this is a draft version. [JsonProperty("draft")] - public bool IsDraft { get; set; } + public bool IsDraft { get; } /// Whether this is a prerelease version. [JsonProperty("prerelease")] - public bool IsPrerelease { get; set; } + public bool IsPrerelease { get; } /// The attached files. - public GitAsset[] Assets { get; set; } + public GitAsset[] Assets { get; } + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The display name. + /// The semantic version string. + /// The Markdown description for the release. + /// Whether this is a draft version. + /// Whether this is a prerelease version. + /// The attached files. + public GitRelease(string name, string tag, string? body, bool isDraft, bool isPrerelease, GitAsset[]? assets) + { + this.Name = name; + this.Tag = tag; + this.Body = body ?? string.Empty; + this.IsDraft = isDraft; + this.IsPrerelease = isPrerelease; + this.Assets = assets ?? Array.Empty(); + } } } diff --git a/src/SMAPI.Web/Framework/Clients/GitHub/GitRepo.cs b/src/SMAPI.Web/Framework/Clients/GitHub/GitRepo.cs index 5b5ce6a6..879b5e49 100644 --- a/src/SMAPI.Web/Framework/Clients/GitHub/GitRepo.cs +++ b/src/SMAPI.Web/Framework/Clients/GitHub/GitRepo.cs @@ -1,5 +1,3 @@ -#nullable disable - using Newtonsoft.Json; namespace StardewModdingAPI.Web.Framework.Clients.GitHub @@ -7,16 +5,34 @@ namespace StardewModdingAPI.Web.Framework.Clients.GitHub /// Basic metadata about a GitHub project. internal class GitRepo { + /********* + ** Accessors + *********/ /// The full repository name, including the owner. [JsonProperty("full_name")] - public string FullName { get; set; } + public string FullName { get; } /// The URL to the repository web page, if any. [JsonProperty("html_url")] - public string WebUrl { get; set; } + public string? WebUrl { get; } /// The code license, if any. [JsonProperty("license")] - public GitLicense License { get; set; } + public GitLicense? License { get; } + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The full repository name, including the owner. + /// The URL to the repository web page, if any. + /// The code license, if any. + public GitRepo(string fullName, string? webUrl, GitLicense? license) + { + this.FullName = fullName; + this.WebUrl = webUrl; + this.License = license; + } } } diff --git a/src/SMAPI.Web/Framework/Clients/GitHub/IGitHubClient.cs b/src/SMAPI.Web/Framework/Clients/GitHub/IGitHubClient.cs index e1961416..886e32d3 100644 --- a/src/SMAPI.Web/Framework/Clients/GitHub/IGitHubClient.cs +++ b/src/SMAPI.Web/Framework/Clients/GitHub/IGitHubClient.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Threading.Tasks; @@ -14,12 +12,12 @@ namespace StardewModdingAPI.Web.Framework.Clients.GitHub /// Get basic metadata for a GitHub repository, if available. /// The repository key (like Pathoschild/SMAPI). /// Returns the repository info if it exists, else null. - Task GetRepositoryAsync(string repo); + Task GetRepositoryAsync(string repo); /// Get the latest release for a GitHub repository. /// The repository key (like Pathoschild/SMAPI). /// Whether to return a prerelease version if it's latest. /// Returns the release if found, else null. - Task GetLatestReleaseAsync(string repo, bool includePrerelease = false); + Task GetLatestReleaseAsync(string repo, bool includePrerelease = false); } } diff --git a/src/SMAPI.Web/Framework/Clients/IModSiteClient.cs b/src/SMAPI.Web/Framework/Clients/IModSiteClient.cs index 2cd1f635..3697ffae 100644 --- a/src/SMAPI.Web/Framework/Clients/IModSiteClient.cs +++ b/src/SMAPI.Web/Framework/Clients/IModSiteClient.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Threading.Tasks; using StardewModdingAPI.Toolkit.Framework.UpdateData; @@ -20,6 +18,6 @@ namespace StardewModdingAPI.Web.Framework.Clients *********/ /// Get update check info about a mod. /// The mod ID. - Task GetModData(string id); + Task GetModData(string id); } } diff --git a/src/SMAPI.Web/Framework/Clients/ModDrop/ModDropClient.cs b/src/SMAPI.Web/Framework/Clients/ModDrop/ModDropClient.cs index 1a11a606..c60b2c90 100644 --- a/src/SMAPI.Web/Framework/Clients/ModDrop/ModDropClient.cs +++ b/src/SMAPI.Web/Framework/Clients/ModDrop/ModDropClient.cs @@ -1,6 +1,5 @@ -#nullable disable - using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Threading.Tasks; using Pathoschild.Http.Client; using StardewModdingAPI.Toolkit.Framework.UpdateData; @@ -43,9 +42,10 @@ namespace StardewModdingAPI.Web.Framework.Clients.ModDrop /// Get update check info about a mod. /// The mod ID. - public async Task GetModData(string id) + [SuppressMessage("ReSharper", "ConstantConditionalAccessQualifier", Justification = "The nullability is validated in this method.")] + public async Task GetModData(string id) { - var page = new GenericModPage(this.SiteKey, id); + IModPage page = new GenericModPage(this.SiteKey, id); if (!long.TryParse(id, out long parsedId)) return page.SetError(RemoteModStatus.DoesNotExist, $"The value '{id}' isn't a valid ModDrop mod ID, must be an integer ID."); @@ -60,9 +60,11 @@ namespace StardewModdingAPI.Web.Framework.Clients.ModDrop Mods = true }) .As(); - ModModel mod = response.Mods[parsedId]; - if (mod.Mod?.Title == null || mod.Mod.ErrorCode.HasValue) - return null; + + if (!response.Mods.TryGetValue(parsedId, out ModModel? mod) || mod?.Mod is null) + return page.SetError(RemoteModStatus.DoesNotExist, "Found no ModDrop page with this ID."); + if (mod.Mod.ErrorCode is not null) + return page.SetError(RemoteModStatus.InvalidData, $"ModDrop returned error code {mod.Mod.ErrorCode} for mod ID '{id}'."); // get files var downloads = new List(); @@ -77,7 +79,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.ModDrop } // return info - string name = mod.Mod?.Title; + string name = mod.Mod.Title; string url = string.Format(this.ModUrlFormat, id); return page.SetInfo(name: name, version: null, url: url, downloads: downloads); } @@ -85,7 +87,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.ModDrop /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. public void Dispose() { - this.Client?.Dispose(); + this.Client.Dispose(); } } } diff --git a/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/FileDataModel.cs b/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/FileDataModel.cs index dd6a95e0..31905338 100644 --- a/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/FileDataModel.cs +++ b/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/FileDataModel.cs @@ -1,5 +1,3 @@ -#nullable disable - using Newtonsoft.Json; namespace StardewModdingAPI.Web.Framework.Clients.ModDrop.ResponseModels @@ -7,27 +5,53 @@ namespace StardewModdingAPI.Web.Framework.Clients.ModDrop.ResponseModels /// Metadata from the ModDrop API about a mod file. public class FileDataModel { + /********* + ** Accessors + *********/ /// The file title. [JsonProperty("title")] - public string Name { get; set; } + public string Name { get; } /// The file description. [JsonProperty("desc")] - public string Description { get; set; } + public string Description { get; } /// The file version. - public string Version { get; set; } + public string Version { get; } /// Whether the file is deleted. - public bool IsDeleted { get; set; } + public bool IsDeleted { get; } /// Whether the file is hidden from users. - public bool IsHidden { get; set; } + public bool IsHidden { get; } /// Whether this is the default file for the mod. - public bool IsDefault { get; set; } + public bool IsDefault { get; } /// Whether this is an archived file. - public bool IsOld { get; set; } + public bool IsOld { get; } + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The file title. + /// The file description. + /// The file version. + /// Whether the file is deleted. + /// Whether the file is hidden from users. + /// Whether this is the default file for the mod. + /// Whether this is an archived file. + public FileDataModel(string name, string description, string version, bool isDeleted, bool isHidden, bool isDefault, bool isOld) + { + this.Name = name; + this.Description = description; + this.Version = version; + this.IsDeleted = isDeleted; + this.IsHidden = isHidden; + this.IsDefault = isDefault; + this.IsOld = isOld; + } } } diff --git a/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModDataModel.cs b/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModDataModel.cs index 6cae16d9..0654b576 100644 --- a/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModDataModel.cs +++ b/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModDataModel.cs @@ -1,17 +1,33 @@ -#nullable disable - namespace StardewModdingAPI.Web.Framework.Clients.ModDrop.ResponseModels { /// Metadata about a mod from the ModDrop API. public class ModDataModel { + /********* + ** Accessors + *********/ /// The mod's unique ID on ModDrop. public int ID { get; set; } + /// The mod name. + public string Title { get; set; } + /// The error code, if any. public int? ErrorCode { get; set; } - /// The mod name. - public string Title { get; set; } + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The mod's unique ID on ModDrop. + /// The mod name. + /// The error code, if any. + public ModDataModel(int id, string title, int? errorCode) + { + this.ID = id; + this.Title = title; + this.ErrorCode = errorCode; + } } } diff --git a/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModListModel.cs b/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModListModel.cs index 445e25cb..cb4be35c 100644 --- a/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModListModel.cs +++ b/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModListModel.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Collections.Generic; namespace StardewModdingAPI.Web.Framework.Clients.ModDrop.ResponseModels @@ -7,7 +5,10 @@ namespace StardewModdingAPI.Web.Framework.Clients.ModDrop.ResponseModels /// A list of mods from the ModDrop API. public class ModListModel { + /********* + ** Accessors + *********/ /// The mod data. - public IDictionary Mods { get; set; } + public IDictionary Mods { get; } = new Dictionary(); } } diff --git a/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModModel.cs b/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModModel.cs index 8869193e..60b818d6 100644 --- a/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModModel.cs +++ b/src/SMAPI.Web/Framework/Clients/ModDrop/ResponseModels/ModModel.cs @@ -1,14 +1,28 @@ -#nullable disable - namespace StardewModdingAPI.Web.Framework.Clients.ModDrop.ResponseModels { /// An entry in a mod list from the ModDrop API. public class ModModel { + /********* + ** Accessors + *********/ /// The available file downloads. - public FileDataModel[] Files { get; set; } + public FileDataModel[] Files { get; } /// The mod metadata. - public ModDataModel Mod { get; set; } + public ModDataModel Mod { get; } + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The available file downloads. + /// The mod metadata. + public ModModel(FileDataModel[] files, ModDataModel mod) + { + this.Files = files; + this.Mod = mod; + } } } diff --git a/src/SMAPI.Web/Framework/Clients/Nexus/NexusClient.cs b/src/SMAPI.Web/Framework/Clients/Nexus/NexusClient.cs index dd0bb94f..23b25f95 100644 --- a/src/SMAPI.Web/Framework/Clients/Nexus/NexusClient.cs +++ b/src/SMAPI.Web/Framework/Clients/Nexus/NexusClient.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Linq; @@ -61,7 +59,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.Nexus /// Get update check info about a mod. /// The mod ID. - public async Task GetModData(string id) + public async Task GetModData(string id) { IModPage page = new GenericModPage(this.SiteKey, id); @@ -72,7 +70,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.Nexus // adult content are hidden for anonymous users, so fall back to the API in that case. // Note that the API has very restrictive rate limits which means we can't just use it // for all cases. - NexusMod mod = await this.GetModFromWebsiteAsync(parsedId); + NexusMod? mod = await this.GetModFromWebsiteAsync(parsedId); if (mod?.Status == NexusModStatus.AdultContentForbidden) mod = await this.GetModFromApiAsync(parsedId); @@ -81,16 +79,16 @@ namespace StardewModdingAPI.Web.Framework.Clients.Nexus return page.SetError(RemoteModStatus.DoesNotExist, "Found no Nexus mod with this ID."); // return info - page.SetInfo(name: mod.Name, url: mod.Url, version: mod.Version, downloads: mod.Downloads); + page.SetInfo(name: mod.Name ?? parsedId.ToString(), url: mod.Url ?? this.GetModUrl(parsedId), version: mod.Version, downloads: mod.Downloads); if (mod.Status != NexusModStatus.Ok) - page.SetError(RemoteModStatus.TemporaryError, mod.Error); + page.SetError(RemoteModStatus.TemporaryError, mod.Error!); return page; } /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources. public void Dispose() { - this.WebClient?.Dispose(); + this.WebClient.Dispose(); } @@ -100,7 +98,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.Nexus /// Get metadata about a mod by scraping the Nexus website. /// The Nexus mod ID. /// Returns the mod info if found, else null. - private async Task GetModFromWebsiteAsync(uint id) + private async Task GetModFromWebsiteAsync(uint id) { // fetch HTML string html; @@ -116,35 +114,38 @@ namespace StardewModdingAPI.Web.Framework.Clients.Nexus } // parse HTML - var doc = new HtmlDocument(); + HtmlDocument doc = new(); doc.LoadHtml(html); // handle Nexus error message - HtmlNode node = doc.DocumentNode.SelectSingleNode("//div[contains(@class, 'site-notice')][contains(@class, 'warning')]"); + HtmlNode? node = doc.DocumentNode.SelectSingleNode("//div[contains(@class, 'site-notice')][contains(@class, 'warning')]"); if (node != null) { string[] errorParts = node.InnerText.Trim().Split(new[] { '\n' }, 2, System.StringSplitOptions.RemoveEmptyEntries); string errorCode = errorParts[0]; - string errorText = errorParts.Length > 1 ? errorParts[1] : null; + string? errorText = errorParts.Length > 1 ? errorParts[1] : null; switch (errorCode.Trim().ToLower()) { case "not found": return null; default: - return new NexusMod { Error = $"Nexus error: {errorCode} ({errorText}).", Status = this.GetWebStatus(errorCode) }; + return new NexusMod( + status: this.GetWebStatus(errorCode), + error: $"Nexus error: {errorCode} ({errorText})." + ); } } // extract mod info string url = this.GetModUrl(id); - string name = doc.DocumentNode.SelectSingleNode("//div[@id='pagetitle']//h1")?.InnerText.Trim(); - string version = doc.DocumentNode.SelectSingleNode("//ul[contains(@class, 'stats')]//li[@class='stat-version']//div[@class='stat']")?.InnerText.Trim(); - SemanticVersion.TryParse(version, out ISemanticVersion parsedVersion); + string? name = doc.DocumentNode.SelectSingleNode("//div[@id='pagetitle']//h1")?.InnerText.Trim(); + string? version = doc.DocumentNode.SelectSingleNode("//ul[contains(@class, 'stats')]//li[@class='stat-version']//div[@class='stat']")?.InnerText.Trim(); + SemanticVersion.TryParse(version, out ISemanticVersion? parsedVersion); // extract files var downloads = new List(); - foreach (var fileSection in doc.DocumentNode.SelectNodes("//div[contains(@class, 'files-tabs')]")) + foreach (HtmlNode fileSection in doc.DocumentNode.SelectNodes("//div[contains(@class, 'files-tabs')]")) { string sectionName = fileSection.Descendants("h2").First().InnerText; if (sectionName != "Main files" && sectionName != "Optional files") @@ -154,7 +155,7 @@ namespace StardewModdingAPI.Web.Framework.Clients.Nexus { string fileName = container.GetDataAttribute("name").Value; string fileVersion = container.GetDataAttribute("version").Value; - string description = container.SelectSingleNode("following-sibling::*[1][self::dd]//div").InnerText?.Trim(); // get text of next
tag; derived from https://stackoverflow.com/a/25535623/262123 + string? description = container.SelectSingleNode("following-sibling::*[1][self::dd]//div").InnerText?.Trim(); // get text of next
tag; derived from https://stackoverflow.com/a/25535623/262123 downloads.Add( new GenericModDownload(fileName, description, fileVersion) @@ -163,13 +164,12 @@ namespace StardewModdingAPI.Web.Framework.Clients.Nexus } // yield info - return new NexusMod - { - Name = name, - Version = parsedVersion?.ToString() ?? version, - Url = url, - Downloads = downloads.ToArray() - }; + return new NexusMod( + name: name ?? id.ToString(), + version: parsedVersion?.ToString() ?? version, + url: url, + downloads: downloads.ToArray() + ); } /// Get metadata about a mod from the Nexus API. @@ -182,22 +182,21 @@ namespace StardewModdingAPI.Web.Framework.Clients.Nexus ModFileList files = await this.ApiClient.ModFiles.GetModFiles("stardewvalley", (int)id, FileCategory.Main, FileCategory.Optional); // yield info - return new NexusMod - { - Name = mod.Name, - Version = SemanticVersion.TryParse(mod.Version, out ISemanticVersion version) ? version?.ToString() : mod.Version, - Url = this.GetModUrl(id), - Downloads = files.Files + return new NexusMod( + name: mod.Name, + version: SemanticVersion.TryParse(mod.Version, out ISemanticVersion? version) ? version.ToString() : mod.Version, + url: this.GetModUrl(id), + downloads: files.Files .Select(file => (IModDownload)new GenericModDownload(file.Name, file.Description, file.FileVersion)) .ToArray() - }; + ); } /// Get the full mod page URL for a given ID. /// The mod ID. private string GetModUrl(uint id) { - UriBuilder builder = new(this.WebClient.BaseClient.BaseAddress); + UriBuilder builder = new(this.WebClient.BaseClient.BaseAddress!); builder.Path += string.Format(this.WebModUrlFormat, id); return builder.Uri.ToString(); } diff --git a/src/SMAPI.Web/Framework/Clients/Nexus/ResponseModels/NexusMod.cs b/src/SMAPI.Web/Framework/Clients/Nexus/ResponseModels/NexusMod.cs index 358c4633..3155cfda 100644 --- a/src/SMAPI.Web/Framework/Clients/Nexus/ResponseModels/NexusMod.cs +++ b/src/SMAPI.Web/Framework/Clients/Nexus/ResponseModels/NexusMod.cs @@ -1,5 +1,4 @@ -#nullable disable - +using System; using Newtonsoft.Json; namespace StardewModdingAPI.Web.Framework.Clients.Nexus.ResponseModels @@ -11,25 +10,53 @@ namespace StardewModdingAPI.Web.Framework.Clients.Nexus.ResponseModels ** Accessors *********/ /// The mod name. - public string Name { get; set; } + public string? Name { get; } /// The mod's semantic version number. - public string Version { get; set; } + public string? Version { get; } /// The mod's web URL. [JsonProperty("mod_page_uri")] - public string Url { get; set; } + public string? Url { get; } /// The mod's publication status. [JsonIgnore] - public NexusModStatus Status { get; set; } = NexusModStatus.Ok; + public NexusModStatus Status { get; } /// The files available to download. [JsonIgnore] - public IModDownload[] Downloads { get; set; } + public IModDownload[] Downloads { get; } /// A custom user-friendly error which indicates why fetching the mod info failed (if applicable). [JsonIgnore] - public string Error { get; set; } + public string? Error { get; } + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The mod name + /// The mod's semantic version number. + /// The mod's web URL. + /// The files available to download. + public NexusMod(string name, string? version, string url, IModDownload[] downloads) + { + this.Name = name; + this.Version = version; + this.Url = url; + this.Status = NexusModStatus.Ok; + this.Downloads = downloads; + } + + /// Construct an instance. + /// The mod's publication status. + /// A custom user-friendly error which indicates why fetching the mod info failed (if applicable). + public NexusMod(NexusModStatus status, string error) + { + this.Status = status; + this.Error = error; + this.Downloads = Array.Empty(); + } } } diff --git a/src/SMAPI.Web/Framework/Clients/Pastebin/IPastebinClient.cs b/src/SMAPI.Web/Framework/Clients/Pastebin/IPastebinClient.cs index 03c78e01..431fed7b 100644 --- a/src/SMAPI.Web/Framework/Clients/Pastebin/IPastebinClient.cs +++ b/src/SMAPI.Web/Framework/Clients/Pastebin/IPastebinClient.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Threading.Tasks; diff --git a/src/SMAPI.Web/Framework/Clients/Pastebin/PasteInfo.cs b/src/SMAPI.Web/Framework/Clients/Pastebin/PasteInfo.cs index 2d48a7ae..7f40e713 100644 --- a/src/SMAPI.Web/Framework/Clients/Pastebin/PasteInfo.cs +++ b/src/SMAPI.Web/Framework/Clients/Pastebin/PasteInfo.cs @@ -1,17 +1,35 @@ -#nullable disable +using System.Diagnostics.CodeAnalysis; namespace StardewModdingAPI.Web.Framework.Clients.Pastebin { /// The response for a get-paste request. internal class PasteInfo { + /********* + ** Accessors + *********/ /// Whether the log was successfully fetched. - public bool Success { get; set; } + [MemberNotNullWhen(true, nameof(PasteInfo.Content))] + [MemberNotNullWhen(false, nameof(PasteInfo.Error))] + public bool Success => this.Error == null || this.Content != null; /// The fetched paste content (if is true). - public string Content { get; set; } + public string? Content { get; internal set; } - /// The error message if saving failed. - public string Error { get; set; } + /// The error message (if is false). + public string? Error { get; } + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The fetched paste content. + /// The error message, if it failed. + public PasteInfo(string? content, string? error) + { + this.Content = content; + this.Error = error; + } } } diff --git a/src/SMAPI.Web/Framework/Clients/Pastebin/PastebinClient.cs b/src/SMAPI.Web/Framework/Clients/Pastebin/PastebinClient.cs index d0cdf374..0e00f071 100644 --- a/src/SMAPI.Web/Framework/Clients/Pastebin/PastebinClient.cs +++ b/src/SMAPI.Web/Framework/Clients/Pastebin/PastebinClient.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Net; using System.Threading.Tasks; @@ -35,24 +33,24 @@ namespace StardewModdingAPI.Web.Framework.Clients.Pastebin try { // get from API - string content = await this.Client + string? content = await this.Client .GetAsync($"raw/{id}") .AsString(); // handle Pastebin errors if (string.IsNullOrWhiteSpace(content)) - return new PasteInfo { Error = "Received an empty response from Pastebin." }; + return new PasteInfo(null, "Received an empty response from Pastebin."); if (content.StartsWith("Decompress a string. /// The compressed text. /// Derived from . - public string DecompressString(string rawText) + [return: NotNullIfNotNull("rawText")] + public string? DecompressString(string? rawText) { + if (rawText is null) + return rawText; + // get raw bytes byte[] zipBuffer; try diff --git a/src/SMAPI.Web/Framework/Compression/IGzipHelper.cs b/src/SMAPI.Web/Framework/Compression/IGzipHelper.cs index e1ec9b67..ef2d5696 100644 --- a/src/SMAPI.Web/Framework/Compression/IGzipHelper.cs +++ b/src/SMAPI.Web/Framework/Compression/IGzipHelper.cs @@ -1,4 +1,4 @@ -#nullable disable +using System.Diagnostics.CodeAnalysis; namespace StardewModdingAPI.Web.Framework.Compression { @@ -14,6 +14,7 @@ namespace StardewModdingAPI.Web.Framework.Compression /// Decompress a string. /// The compressed text. - string DecompressString(string rawText); + [return: NotNullIfNotNull("rawText")] + string? DecompressString(string? rawText); } } diff --git a/src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs b/src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs index 3730a9db..b582b2b0 100644 --- a/src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs +++ b/src/SMAPI.Web/Framework/ConfigModels/ApiClientsConfig.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI.Web.Framework.ConfigModels { /// The config settings for the API clients. @@ -12,17 +10,17 @@ namespace StardewModdingAPI.Web.Framework.ConfigModels ** Generic ****/ /// The user agent for API clients, where {0} is the SMAPI version. - public string UserAgent { get; set; } + public string UserAgent { get; set; } = null!; /**** ** Azure ****/ /// The connection string for the Azure Blob storage account. - public string AzureBlobConnectionString { get; set; } + public string? AzureBlobConnectionString { get; set; } /// The Azure Blob container in which to store temporary uploaded logs. - public string AzureBlobTempContainer { get; set; } + public string AzureBlobTempContainer { get; set; } = null!; /// The number of days since the blob's last-modified date when it will be deleted. public int AzureBlobTempExpiryDays { get; set; } @@ -32,65 +30,65 @@ namespace StardewModdingAPI.Web.Framework.ConfigModels ** Chucklefish ****/ /// The base URL for the Chucklefish mod site. - public string ChucklefishBaseUrl { get; set; } + public string ChucklefishBaseUrl { get; set; } = null!; /// The URL for a mod page on the Chucklefish mod site excluding the , where {0} is the mod ID. - public string ChucklefishModPageUrlFormat { get; set; } + public string ChucklefishModPageUrlFormat { get; set; } = null!; /**** ** CurseForge ****/ /// The base URL for the CurseForge API. - public string CurseForgeBaseUrl { get; set; } + public string CurseForgeBaseUrl { get; set; } = null!; /**** ** GitHub ****/ /// The base URL for the GitHub API. - public string GitHubBaseUrl { get; set; } + public string GitHubBaseUrl { get; set; } = null!; /// The Accept header value expected by the GitHub API. - public string GitHubAcceptHeader { get; set; } + public string GitHubAcceptHeader { get; set; } = null!; /// The username with which to authenticate to the GitHub API (if any). - public string GitHubUsername { get; set; } + public string? GitHubUsername { get; set; } /// The password with which to authenticate to the GitHub API (if any). - public string GitHubPassword { get; set; } + public string? GitHubPassword { get; set; } /**** ** ModDrop ****/ /// The base URL for the ModDrop API. - public string ModDropApiUrl { get; set; } + public string ModDropApiUrl { get; set; } = null!; /// The URL for a ModDrop mod page for the user, where {0} is the mod ID. - public string ModDropModPageUrl { get; set; } + public string ModDropModPageUrl { get; set; } = null!; /**** ** Nexus Mods ****/ /// The base URL for the Nexus Mods API. - public string NexusBaseUrl { get; set; } + public string NexusBaseUrl { get; set; } = null!; /// The URL for a Nexus mod page for the user, excluding the , where {0} is the mod ID. - public string NexusModUrlFormat { get; set; } + public string NexusModUrlFormat { get; set; } = null!; /// The URL for a Nexus mod page to scrape for versions, excluding the , where {0} is the mod ID. - public string NexusModScrapeUrlFormat { get; set; } + public string NexusModScrapeUrlFormat { get; set; } = null!; /// The Nexus API authentication key. - public string NexusApiKey { get; set; } + public string? NexusApiKey { get; set; } /**** ** Pastebin ****/ /// The base URL for the Pastebin API. - public string PastebinBaseUrl { get; set; } + public string PastebinBaseUrl { get; set; } = null!; } } diff --git a/src/SMAPI.Web/Framework/ConfigModels/ModOverrideConfig.cs b/src/SMAPI.Web/Framework/ConfigModels/ModOverrideConfig.cs index 682c97e6..e46ecf2b 100644 --- a/src/SMAPI.Web/Framework/ConfigModels/ModOverrideConfig.cs +++ b/src/SMAPI.Web/Framework/ConfigModels/ModOverrideConfig.cs @@ -1,17 +1,15 @@ -#nullable disable - namespace StardewModdingAPI.Web.Framework.ConfigModels { /// Override update-check metadata for a mod. internal class ModOverrideConfig { /// The unique ID from the mod's manifest. - public string ID { get; set; } + public string ID { get; set; } = null!; /// Whether to allow non-standard versions. public bool AllowNonStandardVersions { get; set; } /// The mod page URL to use regardless of which site has the update, or null to use the site URL. - public string SetUrl { get; set; } + public string? SetUrl { get; set; } } } diff --git a/src/SMAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs b/src/SMAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs index e525e09a..c3b136e8 100644 --- a/src/SMAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs +++ b/src/SMAPI.Web/Framework/ConfigModels/ModUpdateCheckConfig.cs @@ -1,4 +1,4 @@ -#nullable disable +using System; namespace StardewModdingAPI.Web.Framework.ConfigModels { @@ -8,16 +8,16 @@ namespace StardewModdingAPI.Web.Framework.ConfigModels /********* ** Accessors *********/ - /// The number of minutes successful update checks should be cached before refetching them. + /// The number of minutes successful update checks should be cached before re-fetching them. public int SuccessCacheMinutes { get; set; } - /// The number of minutes failed update checks should be cached before refetching them. + /// The number of minutes failed update checks should be cached before re-fetching them. public int ErrorCacheMinutes { get; set; } /// Update-check metadata to override. - public ModOverrideConfig[] ModOverrides { get; set; } + public ModOverrideConfig[] ModOverrides { get; set; } = Array.Empty(); /// The update-check config for SMAPI's own update checks. - public SmapiInfoConfig SmapiInfo { get; set; } + public SmapiInfoConfig SmapiInfo { get; set; } = null!; } } diff --git a/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs b/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs index ef6c2659..62685e47 100644 --- a/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs +++ b/src/SMAPI.Web/Framework/ConfigModels/SiteConfig.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI.Web.Framework.ConfigModels { /// The site config settings. @@ -9,9 +7,9 @@ namespace StardewModdingAPI.Web.Framework.ConfigModels ** Accessors *********/ /// A message to show below the download button (e.g. for details on downloading a beta version), in Markdown format. - public string OtherBlurb { get; set; } + public string? OtherBlurb { get; set; } /// A list of supports to credit on the main page, in Markdown format. - public string SupporterList { get; set; } + public string? SupporterList { get; set; } } } diff --git a/src/SMAPI.Web/Framework/ConfigModels/SmapiInfoConfig.cs b/src/SMAPI.Web/Framework/ConfigModels/SmapiInfoConfig.cs index dbf58817..a95e0048 100644 --- a/src/SMAPI.Web/Framework/ConfigModels/SmapiInfoConfig.cs +++ b/src/SMAPI.Web/Framework/ConfigModels/SmapiInfoConfig.cs @@ -1,4 +1,4 @@ -#nullable disable +using System; namespace StardewModdingAPI.Web.Framework.ConfigModels { @@ -6,12 +6,12 @@ namespace StardewModdingAPI.Web.Framework.ConfigModels internal class SmapiInfoConfig { /// The mod ID used for SMAPI update checks. - public string ID { get; set; } + public string ID { get; set; } = null!; /// The default update key used for SMAPI update checks. - public string DefaultUpdateKey { get; set; } + public string DefaultUpdateKey { get; set; } = null!; /// The update keys to add for SMAPI update checks when the player has a beta version installed. - public string[] AddBetaUpdateKeys { get; set; } + public string[] AddBetaUpdateKeys { get; set; } = Array.Empty(); } } diff --git a/src/SMAPI.Web/Framework/Extensions.cs b/src/SMAPI.Web/Framework/Extensions.cs index a72c12c1..62a23155 100644 --- a/src/SMAPI.Web/Framework/Extensions.cs +++ b/src/SMAPI.Web/Framework/Extensions.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using JetBrains.Annotations; using Microsoft.AspNetCore.Html; @@ -28,7 +26,7 @@ namespace StardewModdingAPI.Web.Framework /// An object that contains route values. /// Get an absolute URL instead of a server-relative path/ /// The generated URL. - public static string PlainAction(this IUrlHelper helper, [AspMvcAction] string action, [AspMvcController] string controller, object values = null, bool absoluteUrl = false) + public static string? PlainAction(this IUrlHelper helper, [AspMvcAction] string action, [AspMvcController] string controller, object? values = null, bool absoluteUrl = false) { // get route values RouteValueDictionary valuesDict = new(values); @@ -39,7 +37,7 @@ namespace StardewModdingAPI.Web.Framework } // get relative URL - string url = helper.Action(action, controller, valuesDict); + string? url = helper.Action(action, controller, valuesDict); if (url == null && action.EndsWith("Async")) url = helper.Action(action[..^"Async".Length], controller, valuesDict); @@ -59,7 +57,7 @@ namespace StardewModdingAPI.Web.Framework /// The value to serialize. /// The serialized JSON. /// This bypasses unnecessary validation (e.g. not allowing null values) in . - public static IHtmlContent ForJson(this RazorPageBase page, object value) + public static IHtmlContent ForJson(this RazorPageBase page, object? value) { string json = JsonConvert.SerializeObject(value); return new HtmlString(json); diff --git a/src/SMAPI.Web/Framework/IModDownload.cs b/src/SMAPI.Web/Framework/IModDownload.cs index b8d1f62c..fe171785 100644 --- a/src/SMAPI.Web/Framework/IModDownload.cs +++ b/src/SMAPI.Web/Framework/IModDownload.cs @@ -1,17 +1,18 @@ -#nullable disable - namespace StardewModdingAPI.Web.Framework { /// Generic metadata about a file download on a mod page. internal interface IModDownload { + /********* + ** Accessors + *********/ /// The download's display name. string Name { get; } /// The download's description. - string Description { get; } + string? Description { get; } /// The download's file version. - string Version { get; } + string? Version { get; } } } diff --git a/src/SMAPI.Web/Framework/IModPage.cs b/src/SMAPI.Web/Framework/IModPage.cs index 68220b49..4d0a8d61 100644 --- a/src/SMAPI.Web/Framework/IModPage.cs +++ b/src/SMAPI.Web/Framework/IModPage.cs @@ -1,6 +1,5 @@ -#nullable disable - using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using StardewModdingAPI.Toolkit.Framework.UpdateData; namespace StardewModdingAPI.Web.Framework @@ -18,13 +17,13 @@ namespace StardewModdingAPI.Web.Framework string Id { get; } /// The mod name. - string Name { get; } + string? Name { get; } /// The mod's semantic version number. - string Version { get; } + string? Version { get; } /// The mod's web URL. - string Url { get; } + string? Url { get; } /// The mod downloads. IModDownload[] Downloads { get; } @@ -33,7 +32,12 @@ namespace StardewModdingAPI.Web.Framework RemoteModStatus Status { get; } /// A user-friendly error which indicates why fetching the mod info failed (if applicable). - string Error { get; } + string? Error { get; } + + /// Whether the mod data is valid. + [MemberNotNullWhen(true, nameof(IModPage.Name), nameof(IModPage.Url))] + [MemberNotNullWhen(false, nameof(IModPage.Error))] + bool IsValid { get; } /********* @@ -44,7 +48,7 @@ namespace StardewModdingAPI.Web.Framework /// The mod's semantic version number. /// The mod's web URL. /// The mod downloads. - IModPage SetInfo(string name, string version, string url, IEnumerable downloads); + IModPage SetInfo(string name, string? version, string url, IEnumerable downloads); /// Set a mod fetch error. /// The mod availability status on the remote site. diff --git a/src/SMAPI.Web/Framework/InternalControllerFeatureProvider.cs b/src/SMAPI.Web/Framework/InternalControllerFeatureProvider.cs index 98738a82..2c24c610 100644 --- a/src/SMAPI.Web/Framework/InternalControllerFeatureProvider.cs +++ b/src/SMAPI.Web/Framework/InternalControllerFeatureProvider.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Reflection; using Microsoft.AspNetCore.Mvc; diff --git a/src/SMAPI.Web/Framework/JobDashboardAuthorizationFilter.cs b/src/SMAPI.Web/Framework/JobDashboardAuthorizationFilter.cs index 8db43dca..3c1405eb 100644 --- a/src/SMAPI.Web/Framework/JobDashboardAuthorizationFilter.cs +++ b/src/SMAPI.Web/Framework/JobDashboardAuthorizationFilter.cs @@ -1,5 +1,3 @@ -#nullable disable - using Hangfire.Dashboard; namespace StardewModdingAPI.Web.Framework diff --git a/src/SMAPI.Web/Framework/ModInfoModel.cs b/src/SMAPI.Web/Framework/ModInfoModel.cs index 021d14fb..e70b60bf 100644 --- a/src/SMAPI.Web/Framework/ModInfoModel.cs +++ b/src/SMAPI.Web/Framework/ModInfoModel.cs @@ -1,4 +1,5 @@ -#nullable disable +using System.Diagnostics.CodeAnalysis; +using Newtonsoft.Json; namespace StardewModdingAPI.Web.Framework { @@ -9,22 +10,22 @@ namespace StardewModdingAPI.Web.Framework ** Accessors *********/ /// The mod name. - public string Name { get; set; } + public string? Name { get; private set; } + + /// The mod's web URL. + public string? Url { get; private set; } /// The mod's latest version. - public ISemanticVersion Version { get; set; } + public ISemanticVersion? Version { get; private set; } /// The mod's latest optional or prerelease version, if newer than . - public ISemanticVersion PreviewVersion { get; set; } - - /// The mod's web URL. - public string Url { get; set; } + public ISemanticVersion? PreviewVersion { get; private set; } /// The mod availability status on the remote site. - public RemoteModStatus Status { get; set; } = RemoteModStatus.Ok; + public RemoteModStatus Status { get; private set; } /// The error message indicating why the mod is invalid (if applicable). - public string Error { get; set; } + public string? Error { get; private set; } /********* @@ -35,19 +36,24 @@ namespace StardewModdingAPI.Web.Framework /// Construct an instance. /// The mod name. + /// The mod's web URL. /// The semantic version for the mod's latest release. /// The semantic version for the mod's latest preview release, if available and different from . - /// The mod's web URL. - public ModInfoModel(string name, ISemanticVersion version, string url, ISemanticVersion previewVersion = null) + /// The mod availability status on the remote site. + /// The error message indicating why the mod is invalid (if applicable). + [JsonConstructor] + public ModInfoModel(string name, string url, ISemanticVersion? version, ISemanticVersion? previewVersion = null, RemoteModStatus status = RemoteModStatus.Ok, string? error = null) { this .SetBasicInfo(name, url) - .SetVersions(version, previewVersion); + .SetVersions(version!, previewVersion) + .SetError(status, error!); } /// Set the basic mod info. /// The mod name. /// The mod's web URL. + [MemberNotNull(nameof(ModInfoModel.Name), nameof(ModInfoModel.Url))] public ModInfoModel SetBasicInfo(string name, string url) { this.Name = name; @@ -59,7 +65,8 @@ namespace StardewModdingAPI.Web.Framework /// Set the mod version info. /// The semantic version for the mod's latest release. /// The semantic version for the mod's latest preview release, if available and different from . - public ModInfoModel SetVersions(ISemanticVersion version, ISemanticVersion previewVersion = null) + [MemberNotNull(nameof(ModInfoModel.Version))] + public ModInfoModel SetVersions(ISemanticVersion version, ISemanticVersion? previewVersion = null) { this.Version = version; this.PreviewVersion = previewVersion; diff --git a/src/SMAPI.Web/Framework/ModSiteManager.cs b/src/SMAPI.Web/Framework/ModSiteManager.cs index 2d6755d8..674b9ffc 100644 --- a/src/SMAPI.Web/Framework/ModSiteManager.cs +++ b/src/SMAPI.Web/Framework/ModSiteManager.cs @@ -1,7 +1,6 @@ -#nullable disable - using System; using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text.RegularExpressions; using System.Threading.Tasks; @@ -36,12 +35,15 @@ namespace StardewModdingAPI.Web.Framework /// The namespaced update key. public async Task GetModPageAsync(UpdateKey updateKey) { + if (!updateKey.LooksValid) + return new GenericModPage(updateKey.Site, updateKey.ID!).SetError(RemoteModStatus.DoesNotExist, $"Invalid update key '{updateKey}'."); + // get site - if (!this.ModSites.TryGetValue(updateKey.Site, out IModSiteClient client)) + if (!this.ModSites.TryGetValue(updateKey.Site, out IModSiteClient? client)) return new GenericModPage(updateKey.Site, updateKey.ID).SetError(RemoteModStatus.DoesNotExist, $"There's no mod site with key '{updateKey.Site}'. Expected one of [{string.Join(", ", this.ModSites.Keys)}]."); // fetch mod - IModPage mod; + IModPage? mod; try { mod = await client.GetModData(updateKey.ID); @@ -60,39 +62,42 @@ namespace StardewModdingAPI.Web.Framework /// The optional update subkey to match in available files. (If no file names or descriptions contain the subkey, it'll be ignored.) /// The changes to apply to remote versions for update checks. /// Whether to allow non-standard versions. - public ModInfoModel GetPageVersions(IModPage page, string subkey, bool allowNonStandardVersions, ChangeDescriptor mapRemoteVersions) + public ModInfoModel GetPageVersions(IModPage page, string? subkey, bool allowNonStandardVersions, ChangeDescriptor? mapRemoteVersions) { // get base model - ModInfoModel model = new ModInfoModel() - .SetBasicInfo(page.Name, page.Url) - .SetError(page.Status, page.Error); - if (page.Status != RemoteModStatus.Ok) + ModInfoModel model = new(); + if (page.IsValid) + model.SetBasicInfo(page.Name, page.Url); + else + { + model.SetError(page.Status, page.Error); return model; + } // fetch versions - bool hasVersions = this.TryGetLatestVersions(page, subkey, allowNonStandardVersions, mapRemoteVersions, out ISemanticVersion mainVersion, out ISemanticVersion previewVersion); + bool hasVersions = this.TryGetLatestVersions(page, subkey, allowNonStandardVersions, mapRemoteVersions, out ISemanticVersion? mainVersion, out ISemanticVersion? previewVersion); if (!hasVersions && subkey != null) hasVersions = this.TryGetLatestVersions(page, null, allowNonStandardVersions, mapRemoteVersions, out mainVersion, out previewVersion); if (!hasVersions) return model.SetError(RemoteModStatus.InvalidData, $"The {page.Site} mod with ID '{page.Id}' has no valid versions."); // return info - return model.SetVersions(mainVersion, previewVersion); + return model.SetVersions(mainVersion!, previewVersion); } /// Get a semantic local version for update checks. /// The version to parse. /// Changes to apply to the raw version, if any. /// Whether to allow non-standard versions. - public ISemanticVersion GetMappedVersion(string version, ChangeDescriptor map, bool allowNonStandard) + public ISemanticVersion? GetMappedVersion(string? version, ChangeDescriptor? map, bool allowNonStandard) { // try mapped version - string rawNewVersion = this.GetRawMappedVersion(version, map, allowNonStandard); - if (SemanticVersion.TryParse(rawNewVersion, allowNonStandard, out ISemanticVersion parsedNew)) + string? rawNewVersion = this.GetRawMappedVersion(version, map); + if (SemanticVersion.TryParse(rawNewVersion, allowNonStandard, out ISemanticVersion? parsedNew)) return parsedNew; // return original version - return SemanticVersion.TryParse(version, allowNonStandard, out ISemanticVersion parsedOld) + return SemanticVersion.TryParse(version, allowNonStandard, out ISemanticVersion? parsedOld) ? parsedOld : null; } @@ -108,31 +113,31 @@ namespace StardewModdingAPI.Web.Framework /// The changes to apply to remote versions for update checks. /// The main mod version. /// The latest prerelease version, if newer than . - private bool TryGetLatestVersions(IModPage mod, string subkey, bool allowNonStandardVersions, ChangeDescriptor mapRemoteVersions, out ISemanticVersion main, out ISemanticVersion preview) + private bool TryGetLatestVersions(IModPage? mod, string? subkey, bool allowNonStandardVersions, ChangeDescriptor? mapRemoteVersions, [NotNullWhen(true)] out ISemanticVersion? main, out ISemanticVersion? preview) { main = null; preview = null; // parse all versions from the mod page - IEnumerable<(string name, string description, ISemanticVersion version)> GetAllVersions() + IEnumerable<(string? name, string? description, ISemanticVersion? version)> GetAllVersions() { if (mod != null) { - ISemanticVersion ParseAndMapVersion(string raw) + ISemanticVersion? ParseAndMapVersion(string? raw) { raw = this.NormalizeVersion(raw); return this.GetMappedVersion(raw, mapRemoteVersions, allowNonStandardVersions); } // get mod version - ISemanticVersion modVersion = ParseAndMapVersion(mod.Version); + ISemanticVersion? modVersion = ParseAndMapVersion(mod.Version); if (modVersion != null) yield return (name: null, description: null, version: ParseAndMapVersion(mod.Version)); // get file versions foreach (IModDownload download in mod.Downloads) { - ISemanticVersion cur = ParseAndMapVersion(download.Version); + ISemanticVersion? cur = ParseAndMapVersion(download.Version); if (cur != null) yield return (download.Name, download.Description, cur); } @@ -143,15 +148,15 @@ namespace StardewModdingAPI.Web.Framework .ToArray(); // get main + preview versions - void TryGetVersions(out ISemanticVersion mainVersion, out ISemanticVersion previewVersion, Func<(string name, string description, ISemanticVersion version), bool> filter = null) + void TryGetVersions([NotNullWhen(true)] out ISemanticVersion? mainVersion, out ISemanticVersion? previewVersion, Func<(string? name, string? description, ISemanticVersion? version), bool>? filter = null) { mainVersion = null; previewVersion = null; // get latest main + preview version - foreach (var entry in versions) + foreach ((string? name, string? description, ISemanticVersion? version) entry in versions) { - if (filter?.Invoke(entry) == false) + if (entry.version is null || filter?.Invoke(entry) == false) continue; if (entry.version.IsPrerelease()) @@ -160,7 +165,7 @@ namespace StardewModdingAPI.Web.Framework mainVersion ??= entry.version; if (mainVersion != null) - break; // any other values will be older + break; // any others will be older since entries are sorted by version } // normalize values @@ -183,8 +188,7 @@ namespace StardewModdingAPI.Web.Framework /// Get a semantic local version for update checks. /// The version to map. /// Changes to apply to the raw version, if any. - /// Whether to allow non-standard versions. - private string GetRawMappedVersion(string version, ChangeDescriptor map, bool allowNonStandard) + private string? GetRawMappedVersion(string? version, ChangeDescriptor? map) { if (version == null || map?.HasChanges != true) return version; @@ -197,7 +201,7 @@ namespace StardewModdingAPI.Web.Framework /// Normalize a version string. /// The version to normalize. - private string NormalizeVersion(string version) + private string? NormalizeVersion(string? version) { if (string.IsNullOrWhiteSpace(version)) return null; diff --git a/src/SMAPI.Web/Framework/RedirectRules/RedirectHostsToUrlsRule.cs b/src/SMAPI.Web/Framework/RedirectRules/RedirectHostsToUrlsRule.cs index fe601524..7b8f0ec9 100644 --- a/src/SMAPI.Web/Framework/RedirectRules/RedirectHostsToUrlsRule.cs +++ b/src/SMAPI.Web/Framework/RedirectRules/RedirectHostsToUrlsRule.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Net; using Microsoft.AspNetCore.Rewrite; @@ -13,7 +11,7 @@ namespace StardewModdingAPI.Web.Framework.RedirectRules ** Fields *********/ /// Maps a lowercase hostname to the resulting redirect URL. - private readonly Func Map; + private readonly Func Map; /********* @@ -22,7 +20,7 @@ namespace StardewModdingAPI.Web.Framework.RedirectRules /// Construct an instance. /// The status code to use for redirects. /// Hostnames mapped to the resulting redirect URL. - public RedirectHostsToUrlsRule(HttpStatusCode statusCode, Func map) + public RedirectHostsToUrlsRule(HttpStatusCode statusCode, Func map) { this.StatusCode = statusCode; this.Map = map ?? throw new ArgumentNullException(nameof(map)); @@ -35,10 +33,10 @@ namespace StardewModdingAPI.Web.Framework.RedirectRules /// Get the new redirect URL. /// The rewrite context. /// Returns the redirect URL, or null if the redirect doesn't apply. - protected override string GetNewUrl(RewriteContext context) + protected override string? GetNewUrl(RewriteContext context) { // get requested host - string host = context.HttpContext.Request.Host.Host; + string? host = context.HttpContext.Request.Host.Host; // get new host host = this.Map(host); diff --git a/src/SMAPI.Web/Framework/RedirectRules/RedirectMatchRule.cs b/src/SMAPI.Web/Framework/RedirectRules/RedirectMatchRule.cs index 81a265c9..b46e8f69 100644 --- a/src/SMAPI.Web/Framework/RedirectRules/RedirectMatchRule.cs +++ b/src/SMAPI.Web/Framework/RedirectRules/RedirectMatchRule.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Net; using Microsoft.AspNetCore.Http; @@ -24,7 +22,7 @@ namespace StardewModdingAPI.Web.Framework.RedirectRules /// The rewrite context. public void ApplyRule(RewriteContext context) { - string newUrl = this.GetNewUrl(context); + string? newUrl = this.GetNewUrl(context); if (newUrl == null) return; @@ -41,7 +39,7 @@ namespace StardewModdingAPI.Web.Framework.RedirectRules /// Get the new redirect URL. /// The rewrite context. /// Returns the redirect URL, or null if the redirect doesn't apply. - protected abstract string GetNewUrl(RewriteContext context); + protected abstract string? GetNewUrl(RewriteContext context); /// Get the full request URL. /// The request. diff --git a/src/SMAPI.Web/Framework/RedirectRules/RedirectPathsToUrlsRule.cs b/src/SMAPI.Web/Framework/RedirectRules/RedirectPathsToUrlsRule.cs index cb3e53ef..e691ffba 100644 --- a/src/SMAPI.Web/Framework/RedirectRules/RedirectPathsToUrlsRule.cs +++ b/src/SMAPI.Web/Framework/RedirectRules/RedirectPathsToUrlsRule.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Collections.Generic; using System.Linq; using System.Net; @@ -39,9 +37,9 @@ namespace StardewModdingAPI.Web.Framework.RedirectRules /// Get the new redirect URL. /// The rewrite context. /// Returns the redirect URL, or null if the redirect doesn't apply. - protected override string GetNewUrl(RewriteContext context) + protected override string? GetNewUrl(RewriteContext context) { - string path = context.HttpContext.Request.Path.Value; + string? path = context.HttpContext.Request.Path.Value; if (!string.IsNullOrWhiteSpace(path)) { diff --git a/src/SMAPI.Web/Framework/RedirectRules/RedirectToHttpsRule.cs b/src/SMAPI.Web/Framework/RedirectRules/RedirectToHttpsRule.cs index dd7c836f..01807608 100644 --- a/src/SMAPI.Web/Framework/RedirectRules/RedirectToHttpsRule.cs +++ b/src/SMAPI.Web/Framework/RedirectRules/RedirectToHttpsRule.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Net; using Microsoft.AspNetCore.Http; @@ -22,7 +20,7 @@ namespace StardewModdingAPI.Web.Framework.RedirectRules *********/ /// Construct an instance. /// Matches requests which should be ignored. - public RedirectToHttpsRule(Func except = null) + public RedirectToHttpsRule(Func? except = null) { this.Except = except ?? (_ => false); this.StatusCode = HttpStatusCode.RedirectKeepVerb; @@ -35,7 +33,7 @@ namespace StardewModdingAPI.Web.Framework.RedirectRules /// Get the new redirect URL. /// The rewrite context. /// Returns the redirect URL, or null if the redirect doesn't apply. - protected override string GetNewUrl(RewriteContext context) + protected override string? GetNewUrl(RewriteContext context) { HttpRequest request = context.HttpContext.Request; if (request.IsHttps || this.Except(request)) diff --git a/src/SMAPI.Web/Framework/Storage/IStorageProvider.cs b/src/SMAPI.Web/Framework/Storage/IStorageProvider.cs index 2eca4845..dfc1fb47 100644 --- a/src/SMAPI.Web/Framework/Storage/IStorageProvider.cs +++ b/src/SMAPI.Web/Framework/Storage/IStorageProvider.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Threading.Tasks; namespace StardewModdingAPI.Web.Framework.Storage diff --git a/src/SMAPI.Web/Framework/Storage/StorageProvider.cs b/src/SMAPI.Web/Framework/Storage/StorageProvider.cs index 0177e602..effbbc9f 100644 --- a/src/SMAPI.Web/Framework/Storage/StorageProvider.cs +++ b/src/SMAPI.Web/Framework/Storage/StorageProvider.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.IO; @@ -65,11 +63,11 @@ namespace StardewModdingAPI.Web.Framework.Storage BlobClient blob = this.GetAzureBlobClient(id); await blob.UploadAsync(stream); - return new UploadResult(true, id, null); + return new UploadResult(id, null); } catch (Exception ex) { - return new UploadResult(false, null, ex.Message); + return new UploadResult(null, ex.Message); } } @@ -77,10 +75,10 @@ namespace StardewModdingAPI.Web.Framework.Storage else { string path = this.GetDevFilePath(id); - Directory.CreateDirectory(Path.GetDirectoryName(path)); + Directory.CreateDirectory(Path.GetDirectoryName(path)!); File.WriteAllText(path, content); - return new UploadResult(true, id, null); + return new UploadResult(id, null); } } @@ -110,21 +108,15 @@ namespace StardewModdingAPI.Web.Framework.Storage string content = this.GzipHelper.DecompressString(reader.ReadToEnd()); // build model - return new StoredFileInfo - { - Success = true, - Content = content, - Expiry = expiry.UtcDateTime - }; + return new StoredFileInfo(content, expiry); } catch (RequestFailedException ex) { - return new StoredFileInfo - { - Error = ex.ErrorCode == "BlobNotFound" + return new StoredFileInfo( + error: ex.ErrorCode == "BlobNotFound" ? "There's no file with that ID." : $"Could not fetch that file from storage ({ex.ErrorCode}: {ex.Message})." - }; + ); } } @@ -137,10 +129,7 @@ namespace StardewModdingAPI.Web.Framework.Storage file.Delete(); if (!file.Exists) { - return new StoredFileInfo - { - Error = "There's no file with that ID." - }; + return new StoredFileInfo(error: "There's no file with that ID."); } // renew @@ -151,13 +140,11 @@ namespace StardewModdingAPI.Web.Framework.Storage } // build model - return new StoredFileInfo - { - Success = true, - Content = File.ReadAllText(file.FullName), - Expiry = DateTime.UtcNow.AddDays(this.ExpiryDays), - Warning = "This file was saved temporarily to the local computer. This should only happen in a local development environment." - }; + return new StoredFileInfo( + content: File.ReadAllText(file.FullName), + expiry: DateTime.UtcNow.AddDays(this.ExpiryDays), + warning: "This file was saved temporarily to the local computer. This should only happen in a local development environment." + ); } } @@ -166,12 +153,7 @@ namespace StardewModdingAPI.Web.Framework.Storage { PasteInfo response = await this.Pastebin.GetAsync(id); response.Content = this.GzipHelper.DecompressString(response.Content); - return new StoredFileInfo - { - Success = response.Success, - Content = response.Content, - Error = response.Error - }; + return new StoredFileInfo(response.Content, null, error: response.Error); } } @@ -179,8 +161,8 @@ namespace StardewModdingAPI.Web.Framework.Storage /// The file ID. private BlobClient GetAzureBlobClient(string id) { - var azure = new BlobServiceClient(this.ClientsConfig.AzureBlobConnectionString); - var container = azure.GetBlobContainerClient(this.ClientsConfig.AzureBlobTempContainer); + BlobServiceClient azure = new(this.ClientsConfig.AzureBlobConnectionString); + BlobContainerClient container = azure.GetBlobContainerClient(this.ClientsConfig.AzureBlobTempContainer); return container.GetBlobClient($"uploads/{id}"); } diff --git a/src/SMAPI.Web/Framework/Storage/StoredFileInfo.cs b/src/SMAPI.Web/Framework/Storage/StoredFileInfo.cs index cd941c94..bbbcf2a9 100644 --- a/src/SMAPI.Web/Framework/Storage/StoredFileInfo.cs +++ b/src/SMAPI.Web/Framework/Storage/StoredFileInfo.cs @@ -1,25 +1,52 @@ -#nullable disable - using System; +using System.Diagnostics.CodeAnalysis; namespace StardewModdingAPI.Web.Framework.Storage { /// The response for a get-file request. internal class StoredFileInfo { + /********* + ** Accessors + *********/ /// Whether the file was successfully fetched. - public bool Success { get; set; } + [MemberNotNullWhen(true, nameof(StoredFileInfo.Content))] + public bool Success => this.Content != null && this.Error == null; /// The fetched file content (if is true). - public string Content { get; set; } + public string? Content { get; } /// When the file will no longer be available. - public DateTime? Expiry { get; set; } + public DateTimeOffset? Expiry { get; } /// The error message if saving succeeded, but a non-blocking issue was encountered. - public string Warning { get; set; } + public string? Warning { get; } /// The error message if saving failed. - public string Error { get; set; } + public string? Error { get; } + + + /********* + ** Public methods + *********/ + /// Construct an instance. + /// The fetched file content (if is true). + /// When the file will no longer be available. + /// The error message if saving succeeded, but a non-blocking issue was encountered. + /// The error message if saving failed. + public StoredFileInfo(string? content, DateTimeOffset? expiry, string? warning = null, string? error = null) + { + this.Content = content; + this.Expiry = expiry; + this.Warning = warning; + this.Error = error; + } + + /// Construct an instance. + /// The error message if saving failed. + public StoredFileInfo(string error) + { + this.Error = error; + } } } diff --git a/src/SMAPI.Web/Framework/Storage/UploadResult.cs b/src/SMAPI.Web/Framework/Storage/UploadResult.cs index b1eedd59..92993d42 100644 --- a/src/SMAPI.Web/Framework/Storage/UploadResult.cs +++ b/src/SMAPI.Web/Framework/Storage/UploadResult.cs @@ -1,4 +1,4 @@ -#nullable disable +using System.Diagnostics.CodeAnalysis; namespace StardewModdingAPI.Web.Framework.Storage { @@ -9,25 +9,25 @@ namespace StardewModdingAPI.Web.Framework.Storage ** Accessors *********/ /// Whether the file upload succeeded. - public bool Succeeded { get; } + [MemberNotNullWhen(true, nameof(UploadResult.ID))] + [MemberNotNullWhen(false, nameof(UploadResult.UploadError))] + public bool Succeeded => this.ID != null && this.UploadError == null; /// The file ID, if applicable. - public string ID { get; } + public string? ID { get; } /// The upload error, if any. - public string UploadError { get; } + public string? UploadError { get; } /********* ** Public methods *********/ /// Construct an instance. - /// Whether the file upload succeeded. /// The file ID, if applicable. /// The upload error, if any. - public UploadResult(bool succeeded, string id, string uploadError) + public UploadResult(string? id, string? uploadError) { - this.Succeeded = succeeded; this.ID = id; this.UploadError = uploadError; } diff --git a/src/SMAPI.Web/Framework/VersionConstraint.cs b/src/SMAPI.Web/Framework/VersionConstraint.cs index f230a95b..1b1abd81 100644 --- a/src/SMAPI.Web/Framework/VersionConstraint.cs +++ b/src/SMAPI.Web/Framework/VersionConstraint.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Routing; @@ -20,7 +18,7 @@ namespace StardewModdingAPI.Web.Framework /// A dictionary that contains the parameters for the URL. /// An object that indicates whether the constraint check is being performed when an incoming request is being handled or when a URL is being generated. /// true if the URL parameter contains a valid value; otherwise, false. - public bool Match(HttpContext httpContext, IRouter route, string routeKey, RouteValueDictionary values, RouteDirection routeDirection) + public bool Match(HttpContext? httpContext, IRouter? route, string routeKey, RouteValueDictionary values, RouteDirection routeDirection) { if (routeKey == null) throw new ArgumentNullException(nameof(routeKey)); @@ -28,7 +26,7 @@ namespace StardewModdingAPI.Web.Framework throw new ArgumentNullException(nameof(values)); return - values.TryGetValue(routeKey, out object routeValue) + values.TryGetValue(routeKey, out object? routeValue) && routeValue is string routeStr && SemanticVersion.TryParse(routeStr, allowNonStandard: true, out _); } diff --git a/src/SMAPI.Web/Program.cs b/src/SMAPI.Web/Program.cs index 5134791a..1fdd3185 100644 --- a/src/SMAPI.Web/Program.cs +++ b/src/SMAPI.Web/Program.cs @@ -1,5 +1,3 @@ -#nullable disable - using Microsoft.AspNetCore.Hosting; using Microsoft.Extensions.Hosting; diff --git a/src/SMAPI.Web/Startup.cs b/src/SMAPI.Web/Startup.cs index 0199938d..98dbca5e 100644 --- a/src/SMAPI.Web/Startup.cs +++ b/src/SMAPI.Web/Startup.cs @@ -1,5 +1,3 @@ -#nullable disable - using System.Collections.Generic; using System.Net; using Hangfire; @@ -102,7 +100,7 @@ namespace StardewModdingAPI.Web // init API clients { ApiClientsConfig api = this.Configuration.GetSection("ApiClients").Get(); - string version = this.GetType().Assembly.GetName().Version.ToString(3); + string version = this.GetType().Assembly.GetName().Version!.ToString(3); string userAgent = string.Format(api.UserAgent, version); services.AddSingleton(new ChucklefishClient( diff --git a/src/SMAPI.Web/ViewModels/IndexModel.cs b/src/SMAPI.Web/ViewModels/IndexModel.cs index 2283acd9..098f18cc 100644 --- a/src/SMAPI.Web/ViewModels/IndexModel.cs +++ b/src/SMAPI.Web/ViewModels/IndexModel.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI.Web.ViewModels { /// The view model for the index page. @@ -9,26 +7,23 @@ namespace StardewModdingAPI.Web.ViewModels ** Accessors *********/ /// The latest stable SMAPI version. - public IndexVersionModel StableVersion { get; set; } + public IndexVersionModel StableVersion { get; } /// A message to show below the download button (e.g. for details on downloading a beta version), in Markdown format. - public string OtherBlurb { get; set; } + public string? OtherBlurb { get; } /// A list of supports to credit on the main page, in Markdown format. - public string SupporterList { get; set; } + public string? SupporterList { get; } /********* ** Public methods *********/ - /// Construct an instance. - public IndexModel() { } - /// Construct an instance. /// The latest stable SMAPI version. /// A message to show below the download button (e.g. for details on downloading a beta version), in Markdown format. /// A list of supports to credit on the main page, in Markdown format. - internal IndexModel(IndexVersionModel stableVersion, string otherBlurb, string supporterList) + internal IndexModel(IndexVersionModel stableVersion, string? otherBlurb, string? supporterList) { this.StableVersion = stableVersion; this.OtherBlurb = otherBlurb; diff --git a/src/SMAPI.Web/ViewModels/IndexVersionModel.cs b/src/SMAPI.Web/ViewModels/IndexVersionModel.cs index 1f5d4ec0..a76a5924 100644 --- a/src/SMAPI.Web/ViewModels/IndexVersionModel.cs +++ b/src/SMAPI.Web/ViewModels/IndexVersionModel.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI.Web.ViewModels { /// The fields for a SMAPI version. @@ -9,30 +7,27 @@ namespace StardewModdingAPI.Web.ViewModels ** Accessors *********/ /// The release version. - public string Version { get; set; } + public string Version { get; } /// The Markdown description for the release. - public string Description { get; set; } + public string Description { get; } /// The main download URL. - public string DownloadUrl { get; set; } + public string DownloadUrl { get; } /// The for-developers download URL (not applicable for prerelease versions). - public string DevDownloadUrl { get; set; } + public string? DevDownloadUrl { get; } /********* ** Public methods *********/ - /// Construct an instance. - public IndexVersionModel() { } - /// Construct an instance. /// The release number. /// The Markdown description for the release. /// The main download URL. /// The for-developers download URL (not applicable for prerelease versions). - internal IndexVersionModel(string version, string description, string downloadUrl, string devDownloadUrl) + internal IndexVersionModel(string version, string description, string downloadUrl, string? devDownloadUrl) { this.Version = version; this.Description = description; diff --git a/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorErrorModel.cs b/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorErrorModel.cs index 3c63b730..4d37d449 100644 --- a/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorErrorModel.cs +++ b/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorErrorModel.cs @@ -1,5 +1,3 @@ -#nullable disable - using Newtonsoft.Json.Schema; namespace StardewModdingAPI.Web.ViewModels.JsonValidator @@ -11,30 +9,27 @@ namespace StardewModdingAPI.Web.ViewModels.JsonValidator ** Accessors *********/ /// The line number on which the error occurred. - public int Line { get; set; } + public int Line { get; } /// The field path in the JSON file where the error occurred. - public string Path { get; set; } + public string? Path { get; } /// A human-readable description of the error. - public string Message { get; set; } + public string Message { get; } /// The schema error type. - public ErrorType SchemaErrorType { get; set; } + public ErrorType SchemaErrorType { get; } /********* ** Public methods *********/ - /// Construct an instance. - public JsonValidatorErrorModel() { } - /// Construct an instance. /// The line number on which the error occurred. /// The field path in the JSON file where the error occurred. /// A human-readable description of the error. /// The schema error type. - public JsonValidatorErrorModel(int line, string path, string message, ErrorType schemaErrorType) + public JsonValidatorErrorModel(int line, string? path, string message, ErrorType schemaErrorType) { this.Line = line; this.Path = path; diff --git a/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorModel.cs b/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorModel.cs index 2543807f..85c2f44d 100644 --- a/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorModel.cs +++ b/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorModel.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Linq; @@ -13,51 +11,48 @@ namespace StardewModdingAPI.Web.ViewModels.JsonValidator ** Accessors *********/ /// Whether to show the edit view. - public bool IsEditView { get; set; } + public bool IsEditView { get; } /// The paste ID. - public string PasteID { get; set; } + public string? PasteID { get; } /// The schema name with which the JSON was validated. - public string SchemaName { get; set; } + public string? SchemaName { get; } /// The supported JSON schemas (names indexed by ID). - public readonly IDictionary SchemaFormats; + public IDictionary SchemaFormats { get; } /// The validated content. - public string Content { get; set; } + public string? Content { get; set; } /// The schema validation errors, if any. public JsonValidatorErrorModel[] Errors { get; set; } = Array.Empty(); /// A non-blocking warning while uploading the file. - public string UploadWarning { get; set; } + public string? UploadWarning { get; set; } /// When the uploaded file will no longer be available. - public DateTime? Expiry { get; set; } + public DateTimeOffset? Expiry { get; set; } /// An error which occurred while uploading the JSON. - public string UploadError { get; set; } + public string? UploadError { get; set; } /// An error which occurred while parsing the JSON. - public string ParseError { get; set; } + public string? ParseError { get; set; } /// A web URL to the user-facing format documentation. - public string FormatUrl { get; set; } + public string? FormatUrl { get; set; } /********* ** Public methods *********/ - /// Construct an instance. - public JsonValidatorModel() { } - /// Construct an instance. /// The stored file ID. /// The schema name with which the JSON was validated. /// The supported JSON schemas (names indexed by ID). /// Whether to show the edit view. - public JsonValidatorModel(string pasteID, string schemaName, IDictionary schemaFormats, bool isEditView) + public JsonValidatorModel(string? pasteID, string? schemaName, IDictionary schemaFormats, bool isEditView) { this.PasteID = pasteID; this.SchemaName = schemaName; @@ -69,7 +64,7 @@ namespace StardewModdingAPI.Web.ViewModels.JsonValidator /// The validated content. /// When the uploaded file will no longer be available. /// A non-blocking warning while uploading the log. - public JsonValidatorModel SetContent(string content, DateTime? expiry, string uploadWarning = null) + public JsonValidatorModel SetContent(string content, DateTimeOffset? expiry, string? uploadWarning = null) { this.Content = content; this.Expiry = expiry; diff --git a/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorRequestModel.cs b/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorRequestModel.cs index 43114d94..3edb58db 100644 --- a/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorRequestModel.cs +++ b/src/SMAPI.Web/ViewModels/JsonValidator/JsonValidatorRequestModel.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI.Web.ViewModels.JsonValidator { /// The view model for a JSON validation request. @@ -9,9 +7,22 @@ namespace StardewModdingAPI.Web.ViewModels.JsonValidator ** Accessors *********/ /// The schema name with which to validate the JSON. - public string SchemaName { get; set; } + public string SchemaName { get; } /// The raw content to validate. - public string Content { get; set; } + public string Content { get; } + + + /********* + ** Accessors + *********/ + /// Construct an instance. + /// The schema name with which to validate the JSON. + /// The raw content to validate. + public JsonValidatorRequestModel(string schemaName, string content) + { + this.SchemaName = schemaName; + this.Content = content; + } } } diff --git a/src/SMAPI.Web/ViewModels/LogParserModel.cs b/src/SMAPI.Web/ViewModels/LogParserModel.cs index d7e4d810..c39a9b0a 100644 --- a/src/SMAPI.Web/ViewModels/LogParserModel.cs +++ b/src/SMAPI.Web/ViewModels/LogParserModel.cs @@ -44,7 +44,7 @@ namespace StardewModdingAPI.Web.ViewModels public string? ParseError => this.ParsedLog?.Error; /// When the uploaded file will no longer be available. - public DateTime? Expiry { get; set; } + public DateTimeOffset? Expiry { get; set; } /// Whether parsed log data is available. [MemberNotNullWhen(true, nameof(LogParserModel.PasteID), nameof(LogParserModel.ParsedLog))] diff --git a/src/SMAPI.Web/ViewModels/ModCompatibilityModel.cs b/src/SMAPI.Web/ViewModels/ModCompatibilityModel.cs index 2af30cc3..36ea891d 100644 --- a/src/SMAPI.Web/ViewModels/ModCompatibilityModel.cs +++ b/src/SMAPI.Web/ViewModels/ModCompatibilityModel.cs @@ -1,5 +1,4 @@ -#nullable disable - +using Newtonsoft.Json; using StardewModdingAPI.Toolkit.Framework.Clients.Wiki; namespace StardewModdingAPI.Web.ViewModels @@ -11,21 +10,35 @@ namespace StardewModdingAPI.Web.ViewModels ** Accessors *********/ /// The compatibility status, as a string like "Broken". - public string Status { get; set; } + public string Status { get; } /// The human-readable summary, as an HTML block. - public string Summary { get; set; } + public string? Summary { get; } /// The game or SMAPI version which broke this mod (if applicable). - public string BrokeIn { get; set; } + public string? BrokeIn { get; } /// A link to the unofficial version which fixes compatibility, if any. - public ModLinkModel UnofficialVersion { get; set; } + public ModLinkModel? UnofficialVersion { get; } /********* ** Public methods *********/ + /// Construct an instance. + /// The compatibility status, as a string like "Broken". + /// The human-readable summary, as an HTML block. + /// The game or SMAPI version which broke this mod (if applicable). + /// A link to the unofficial version which fixes compatibility, if any. + [JsonConstructor] + public ModCompatibilityModel(string status, string? summary, string? brokeIn, ModLinkModel? unofficialVersion) + { + this.Status = status; + this.Summary = summary; + this.BrokeIn = brokeIn; + this.UnofficialVersion = unofficialVersion; + } + /// Construct an instance. /// The mod metadata. public ModCompatibilityModel(WikiCompatibilityInfo info) @@ -36,7 +49,7 @@ namespace StardewModdingAPI.Web.ViewModels this.Summary = info.Summary; this.BrokeIn = info.BrokeIn; if (info.UnofficialVersion != null) - this.UnofficialVersion = new ModLinkModel(info.UnofficialUrl, info.UnofficialVersion.ToString()); + this.UnofficialVersion = new ModLinkModel(info.UnofficialUrl!, info.UnofficialVersion.ToString()); } } } diff --git a/src/SMAPI.Web/ViewModels/ModLinkModel.cs b/src/SMAPI.Web/ViewModels/ModLinkModel.cs index 3039702e..96f14d48 100644 --- a/src/SMAPI.Web/ViewModels/ModLinkModel.cs +++ b/src/SMAPI.Web/ViewModels/ModLinkModel.cs @@ -1,5 +1,3 @@ -#nullable disable - namespace StardewModdingAPI.Web.ViewModels { /// Metadata about a link. @@ -9,10 +7,10 @@ namespace StardewModdingAPI.Web.ViewModels ** Accessors *********/ /// The URL of the linked page. - public string Url { get; set; } + public string Url { get; } /// The suggested link text. - public string Text { get; set; } + public string Text { get; } /********* diff --git a/src/SMAPI.Web/ViewModels/ModListModel.cs b/src/SMAPI.Web/ViewModels/ModListModel.cs index f0cf0c3a..be9f973a 100644 --- a/src/SMAPI.Web/ViewModels/ModListModel.cs +++ b/src/SMAPI.Web/ViewModels/ModListModel.cs @@ -1,5 +1,3 @@ -#nullable disable - using System; using System.Collections.Generic; using System.Linq; @@ -13,37 +11,34 @@ namespace StardewModdingAPI.Web.ViewModels ** Accessors *********/ /// The current stable version of the game. - public string StableVersion { get; set; } + public string? StableVersion { get; } /// The current beta version of the game (if any). - public string BetaVersion { get; set; } + public string? BetaVersion { get; } /// The mods to display. - public ModModel[] Mods { get; set; } + public ModModel[] Mods { get; } /// When the data was last updated. - public DateTimeOffset LastUpdated { get; set; } + public DateTimeOffset LastUpdated { get; } /// Whether the data hasn't been updated in a while. - public bool IsStale { get; set; } + public bool IsStale { get; } /// Whether the mod metadata is available. - public bool HasData => this.Mods?.Any() == true; + public bool HasData => this.Mods.Any(); /********* ** Public methods *********/ - /// Construct an empty instance. - public ModListModel() { } - /// Construct an instance. /// The current stable version of the game. /// The current beta version of the game (if any). /// The mods to display. /// When the data was last updated. /// Whether the data hasn't been updated in a while. - public ModListModel(string stableVersion, string betaVersion, IEnumerable mods, DateTimeOffset lastUpdated, bool isStale) + public ModListModel(string? stableVersion, string? betaVersion, IEnumerable mods, DateTimeOffset lastUpdated, bool isStale) { this.StableVersion = stableVersion; this.BetaVersion = betaVersion; diff --git a/src/SMAPI.Web/ViewModels/ModModel.cs b/src/SMAPI.Web/ViewModels/ModModel.cs index d0d7373b..929bf682 100644 --- a/src/SMAPI.Web/ViewModels/ModModel.cs +++ b/src/SMAPI.Web/ViewModels/ModModel.cs @@ -1,7 +1,6 @@ -#nullable disable - using System.Collections.Generic; using System.Linq; +using Newtonsoft.Json; using StardewModdingAPI.Toolkit.Framework.Clients.Wiki; namespace StardewModdingAPI.Web.ViewModels @@ -13,43 +12,43 @@ namespace StardewModdingAPI.Web.ViewModels ** Accessors *********/ /// The mod name. - public string Name { get; set; } + public string? Name { get; } /// The mod's alternative names, if any. - public string AlternateNames { get; set; } + public string AlternateNames { get; } /// The mod author's name. - public string Author { get; set; } + public string? Author { get; } /// The mod author's alternative names, if any. - public string AlternateAuthors { get; set; } + public string AlternateAuthors { get; } /// The GitHub repo, if any. - public string GitHubRepo { get; set; } + public string? GitHubRepo { get; } /// The URL to the mod's source code, if any. - public string SourceUrl { get; set; } + public string? SourceUrl { get; } /// The compatibility status for the stable version of the game. - public ModCompatibilityModel Compatibility { get; set; } + public ModCompatibilityModel Compatibility { get; } /// The compatibility status for the beta version of the game. - public ModCompatibilityModel BetaCompatibility { get; set; } + public ModCompatibilityModel? BetaCompatibility { get; } /// Links to the available mod pages. - public ModLinkModel[] ModPages { get; set; } + public ModLinkModel[] ModPages { get; } /// The human-readable warnings for players about this mod. - public string[] Warnings { get; set; } + public string[] Warnings { get; } /// The URL of the pull request which submits changes for an unofficial update to the author, if any. - public string PullRequestUrl { get; set; } + public string? PullRequestUrl { get; } - /// Special notes intended for developers who maintain unofficial updates or submit pull requests. - public string DevNote { get; set; } + /// Special notes intended for developers who maintain unofficial updates or submit pull requests. + public string? DevNote { get; } /// A unique identifier for the mod that can be used in an anchor URL. - public string Slug { get; set; } + public string? Slug { get; } /// The sites where the mod can be downloaded. public string[] ModPageSites => this.ModPages.Select(p => p.Text).ToArray(); @@ -58,6 +57,38 @@ namespace StardewModdingAPI.Web.ViewModels /********* ** Public methods *********/ + /// Construct an instance. + /// The mod name. + /// The mod's alternative names, if any. + /// The mod author's name. + /// The mod author's alternative names, if any. + /// The GitHub repo, if any. + /// The URL to the mod's source code, if any. + /// The compatibility status for the stable version of the game. + /// The compatibility status for the beta version of the game. + /// Links to the available mod pages. + /// The human-readable warnings for players about this mod. + /// The URL of the pull request which submits changes for an unofficial update to the author, if any. + /// Special notes intended for developers who maintain unofficial updates or submit pull requests. + /// A unique identifier for the mod that can be used in an anchor URL. + [JsonConstructor] + public ModModel(string? name, string alternateNames, string author, string alternateAuthors, string gitHubRepo, string sourceUrl, ModCompatibilityModel compatibility, ModCompatibilityModel betaCompatibility, ModLinkModel[] modPages, string[] warnings, string pullRequestUrl, string devNote, string slug) + { + this.Name = name; + this.AlternateNames = alternateNames; + this.Author = author; + this.AlternateAuthors = alternateAuthors; + this.GitHubRepo = gitHubRepo; + this.SourceUrl = sourceUrl; + this.Compatibility = compatibility; + this.BetaCompatibility = betaCompatibility; + this.ModPages = modPages; + this.Warnings = warnings; + this.PullRequestUrl = pullRequestUrl; + this.DevNote = devNote; + this.Slug = slug; + } + /// Construct an instance. /// The mod metadata. public ModModel(WikiModEntry entry) @@ -84,7 +115,7 @@ namespace StardewModdingAPI.Web.ViewModels *********/ /// Get the web URL for the mod's source code repository, if any. /// The mod metadata. - private string GetSourceUrl(WikiModEntry entry) + private string? GetSourceUrl(WikiModEntry entry) { if (!string.IsNullOrWhiteSpace(entry.GitHubRepo)) return $"https://github.com/{entry.GitHubRepo}"; diff --git a/src/SMAPI.Web/Views/Index/Index.cshtml b/src/SMAPI.Web/Views/Index/Index.cshtml index 9841ca42..acb8df78 100644 --- a/src/SMAPI.Web/Views/Index/Index.cshtml +++ b/src/SMAPI.Web/Views/Index/Index.cshtml @@ -1,7 +1,3 @@ -@{ - #nullable disable -} - @using Microsoft.Extensions.Options @using StardewModdingAPI.Web.Framework @using StardewModdingAPI.Web.Framework.ConfigModels @@ -28,7 +24,7 @@
- Download SMAPI @Model.StableVersion.Version
+ Download SMAPI @Model.StableVersion.Version