diff options
author | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-06-09 19:46:12 -0400 |
---|---|---|
committer | Jesse Plamondon-Willard <github@jplamondonw.com> | 2018-06-09 19:46:12 -0400 |
commit | 248ba90b75df31a657978c17ad4c6dff26210c96 (patch) | |
tree | b418ce63a35a89ca20338bf8a6f0f6169293aee4 /src | |
parent | 94e59482fc86da15d2e3f0599f46294b0b82ad62 (diff) | |
download | SMAPI-248ba90b75df31a657978c17ad4c6dff26210c96.tar.gz SMAPI-248ba90b75df31a657978c17ad4c6dff26210c96.tar.bz2 SMAPI-248ba90b75df31a657978c17ad4c6dff26210c96.zip |
add metadata dump option for troubleshooting
Diffstat (limited to 'src')
-rw-r--r-- | src/SMAPI/Framework/Models/ModFolderExport.cs | 21 | ||||
-rw-r--r-- | src/SMAPI/Framework/Models/SConfig.cs | 3 | ||||
-rw-r--r-- | src/SMAPI/Program.cs | 16 | ||||
-rw-r--r-- | src/SMAPI/StardewModdingAPI.config.json | 6 | ||||
-rw-r--r-- | src/SMAPI/StardewModdingAPI.csproj | 1 |
5 files changed, 46 insertions, 1 deletions
diff --git a/src/SMAPI/Framework/Models/ModFolderExport.cs b/src/SMAPI/Framework/Models/ModFolderExport.cs new file mode 100644 index 00000000..3b8d451a --- /dev/null +++ b/src/SMAPI/Framework/Models/ModFolderExport.cs @@ -0,0 +1,21 @@ +namespace StardewModdingAPI.Framework.Models +{ + /// <summary>Metadata exported to the mod folder.</summary> + internal class ModFolderExport + { + /// <summary>When the export was generated.</summary> + public string Exported { get; set; } + + /// <summary>The absolute path of the mod folder.</summary> + public string ModFolderPath { get; set; } + + /// <summary>The game version which last loaded the mods.</summary> + public string GameVersion { get; set; } + + /// <summary>The SMAPI version which last loaded the mods.</summary> + public string ApiVersion { get; set; } + + /// <summary>The detected mods.</summary> + public IModMetadata[] Mods { get; set; } + } +} diff --git a/src/SMAPI/Framework/Models/SConfig.cs b/src/SMAPI/Framework/Models/SConfig.cs index 98614933..15671af4 100644 --- a/src/SMAPI/Framework/Models/SConfig.cs +++ b/src/SMAPI/Framework/Models/SConfig.cs @@ -26,6 +26,9 @@ namespace StardewModdingAPI.Framework.Models /// <summary>Whether SMAPI should log more information about the game context.</summary> public bool VerboseLogging { get; set; } + /// <summary>Whether to generate a file in the mods folder with detailed metadata about the detected mods.</summary> + public bool DumpMetadata { get; set; } + /// <summary>The console color scheme to use.</summary> public MonitorColorScheme ColorScheme { get; set; } diff --git a/src/SMAPI/Program.cs b/src/SMAPI/Program.cs index 4ede45d5..350a6195 100644 --- a/src/SMAPI/Program.cs +++ b/src/SMAPI/Program.cs @@ -428,6 +428,20 @@ namespace StardewModdingAPI // load mods this.LoadMods(mods, this.JsonHelper, this.ContentCore, modDatabase); + // write metadata file + if (this.Settings.DumpMetadata) + { + ModFolderExport export = new ModFolderExport + { + Exported = DateTime.UtcNow.ToString("O"), + ApiVersion = Constants.ApiVersion.ToString(), + GameVersion = Constants.GameVersion.ToString(), + ModFolderPath = Constants.ModPath, + Mods = mods + }; + this.JsonHelper.WriteJsonFile(Path.Combine(Constants.LogDir, $"{Constants.LogNamePrefix}.metadata-dump.json"), export); + } + // check for updates this.CheckForUpdatesAsync(mods); } @@ -1276,7 +1290,7 @@ namespace StardewModdingAPI if (!logsDir.Exists) return; - foreach (FileInfo logFile in logsDir.EnumerateFiles("*.txt")) + foreach (FileInfo logFile in logsDir.EnumerateFiles()) { if (logFile.Name.StartsWith(Constants.LogNamePrefix, StringComparison.InvariantCultureIgnoreCase)) { diff --git a/src/SMAPI/StardewModdingAPI.config.json b/src/SMAPI/StardewModdingAPI.config.json index 7aac6e4c..115997ba 100644 --- a/src/SMAPI/StardewModdingAPI.config.json +++ b/src/SMAPI/StardewModdingAPI.config.json @@ -45,6 +45,12 @@ This file contains advanced configuration for SMAPI. You generally shouldn't cha "VerboseLogging": false, /** + * Whether to generate a 'SMAPI-latest.metadata-dump.json' file in the logs folder with the full mod + * metadata for detected mods. This is only needed when troubleshooting some cases. + */ + "DumpMetadata": false, + + /** * The console color theme to use. The possible values are: * - AutoDetect: SMAPI will assume a light background on Mac, and detect the background color automatically on Linux or Windows. * - LightBackground: use darker text colors that look better on a white or light background. diff --git a/src/SMAPI/StardewModdingAPI.csproj b/src/SMAPI/StardewModdingAPI.csproj index 2df3e63f..8e3ad83b 100644 --- a/src/SMAPI/StardewModdingAPI.csproj +++ b/src/SMAPI/StardewModdingAPI.csproj @@ -107,6 +107,7 @@ <Compile Include="Framework\ContentManagers\GameContentManager.cs" /> <Compile Include="Framework\ContentManagers\IContentManager.cs" /> <Compile Include="Framework\ContentManagers\ModContentManager.cs" /> + <Compile Include="Framework\Models\ModFolderExport.cs" /> <Compile Include="Framework\Patching\GamePatcher.cs" /> <Compile Include="Framework\Patching\IHarmonyPatch.cs" /> <Compile Include="Framework\Serialisation\ColorConverter.cs" /> |