diff options
| author | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-08-02 16:38:51 -0400 |
|---|---|---|
| committer | Jesse Plamondon-Willard <Pathoschild@users.noreply.github.com> | 2020-08-02 16:38:51 -0400 |
| commit | 8da88b8fe5b41739c5cd0df3280b9770fc7f10a4 (patch) | |
| tree | aed3679d01ee546726851982862daac2bad38b41 /src | |
| parent | ba0dff819f2e65b16a0c7bc7a9233fdb101994d0 (diff) | |
| parent | b96bcb21894257f06716e6a51102f74d2aba5178 (diff) | |
| download | SMAPI-8da88b8fe5b41739c5cd0df3280b9770fc7f10a4.tar.gz SMAPI-8da88b8fe5b41739c5cd0df3280b9770fc7f10a4.tar.bz2 SMAPI-8da88b8fe5b41739c5cd0df3280b9770fc7f10a4.zip | |
Merge branch 'develop' into stable
Diffstat (limited to 'src')
55 files changed, 188 insertions, 154 deletions
diff --git a/src/SMAPI.Installer/InteractiveInstaller.cs b/src/SMAPI.Installer/InteractiveInstaller.cs index 1457848b..dc96e2e8 100644 --- a/src/SMAPI.Installer/InteractiveInstaller.cs +++ b/src/SMAPI.Installer/InteractiveInstaller.cs @@ -468,7 +468,7 @@ namespace StardewModdingApi.Installer } // find target folder - ModFolder targetMod = targetMods.FirstOrDefault(p => p.Manifest?.UniqueID?.Equals(sourceMod.Manifest.UniqueID, StringComparison.InvariantCultureIgnoreCase) == true); + ModFolder targetMod = targetMods.FirstOrDefault(p => p.Manifest?.UniqueID?.Equals(sourceMod.Manifest.UniqueID, StringComparison.OrdinalIgnoreCase) == true); DirectoryInfo defaultTargetFolder = new DirectoryInfo(Path.Combine(paths.ModsPath, sourceMod.Directory.Name)); DirectoryInfo targetFolder = targetMod?.Directory ?? defaultTargetFolder; this.PrintDebug(targetFolder.FullName == defaultTargetFolder.FullName @@ -808,7 +808,7 @@ namespace StardewModdingApi.Installer continue; // should never happen // delete packaged mods (newer version bundled into SMAPI) - if (isDir && packagedModNames.Contains(entry.Name, StringComparer.InvariantCultureIgnoreCase)) + if (isDir && packagedModNames.Contains(entry.Name, StringComparer.OrdinalIgnoreCase)) { this.PrintDebug($" Deleting {entry.Name} because it's bundled into SMAPI..."); this.InteractivelyDelete(entry.FullName); diff --git a/src/SMAPI.Installer/Program.cs b/src/SMAPI.Installer/Program.cs index b7fa45f5..dc6c97f4 100644 --- a/src/SMAPI.Installer/Program.cs +++ b/src/SMAPI.Installer/Program.cs @@ -67,7 +67,7 @@ namespace StardewModdingApi.Installer AssemblyName name = new AssemblyName(e.Name); foreach (FileInfo dll in new DirectoryInfo(Program.InternalFilesPath).EnumerateFiles("*.dll")) { - if (name.Name.Equals(AssemblyName.GetAssemblyName(dll.FullName).Name, StringComparison.InvariantCultureIgnoreCase)) + if (name.Name.Equals(AssemblyName.GetAssemblyName(dll.FullName).Name, StringComparison.OrdinalIgnoreCase)) return Assembly.LoadFrom(dll.FullName); } return null; diff --git a/src/SMAPI.Installer/assets/unix-launcher.sh b/src/SMAPI.Installer/assets/unix-launcher.sh index b72eed22..1d97d487 100644 --- a/src/SMAPI.Installer/assets/unix-launcher.sh +++ b/src/SMAPI.Installer/assets/unix-launcher.sh @@ -46,80 +46,64 @@ else if [ "$ARCH" == "x86_64" ]; then ln -sf mcs.bin.x86_64 mcs cp StardewValley.bin.x86_64 StardewModdingAPI.bin.x86_64 - LAUNCHER="./StardewModdingAPI.bin.x86_64 $*" + LAUNCHER="./StardewModdingAPI.bin.x86_64" else ln -sf mcs.bin.x86 mcs cp StardewValley.bin.x86 StardewModdingAPI.bin.x86 - LAUNCHER="./StardewModdingAPI.bin.x86 $*" + LAUNCHER="./StardewModdingAPI.bin.x86" fi + export LAUNCHER # get cross-distro version of POSIX command COMMAND="" if command -v command 2>/dev/null; then COMMAND="command -v" elif type type 2>/dev/null; then - COMMAND="type" + COMMAND="type -p" fi # select terminal (prefer xterm for best compatibility, then known supported terminals) for terminal in xterm gnome-terminal kitty terminator xfce4-terminal konsole terminal termite alacritty mate-terminal x-terminal-emulator; do if $COMMAND "$terminal" 2>/dev/null; then - # Find the true shell behind x-terminal-emulator - if [ "$(basename "$(readlink -f $(which "$terminal"))")" != "x-terminal-emulator" ]; then - export LAUNCHTERM=$terminal - break; - else - export LAUNCHTERM="$(basename "$(readlink -f $(which x-terminal-emulator))")" - # Remember that we're using x-terminal-emulator just in case it points outside the $PATH - export XTE=1 - break; - fi + export LAUNCHTERM=$terminal + break; fi done - # if no terminal was found, run in current shell or with no output - if [ -z "$LAUNCHTERM" ]; then - sh -c 'TERM=xterm $LAUNCHER' - if [ $? -eq 127 ]; then - $LAUNCHER --no-terminal - fi - exit + # find the true shell behind x-terminal-emulator + if [ "$LAUNCHTERM" = "x-terminal-emulator" ]; then + export LAUNCHTERM="$(basename "$(readlink -f $(COMMAND x-terminal-emulator))")" fi # run in selected terminal and account for quirks case $LAUNCHTERM in - terminator) - # Terminator converts -e to -x when used through x-terminal-emulator for some reason - if $XTE; then - terminator -e "sh -c 'TERM=xterm $LAUNCHER'" - else - terminator -x "sh -c 'TERM=xterm $LAUNCHER'" - fi + terminal|termite) + # LAUNCHTERM consumes only one argument after -e + # options containing space characters are unsupported + exec $LAUNCHTERM -e "env TERM=xterm $LAUNCHER $@" ;; - kitty) - # Kitty overrides the TERM varible unless you set it explicitly - kitty -o term=xterm $LAUNCHER + xterm|konsole|alacritty) + # LAUNCHTERM consumes all arguments after -e + exec $LAUNCHTERM -e env TERM=xterm $LAUNCHER "$@" ;; - alacritty) - # Alacritty doesn't like the double quotes or the variable - if [ "$ARCH" == "x86_64" ]; then - alacritty -e sh -c 'TERM=xterm ./StardewModdingAPI.bin.x86_64 $*' - else - alacritty -e sh -c 'TERM=xterm ./StardewModdingAPI.bin.x86 $*' - fi + terminator|xfce4-terminal|mate-terminal) + # LAUNCHTERM consumes all arguments after -x + exec $LAUNCHTERM -x env TERM=xterm $LAUNCHER "$@" ;; - xterm|xfce4-terminal|gnome-terminal|terminal|termite|mate-terminal) - $LAUNCHTERM -e "sh -c 'TERM=xterm $LAUNCHER'" + gnome-terminal) + # LAUNCHTERM consumes all arguments after -- + exec $LAUNCHTERM -- env TERM=xterm $LAUNCHER "$@" ;; - konsole) - konsole -p Environment=TERM=xterm -e "$LAUNCHER" + kitty) + # LAUNCHTERM consumes all trailing arguments + exec $LAUNCHTERM env TERM=xterm $LAUNCHER "$@" ;; *) # If we don't know the terminal, just try to run it in the current shell. - sh -c 'TERM=xterm $LAUNCHER' + env TERM=xterm $LAUNCHER "$@" # if THAT fails, launch with no output if [ $? -eq 127 ]; then - $LAUNCHER --no-terminal + exec $LAUNCHER --no-terminal "$@" fi esac fi 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 5ae6574d..9c230203 100644 --- a/src/SMAPI.ModBuildConfig.Analyzer.Tests/SMAPI.ModBuildConfig.Analyzer.Tests.csproj +++ b/src/SMAPI.ModBuildConfig.Analyzer.Tests/SMAPI.ModBuildConfig.Analyzer.Tests.csproj @@ -9,7 +9,7 @@ <PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.10.0" /> <PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.6.1" /> <PackageReference Include="NUnit" Version="3.12.0" /> - <PackageReference Include="NUnit3TestAdapter" Version="3.16.1"> + <PackageReference Include="NUnit3TestAdapter" Version="3.17.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> </PackageReference> diff --git a/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs b/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs index f0363a3e..636c3669 100644 --- a/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs +++ b/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs @@ -33,7 +33,7 @@ namespace StardewModdingAPI.ModBuildConfig.Framework /// <exception cref="UserErrorException">The mod package isn't valid.</exception> public ModFileManager(string projectDir, string targetDir, Regex[] ignoreFilePatterns, bool validateRequiredModFiles) { - this.Files = new Dictionary<string, FileInfo>(StringComparer.InvariantCultureIgnoreCase); + this.Files = new Dictionary<string, FileInfo>(StringComparer.OrdinalIgnoreCase); // validate paths if (!Directory.Exists(projectDir)) @@ -68,7 +68,7 @@ namespace StardewModdingAPI.ModBuildConfig.Framework /// <summary>Get the files in the mod package.</summary> public IDictionary<string, FileInfo> GetFiles() { - return new Dictionary<string, FileInfo>(this.Files, StringComparer.InvariantCultureIgnoreCase); + return new Dictionary<string, FileInfo>(this.Files, StringComparer.OrdinalIgnoreCase); } /// <summary>Get a semantic version from the mod manifest.</summary> @@ -165,8 +165,8 @@ namespace StardewModdingAPI.ModBuildConfig.Framework || this.EqualsInvariant(file.Name, "Newtonsoft.Json.xml") // code analysis files - || file.Name.EndsWith(".CodeAnalysisLog.xml", StringComparison.InvariantCultureIgnoreCase) - || file.Name.EndsWith(".lastcodeanalysissucceeded", StringComparison.InvariantCultureIgnoreCase) + || file.Name.EndsWith(".CodeAnalysisLog.xml", StringComparison.OrdinalIgnoreCase) + || file.Name.EndsWith(".lastcodeanalysissucceeded", StringComparison.OrdinalIgnoreCase) // OS metadata files || this.EqualsInvariant(file.Name, ".DS_Store") @@ -183,7 +183,7 @@ namespace StardewModdingAPI.ModBuildConfig.Framework { if (str == null) return other == null; - return str.Equals(other, StringComparison.InvariantCultureIgnoreCase); + return str.Equals(other, StringComparison.OrdinalIgnoreCase); } } } diff --git a/src/SMAPI.ModBuildConfig/build/smapi.targets b/src/SMAPI.ModBuildConfig/build/smapi.targets index bfee3b33..03db7490 100644 --- a/src/SMAPI.ModBuildConfig/build/smapi.targets +++ b/src/SMAPI.ModBuildConfig/build/smapi.targets @@ -20,12 +20,12 @@ <ModZipPath Condition="'$(ModZipPath)' == ''">$(TargetDir)</ModZipPath> <EnableModDeploy Condition="'$(EnableModDeploy)' == ''">true</EnableModDeploy> <EnableModZip Condition="'$(EnableModZip)' == ''">true</EnableModZip> - <EnableHarmony Condition="'$(EnableModZip)' == ''">false</EnableHarmony> - <EnableGameDebugging Condition="$(EnableGameDebugging) == ''">true</EnableGameDebugging> + <EnableHarmony Condition="'$(EnableHarmony)' == ''">false</EnableHarmony> + <EnableGameDebugging Condition="'$(EnableGameDebugging)' == ''">true</EnableGameDebugging> <CopyModReferencesToBuildOutput Condition="'$(CopyModReferencesToBuildOutput)' == '' OR ('$(CopyModReferencesToBuildOutput)' != 'true' AND '$(CopyModReferencesToBuildOutput)' != 'false')">false</CopyModReferencesToBuildOutput> </PropertyGroup> - <PropertyGroup Condition="$(OS) == 'Windows_NT' AND $(EnableGameDebugging) == 'true'"> + <PropertyGroup Condition="'$(OS)' == 'Windows_NT' AND '$(EnableGameDebugging)' == 'true'"> <!-- enable game debugging --> <StartAction>Program</StartAction> <StartProgram>$(GamePath)\StardewModdingAPI.exe</StartProgram> @@ -47,7 +47,7 @@ </ItemGroup> <!-- Windows --> - <ItemGroup Condition="$(OS) == 'Windows_NT'"> + <ItemGroup Condition="'$(OS)' == 'Windows_NT'"> <Reference Include="Microsoft.Xna.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" Private="$(CopyModReferencesToBuildOutput)" /> <Reference Include="Microsoft.Xna.Framework.Game, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" Private="$(CopyModReferencesToBuildOutput)" /> <Reference Include="Microsoft.Xna.Framework.Graphics, Version=4.0.0.0, Culture=neutral, PublicKeyToken=842cf8be1de50553, processorArchitecture=x86" Private="$(CopyModReferencesToBuildOutput)" /> @@ -56,7 +56,7 @@ </ItemGroup> <!-- Linux/Mac --> - <ItemGroup Condition="$(OS) != 'Windows_NT'"> + <ItemGroup Condition="'$(OS)' != 'Windows_NT'"> <Reference Include="MonoGame.Framework" HintPath="$(GamePath)\MonoGame.Framework.dll" Private="$(CopyModReferencesToBuildOutput)" /> </ItemGroup> diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs index 9c7082c9..e84445d7 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs @@ -64,7 +64,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands this.LogError($"Argument {index} ({name}) is required."); return false; } - if (oneOf?.Any() == true && !oneOf.Contains(this.Args[index], StringComparer.InvariantCultureIgnoreCase)) + if (oneOf?.Any() == true && !oneOf.Contains(this.Args[index], StringComparer.OrdinalIgnoreCase)) { this.LogError($"Argument {index} ({name}) must be one of {string.Join(", ", oneOf)}."); return false; diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs index e9545575..1190a4ab 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/ClearCommand.cs @@ -56,7 +56,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands.World return; // get target location - GameLocation location = Game1.locations.FirstOrDefault(p => p.Name != null && p.Name.Equals(locationName, StringComparison.InvariantCultureIgnoreCase)); + GameLocation location = Game1.locations.FirstOrDefault(p => p.Name != null && p.Name.Equals(locationName, StringComparison.OrdinalIgnoreCase)); if (location == null && locationName == "current") location = Game1.currentLocation; if (location == null) diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemData/SearchableItem.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemData/SearchableItem.cs index b618a308..d9e63126 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemData/SearchableItem.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemData/SearchableItem.cs @@ -44,8 +44,8 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.ItemData public bool NameContains(string substring) { return - this.Name.IndexOf(substring, StringComparison.InvariantCultureIgnoreCase) != -1 - || this.DisplayName.IndexOf(substring, StringComparison.InvariantCultureIgnoreCase) != -1; + this.Name.IndexOf(substring, StringComparison.OrdinalIgnoreCase) != -1 + || this.DisplayName.IndexOf(substring, StringComparison.OrdinalIgnoreCase) != -1; } /// <summary>Get whether the item name is exactly equal to a case-insensitive string.</summary> @@ -53,8 +53,8 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.ItemData public bool NameEquivalentTo(string name) { return - this.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase) - || this.DisplayName.Equals(name, StringComparison.InvariantCultureIgnoreCase); + this.Name.Equals(name, StringComparison.OrdinalIgnoreCase) + || this.DisplayName.Equals(name, StringComparison.OrdinalIgnoreCase); } } } diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs index 6a17213c..37f5f8d1 100644 --- a/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs +++ b/src/SMAPI.Mods.ConsoleCommands/Framework/ItemRepository.cs @@ -77,7 +77,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework // furniture foreach (int id in this.TryLoad<int, string>("Data\\Furniture").Keys) { - if (id == 1466 || id == 1468) + if (id == 1466 || id == 1468 || id == 1680) yield return this.TryCreate(ItemType.Furniture, id, () => new TV(id, Vector2.Zero)); else yield return this.TryCreate(ItemType.Furniture, id, () => new Furniture(id, Vector2.Zero)); @@ -192,7 +192,7 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework SObject input = this.TryCreate(ItemType.Object, -1, () => new SObject(pair.Key, 1))?.Item as SObject; if (input == null || input.Category != SObject.FishCategory) continue; - Color color = TailoringMenu.GetDyeColor(input) ?? Color.Orange; + Color color = this.GetRoeColor(input); // yield roe SObject roe = null; @@ -259,12 +259,24 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework { try { - return new SearchableItem(type, id, createItem()); + var item = createItem(); + item.getDescription(); // force-load item data, so it crashes here if it's invalid + return new SearchableItem(type, id, item); } catch { return null; // if some item data is invalid, just don't include it } } + + /// <summary>Get the color to use a given fish's roe.</summary> + /// <param name="fish">The fish whose roe to color.</param> + /// <remarks>Derived from <see cref="StardewValley.Buildings.FishPond.GetFishProduce"/>.</remarks> + private Color GetRoeColor(SObject fish) + { + return fish.ParentSheetIndex == 698 // sturgeon + ? new Color(61, 55, 42) + : (TailoringMenu.GetDyeColor(fish) ?? Color.Orange); + } } } diff --git a/src/SMAPI.Mods.ConsoleCommands/manifest.json b/src/SMAPI.Mods.ConsoleCommands/manifest.json index 7300cdf8..1be55776 100644 --- a/src/SMAPI.Mods.ConsoleCommands/manifest.json +++ b/src/SMAPI.Mods.ConsoleCommands/manifest.json @@ -1,9 +1,9 @@ { "Name": "Console Commands", "Author": "SMAPI", - "Version": "3.6.1", + "Version": "3.6.2", "Description": "Adds SMAPI console commands that let you manipulate the game.", "UniqueID": "SMAPI.ConsoleCommands", "EntryDll": "ConsoleCommands.dll", - "MinimumApiVersion": "3.6.1" + "MinimumApiVersion": "3.6.2" } diff --git a/src/SMAPI.Mods.SaveBackup/manifest.json b/src/SMAPI.Mods.SaveBackup/manifest.json index cffd780d..c57ac162 100644 --- a/src/SMAPI.Mods.SaveBackup/manifest.json +++ b/src/SMAPI.Mods.SaveBackup/manifest.json @@ -1,9 +1,9 @@ { "Name": "Save Backup", "Author": "SMAPI", - "Version": "3.6.1", + "Version": "3.6.2", "Description": "Automatically backs up all your saves once per day into its folder.", "UniqueID": "SMAPI.SaveBackup", "EntryDll": "SaveBackup.dll", - "MinimumApiVersion": "3.6.1" + "MinimumApiVersion": "3.6.2" } diff --git a/src/SMAPI.Tests/SMAPI.Tests.csproj b/src/SMAPI.Tests/SMAPI.Tests.csproj index b1548e3a..6896808d 100644 --- a/src/SMAPI.Tests/SMAPI.Tests.csproj +++ b/src/SMAPI.Tests/SMAPI.Tests.csproj @@ -16,7 +16,7 @@ </ItemGroup> <ItemGroup> - <PackageReference Include="Moq" Version="4.14.1" /> + <PackageReference Include="Moq" Version="4.14.5" /> <PackageReference Include="Newtonsoft.Json" Version="12.0.3" /> <PackageReference Include="NUnit" Version="3.12.0" /> </ItemGroup> diff --git a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs index 34e2e1b8..89a22eaf 100644 --- a/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs +++ b/src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs @@ -233,7 +233,7 @@ namespace StardewModdingAPI.Toolkit.Framework.Clients.Wiki // parse // Specified on the wiki in the form "remote version → mapped version; another remote version → mapped version" - IDictionary<string, string> map = new Dictionary<string, string>(StringComparer.InvariantCultureIgnoreCase); + IDictionary<string, string> map = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); foreach ( |
