log custom SMAPI settings to simplify troubleshooting
This commit is contained in:
parent
3cf3df8ffb
commit
4e7a67bc6d
|
@ -43,7 +43,6 @@ For modders:
|
||||||
* Improved mod scanning:
|
* Improved mod scanning:
|
||||||
* Now ignores metadata files and folders (like `__MACOSX` and `__folder_managed_by_vortex`) and content files (like `.txt` or `.png`), which avoids missing-manifest errors in some common cases.
|
* Now ignores metadata files and folders (like `__MACOSX` and `__folder_managed_by_vortex`) and content files (like `.txt` or `.png`), which avoids missing-manifest errors in some common cases.
|
||||||
* Now detects XNB mods more accurately, and consolidates multi-folder XNB mods in logged messages.
|
* Now detects XNB mods more accurately, and consolidates multi-folder XNB mods in logged messages.
|
||||||
* Added trace logs for skipped loose files so it's easier to troubleshoot player logs.
|
|
||||||
* Save Backup now works in the background, to avoid affecting startup time for players with a large number of saves.
|
* Save Backup now works in the background, to avoid affecting startup time for players with a large number of saves.
|
||||||
* The installer now recognises custom game paths stored in `stardewvalley.targets`.
|
* The installer now recognises custom game paths stored in `stardewvalley.targets`.
|
||||||
* Duplicate-mod errors now show the mod version in each folder.
|
* Duplicate-mod errors now show the mod version in each folder.
|
||||||
|
@ -93,6 +92,7 @@ For modders:
|
||||||
* Added separate `LogNetworkTraffic` option to make verbose logging less overwhelmingly verbose.
|
* Added separate `LogNetworkTraffic` option to make verbose logging less overwhelmingly verbose.
|
||||||
* Added asset propagation for `Data\FarmAnimals`, critter textures, and `DayTimeMoneyBox` buttons.
|
* Added asset propagation for `Data\FarmAnimals`, critter textures, and `DayTimeMoneyBox` buttons.
|
||||||
* Added `Texture2D.Name` values set to the asset key.
|
* Added `Texture2D.Name` values set to the asset key.
|
||||||
|
* Added trace logs for skipped loose files in the `Mods` folder and custom SMAPI settings so it's easier to troubleshoot player logs.
|
||||||
* `Constants.TargetPlatform` now returns `Android` when playing on an Android device.
|
* `Constants.TargetPlatform` now returns `Android` when playing on an Android device.
|
||||||
* Trace logs for a broken mod now list all detected issues (instead of the first one).
|
* Trace logs for a broken mod now list all detected issues (instead of the first one).
|
||||||
* Trace logs when loading mods are now more clear.
|
* Trace logs when loading mods are now more clear.
|
||||||
|
|
|
@ -1,3 +1,6 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
using StardewModdingAPI.Internal.ConsoleWriting;
|
using StardewModdingAPI.Internal.ConsoleWriting;
|
||||||
|
|
||||||
namespace StardewModdingAPI.Framework.Models
|
namespace StardewModdingAPI.Framework.Models
|
||||||
|
@ -5,6 +8,35 @@ namespace StardewModdingAPI.Framework.Models
|
||||||
/// <summary>The SMAPI configuration settings.</summary>
|
/// <summary>The SMAPI configuration settings.</summary>
|
||||||
internal class SConfig
|
internal class SConfig
|
||||||
{
|
{
|
||||||
|
/********
|
||||||
|
** Fields
|
||||||
|
********/
|
||||||
|
/// <summary>The default config values, for fields that should be logged if different.</summary>
|
||||||
|
private static readonly IDictionary<string, object> DefaultValues = new Dictionary<string, object>
|
||||||
|
{
|
||||||
|
[nameof(CheckForUpdates)] = true,
|
||||||
|
[nameof(ParanoidWarnings)] =
|
||||||
|
#if DEBUG
|
||||||
|
true,
|
||||||
|
#else
|
||||||
|
false,
|
||||||
|
#endif
|
||||||
|
[nameof(UseBetaChannel)] = Constants.ApiVersion.IsPrerelease(),
|
||||||
|
[nameof(GitHubProjectName)] = "Pathoschild/SMAPI",
|
||||||
|
[nameof(WebApiBaseUrl)] = "https://api.smapi.io",
|
||||||
|
[nameof(VerboseLogging)] = false,
|
||||||
|
[nameof(LogNetworkTraffic)] = false,
|
||||||
|
[nameof(DumpMetadata)] = false
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>The default values for <see cref="SuppressUpdateChecks"/>, to log changes if different.</summary>
|
||||||
|
private static readonly HashSet<string> DefaultSuppressUpdateChecks = new HashSet<string>(StringComparer.InvariantCultureIgnoreCase)
|
||||||
|
{
|
||||||
|
"SMAPI.ConsoleCommands",
|
||||||
|
"SMAPI.SaveBackup"
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
/********
|
/********
|
||||||
** Accessors
|
** Accessors
|
||||||
********/
|
********/
|
||||||
|
@ -15,15 +47,10 @@ namespace StardewModdingAPI.Framework.Models
|
||||||
public bool CheckForUpdates { get; set; }
|
public bool CheckForUpdates { get; set; }
|
||||||
|
|
||||||
/// <summary>Whether to add a section to the 'mod issues' list for mods which which directly use potentially sensitive .NET APIs like file or shell access.</summary>
|
/// <summary>Whether to add a section to the 'mod issues' list for mods which which directly use potentially sensitive .NET APIs like file or shell access.</summary>
|
||||||
public bool ParanoidWarnings { get; set; } =
|
public bool ParanoidWarnings { get; set; } = (bool)SConfig.DefaultValues[nameof(SConfig.ParanoidWarnings)];
|
||||||
#if DEBUG
|
|
||||||
true;
|
|
||||||
#else
|
|
||||||
false;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/// <summary>Whether to show beta versions as valid updates.</summary>
|
/// <summary>Whether to show beta versions as valid updates.</summary>
|
||||||
public bool UseBetaChannel { get; set; } = Constants.ApiVersion.IsPrerelease();
|
public bool UseBetaChannel { get; set; } = (bool)SConfig.DefaultValues[nameof(SConfig.UseBetaChannel)];
|
||||||
|
|
||||||
/// <summary>SMAPI's GitHub project name, used to perform update checks.</summary>
|
/// <summary>SMAPI's GitHub project name, used to perform update checks.</summary>
|
||||||
public string GitHubProjectName { get; set; }
|
public string GitHubProjectName { get; set; }
|
||||||
|
@ -45,5 +72,28 @@ namespace StardewModdingAPI.Framework.Models
|
||||||
|
|
||||||
/// <summary>The mod IDs SMAPI should ignore when performing update checks or validating update keys.</summary>
|
/// <summary>The mod IDs SMAPI should ignore when performing update checks or validating update keys.</summary>
|
||||||
public string[] SuppressUpdateChecks { get; set; }
|
public string[] SuppressUpdateChecks { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
/********
|
||||||
|
** Public methods
|
||||||
|
********/
|
||||||
|
/// <summary>Get the settings which have been customised by the player.</summary>
|
||||||
|
public IDictionary<string, object> GetCustomSettings()
|
||||||
|
{
|
||||||
|
IDictionary<string, object> custom = new Dictionary<string, object>();
|
||||||
|
|
||||||
|
foreach (var pair in SConfig.DefaultValues)
|
||||||
|
{
|
||||||
|
object value = typeof(SConfig).GetProperty(pair.Key)?.GetValue(this);
|
||||||
|
if (!pair.Value.Equals(value))
|
||||||
|
custom[pair.Key] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
HashSet<string> curSuppressUpdateChecks = new HashSet<string>(this.SuppressUpdateChecks ?? new string[0], StringComparer.InvariantCultureIgnoreCase);
|
||||||
|
if (SConfig.DefaultSuppressUpdateChecks.Count != curSuppressUpdateChecks.Count || SConfig.DefaultSuppressUpdateChecks.Any(p => !curSuppressUpdateChecks.Contains(p)))
|
||||||
|
custom[nameof(this.SuppressUpdateChecks)] = "[" + string.Join(", ", this.SuppressUpdateChecks ?? new string[0]) + "]";
|
||||||
|
|
||||||
|
return custom;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -164,6 +164,13 @@ namespace StardewModdingAPI.Framework
|
||||||
this.Monitor.Log("(Using custom --mods-path argument.)", LogLevel.Trace);
|
this.Monitor.Log("(Using custom --mods-path argument.)", LogLevel.Trace);
|
||||||
this.Monitor.Log($"Log started at {DateTime.UtcNow:s} UTC", LogLevel.Trace);
|
this.Monitor.Log($"Log started at {DateTime.UtcNow:s} UTC", LogLevel.Trace);
|
||||||
|
|
||||||
|
// log custom settings
|
||||||
|
{
|
||||||
|
IDictionary<string, object> customSettings = this.Settings.GetCustomSettings();
|
||||||
|
if (customSettings.Any())
|
||||||
|
this.Monitor.Log($"Loaded with custom settings: {string.Join(", ", customSettings.OrderBy(p => p.Key).Select(p => $"{p.Key}: {p.Value}"))}", LogLevel.Trace);
|
||||||
|
}
|
||||||
|
|
||||||
// validate platform
|
// validate platform
|
||||||
#if SMAPI_FOR_WINDOWS
|
#if SMAPI_FOR_WINDOWS
|
||||||
if (Constants.Platform != Platform.Windows)
|
if (Constants.Platform != Platform.Windows)
|
||||||
|
|
|
@ -3,6 +3,7 @@
|
||||||
|
|
||||||
|
|
||||||
This file contains advanced configuration for SMAPI. You generally shouldn't change this file.
|
This file contains advanced configuration for SMAPI. You generally shouldn't change this file.
|
||||||
|
The default values are mirrored in StardewModdingAPI.Framework.Models.SConfig to log custom changes.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue