summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/SMAPI.Installer/Framework/InstallerPaths.cs18
-rw-r--r--src/SMAPI.Installer/InteractiveInstaller.cs21
-rw-r--r--src/SMAPI.Installer/SMAPI.Installer.csproj15
-rw-r--r--src/SMAPI.Installer/assets/README.txt (renamed from src/SMAPI.Installer/README.txt)0
-rw-r--r--src/SMAPI.Installer/assets/System.Numerics.dllbin0 -> 54272 bytes
-rw-r--r--src/SMAPI.Installer/assets/System.Runtime.Caching.dllbin0 -> 71168 bytes
-rw-r--r--src/SMAPI.Installer/assets/unix-install.sh (renamed from src/SMAPI.Installer/unix-install.sh)0
-rw-r--r--src/SMAPI.Installer/assets/unix-launcher.sh (renamed from src/SMAPI.Installer/unix-launcher.sh)0
-rw-r--r--src/SMAPI.Installer/assets/windows-exe-config.xml (renamed from src/SMAPI.Installer/windows-exe-config.xml)0
-rw-r--r--src/SMAPI.Installer/assets/windows-install.bat (renamed from src/SMAPI.Installer/windows-install.bat)0
-rw-r--r--src/SMAPI.ModBuildConfig.Analyzer.Tests/SMAPI.ModBuildConfig.Analyzer.Tests.csproj5
-rw-r--r--src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs3
-rw-r--r--src/SMAPI.ModBuildConfig/package.nuspec17
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs59
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ITrainerCommand.cs14
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/PerformanceCounterCommand.cs647
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Other/TestInputCommand.cs59
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetHealthCommand.cs15
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetMoneyCommand.cs13
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/Player/SetStaminaCommand.cs15
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/TrainerCommand.cs30
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/Framework/Commands/World/FreezeTimeCommand.cs15
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/ModEntry.cs31
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/SMAPI.Mods.ConsoleCommands.csproj1
-rw-r--r--src/SMAPI.Mods.ConsoleCommands/manifest.json4
-rw-r--r--src/SMAPI.Mods.SaveBackup/ModEntry.cs52
-rw-r--r--src/SMAPI.Mods.SaveBackup/SMAPI.Mods.SaveBackup.csproj1
-rw-r--r--src/SMAPI.Mods.SaveBackup/manifest.json4
-rw-r--r--src/SMAPI.Tests/Utilities/SemanticVersionTests.cs208
-rw-r--r--src/SMAPI.Toolkit.CoreInterfaces/ISemanticVersion.cs3
-rw-r--r--src/SMAPI.Toolkit.CoreInterfaces/SMAPI.Toolkit.CoreInterfaces.csproj3
-rw-r--r--src/SMAPI.Toolkit/Framework/Clients/WebApi/ModEntryModel.cs22
-rw-r--r--src/SMAPI.Toolkit/Framework/Clients/WebApi/ModExtendedMetadataModel.cs16
-rw-r--r--src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiClient.cs12
-rw-r--r--src/SMAPI.Toolkit/Framework/Clients/Wiki/WikiModEntry.cs4
-rw-r--r--src/SMAPI.Toolkit/Framework/SemanticVersionReader.cs126
-rw-r--r--src/SMAPI.Toolkit/SMAPI.Toolkit.csproj5
-rw-r--r--src/SMAPI.Toolkit/SemanticVersion.cs72
-rw-r--r--src/SMAPI.Toolkit/Serialization/Converters/SemanticVersionConverter.cs2
-rw-r--r--src/SMAPI.Web.LegacyRedirects/SMAPI.Web.LegacyRedirects.csproj2
-rw-r--r--src/SMAPI.Web/Controllers/ModsApiController.cs17
-rw-r--r--src/SMAPI.Web/Framework/Caching/Wiki/CachedWikiMod.cs8
-rw-r--r--src/SMAPI.Web/Framework/Clients/Chucklefish/ChucklefishClient.cs2
-rw-r--r--src/SMAPI.Web/Framework/LogParsing/LogParser.cs9
-rw-r--r--src/SMAPI.Web/Framework/VersionConstraint.cs28
-rw-r--r--src/SMAPI.Web/SMAPI.Web.csproj14
-rw-r--r--src/SMAPI.Web/ViewModels/ModModel.cs7
-rw-r--r--src/SMAPI.Web/Views/Index/Index.cshtml159
-rw-r--r--src/SMAPI.Web/Views/Mods/Index.cshtml7
-rw-r--r--src/SMAPI.Web/Views/Shared/_Layout.cshtml7
-rw-r--r--src/SMAPI.Web/wwwroot/Content/css/index.css35
-rw-r--r--src/SMAPI/Constants.cs10
-rw-r--r--src/SMAPI/Framework/Content/ContentCache.cs1
-rw-r--r--src/SMAPI/Framework/ContentCoordinator.cs99
-rw-r--r--src/SMAPI/Framework/ContentManagers/GameContentManager.cs36
-rw-r--r--src/SMAPI/Framework/ContentManagers/ModContentManager.cs1
-rw-r--r--src/SMAPI/Framework/Events/EventManager.cs48
-rw-r--r--src/SMAPI/Framework/Events/IManagedEvent.cs15
-rw-r--r--src/SMAPI/Framework/Events/ManagedEvent.cs58
-rw-r--r--src/SMAPI/Framework/GameVersion.cs30
-rw-r--r--src/SMAPI/Framework/InternalExtensions.cs70
-rw-r--r--src/SMAPI/Framework/ModHelpers/DataHelper.cs2
-rw-r--r--src/SMAPI/Framework/ModLinked.cs29
-rw-r--r--src/SMAPI/Framework/PerformanceMonitoring/AlertContext.cs34
-rw-r--r--src/SMAPI/Framework/PerformanceMonitoring/AlertEntry.cs38
-rw-r--r--src/SMAPI/Framework/PerformanceMonitoring/PeakEntry.cs35
-rw-r--r--src/SMAPI/Framework/PerformanceMonitoring/PerformanceCounter.cs125
-rw-r--r--src/SMAPI/Framework/PerformanceMonitoring/PerformanceCounterCollection.cs205
-rw-r--r--src/SMAPI/Framework/PerformanceMonitoring/PerformanceCounterEntry.cs30
-rw-r--r--src/SMAPI/Framework/PerformanceMonitoring/PerformanceMonitor.cs184
-rw-r--r--src/SMAPI/Framework/SCore.cs66
-rw-r--r--src/SMAPI/Framework/SGame.cs11
-rw-r--r--src/SMAPI/Framework/Serialization/PointConverter.cs2
-rw-r--r--src/SMAPI/Framework/Serialization/Vector2Converter.cs43
-rw-r--r--src/SMAPI/Framework/SnapshotListDiff.cs6
-rw-r--r--src/SMAPI/Metadata/CoreAssetPropagator.cs53
-rw-r--r--src/SMAPI/Patches/LoadErrorPatch.cs87
-rw-r--r--src/SMAPI/Patches/ScheduleErrorPatch.cs86
-rw-r--r--src/SMAPI/Program.cs1
-rw-r--r--src/SMAPI/SMAPI.config.json6
-rw-r--r--src/SMAPI/SMAPI.csproj27
-rw-r--r--src/SMAPI/SemanticVersion.cs34
-rw-r--r--src/SMAPI/i18n/fr.json3
83 files changed, 2726 insertions, 556 deletions
diff --git a/src/SMAPI.Installer/Framework/InstallerPaths.cs b/src/SMAPI.Installer/Framework/InstallerPaths.cs
index 9393e14f..ac6c3a8e 100644
--- a/src/SMAPI.Installer/Framework/InstallerPaths.cs
+++ b/src/SMAPI.Installer/Framework/InstallerPaths.cs
@@ -8,6 +8,9 @@ namespace StardewModdingAPI.Installer.Framework
/*********
** Accessors
*********/
+ /****
+ ** Main folders
+ ****/
/// <summary>The directory path containing the files to copy into the game folder.</summary>
public DirectoryInfo BundleDir { get; }
@@ -17,9 +20,18 @@ namespace StardewModdingAPI.Installer.Framework
/// <summary>The directory into which to install mods.</summary>
public DirectoryInfo ModsDir { get; }
+ /****
+ ** Installer paths
+ ****/
/// <summary>The full path to directory path containing the files to copy into the game folder.</summary>
public string BundlePath => this.BundleDir.FullName;
+ /// <summary>The full path to the backup API user settings folder, if applicable.</summary>
+ public string BundleApiUserConfigPath { get; }
+
+ /****
+ ** Game paths
+ ****/
/// <summary>The full path to the directory containing the installed game.</summary>
public string GamePath => this.GameDir.FullName;
@@ -29,6 +41,9 @@ namespace StardewModdingAPI.Installer.Framework
/// <summary>The full path to SMAPI's internal configuration file.</summary>
public string ApiConfigPath { get; }
+ /// <summary>The full path to the user's config overrides file.</summary>
+ public string ApiUserConfigPath { get; }
+
/// <summary>The full path to the installed SMAPI executable file.</summary>
public string ExecutablePath { get; }
@@ -55,11 +70,14 @@ namespace StardewModdingAPI.Installer.Framework
this.GameDir = gameDir;
this.ModsDir = new DirectoryInfo(Path.Combine(gameDir.FullName, "Mods"));
+ this.BundleApiUserConfigPath = Path.Combine(bundleDir.FullName, "smapi-internal", "config.user.json");
+
this.ExecutablePath = Path.Combine(gameDir.FullName, gameExecutableName);
this.UnixLauncherPath = Path.Combine(gameDir.FullName, "StardewValley");
this.UnixSmapiLauncherPath = Path.Combine(gameDir.FullName, "StardewModdingAPI");
this.UnixBackupLauncherPath = Path.Combine(gameDir.FullName, "StardewValley-original");
this.ApiConfigPath = Path.Combine(gameDir.FullName, "smapi-internal", "config.json");
+ this.ApiUserConfigPath = Path.Combine(gameDir.FullName, "smapi-internal", "config.user.json");
}
}
}
diff --git a/src/SMAPI.Installer/InteractiveInstaller.cs b/src/SMAPI.Installer/InteractiveInstaller.cs
index 964300ac..2d58baf0 100644
--- a/src/SMAPI.Installer/InteractiveInstaller.cs
+++ b/src/SMAPI.Installer/InteractiveInstaller.cs
@@ -352,6 +352,12 @@ namespace StardewModdingApi.Installer
Console.WriteLine();
/****
+ ** Back up user settings
+ ****/
+ if (File.Exists(paths.ApiUserConfigPath))
+ File.Copy(paths.ApiUserConfigPath, paths.BundleApiUserConfigPath);
+
+ /****
** Always uninstall old files
****/
// restore game launcher
@@ -373,6 +379,21 @@ namespace StardewModdingApi.Installer
this.InteractivelyDelete(path);
}
+ // move global save data folder (changed in 3.2)
+ {
+ string dataPath = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "StardewValley");
+ DirectoryInfo oldDir = new DirectoryInfo(Path.Combine(dataPath, "Saves", ".smapi"));
+ DirectoryInfo newDir = new DirectoryInfo(Path.Combine(dataPath, ".smapi"));
+
+ if (oldDir.Exists)
+ {
+ if (newDir.Exists)
+ this.InteractivelyDelete(oldDir.FullName);
+ else
+ oldDir.MoveTo(newDir.FullName);
+ }
+ }
+
/****
** Install new files
****/
diff --git a/src/SMAPI.Installer/SMAPI.Installer.csproj b/src/SMAPI.Installer/SMAPI.Installer.csproj
index 3f01c8fe..79e19d89 100644
--- a/src/SMAPI.Installer/SMAPI.Installer.csproj
+++ b/src/SMAPI.Installer/SMAPI.Installer.csproj
@@ -8,7 +8,6 @@
<LangVersion>latest</LangVersion>
<OutputType>Exe</OutputType>
<PlatformTarget>x86</PlatformTarget>
- <OutputPath>$(SolutionDir)\..\bin\$(Configuration)\Installer</OutputPath>
<AppendTargetFrameworkToOutputPath>false</AppendTargetFrameworkToOutputPath>
</PropertyGroup>
@@ -17,19 +16,7 @@
</ItemGroup>
<ItemGroup>
- <None Update="README.txt">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="windows-exe-config.xml">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="windows-install.bat">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="unix-install.sh">
- <CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
- </None>
- <None Include="unix-launcher.sh">
+ <None Update="assets\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
</ItemGroup>
diff --git a/src/SMAPI.Installer/README.txt b/src/SMAPI.Installer/assets/README.txt
index 0da49a46..0da49a46 100644
--- a/src/SMAPI.Installer/README.txt
+++ b/src/SMAPI.Installer/assets/README.txt
diff --git a/src/SMAPI.Installer/assets/System.Numerics.dll b/src/SMAPI.Installer/assets/System.Numerics.dll
new file mode 100644
index 00000000..fed0f92c
--- /dev/null
+++ b/src/SMAPI.Installer/assets/System.Numerics.dll
Binary files differ
diff --git a/src/SMAPI.Installer/assets/System.Runtime.Caching.dll b/src/SMAPI.Installer/assets/System.Runtime.Caching.dll
new file mode 100644
index 00000000..a062391d
--- /dev/null
+++ b/src/SMAPI.Installer/assets/System.Runtime.Caching.dll
Binary files differ
diff --git a/src/SMAPI.Installer/unix-install.sh b/src/SMAPI.Installer/assets/unix-install.sh
index 6d0c86ce..6d0c86ce 100644
--- a/src/SMAPI.Installer/unix-install.sh
+++ b/src/SMAPI.Installer/assets/unix-install.sh
diff --git a/src/SMAPI.Installer/unix-launcher.sh b/src/SMAPI.Installer/assets/unix-launcher.sh
index b72eed22..b72eed22 100644
--- a/src/SMAPI.Installer/unix-launcher.sh
+++ b/src/SMAPI.Installer/assets/unix-launcher.sh
diff --git a/src/SMAPI.Installer/windows-exe-config.xml b/src/SMAPI.Installer/assets/windows-exe-config.xml
index 386c7f1a..386c7f1a 100644
--- a/src/SMAPI.Installer/windows-exe-config.xml
+++ b/src/SMAPI.Installer/assets/windows-exe-config.xml
diff --git a/src/SMAPI.Installer/windows-install.bat b/src/SMAPI.Installer/assets/windows-install.bat
index d02dd4c6..d02dd4c6 100644
--- a/src/SMAPI.Installer/windows-install.bat
+++ b/src/SMAPI.Installer/assets/windows-install.bat
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 7e3ce7d4..c1d5626f 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,10 @@
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="2.10.0" />
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
<PackageReference Include="NUnit" Version="3.12.0" />
- <PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
+ <PackageReference Include="NUnit3TestAdapter" Version="3.16.1">
+ <PrivateAssets>all</PrivateAssets>
+ <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
+ </PackageReference>
</ItemGroup>
<ItemGroup>
diff --git a/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs b/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs
index a852f133..f0363a3e 100644
--- a/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs
+++ b/src/SMAPI.ModBuildConfig/Framework/ModFileManager.cs
@@ -156,6 +156,9 @@ namespace StardewModdingAPI.ModBuildConfig.Framework
// release zips
this.EqualsInvariant(file.Extension, ".zip")
+ // Harmony (bundled into SMAPI)
+ || this.EqualsInvariant(file.Name, "0Harmony.dll")
+
// Json.NET (bundled into SMAPI)
|| this.EqualsInvariant(file.Name, "Newtonsoft.Json.dll")
|| this.EqualsInvariant(file.Name, "Newtonsoft.Json.pdb")
diff --git a/src/SMAPI.ModBuildConfig/package.nuspec b/src/SMAPI.ModBuildConfig/package.nuspec
index 846f438d..afb03cec 100644
--- a/src/SMAPI.ModBuildConfig/package.nuspec
+++ b/src/SMAPI.ModBuildConfig/package.nuspec
@@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2013/05/nuspec.xsd">
<metadata>
<id>Pathoschild.Stardew.ModBuildConfig</id>
- <version>3.0.0</version>
+ <version>3.1.0</version>
<title>Build package for SMAPI mods</title>
<authors>Pathoschild</authors>
<owners>Pathoschild</owners>
@@ -14,18 +14,9 @@
<iconUrl>https://raw.githubusercontent.com/Pathoschild/SMAPI/develop/src/SMAPI.ModBuildConfig/assets/nuget-icon.png</iconUrl>
<description>Automates the build configuration for crossplatform Stardew Valley SMAPI mods. For SMAPI 3.0 or later.</description>
<releaseNotes>
- 3.0.0:
- - Updated for SMAPI 3.0 and Stardew Valley 1.4.
- - Added automatic support for 'assets' folders.
- - Added $(GameExecutableName) MSBuild variable.
- - Added support for projects using the simplified .csproj format.
- - Added option to disable game debugging config.
- - Added .pdb files to builds by default (to enable line numbers in error stack traces).
- - Added optional Harmony reference.
- - Fixed Newtonsoft.Json.pdb included in release zips when Json.NET is referenced directly.
- - Fixed &lt;IgnoreModFilePatterns&gt; not working for i18n files.
- - Dropped support for older versions of SMAPI and Visual Studio.
- - Migrated package icon to NuGet's new format.
+ 3.1.0:
+ - Added support for semantic versioning 2.0.
+ - 0Harmony.dll is now ignored if the mod references it directly (it's bundled with SMAPI).
</releaseNotes>
</metadata>
<files>
diff --git a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs
index 10007b42..9c7082c9 100644
--- a/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs
+++ b/src/SMAPI.Mods.ConsoleCommands/Framework/Commands/ArgumentParser.cs
@@ -1,6 +1,7 @@
-using System;
+using System;
using System.Collections;
using System.Collections.Generic;
+using System.Globalization;
using System.Linq;
namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands
@@ -31,13 +32,6 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands
/// <param name="index">The zero-based index of the element to get.</param>
public string this[int index] => this.Args[index];
- /// <summary>A method which parses a string argument into the given value.</summary>
- /// <typeparam name="T">The expected argument type.</typeparam>
- /// <param name="input">The argument to parse.</param>
- /// <param name="output">The parsed value.</param>
- /// <returns>Returns whether the argument was successfully parsed.</returns>
- public delegate bool ParseDelegate<T>(string input, out T output);
-
/*********
** Public methods
@@ -113,6 +107,38 @@ namespace StardewModdingAPI.Mods.ConsoleCommands.Framework.Commands
return true;
}
+ /// <summary>Try to read a decimal argument.</summary>
+ /// <param name="index">The argument index.</param>
+ /// <param name="name">The argument name for error messages.</param>
+ /// <param name="value">The parsed value.</param>
+ /// <param name="required">Whether to show an error if the argument is missing.</param>
+ /// <param name="min">The minimum value allowed.</param>
+ /// <param name="max">The maximum value allowed.</param>
+ public bool TryGetDecimal(int index, string name, out decimal value, bool required = true, decimal? min = null, decimal? max = null)
+ {
+ value = 0;
+
+ // get argument
+ if (!this.TryGet(index, name, out string raw, required))
+ return false;
+
+ // parse
+ if (!decimal.TryParse(raw, NumberStyles.Number, CultureInfo.InvariantCulture, out value))