From fd77ae93d59222d70c86aebfc044f3af11063372 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 9 Aug 2019 01:18:05 -0400 Subject: fix typos and inconsistent spelling --- src/SMAPI.Tests/Core/TranslationTests.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/SMAPI.Tests/Core/TranslationTests.cs') diff --git a/src/SMAPI.Tests/Core/TranslationTests.cs b/src/SMAPI.Tests/Core/TranslationTests.cs index 63404a41..eea301ae 100644 --- a/src/SMAPI.Tests/Core/TranslationTests.cs +++ b/src/SMAPI.Tests/Core/TranslationTests.cs @@ -245,7 +245,7 @@ namespace StardewModdingAPI.Tests.Core [TestCase("{{value}}", "value")] [TestCase("{{VaLuE}}", "vAlUe")] [TestCase("{{VaLuE }}", " vAlUe")] - public void Translation_Tokens_KeysAreNormalised(string text, string key) + public void Translation_Tokens_KeysAreNormalized(string text, string key) { // arrange string value = Guid.NewGuid().ToString("N"); -- cgit From 25e4aa14d865cdf9f3616cfb0fd981aaaf0e3535 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Fri, 9 Aug 2019 17:47:53 -0400 Subject: remove legacy AssemblyInfo and GlobalAssemblyInfo files, use consistent assembly names --- build/GlobalAssemblyInfo.cs | 5 ----- build/common.targets | 3 +++ docs/technical/smapi.md | 12 ++++++------ src/SMAPI.Installer/Properties/AssemblyInfo.cs | 4 ---- src/SMAPI.Installer/SMAPI.Installer.csproj | 8 ++------ .../SMAPI.ModBuildConfig.Analyzer.Tests.csproj | 2 ++ src/SMAPI.ModBuildConfig.Analyzer/Properties/AssemblyInfo.cs | 4 ---- .../SMAPI.ModBuildConfig.Analyzer.csproj | 9 ++++----- src/SMAPI.ModBuildConfig/Properties/AssemblyInfo.cs | 6 ------ src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj | 4 ++-- src/SMAPI.Mods.ConsoleCommands/Properties/AssemblyInfo.cs | 4 ---- .../SMAPI.Mods.ConsoleCommands.csproj | 9 +-------- src/SMAPI.Mods.SaveBackup/Properties/AssemblyInfo.cs | 4 ---- src/SMAPI.Mods.SaveBackup/SMAPI.Mods.SaveBackup.csproj | 9 +-------- src/SMAPI.Tests/Core/ModResolverTests.cs | 4 +++- src/SMAPI.Tests/Core/TranslationTests.cs | 3 ++- src/SMAPI.Tests/Properties/AssemblyInfo.cs | 4 ---- src/SMAPI.Tests/SMAPI.Tests.csproj | 8 +------- src/SMAPI.Tests/Sample.cs | 2 +- src/SMAPI.Tests/Toolkit/PathUtilitiesTests.cs | 2 +- src/SMAPI.Tests/Utilities/SDateTests.cs | 2 +- src/SMAPI.Tests/Utilities/SemanticVersionTests.cs | 3 ++- src/SMAPI.Toolkit.CoreInterfaces/Properties/AssemblyInfo.cs | 4 ---- .../SMAPI.Toolkit.CoreInterfaces.csproj | 9 +++------ src/SMAPI.Toolkit/ModToolkit.cs | 3 +++ src/SMAPI.Toolkit/Properties/AssemblyInfo.cs | 7 ------- src/SMAPI.Toolkit/SMAPI.Toolkit.csproj | 8 +++----- src/SMAPI.Web/Properties/AssemblyInfo.cs | 4 ---- src/SMAPI.Web/SMAPI.Web.csproj | 8 +++----- src/SMAPI/Program.cs | 3 +++ src/SMAPI/Properties/AssemblyInfo.cs | 7 ------- src/SMAPI/SMAPI.csproj | 8 ++------ 32 files changed, 49 insertions(+), 123 deletions(-) delete mode 100644 build/GlobalAssemblyInfo.cs delete mode 100644 src/SMAPI.Installer/Properties/AssemblyInfo.cs delete mode 100644 src/SMAPI.ModBuildConfig.Analyzer/Properties/AssemblyInfo.cs delete mode 100644 src/SMAPI.ModBuildConfig/Properties/AssemblyInfo.cs delete mode 100644 src/SMAPI.Mods.ConsoleCommands/Properties/AssemblyInfo.cs delete mode 100644 src/SMAPI.Mods.SaveBackup/Properties/AssemblyInfo.cs delete mode 100644 src/SMAPI.Tests/Properties/AssemblyInfo.cs delete mode 100644 src/SMAPI.Toolkit.CoreInterfaces/Properties/AssemblyInfo.cs delete mode 100644 src/SMAPI.Toolkit/Properties/AssemblyInfo.cs delete mode 100644 src/SMAPI.Web/Properties/AssemblyInfo.cs delete mode 100644 src/SMAPI/Properties/AssemblyInfo.cs (limited to 'src/SMAPI.Tests/Core/TranslationTests.cs') diff --git a/build/GlobalAssemblyInfo.cs b/build/GlobalAssemblyInfo.cs deleted file mode 100644 index 0fa0d331..00000000 --- a/build/GlobalAssemblyInfo.cs +++ /dev/null @@ -1,5 +0,0 @@ -using System.Reflection; - -[assembly: AssemblyProduct("SMAPI")] -[assembly: AssemblyVersion("3.0.0")] -[assembly: AssemblyFileVersion("3.0.0")] diff --git a/build/common.targets b/build/common.targets index 59d5bfd2..a9bc9ebb 100644 --- a/build/common.targets +++ b/build/common.targets @@ -4,6 +4,9 @@ + 3.0.0 + SMAPI + $(AssemblySearchPaths);{GAC} $(DefineConstants);SMAPI_FOR_WINDOWS diff --git a/docs/technical/smapi.md b/docs/technical/smapi.md index a006ff1a..f6994ba3 100644 --- a/docs/technical/smapi.md +++ b/docs/technical/smapi.md @@ -50,7 +50,7 @@ argument | purpose ### Compile flags SMAPI uses a small number of conditional compilation constants, which you can set by editing the -`` element in `StardewModdingAPI.csproj`. Supported constants: +`` element in `SMAPI.csproj`. Supported constants: flag | purpose ---- | ------- @@ -71,17 +71,17 @@ your current OS automatically and load the correct references. Compile output wi ### Debugging a local build Rebuilding the solution in debug mode will copy the SMAPI files into your game folder. Starting -the `StardewModdingAPI` project with debugging from Visual Studio (on Mac or Windows) will launch -SMAPI with the debugger attached, so you can intercept errors and step through the code being -executed. This doesn't work in MonoDevelop on Linux, unfortunately. +the `SMAPI` project with debugging from Visual Studio (on Mac or Windows) will launch SMAPI with +the debugger attached, so you can intercept errors and step through the code being executed. This +doesn't work in MonoDevelop on Linux, unfortunately. ### Preparing a release To prepare a crossplatform SMAPI release, you'll need to compile it on two platforms. See [crossplatforming info](https://stardewvalleywiki.com/Modding:Modder_Guide/Test_and_Troubleshoot#Testing_on_all_platforms) on the wiki for the first-time setup. -1. Update the version number in `GlobalAssemblyInfo.cs` and `Constants::Version`. Make sure you use a - [semantic version](https://semver.org). Recommended format: +1. Update the version number in `.root/build/common.targets` and `Constants::Version`. Make sure + you use a [semantic version](https://semver.org). Recommended format: build type | format | example :--------- | :----------------------- | :------ diff --git a/src/SMAPI.Installer/Properties/AssemblyInfo.cs b/src/SMAPI.Installer/Properties/AssemblyInfo.cs deleted file mode 100644 index 9838e5a0..00000000 --- a/src/SMAPI.Installer/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,4 +0,0 @@ -using System.Reflection; - -[assembly: AssemblyTitle("SMAPI.Installer")] -[assembly: AssemblyDescription("The SMAPI installer for players.")] diff --git a/src/SMAPI.Installer/SMAPI.Installer.csproj b/src/SMAPI.Installer/SMAPI.Installer.csproj index a2e115e6..3f01c8fe 100644 --- a/src/SMAPI.Installer/SMAPI.Installer.csproj +++ b/src/SMAPI.Installer/SMAPI.Installer.csproj @@ -1,10 +1,10 @@  - SMAPI.Installer SMAPI.Installer + StardewModdingAPI.Installer + The SMAPI installer for players. net45 - false latest Exe x86 @@ -12,10 +12,6 @@ false - - - - diff --git a/src/SMAPI.ModBuildConfig.Analyzer.Tests/SMAPI.ModBuildConfig.Analyzer.Tests.csproj b/src/SMAPI.ModBuildConfig.Analyzer.Tests/SMAPI.ModBuildConfig.Analyzer.Tests.csproj index 40ceba3c..681eb5c2 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer.Tests/SMAPI.ModBuildConfig.Analyzer.Tests.csproj +++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/SMAPI.ModBuildConfig.Analyzer.Tests.csproj @@ -16,4 +16,6 @@ + + diff --git a/src/SMAPI.ModBuildConfig.Analyzer/Properties/AssemblyInfo.cs b/src/SMAPI.ModBuildConfig.Analyzer/Properties/AssemblyInfo.cs deleted file mode 100644 index 1cc41000..00000000 --- a/src/SMAPI.ModBuildConfig.Analyzer/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,4 +0,0 @@ -using System.Reflection; - -[assembly: AssemblyTitle("SMAPI.ModBuildConfig.Analyzer")] -[assembly: AssemblyDescription("")] diff --git a/src/SMAPI.ModBuildConfig.Analyzer/SMAPI.ModBuildConfig.Analyzer.csproj b/src/SMAPI.ModBuildConfig.Analyzer/SMAPI.ModBuildConfig.Analyzer.csproj index d812e9c6..3659e25a 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer/SMAPI.ModBuildConfig.Analyzer.csproj +++ b/src/SMAPI.ModBuildConfig.Analyzer/SMAPI.ModBuildConfig.Analyzer.csproj @@ -1,17 +1,16 @@  + SMAPI.ModBuildConfig.Analyzer + StardewModdingAPI.ModBuildConfig.Analyzer + 3.0.0 netstandard2.0 - false + latest false bin latest - - - - diff --git a/src/SMAPI.ModBuildConfig/Properties/AssemblyInfo.cs b/src/SMAPI.ModBuildConfig/Properties/AssemblyInfo.cs deleted file mode 100644 index 255ce509..00000000 --- a/src/SMAPI.ModBuildConfig/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,6 +0,0 @@ -using System.Reflection; - -[assembly: AssemblyTitle("SMAPI.ModBuildConfig")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyVersion("3.0.0")] -[assembly: AssemblyFileVersion("3.0.0")] diff --git a/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj b/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj index e13526f9..137a6c4a 100644 --- a/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj +++ b/src/SMAPI.ModBuildConfig/SMAPI.ModBuildConfig.csproj @@ -1,10 +1,10 @@  - SMAPI.ModBuildConfig SMAPI.ModBuildConfig + StardewModdingAPI.ModBuildConfig + 3.0.0 net45 - false latest x86 false diff --git a/src/SMAPI.Mods.ConsoleCommands/Properties/AssemblyInfo.cs b/src/SMAPI.Mods.ConsoleCommands/Properties/AssemblyInfo.cs deleted file mode 100644 index 86653141..00000000 --- a/src/SMAPI.Mods.ConsoleCommands/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,4 +0,0 @@ -using System.Reflection; - -[assembly: AssemblyTitle("SMAPI.Mods.ConsoleCommands")] -[assembly: AssemblyDescription("")] diff --git a/src/SMAPI.Mods.ConsoleCommands/SMAPI.Mods.ConsoleCommands.csproj b/src/SMAPI.Mods.ConsoleCommands/SMAPI.Mods.ConsoleCommands.csproj index 80e1986e..ce35bf73 100644 --- a/src/SMAPI.Mods.ConsoleCommands/SMAPI.Mods.ConsoleCommands.csproj +++ b/src/SMAPI.Mods.ConsoleCommands/SMAPI.Mods.ConsoleCommands.csproj @@ -1,10 +1,9 @@  - SMAPI.Mods.ConsoleCommands ConsoleCommands + StardewModdingAPI.Mods.ConsoleCommands net45 - false latest $(SolutionDir)\..\bin\$(Configuration)\Mods\ConsoleCommands false @@ -62,12 +61,6 @@ - - - Properties\GlobalAssemblyInfo.cs - - - PreserveNewest diff --git a/src/SMAPI.Mods.SaveBackup/Properties/AssemblyInfo.cs b/src/SMAPI.Mods.SaveBackup/Properties/AssemblyInfo.cs deleted file mode 100644 index fc6b26fa..00000000 --- a/src/SMAPI.Mods.SaveBackup/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,4 +0,0 @@ -using System.Reflection; - -[assembly: AssemblyTitle("StardewModdingAPI.Mods.SaveBackup")] -[assembly: AssemblyDescription("")] diff --git a/src/SMAPI.Mods.SaveBackup/SMAPI.Mods.SaveBackup.csproj b/src/SMAPI.Mods.SaveBackup/SMAPI.Mods.SaveBackup.csproj index d2e41e77..2d031408 100644 --- a/src/SMAPI.Mods.SaveBackup/SMAPI.Mods.SaveBackup.csproj +++ b/src/SMAPI.Mods.SaveBackup/SMAPI.Mods.SaveBackup.csproj @@ -1,10 +1,9 @@  - SMAPI.Mods.SaveBackup SaveBackup + StardewModdingAPI.Mods.SaveBackup net45 - false latest $(SolutionDir)\..\bin\$(Configuration)\Mods\SaveBackup false @@ -24,12 +23,6 @@ - - - Properties\GlobalAssemblyInfo.cs - - - PreserveNewest diff --git a/src/SMAPI.Tests/Core/ModResolverTests.cs b/src/SMAPI.Tests/Core/ModResolverTests.cs index c1aa0212..a9c88c60 100644 --- a/src/SMAPI.Tests/Core/ModResolverTests.cs +++ b/src/SMAPI.Tests/Core/ModResolverTests.cs @@ -5,13 +5,15 @@ using System.Linq; using Moq; using Newtonsoft.Json; using NUnit.Framework; +using StardewModdingAPI; using StardewModdingAPI.Framework; using StardewModdingAPI.Framework.ModLoading; using StardewModdingAPI.Toolkit; using StardewModdingAPI.Toolkit.Framework.ModData; using StardewModdingAPI.Toolkit.Serialization.Models; +using SemanticVersion = StardewModdingAPI.SemanticVersion; -namespace StardewModdingAPI.Tests.Core +namespace SMAPI.Tests.Core { /// Unit tests for . [TestFixture] diff --git a/src/SMAPI.Tests/Core/TranslationTests.cs b/src/SMAPI.Tests/Core/TranslationTests.cs index eea301ae..c098aca5 100644 --- a/src/SMAPI.Tests/Core/TranslationTests.cs +++ b/src/SMAPI.Tests/Core/TranslationTests.cs @@ -2,10 +2,11 @@ using System; using System.Collections.Generic; using System.Linq; using NUnit.Framework; +using StardewModdingAPI; using StardewModdingAPI.Framework.ModHelpers; using StardewValley; -namespace StardewModdingAPI.Tests.Core +namespace SMAPI.Tests.Core { /// Unit tests for and . [TestFixture] diff --git a/src/SMAPI.Tests/Properties/AssemblyInfo.cs b/src/SMAPI.Tests/Properties/AssemblyInfo.cs deleted file mode 100644 index 8b21e8fe..00000000 --- a/src/SMAPI.Tests/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,4 +0,0 @@ -using System.Reflection; - -[assembly: AssemblyTitle("SMAPI.Tests")] -[assembly: AssemblyDescription("")] diff --git a/src/SMAPI.Tests/SMAPI.Tests.csproj b/src/SMAPI.Tests/SMAPI.Tests.csproj index 41e12d7d..a627b3c3 100644 --- a/src/SMAPI.Tests/SMAPI.Tests.csproj +++ b/src/SMAPI.Tests/SMAPI.Tests.csproj @@ -1,8 +1,8 @@  - SMAPI.Tests SMAPI.Tests + SMAPI.Tests net45 false latest @@ -28,12 +28,6 @@ - - - Properties\GlobalAssemblyInfo.cs - - - diff --git a/src/SMAPI.Tests/Sample.cs b/src/SMAPI.Tests/Sample.cs index 6cd27707..f4f0d88e 100644 --- a/src/SMAPI.Tests/Sample.cs +++ b/src/SMAPI.Tests/Sample.cs @@ -1,6 +1,6 @@ using System; -namespace StardewModdingAPI.Tests +namespace SMAPI.Tests { /// Provides sample values for unit testing. internal static class Sample diff --git a/src/SMAPI.Tests/Toolkit/PathUtilitiesTests.cs b/src/SMAPI.Tests/Toolkit/PathUtilitiesTests.cs index 3dc65ed5..55785bfa 100644 --- a/src/SMAPI.Tests/Toolkit/PathUtilitiesTests.cs +++ b/src/SMAPI.Tests/Toolkit/PathUtilitiesTests.cs @@ -1,7 +1,7 @@ using NUnit.Framework; using StardewModdingAPI.Toolkit.Utilities; -namespace StardewModdingAPI.Tests.Toolkit +namespace SMAPI.Tests.Toolkit { /// Unit tests for . [TestFixture] diff --git a/src/SMAPI.Tests/Utilities/SDateTests.cs b/src/SMAPI.Tests/Utilities/SDateTests.cs index 642f11f6..d25a101a 100644 --- a/src/SMAPI.Tests/Utilities/SDateTests.cs +++ b/src/SMAPI.Tests/Utilities/SDateTests.cs @@ -6,7 +6,7 @@ using System.Text.RegularExpressions; using NUnit.Framework; using StardewModdingAPI.Utilities; -namespace StardewModdingAPI.Tests.Utilities +namespace SMAPI.Tests.Utilities { /// Unit tests for . [TestFixture] diff --git a/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs b/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs index 8f64a5fb..8da64c27 100644 --- a/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs +++ b/src/SMAPI.Tests/Utilities/SemanticVersionTests.cs @@ -2,9 +2,10 @@ using System; using System.Diagnostics.CodeAnalysis; using Newtonsoft.Json; using NUnit.Framework; +using StardewModdingAPI; using StardewModdingAPI.Framework; -namespace StardewModdingAPI.Tests.Utilities +namespace SMAPI.Tests.Utilities { /// Unit tests for . [TestFixture] diff --git a/src/SMAPI.Toolkit.CoreInterfaces/Properties/AssemblyInfo.cs b/src/SMAPI.Toolkit.CoreInterfaces/Properties/AssemblyInfo.cs deleted file mode 100644 index a29ba6cf..00000000 --- a/src/SMAPI.Toolkit.CoreInterfaces/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,4 +0,0 @@ -using System.Reflection; - -[assembly: AssemblyTitle("SMAPI.Toolkit.CoreInterfaces")] -[assembly: AssemblyDescription("Provides toolkit interfaces which are available to SMAPI mods.")] diff --git a/src/SMAPI.Toolkit.CoreInterfaces/SMAPI.Toolkit.CoreInterfaces.csproj b/src/SMAPI.Toolkit.CoreInterfaces/SMAPI.Toolkit.CoreInterfaces.csproj index 7d8fc998..a39ef3af 100644 --- a/src/SMAPI.Toolkit.CoreInterfaces/SMAPI.Toolkit.CoreInterfaces.csproj +++ b/src/SMAPI.Toolkit.CoreInterfaces/SMAPI.Toolkit.CoreInterfaces.csproj @@ -1,18 +1,15 @@  + SMAPI.Toolkit.CoreInterfaces + StardewModdingAPI + Provides toolkit interfaces which are available to SMAPI mods. net4.5;netstandard2.0 - SMAPI - false ..\..\bin\$(Configuration)\SMAPI.Toolkit.CoreInterfaces ..\..\bin\$(Configuration)\SMAPI.Toolkit.CoreInterfaces\$(TargetFramework)\SMAPI.Toolkit.CoreInterfaces.xml latest - - - - diff --git a/src/SMAPI.Toolkit/ModToolkit.cs b/src/SMAPI.Toolkit/ModToolkit.cs index 08fe0fed..80b14659 100644 --- a/src/SMAPI.Toolkit/ModToolkit.cs +++ b/src/SMAPI.Toolkit/ModToolkit.cs @@ -2,6 +2,7 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Runtime.CompilerServices; using System.Threading.Tasks; using Newtonsoft.Json; using StardewModdingAPI.Toolkit.Framework.Clients.Wiki; @@ -10,6 +11,8 @@ using StardewModdingAPI.Toolkit.Framework.ModData; using StardewModdingAPI.Toolkit.Framework.ModScanning; using StardewModdingAPI.Toolkit.Serialization; +[assembly: InternalsVisibleTo("StardewModdingAPI")] +[assembly: InternalsVisibleTo("SMAPI.Web")] namespace StardewModdingAPI.Toolkit { /// A convenience wrapper for the various tools. diff --git a/src/SMAPI.Toolkit/Properties/AssemblyInfo.cs b/src/SMAPI.Toolkit/Properties/AssemblyInfo.cs deleted file mode 100644 index ec873f79..00000000 --- a/src/SMAPI.Toolkit/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -[assembly: AssemblyTitle("SMAPI.Toolkit")] -[assembly: AssemblyDescription("A library which encapsulates mod-handling logic for mod managers and tools. Not intended for use by mods.")] -[assembly: InternalsVisibleTo("StardewModdingAPI")] -[assembly: InternalsVisibleTo("SMAPI.Web")] diff --git a/src/SMAPI.Toolkit/SMAPI.Toolkit.csproj b/src/SMAPI.Toolkit/SMAPI.Toolkit.csproj index 1cdde423..71b8fc55 100644 --- a/src/SMAPI.Toolkit/SMAPI.Toolkit.csproj +++ b/src/SMAPI.Toolkit/SMAPI.Toolkit.csproj @@ -1,8 +1,10 @@  + SMAPI.Toolkit + StardewModdingAPI.Toolkit + A library which encapsulates mod-handling logic for mod managers and tools. Not intended for use by mods. net4.5;netstandard2.0 - false ..\..\bin\$(Configuration)\SMAPI.Toolkit ..\..\bin\$(Configuration)\SMAPI.Toolkit\$(TargetFramework)\SMAPI.Toolkit.xml latest @@ -10,10 +12,6 @@ StardewModdingAPI.Toolkit - - - - diff --git a/src/SMAPI.Web/Properties/AssemblyInfo.cs b/src/SMAPI.Web/Properties/AssemblyInfo.cs deleted file mode 100644 index 31e6fc30..00000000 --- a/src/SMAPI.Web/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,4 +0,0 @@ -using System.Reflection; - -[assembly: AssemblyTitle("SMAPI.Web")] -[assembly: AssemblyDescription("")] diff --git a/src/SMAPI.Web/SMAPI.Web.csproj b/src/SMAPI.Web/SMAPI.Web.csproj index 98517818..316a6a28 100644 --- a/src/SMAPI.Web/SMAPI.Web.csproj +++ b/src/SMAPI.Web/SMAPI.Web.csproj @@ -1,9 +1,9 @@  + SMAPI.Web StardewModdingAPI.Web netcoreapp2.0 - false latest @@ -11,10 +11,6 @@ - - - - @@ -52,4 +48,6 @@ + + diff --git a/src/SMAPI/Program.cs b/src/SMAPI/Program.cs index 6c94a2af..2d143439 100644 --- a/src/SMAPI/Program.cs +++ b/src/SMAPI/Program.cs @@ -3,12 +3,15 @@ using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; using System.Reflection; +using System.Runtime.CompilerServices; using System.Threading; #if SMAPI_FOR_WINDOWS #endif using StardewModdingAPI.Framework; using StardewModdingAPI.Toolkit.Utilities; +[assembly: InternalsVisibleTo("SMAPI.Tests")] +[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] // Moq for unit testing namespace StardewModdingAPI { /// The main entry point for SMAPI, responsible for hooking into and launching the game. diff --git a/src/SMAPI/Properties/AssemblyInfo.cs b/src/SMAPI/Properties/AssemblyInfo.cs deleted file mode 100644 index 03843ea8..00000000 --- a/src/SMAPI/Properties/AssemblyInfo.cs +++ /dev/null @@ -1,7 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -[assembly: AssemblyTitle("SMAPI")] -[assembly: AssemblyDescription("A modding API for Stardew Valley.")] -[assembly: InternalsVisibleTo("StardewModdingAPI.Tests")] -[assembly: InternalsVisibleTo("DynamicProxyGenAssembly2")] // Moq for unit testing diff --git a/src/SMAPI/SMAPI.csproj b/src/SMAPI/SMAPI.csproj index 0157e66a..f41ede29 100644 --- a/src/SMAPI/SMAPI.csproj +++ b/src/SMAPI/SMAPI.csproj @@ -1,10 +1,10 @@  - StardewModdingAPI StardewModdingAPI + StardewModdingAPI + The modding API for Stardew Valley. net45 - false latest x86 Exe @@ -91,10 +91,6 @@ - - - - PreserveNewest -- cgit From 673510b3941dd35a127e4f4a8a406f34b72b6a66 Mon Sep 17 00:00:00 2001 From: Jesse Plamondon-Willard Date: Tue, 1 Oct 2019 20:04:58 -0400 Subject: remove unused translation field & method --- docs/release-notes.md | 2 +- src/SMAPI.Tests/Core/TranslationTests.cs | 49 +++++++------------ .../Framework/ModHelpers/TranslationHelper.cs | 13 ++--- src/SMAPI/Framework/SCore.cs | 6 +-- src/SMAPI/Translation.cs | 55 +++++++++------------- 5 files changed, 47 insertions(+), 78 deletions(-) (limited to 'src/SMAPI.Tests/Core/TranslationTests.cs') diff --git a/docs/release-notes.md b/docs/release-notes.md index 2a1b333e..26645210 100644 --- a/docs/release-notes.md +++ b/docs/release-notes.md @@ -90,7 +90,7 @@ For modders: * Breaking changes: * Mods are now loaded much earlier in the game launch. This lets mods intercept any content asset, but the game is not fully initialized when `Entry` is called (use the `GameLaunched` event if you need to run code when the game is initialized). * Removed all deprecated APIs. - * Removed `Monitor.ExitGameImmediately`. + * Removed unused APIs: `Monitor.ExitGameImmediately`, `Translation.ModName`, and `Translation.Assert`. * Fixed `ICursorPosition.AbsolutePixels` not adjusted for zoom. * Changes: * Added support for content pack translations. diff --git a/src/SMAPI.Tests/Core/TranslationTests.cs b/src/SMAPI.Tests/Core/TranslationTests.cs index c098aca5..457f9fad 100644 --- a/src/SMAPI.Tests/Core/TranslationTests.cs +++ b/src/SMAPI.Tests/Core/TranslationTests.cs @@ -32,7 +32,7 @@ namespace SMAPI.Tests.Core var data = new Dictionary>(); // act - ITranslationHelper helper = new TranslationHelper("ModID", "ModName", "en", LocalizedContentManager.LanguageCode.en).SetTranslations(data); + ITranslationHelper helper = new TranslationHelper("ModID", "en", LocalizedContentManager.LanguageCode.en).SetTranslations(data); Translation translation = helper.Get("key"); Translation[] translationList = helper.GetTranslations()?.ToArray(); @@ -55,7 +55,7 @@ namespace SMAPI.Tests.Core // act var actual = new Dictionary(); - TranslationHelper helper = new TranslationHelper("ModID", "ModName", "en", LocalizedContentManager.LanguageCode.en).SetTranslations(data); + TranslationHelper helper = new TranslationHelper("ModID", "en", LocalizedContentManager.LanguageCode.en).SetTranslations(data); foreach (string locale in expected.Keys) { this.AssertSetLocale(helper, locale, LocalizedContentManager.LanguageCode.en); @@ -79,7 +79,7 @@ namespace SMAPI.Tests.Core // act var actual = new Dictionary(); - TranslationHelper helper = new TranslationHelper("ModID", "ModName", "en", LocalizedContentManager.LanguageCode.en).SetTranslations(data); + TranslationHelper helper = new TranslationHelper("ModID", "en", LocalizedContentManager.LanguageCode.en).SetTranslations(data); foreach (string locale in expected.Keys) { this.AssertSetLocale(helper, locale, LocalizedContentManager.LanguageCode.en); @@ -109,14 +109,14 @@ namespace SMAPI.Tests.Core [TestCase(" boop ", ExpectedResult = true)] public bool Translation_HasValue(string text) { - return new Translation("ModName", "pt-BR", "key", text).HasValue(); + return new Translation("pt-BR", "key", text).HasValue(); } [Test(Description = "Assert that the translation's ToString method returns the expected text for various inputs.")] public void Translation_ToString([ValueSource(nameof(TranslationTests.Samples))] string text) { // act - Translation translation = new Translation("ModName", "pt-BR", "key", text); + Translation translation = new Translation("pt-BR", "key", text); // assert if (translation.HasValue()) @@ -129,7 +129,7 @@ namespace SMAPI.Tests.Core public void Translation_ImplicitStringConversion([ValueSource(nameof(TranslationTests.Samples))] string text) { // act - Translation translation = new Translation("ModName", "pt-BR", "key", text); + Translation translation = new Translation("pt-BR", "key", text); // assert if (translation.HasValue()) @@ -142,7 +142,7 @@ namespace SMAPI.Tests.Core public void Translation_UsePlaceholder([Values(true, false)] bool value, [ValueSource(nameof(TranslationTests.Samples))] string text) { // act - Translation translation = new Translation("ModName", "pt-BR", "key", text).UsePlaceholder(value); + Translation translation = new Translation("pt-BR", "key", text).UsePlaceholder(value); // assert if (translation.HasValue()) @@ -153,24 +153,11 @@ namespace SMAPI.Tests.Core Assert.AreEqual(this.GetPlaceholderText("key"), translation.ToString(), "The translation returned an unexpected value given a null or empty input with the placeholder enabled."); } - [Test(Description = "Assert that the translation's Assert method throws the expected exception.")] - public void Translation_Assert([ValueSource(nameof(TranslationTests.Samples))] string text) - { - // act - Translation translation = new Translation("ModName", "pt-BR", "key", text); - - // assert - if (translation.HasValue()) - Assert.That(() => translation.Assert(), Throws.Nothing, "The assert unexpected threw an exception for a valid input."); - else - Assert.That(() => translation.Assert(), Throws.Exception.TypeOf(), "The assert didn't throw an exception for invalid input."); - } - [Test(Description = "Assert that the translation returns the expected text after setting the default.")] public void Translation_Default([ValueSource(nameof(TranslationTests.Samples))] string text, [ValueSource(nameof(TranslationTests.Samples))] string @default) { // act - Translation translation = new Translation("ModName", "pt-BR", "key", text).Default(@default); + Translation translation = new Translation("pt-BR", "key", text).Default(@default); // assert if (!string.IsNullOrEmpty(text)) @@ -195,7 +182,7 @@ namespace SMAPI.Tests.Core string expected = $"{start} tokens are properly replaced (including {middle} {middle}) {end}"; // act - Translation translation = new Translation("ModName", "pt-BR", "key", input); + Translation translation = new Translation("pt-BR", "key", input); switch (structure) { case "anonymous object": @@ -236,7 +223,7 @@ namespace SMAPI.Tests.Core string value = Guid.NewGuid().ToString("N"); // act - Translation translation = new Translation("ModName", "pt-BR", "key", text).Tokens(new Dictionary { [key] = value }); + Translation translation = new Translation("pt-BR", "key", text).Tokens(new Dictionary { [key] = value }); // assert Assert.AreEqual(value, translation.ToString(), "The translation returned an unexpected value given a valid base text."); @@ -252,7 +239,7 @@ namespace SMAPI.Tests.Core string value = Guid.NewGuid().ToString("N"); // act - Translation translation = new Translation("ModName", "pt-BR", "key", text).Tokens(new Dictionary { [key] = value }); + Translation translation = new Translation("pt-BR", "key", text).Tokens(new Dictionary { [key] = value }); // assert Assert.AreEqual(value, translation.ToString(), "The translation returned an unexpected value given a valid base text."); @@ -303,19 +290,19 @@ namespace SMAPI.Tests.Core { ["default"] = new[] { - new Translation(string.Empty, "default", "key A", "default A"), - new Translation(string.Empty, "default", "key C", "default C") + new Translation("default", "key A", "default A"), + new Translation("default", "key C", "default C") }, ["en"] = new[] { - new Translation(string.Empty, "en", "key A", "en A"), - new Translation(string.Empty, "en", "key B", "en B"), - new Translation(string.Empty, "en", "key C", "default C") + new Translation("en", "key A", "en A"), + new Translation("en", "key B", "en B"), + new Translation("en", "key C", "default C") }, ["zzz"] = new[] { - new Translation(string.Empty, "zzz", "key A", "zzz A"), - new Translation(string.Empty, "zzz", "key C", "default C") + new Translation("zzz", "key A", "zzz A"), + new Translation("zzz", "key C", "default C") } }; expected["en-us"] = expected["en"].ToArray(); diff --git a/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs b/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs index 3252e047..65850384 100644 --- a/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs +++ b/src/SMAPI/Framework/ModHelpers/TranslationHelper.cs @@ -11,9 +11,6 @@ namespace StardewModdingAPI.Framework.ModHelpers /********* ** Fields *********/ - /// The name of the relevant mod for error messages. - private readonly string ModName; - /// The translations for each locale. private readonly IDictionary> All = new Dictionary>(StringComparer.InvariantCultureIgnoreCase); @@ -36,15 +33,11 @@ namespace StardewModdingAPI.Framework.ModHelpers *********/ /// Construct an instance. /// The unique ID of the relevant mod. - /// The name of the relevant mod for error messages. /// The initial locale. /// The game's current language code. - public TranslationHelper(string modID, string modName, string locale, LocalizedContentManager.LanguageCode languageCode) + public TranslationHelper(string modID, string locale, LocalizedContentManager.LanguageCode languageCode) : base(modID) { - // save data - this.ModName = modName; - // set locale this.SetLocale(locale, languageCode); } @@ -60,7 +53,7 @@ namespace StardewModdingAPI.Framework.ModHelpers public Translation Get(string key) { this.ForLocale.TryGetValue(key, out Translation translation); - return translation ?? new Translation(this.ModName, this.Locale, key, null); + return translation ?? new Translation(this.Locale, key, null); } /// Get a translation for the current locale. @@ -105,7 +98,7 @@ namespace StardewModdingAPI.Framework.ModHelpers foreach (var pair in translations) { if (!this.ForLocale.ContainsKey(pair.Key)) - this.ForLocale.Add(pair.Key, new Translation(this.ModName, this.Locale, pair.Key, pair.Value)); + this.ForLocale.Add(pair.Key, new Translation(this.Locale, pair.Key, pair.Value)); } } } diff --git a/src/SMAPI/Framework/SCore.cs b/src/SMAPI/Framework/SCore.cs index bc893abc..a4b38a50 100644 --- a/src/SMAPI/Framework/SCore.cs +++ b/src/SMAPI/Framework/SCore.cs @@ -960,7 +960,7 @@ namespace StardewModdingAPI.Framework IManifest manifest = mod.Manifest; IMonitor monitor = this.GetSecondaryMonitor(mod.DisplayName); IContentHelper contentHelper = new ContentHelper(this.ContentCore, mod.DirectoryPath, manifest.UniqueID, mod.DisplayName, monitor); - TranslationHelper translationHelper = new TranslationHelper(manifest.UniqueID, manifest.Name, contentCore.GetLocale(), contentCore.Language); + TranslationHelper translationHelper = new TranslationHelper(manifest.UniqueID, contentCore.GetLocale(), contentCore.Language); IContentPack contentPack = new ContentPack(mod.DirectoryPath, manifest, contentHelper, translationHelper, jsonHelper); mod.SetMod(contentPack, monitor, translationHelper); this.ModRegistry.Add(mod); @@ -1024,7 +1024,7 @@ namespace StardewModdingAPI.Framework // init mod helpers IMonitor monitor = this.GetSecondaryMonitor(mod.DisplayName); - TranslationHelper translationHelper = new TranslationHelper(manifest.UniqueID, manifest.Name, contentCore.GetLocale(), contentCore.Language); + TranslationHelper translationHelper = new TranslationHelper(manifest.UniqueID, contentCore.GetLocale(), contentCore.Language); IModHelper modHelper; { IModEvents events = new ModEvents(mod, this.EventManager); @@ -1040,7 +1040,7 @@ namespace StardewModdingAPI.Framework { IMonitor packMonitor = this.GetSecondaryMonitor(packManifest.Name); IContentHelper packContentHelper = new ContentHelper(contentCore, packDirPath, packManifest.UniqueID, packManifest.Name, packMonitor); - ITranslationHelper packTranslationHelper = new TranslationHelper(packManifest.UniqueID, packManifest.Name, contentCore.GetLocale(), contentCore.Language); + ITranslationHelper packTranslationHelper = new TranslationHelper(packManifest.UniqueID, contentCore.GetLocale(), contentCore.Language); return new ContentPack(packDirPath, packManifest, packContentHelper, packTranslationHelper, this.Toolkit.JsonHelper); } diff --git a/src/SMAPI/Translation.cs b/src/SMAPI/Translation.cs index e8698e2c..2196c8a5 100644 --- a/src/SMAPI/Translation.cs +++ b/src/SMAPI/Translation.cs @@ -15,9 +15,6 @@ namespace StardewModdingAPI /// The placeholder text when the translation is null or empty, where {0} is the translation key. internal const string PlaceholderText = "(no translation:{0})"; - /// The name of the relevant mod for error messages. - private readonly string ModName; - /// The locale for which the translation was fetched. private readonly string Locale; @@ -39,36 +36,11 @@ namespace StardewModdingAPI ** Public methods *********/ /// Construct an instance. - /// The name of the relevant mod for error messages. - /// The locale for which the translation was fetched. - /// The translation key. - /// The underlying translation text. - internal Translation(string modName, string locale, string key, string text) - : this(modName, locale, key, text, string.Format(Translation.PlaceholderText, key)) { } - - /// Construct an instance. - /// The name of the relevant mod for error messages. /// The locale for which the translation was fetched. /// The translation key. /// The underlying translation text. - /// The value to return if the translations is undefined. - internal Translation(string modName, string locale, string key, string text, string placeholder) - { - this.ModName = modName; - this.Locale = locale; - this.Key = key; - this.Text = text; - this.Placeholder = placeholder; - } - - /// Throw an exception if the translation text is null or empty. - /// There's no available translation matching the requested key and locale. - public Translation Assert() - { - if (!this.HasValue()) - throw new KeyNotFoundException($"The '{this.ModName}' mod doesn't have a translation with key '{this.Key}' for the '{this.Locale}' locale or its fallbacks."); - return this; - } + internal Translation(string locale, string key, string text) + : this(locale, key, text, string.Format(Translation.PlaceholderText, key)) { } /// Replace the text if it's null or empty. If you set a null or empty value, the translation will show the fallback "no translation" placeholder (see if you want to disable that). Returns a new instance if changed. /// The default value. @@ -76,14 +48,14 @@ namespace StardewModdingAPI { return this.HasValue() ? this - : new Translation(this.ModName, this.Locale, this.Key, @default); + : new Translation(this.Locale, this.Key, @default); } /// Whether to return a "no translation" placeholder if the translation is null or empty. Returns a new instance. /// Whether to return a placeholder. public Translation UsePlaceholder(bool use) { - return new Translation(this.ModName, this.Locale, this.Key, this.Text, use ? string.Format(Translation.PlaceholderText, this.Key) : null); + return new Translation(this.Locale, this.Key, this.Text, use ? string.Format(Translation.PlaceholderText, this.Key) : null); } /// Replace tokens in the text like {{value}} with the given values. Returns a new instance. @@ -127,7 +99,7 @@ namespace StardewModdingAPI ? value : match.Value; }); - return new Translation(this.ModName, this.Locale, this.Key, text); + return new Translation(this.Locale, this.Key, text); } /// Get whether the translation has a defined value. @@ -150,5 +122,22 @@ namespace StardewModdingAPI { return translation?.ToString(); } + + + /********* + ** Private methods + *********/ + /// Construct an instance. + /// The locale for which the translation was fetched. + /// The translation key. + /// The underlying translation text. + /// The value to return if the translations is undefined. + private Translation(string locale, string key, string text, string placeholder) + { + this.Locale = locale; + this.Key = key; + this.Text = text; + this.Placeholder = placeholder; + } } } -- cgit