diff --git a/CHANGELIST.md b/CHANGELIST.md
index 058fd6a2..bd08c80e 100644
--- a/CHANGELIST.md
+++ b/CHANGELIST.md
@@ -25,6 +25,7 @@
- Replace Options with SegmentedOptions in most places
- Fix ListConfig feature with new layout
- Move InternalProgram up a level in options, fix XAML
+- Fix path assignment from UI
### 3.6.0 (2025-11-28)
diff --git a/MPF.Frontend/DumpEnvironment.cs b/MPF.Frontend/DumpEnvironment.cs
index 44244b75..68cb1236 100644
--- a/MPF.Frontend/DumpEnvironment.cs
+++ b/MPF.Frontend/DumpEnvironment.cs
@@ -284,10 +284,10 @@ namespace MPF.Frontend
// Set the proper parameters
_executionContext = _internalProgram switch
{
- InternalProgram.Aaru => new ExecutionContexts.Aaru.ExecutionContext(_system, mediaType, _drive.Name, OutputPath, driveSpeed, _options.ConvertToOptions().Settings),
- InternalProgram.DiscImageCreator => new ExecutionContexts.DiscImageCreator.ExecutionContext(_system, mediaType, _drive.Name, OutputPath, driveSpeed, _options.ConvertToOptions().Settings),
- // InternalProgram.Dreamdump => new ExecutionContexts.Dreamdump.ExecutionContext(_system, mediaType, _drive.Name, OutputPath, driveSpeed, _options.ConvertToOptions().Settings),
- InternalProgram.Redumper => new ExecutionContexts.Redumper.ExecutionContext(_system, mediaType, _drive.Name, OutputPath, driveSpeed, _options.ConvertToOptions().Settings),
+ InternalProgram.Aaru => new ExecutionContexts.Aaru.ExecutionContext(_system, mediaType, _drive.Name, OutputPath, driveSpeed, _options.Settings),
+ InternalProgram.DiscImageCreator => new ExecutionContexts.DiscImageCreator.ExecutionContext(_system, mediaType, _drive.Name, OutputPath, driveSpeed, _options.Settings),
+ // InternalProgram.Dreamdump => new ExecutionContexts.Dreamdump.ExecutionContext(_system, mediaType, _drive.Name, OutputPath, driveSpeed, _options.Settings),
+ InternalProgram.Redumper => new ExecutionContexts.Redumper.ExecutionContext(_system, mediaType, _drive.Name, OutputPath, driveSpeed, _options.Settings),
// If no dumping program found, set to null
InternalProgram.NONE => null,
diff --git a/MPF.Frontend/SegmentedOptions.cs b/MPF.Frontend/SegmentedOptions.cs
index 98be4389..c8afa345 100644
--- a/MPF.Frontend/SegmentedOptions.cs
+++ b/MPF.Frontend/SegmentedOptions.cs
@@ -1,4 +1,5 @@
using System;
+using System.Collections.Generic;
using System.IO;
using SabreTools.RedumpLib.Data;
using AaruConstants = MPF.ExecutionContexts.Aaru.SettingConstants;
@@ -64,6 +65,19 @@ namespace MPF.Frontend
#endregion
+ #region Passthrough Properties
+
+ ///
+ /// All settings in the form of a dictionary
+ ///
+ /// TODO: Remove when Options is no longer relevant
+ public Dictionary Settings
+ {
+ get { return ConvertToOptions().Settings; }
+ }
+
+ #endregion
+
#region Constructors
///
@@ -266,7 +280,7 @@ namespace MPF.Frontend
/// Convert to an Options object
///
/// TODO: Remove when Options is no longer relevant
- public Options ConvertToOptions()
+ private Options ConvertToOptions()
{
return new Options
{
diff --git a/MPF.Frontend/Tools/OptionsLoader.cs b/MPF.Frontend/Tools/OptionsLoader.cs
index 0ff27f84..00366ed9 100644
--- a/MPF.Frontend/Tools/OptionsLoader.cs
+++ b/MPF.Frontend/Tools/OptionsLoader.cs
@@ -228,7 +228,7 @@ namespace MPF.Frontend.Tools
///
/// Save the current set of options to the application configuration
///
- public static void SaveToConfig(Options options)
+ public static void SaveToConfig(SegmentedOptions options)
{
// If no options path can be found
if (string.IsNullOrEmpty(ConfigurationPath))
@@ -261,7 +261,7 @@ namespace MPF.Frontend.Tools
///
/// Save the current set of options to the application configuration
///
- public static void SaveToConfig(SegmentedOptions options)
+ public static void SaveToConfigNative(SegmentedOptions options)
{
// If no options path can be found
if (string.IsNullOrEmpty(ConfigurationPath))
diff --git a/MPF.Frontend/ViewModels/MainViewModel.cs b/MPF.Frontend/ViewModels/MainViewModel.cs
index 426d3fc8..0fcc96b1 100644
--- a/MPF.Frontend/ViewModels/MainViewModel.cs
+++ b/MPF.Frontend/ViewModels/MainViewModel.cs
@@ -26,7 +26,7 @@ namespace MPF.Frontend.ViewModels
set
{
_options = value;
- OptionsLoader.SaveToConfig(_options.ConvertToOptions());
+ OptionsLoader.SaveToConfig(_options);
}
}
private SegmentedOptions _options;
diff --git a/MPF.Frontend/ViewModels/OptionsViewModel.cs b/MPF.Frontend/ViewModels/OptionsViewModel.cs
index a5d715bf..4edb9234 100644
--- a/MPF.Frontend/ViewModels/OptionsViewModel.cs
+++ b/MPF.Frontend/ViewModels/OptionsViewModel.cs
@@ -1,4 +1,4 @@
-using System.Collections.Generic;
+using System.Collections.Generic;
using System.ComponentModel;
using MPF.Frontend.ComboBoxItems;
using LogCompression = MPF.Processors.LogCompression;
diff --git a/MPF.UI/Windows/OptionsWindow.xaml.cs b/MPF.UI/Windows/OptionsWindow.xaml.cs
index 75ad5e89..402c94ad 100644
--- a/MPF.UI/Windows/OptionsWindow.xaml.cs
+++ b/MPF.UI/Windows/OptionsWindow.xaml.cs
@@ -1,4 +1,4 @@
-using System;
+using System;
using System.IO;
using System.Threading.Tasks;
using System.Windows;
@@ -64,10 +64,10 @@ namespace MPF.UI.Windows
RedumpPasswordBox!.Password = options.Processing.Login.RedumpPassword;
// Add handlers
- AaruPathButton!.Click += BrowseForPathClick;
- DiscImageCreatorPathButton!.Click += BrowseForPathClick;
- RedumperPathButton!.Click += BrowseForPathClick;
- DefaultOutputPathButton!.Click += BrowseForPathClick;
+ AaruPathButton!.Click += BrowseForAaruPathClick;
+ DiscImageCreatorPathButton!.Click += BrowseForDiscImageCreatorPathClick;
+ RedumperPathButton!.Click += BrowseForRedumperPathClick;
+ DefaultOutputPathButton!.Click += BrowseForDefaultOutputPathClick;
AcceptButton!.Click += OnAcceptClick;
CancelButton!.Click += OnCancelClick;
@@ -91,11 +91,11 @@ namespace MPF.UI.Windows
///
/// Browse and set a path based on the invoking button
///
- private void BrowseForPath(Window parent, System.Windows.Controls.Button? button)
+ private string? BrowseForPath(Window parent, System.Windows.Controls.Button? button)
{
// If the button is null, we can't do anything
if (button is null)
- return;
+ return null;
// Strips button prefix to obtain the setting name
#if NETCOREAPP || NETSTANDARD2_1_OR_GREATER
@@ -118,38 +118,39 @@ namespace MPF.UI.Windows
using (dialog)
{
DialogResult result = dialog.ShowDialog();
- if (result == System.Windows.Forms.DialogResult.OK)
+ if (result != System.Windows.Forms.DialogResult.OK)
+ return null;
+
+ string path = string.Empty;
+ bool exists = false;
+
+ if (shouldBrowseForPath && dialog is FolderBrowserDialog folderBrowserDialog)
{
- string path = string.Empty;
- bool exists = false;
-
- if (shouldBrowseForPath && dialog is FolderBrowserDialog folderBrowserDialog)
- {
- path = folderBrowserDialog.SelectedPath;
- exists = Directory.Exists(path);
- }
- else if (dialog is OpenFileDialog openFileDialog)
- {
- path = openFileDialog.FileName;
- exists = File.Exists(path);
- }
-
- if (exists)
- {
- OptionsViewModel.Options.ConvertToOptions()[pathSettingName] = path;
- var textBox = TextBoxForPathSetting(parent, pathSettingName);
- textBox?.Text = path;
- }
- else
- {
- CustomMessageBox.Show(
- "Specified path doesn't exist!",
- (string)System.Windows.Application.Current.FindResource("ErrorMessageString"),
- MessageBoxButton.OK,
- MessageBoxImage.Error
- );
- }
+ path = folderBrowserDialog.SelectedPath;
+ exists = Directory.Exists(path);
}
+ else if (dialog is OpenFileDialog openFileDialog)
+ {
+ path = openFileDialog.FileName;
+ exists = File.Exists(path);
+ }
+
+ if (exists)
+ {
+ var textBox = TextBoxForPathSetting(parent, pathSettingName);
+ textBox?.Text = path;
+ }
+ else
+ {
+ CustomMessageBox.Show(
+ "Specified path doesn't exist!",
+ (string)System.Windows.Application.Current.FindResource("ErrorMessageString"),
+ MessageBoxButton.OK,
+ MessageBoxImage.Error
+ );
+ }
+
+ return path;
}
}
@@ -205,8 +206,42 @@ namespace MPF.UI.Windows
///
/// Handler for generic Click event
///
- private void BrowseForPathClick(object sender, EventArgs e)
- => BrowseForPath(this, sender as System.Windows.Controls.Button);
+ private void BrowseForAaruPathClick(object sender, EventArgs e)
+ {
+ string? result = BrowseForPath(this, sender as System.Windows.Controls.Button);
+ if (result is not null)
+ OptionsViewModel.Options.Dumping.AaruPath = result;
+ }
+
+ ///
+ /// Handler for generic Click event
+ ///
+ private void BrowseForDefaultOutputPathClick(object sender, EventArgs e)
+ {
+ string? result = BrowseForPath(this, sender as System.Windows.Controls.Button);
+ if (result is not null)
+ OptionsViewModel.Options.Dumping.DefaultOutputPath = result;
+ }
+
+ ///
+ /// Handler for generic Click event
+ ///
+ private void BrowseForDiscImageCreatorPathClick(object sender, EventArgs e)
+ {
+ string? result = BrowseForPath(this, sender as System.Windows.Controls.Button);
+ if (result is not null)
+ OptionsViewModel.Options.Dumping.DiscImageCreatorPath = result;
+ }
+
+ ///
+ /// Handler for generic Click event
+ ///
+ private void BrowseForRedumperPathClick(object sender, EventArgs e)
+ {
+ string? result = BrowseForPath(this, sender as System.Windows.Controls.Button);
+ if (result is not null)
+ OptionsViewModel.Options.Dumping.RedumperPath = result;
+ }
///
/// Alert user of non-redump mode implications