mirror of
https://github.com/SabreTools/MPF.git
synced 2026-07-02 17:24:48 +00:00
Always write full configuration file (fixes #839)
This commit is contained in:
@@ -4,6 +4,7 @@
|
||||
- Update redumper to build 549
|
||||
- Allow max speed dumping ("0")
|
||||
- Normalize file path in CLI
|
||||
- Always write full configuration file
|
||||
|
||||
### 3.3.0 (2025-01-03)
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ namespace MPF.CLI
|
||||
|
||||
// Reset first run
|
||||
options.FirstRun = false;
|
||||
OptionsLoader.SaveToConfig(options, saveDefault: true);
|
||||
OptionsLoader.SaveToConfig(options);
|
||||
}
|
||||
|
||||
// Try processing the standalone arguments
|
||||
|
||||
@@ -315,29 +315,26 @@ namespace MPF.Frontend.Tools
|
||||
/// <summary>
|
||||
/// Save the current set of options to the application configuration
|
||||
/// </summary>
|
||||
public static void SaveToConfig(Options options, bool saveDefault = false)
|
||||
public static void SaveToConfig(Options options)
|
||||
{
|
||||
// If no options path can be found
|
||||
if (string.IsNullOrEmpty(ConfigurationPath))
|
||||
return;
|
||||
|
||||
// If default values should be saved as well
|
||||
if (saveDefault)
|
||||
// Ensure default values are included
|
||||
PropertyInfo[] properties = typeof(Options).GetProperties();
|
||||
foreach (var property in properties)
|
||||
{
|
||||
PropertyInfo[] properties = typeof(Options).GetProperties();
|
||||
foreach (var property in properties)
|
||||
{
|
||||
// Skip dictionary properties
|
||||
if (property.Name == "Item")
|
||||
continue;
|
||||
// Skip dictionary properties
|
||||
if (property.Name == "Item")
|
||||
continue;
|
||||
|
||||
// Skip non-option properties
|
||||
if (property.Name == "Settings" || property.Name == "HasRedumpLogin")
|
||||
continue;
|
||||
// Skip non-option properties
|
||||
if (property.Name == "Settings" || property.Name == "HasRedumpLogin")
|
||||
continue;
|
||||
|
||||
var val = property.GetValue(options, null);
|
||||
property.SetValue(options, val, null);
|
||||
}
|
||||
var val = property.GetValue(options, null);
|
||||
property.SetValue(options, val, null);
|
||||
}
|
||||
|
||||
// Handle a very strange edge case
|
||||
@@ -368,7 +365,7 @@ namespace MPF.Frontend.Tools
|
||||
|
||||
// Local folder
|
||||
#if NET20 || NET35 || NET40 || NET452
|
||||
string runtimeDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
string runtimeDir = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
|
||||
#else
|
||||
string runtimeDir = AppContext.BaseDirectory;
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user