diff --git a/CHANGELIST.md b/CHANGELIST.md index cca29c6a..531fa18f 100644 --- a/CHANGELIST.md +++ b/CHANGELIST.md @@ -13,6 +13,7 @@ - Enable nullability in MPF - Enable nullability in MPF.UI.Core - Enable nullability in MPF.Test +- Handle some suggested changes ### 2.7.0 (2023-10-11) diff --git a/MPF.Core/Data/Options.cs b/MPF.Core/Data/Options.cs index 91666c21..ab3e5096 100644 --- a/MPF.Core/Data/Options.cs +++ b/MPF.Core/Data/Options.cs @@ -4,11 +4,7 @@ using SabreTools.RedumpLib.Data; namespace MPF.Core.Data { -#if NET48 public class Options -#else - public class Options -#endif { /// /// All settings in the form of a dictionary @@ -664,9 +660,9 @@ namespace MPF.Core.Data /// Default value to return if no value is found /// Setting value if possible, default value otherwise #if NET48 - private bool GetBooleanSetting(Dictionary settings, string key, bool defaultValue) + private static bool GetBooleanSetting(Dictionary settings, string key, bool defaultValue) #else - private bool GetBooleanSetting(Dictionary settings, string key, bool defaultValue) + private static bool GetBooleanSetting(Dictionary settings, string key, bool defaultValue) #endif { if (settings.ContainsKey(key)) @@ -690,9 +686,9 @@ namespace MPF.Core.Data /// Default value to return if no value is found /// Setting value if possible, default value otherwise #if NET48 - private int GetInt32Setting(Dictionary settings, string key, int defaultValue) + private static int GetInt32Setting(Dictionary settings, string key, int defaultValue) #else - private int GetInt32Setting(Dictionary settings, string key, int defaultValue) + private static int GetInt32Setting(Dictionary settings, string key, int defaultValue) #endif { if (settings.ContainsKey(key)) @@ -716,9 +712,9 @@ namespace MPF.Core.Data /// Default value to return if no value is found /// Setting value if possible, default value otherwise #if NET48 - private string GetStringSetting(Dictionary settings, string key, string defaultValue) + private static string GetStringSetting(Dictionary settings, string key, string defaultValue) #else - private string? GetStringSetting(Dictionary settings, string key, string? defaultValue) + private static string? GetStringSetting(Dictionary settings, string key, string? defaultValue) #endif { if (settings.ContainsKey(key)) diff --git a/MPF.Core/UI/ViewModels/MainViewModel.cs b/MPF.Core/UI/ViewModels/MainViewModel.cs index 74cc3b90..0f12fffe 100644 --- a/MPF.Core/UI/ViewModels/MainViewModel.cs +++ b/MPF.Core/UI/ViewModels/MainViewModel.cs @@ -104,7 +104,7 @@ namespace MPF.Core.UI.ViewModels set { _optionsMenuItemEnabled = value; - TriggerPropertyChanged("OptionsMenuItemEnabled"); + TriggerPropertyChanged(nameof(OptionsMenuItemEnabled)); } } private bool _optionsMenuItemEnabled; @@ -118,7 +118,7 @@ namespace MPF.Core.UI.ViewModels set { _currentSystem = value; - TriggerPropertyChanged("CurrentSystem"); + TriggerPropertyChanged(nameof(CurrentSystem)); } } private RedumpSystem? _currentSystem; @@ -132,7 +132,7 @@ namespace MPF.Core.UI.ViewModels set { _systemTypeComboBoxEnabled = value; - TriggerPropertyChanged("SystemTypeComboBoxEnabled"); + TriggerPropertyChanged(nameof(SystemTypeComboBoxEnabled)); } } private bool _systemTypeComboBoxEnabled; @@ -146,7 +146,7 @@ namespace MPF.Core.UI.ViewModels set { _currentMediaType = value; - TriggerPropertyChanged("CurrentMediaType"); + TriggerPropertyChanged(nameof(CurrentMediaType)); } } private MediaType? _currentMediaType; @@ -160,7 +160,7 @@ namespace MPF.Core.UI.ViewModels set { _mediaTypeComboBoxEnabled = value; - TriggerPropertyChanged("MediaTypeComboBoxEnabled"); + TriggerPropertyChanged(nameof(MediaTypeComboBoxEnabled)); } } private bool _mediaTypeComboBoxEnabled; @@ -174,7 +174,7 @@ namespace MPF.Core.UI.ViewModels set { _outputPath = value; - TriggerPropertyChanged("OutputPath"); + TriggerPropertyChanged(nameof(OutputPath)); } } private string _outputPath; @@ -188,7 +188,7 @@ namespace MPF.Core.UI.ViewModels set { _outputPathTextBoxEnabled = value; - TriggerPropertyChanged("OutputPathTextBoxEnabled"); + TriggerPropertyChanged(nameof(OutputPathTextBoxEnabled)); } } private bool _outputPathTextBoxEnabled; @@ -202,7 +202,7 @@ namespace MPF.Core.UI.ViewModels set { _outputPathBrowseButtonEnabled = value; - TriggerPropertyChanged("OutputPathBrowseButtonEnabled"); + TriggerPropertyChanged(nameof(OutputPathBrowseButtonEnabled)); } } private bool _outputPathBrowseButtonEnabled; @@ -220,7 +220,7 @@ namespace MPF.Core.UI.ViewModels set { _currentDrive = value; - TriggerPropertyChanged("CurrentDrive"); + TriggerPropertyChanged(nameof(CurrentDrive)); } } #if NET48 @@ -238,7 +238,7 @@ namespace MPF.Core.UI.ViewModels set { _driveLetterComboBoxEnabled = value; - TriggerPropertyChanged("DriveLetterComboBoxEnabled"); + TriggerPropertyChanged(nameof(DriveLetterComboBoxEnabled)); } } private bool _driveLetterComboBoxEnabled; @@ -252,7 +252,7 @@ namespace MPF.Core.UI.ViewModels set { _driveSpeed = value; - TriggerPropertyChanged("DriveSpeed"); + TriggerPropertyChanged(nameof(DriveSpeed)); } } private int _driveSpeed; @@ -266,7 +266,7 @@ namespace MPF.Core.UI.ViewModels set { _driveSpeedComboBoxEnabled = value; - TriggerPropertyChanged("DriveSpeedComboBoxEnabled"); + TriggerPropertyChanged(nameof(DriveSpeedComboBoxEnabled)); } } private bool _driveSpeedComboBoxEnabled; @@ -280,7 +280,7 @@ namespace MPF.Core.UI.ViewModels set { _currentProgram = value; - TriggerPropertyChanged("CurrentProgram"); + TriggerPropertyChanged(nameof(CurrentProgram)); } } private InternalProgram _currentProgram; @@ -294,7 +294,7 @@ namespace MPF.Core.UI.ViewModels set { _dumpingProgramComboBoxEnabled = value; - TriggerPropertyChanged("DumpingProgramComboBoxEnabled"); + TriggerPropertyChanged(nameof(DumpingProgramComboBoxEnabled)); } } private bool _dumpingProgramComboBoxEnabled; @@ -308,7 +308,7 @@ namespace MPF.Core.UI.ViewModels set { _parameters = value; - TriggerPropertyChanged("Parameters"); + TriggerPropertyChanged(nameof(Parameters)); } } private string _parameters; @@ -322,7 +322,7 @@ namespace MPF.Core.UI.ViewModels set { _parametersCheckBoxEnabled = value; - TriggerPropertyChanged("ParametersCheckBoxEnabled"); + TriggerPropertyChanged(nameof(ParametersCheckBoxEnabled)); } } private bool _parametersCheckBoxEnabled; @@ -336,7 +336,7 @@ namespace MPF.Core.UI.ViewModels set { _enableParametersCheckBoxEnabled = value; - TriggerPropertyChanged("EnableParametersCheckBoxEnabled"); + TriggerPropertyChanged(nameof(EnableParametersCheckBoxEnabled)); } } private bool _enableParametersCheckBoxEnabled; @@ -350,7 +350,7 @@ namespace MPF.Core.UI.ViewModels set { _startStopButtonEnabled = value; - TriggerPropertyChanged("StartStopButtonEnabled"); + TriggerPropertyChanged(nameof(StartStopButtonEnabled)); } } private bool _startStopButtonEnabled; @@ -364,7 +364,7 @@ namespace MPF.Core.UI.ViewModels set { _startStopButtonText = (value as string) ?? string.Empty; - TriggerPropertyChanged("StartStopButtonText"); + TriggerPropertyChanged(nameof(StartStopButtonText)); } } private string _startStopButtonText; @@ -378,7 +378,7 @@ namespace MPF.Core.UI.ViewModels set { _mediaScanButtonEnabled = value; - TriggerPropertyChanged("MediaScanButtonEnabled"); + TriggerPropertyChanged(nameof(MediaScanButtonEnabled)); } } private bool _mediaScanButtonEnabled; @@ -392,7 +392,7 @@ namespace MPF.Core.UI.ViewModels set { _updateVolumeLabelEnabled = value; - TriggerPropertyChanged("UpdateVolumeLabelEnabled"); + TriggerPropertyChanged(nameof(UpdateVolumeLabelEnabled)); } } private bool _updateVolumeLabelEnabled; @@ -406,7 +406,7 @@ namespace MPF.Core.UI.ViewModels set { _copyProtectScanButtonEnabled = value; - TriggerPropertyChanged("CopyProtectScanButtonEnabled"); + TriggerPropertyChanged(nameof(CopyProtectScanButtonEnabled)); } } private bool _copyProtectScanButtonEnabled; @@ -420,7 +420,7 @@ namespace MPF.Core.UI.ViewModels set { _status = value; - TriggerPropertyChanged("Status"); + TriggerPropertyChanged(nameof(Status)); } } private string _status; @@ -434,7 +434,7 @@ namespace MPF.Core.UI.ViewModels set { _logPanelExpanded = value; - TriggerPropertyChanged("LogPanelExpanded"); + TriggerPropertyChanged(nameof(LogPanelExpanded)); } } private bool _logPanelExpanded; @@ -452,7 +452,7 @@ namespace MPF.Core.UI.ViewModels set { _drives = value; - TriggerPropertyChanged("Drives"); + TriggerPropertyChanged(nameof(Drives)); } } private List _drives; @@ -466,7 +466,7 @@ namespace MPF.Core.UI.ViewModels set { _driveSpeeds = value; - TriggerPropertyChanged("DriveSpeeds"); + TriggerPropertyChanged(nameof(DriveSpeeds)); } } private List _driveSpeeds; @@ -484,7 +484,7 @@ namespace MPF.Core.UI.ViewModels set { _mediaTypes = value; - TriggerPropertyChanged("MediaTypes"); + TriggerPropertyChanged(nameof(MediaTypes)); } } #if NET48 @@ -502,7 +502,7 @@ namespace MPF.Core.UI.ViewModels set { _systems = value; - TriggerPropertyChanged("Systems"); + TriggerPropertyChanged(nameof(Systems)); } } private List _systems; @@ -516,7 +516,7 @@ namespace MPF.Core.UI.ViewModels set { _internalPrograms = value; - TriggerPropertyChanged("InternalPrograms"); + TriggerPropertyChanged(nameof(InternalPrograms)); } } private List> _internalPrograms; @@ -801,7 +801,7 @@ namespace MPF.Core.UI.ViewModels /// /// Build a dummy SubmissionInfo /// - public SubmissionInfo CreateDebugSubmissionInfo() + public static SubmissionInfo CreateDebugSubmissionInfo() { return new SubmissionInfo() { @@ -994,7 +994,7 @@ namespace MPF.Core.UI.ViewModels } } -#endregion + #endregion #region UI Functionality @@ -1822,7 +1822,11 @@ namespace MPF.Core.UI.ViewModels var message = value?.Message; // Update the label with only the first line of output +#if NET48 if (message != null && message.Contains("\n")) +#else + if (message != null && message.Contains('\n')) +#endif this.Status = value?.Message?.Split('\n')[0] + " (See log output)"; else this.Status = value?.Message ?? string.Empty; @@ -1848,6 +1852,6 @@ namespace MPF.Core.UI.ViewModels VerboseLogLn(message); } - #endregion +#endregion } } diff --git a/MPF.Test/Modules/DiscImageCreatorTests.cs b/MPF.Test/Modules/DiscImageCreatorTests.cs index 2302ca85..510f44a4 100644 --- a/MPF.Test/Modules/DiscImageCreatorTests.cs +++ b/MPF.Test/Modules/DiscImageCreatorTests.cs @@ -1,4 +1,5 @@ -using System.Collections.Generic; +using System; +using System.Collections.Generic; using MPF.Core.Data; using MPF.Core.Modules.DiscImageCreator; using SabreTools.RedumpLib.Data; @@ -33,7 +34,7 @@ namespace MPF.Test.Modules var options = new Options(); var actual = new Parameters(knownSystem, mediaType, 'D', "disc.bin", 16, options); - HashSet expectedSet = new HashSet(expected ?? new string[0]); + HashSet expectedSet = new HashSet(expected ?? Array.Empty()); HashSet actualSet = GenerateUsedKeys(actual); Assert.Equal(expectedSet, actualSet); } @@ -46,7 +47,7 @@ namespace MPF.Test.Modules var options = new Options { DICRereadCount = rereadC2 }; var actual = new Parameters(knownSystem, mediaType, 'D', "disc.bin", 16, options); - HashSet expectedSet = new HashSet(expected ?? new string[0]); + HashSet expectedSet = new HashSet(expected ?? Array.Empty()); HashSet actualSet = GenerateUsedKeys(actual); Assert.Equal(expectedSet, actualSet); @@ -66,7 +67,7 @@ namespace MPF.Test.Modules var options = new Options { DICDVDRereadCount = rereadDVDBD }; var actual = new Parameters(knownSystem, mediaType, 'D', "disc.bin", 16, options); - HashSet expectedSet = new HashSet(expected ?? new string[0]); + HashSet expectedSet = new HashSet(expected ?? Array.Empty()); HashSet actualSet = GenerateUsedKeys(actual); Assert.Equal(expectedSet, actualSet); @@ -90,7 +91,7 @@ namespace MPF.Test.Modules var options = new Options { DICMultiSectorRead = multiSectorRead }; var actual = new Parameters(knownSystem, mediaType, 'D', "disc.bin", 16, options); - HashSet expectedSet = new HashSet(expected ?? new string[0]); + HashSet expectedSet = new HashSet(expected ?? Array.Empty()); HashSet actualSet = GenerateUsedKeys(actual); Assert.Equal(expectedSet, actualSet); if (expectedSet.Count != 1 && multiSectorRead) @@ -111,7 +112,7 @@ namespace MPF.Test.Modules var options = new Options { DICParanoidMode = paranoidMode }; var actual = new Parameters(knownSystem, mediaType, 'D', "disc.bin", 16, options); - HashSet expectedSet = new HashSet(expected ?? new string[0]); + HashSet expectedSet = new HashSet(expected ?? Array.Empty()); HashSet actualSet = GenerateUsedKeys(actual); Assert.Equal(expectedSet, actualSet); if (paranoidMode) diff --git a/MPF.UI.Core/ElementConverter.cs b/MPF.UI.Core/ElementConverter.cs index 600e42ef..7ec74f92 100644 --- a/MPF.UI.Core/ElementConverter.cs +++ b/MPF.UI.Core/ElementConverter.cs @@ -37,8 +37,7 @@ namespace MPF.UI.Core #endif { // If it's an IElement but ends up null - var element = value as IElement; - if (element == null) + if (!(value is IElement element)) return null; switch (element) diff --git a/MPF.UI.Core/External/WPFCustomMessageBox/CustomMessageBox.cs b/MPF.UI.Core/External/WPFCustomMessageBox/CustomMessageBox.cs index 791d02a9..49c9f1e4 100644 --- a/MPF.UI.Core/External/WPFCustomMessageBox/CustomMessageBox.cs +++ b/MPF.UI.Core/External/WPFCustomMessageBox/CustomMessageBox.cs @@ -18,7 +18,7 @@ namespace WPFCustomMessageBox /// Global parameter to enable (true) or disable (false) the removal of the title bar icon. /// If you are using a custom window style, the icon removal may cause issues like displaying two title bar (the default windows one and the custom one). /// - public static bool RemoveTitleBarIcon = true; + private static readonly bool RemoveTitleBarIcon = true; /// /// Displays a message box that has a message and returns a result. @@ -578,7 +578,7 @@ namespace WPFCustomMessageBox { if (timeout.HasValue && timeout.Value <= 0) { - throw new ArgumentOutOfRangeException("timeout", string.Format("Timeout must be greater than 0.")); + throw new ArgumentOutOfRangeException(nameof(timeout), string.Format("Timeout must be greater than 0.")); } if (timeout.HasValue) diff --git a/MPF.UI.Core/External/WPFCustomMessageBox/CustomMessageBoxWindow.xaml.cs b/MPF.UI.Core/External/WPFCustomMessageBox/CustomMessageBoxWindow.xaml.cs index 72952708..b2525f77 100644 --- a/MPF.UI.Core/External/WPFCustomMessageBox/CustomMessageBoxWindow.xaml.cs +++ b/MPF.UI.Core/External/WPFCustomMessageBox/CustomMessageBoxWindow.xaml.cs @@ -10,7 +10,7 @@ namespace WPFCustomMessageBox /// internal partial class CustomMessageBoxWindow : Window { - private bool _removeTitleBarIcon = true; + private readonly bool _removeTitleBarIcon = true; #if NET48 public string Caption diff --git a/MPF.UI.Core/External/WPFCustomMessageBox/Util.cs b/MPF.UI.Core/External/WPFCustomMessageBox/Util.cs index ea64f77c..7642f00f 100644 --- a/MPF.UI.Core/External/WPFCustomMessageBox/Util.cs +++ b/MPF.UI.Core/External/WPFCustomMessageBox/Util.cs @@ -88,7 +88,7 @@ namespace WPFCustomMessageBox IntPtr hwnd = new WindowInteropHelper(window).Handle; // Change the extended window style to not show a window icon int extendedStyle = GetWindowLong(hwnd, GWL_EXSTYLE); - SetWindowLong(hwnd, GWL_EXSTYLE, extendedStyle | WS_EX_DLGMODALFRAME); + _ = SetWindowLong(hwnd, GWL_EXSTYLE, extendedStyle | WS_EX_DLGMODALFRAME); // Update the window's non-client area to reflect the changes SetWindowPos(hwnd, IntPtr.Zero, 0, 0, 0, 0, SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER | SWP_FRAMECHANGED); } diff --git a/MPF.UI.Core/Windows/DiscInformationWindow.xaml.cs b/MPF.UI.Core/Windows/DiscInformationWindow.xaml.cs index 64bfa0b1..c2e7f71b 100644 --- a/MPF.UI.Core/Windows/DiscInformationWindow.xaml.cs +++ b/MPF.UI.Core/Windows/DiscInformationWindow.xaml.cs @@ -151,43 +151,43 @@ namespace MPF.UI.Core.Windows ErrorsCount.Visibility = Visibility.Collapsed; if (string.IsNullOrWhiteSpace(submissionInfo.CommonDiscInfo?.EXEDateBuildDate)) EXEDateBuildDate.Visibility = Visibility.Collapsed; - if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.Keys.Contains(SiteCode.Filename) != true) + if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.Filename) != true) Filename.Visibility = Visibility.Collapsed; if (string.IsNullOrWhiteSpace(submissionInfo.Extras?.Header)) Header.Visibility = Visibility.Collapsed; - if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.Keys.Contains(SiteCode.InternalName) != true) + if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.InternalName) != true) InternalName.Visibility = Visibility.Collapsed; - if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.Keys.Contains(SiteCode.InternalSerialName) != true) + if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.InternalSerialName) != true) InternalSerialName.Visibility = Visibility.Collapsed; - if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.Keys.Contains(SiteCode.Multisession) != true) + if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.Multisession) != true) Multisession.Visibility = Visibility.Collapsed; if (submissionInfo.CopyProtection?.LibCrypt == null) LibCrypt.Visibility = Visibility.Collapsed; if (string.IsNullOrWhiteSpace(submissionInfo.CopyProtection?.LibCryptData)) LibCryptData.Visibility = Visibility.Collapsed; - if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.Keys.Contains(SiteCode.PFIHash) != true) + if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.PFIHash) != true) PFIHash.Visibility = Visibility.Collapsed; if (string.IsNullOrWhiteSpace(submissionInfo.Extras?.PIC)) PIC.Visibility = Visibility.Collapsed; if (string.IsNullOrWhiteSpace(submissionInfo.Extras?.PVD)) PVD.Visibility = Visibility.Collapsed; - if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.Keys.Contains(SiteCode.RingNonZeroDataStart) != true) + if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.RingNonZeroDataStart) != true) RingNonZeroDataStart.Visibility = Visibility.Collapsed; if (string.IsNullOrWhiteSpace(submissionInfo.CopyProtection?.SecuROMData)) SecuROMData.Visibility = Visibility.Collapsed; - if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.Keys.Contains(SiteCode.SSHash) != true) + if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.SSHash) != true) SSHash.Visibility = Visibility.Collapsed; if (string.IsNullOrWhiteSpace(submissionInfo.Extras?.SecuritySectorRanges)) SecuritySectorRanges.Visibility = Visibility.Collapsed; - if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.Keys.Contains(SiteCode.SSVersion) != true) + if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.SSVersion) != true) SSVersion.Visibility = Visibility.Collapsed; - if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.Keys.Contains(SiteCode.UniversalHash) != true) + if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.UniversalHash) != true) UniversalHash.Visibility = Visibility.Collapsed; - if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.Keys.Contains(SiteCode.VolumeLabel) != true) + if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.VolumeLabel) != true) VolumeLabel.Visibility = Visibility.Collapsed; - if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.Keys.Contains(SiteCode.XeMID) != true) + if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.XeMID) != true) XeMID.Visibility = Visibility.Collapsed; - if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.Keys.Contains(SiteCode.XMID) != true) + if (submissionInfo.CommonDiscInfo?.CommentsSpecialFields?.ContainsKey(SiteCode.XMID) != true) XMID.Visibility = Visibility.Collapsed; } diff --git a/MPF.UI.Core/Windows/OptionsWindow.xaml.cs b/MPF.UI.Core/Windows/OptionsWindow.xaml.cs index c2c50b65..68307f32 100644 --- a/MPF.UI.Core/Windows/OptionsWindow.xaml.cs +++ b/MPF.UI.Core/Windows/OptionsWindow.xaml.cs @@ -115,9 +115,9 @@ namespace MPF.UI.Core.Windows /// Setting name to find /// TextBox for that setting #if NET48 - private System.Windows.Controls.TextBox TextBoxForPathSetting(Window parent, string name) => + private static System.Windows.Controls.TextBox TextBoxForPathSetting(Window parent, string name) => #else - private System.Windows.Controls.TextBox? TextBoxForPathSetting(Window parent, string name) => + private static System.Windows.Controls.TextBox? TextBoxForPathSetting(Window parent, string name) => #endif parent.FindName(name + "TextBox") as System.Windows.Controls.TextBox;