Remove useless passthrough vars

This commit is contained in:
Matt Nadareski
2020-09-12 14:11:55 -07:00
parent 3a2bda6fb6
commit ceddcc0722
5 changed files with 19 additions and 39 deletions

View File

@@ -87,7 +87,7 @@ namespace DICUI.Avalonia
// TODO: If log window open, "dock" it to the current Window
if (UIOptions.OpenLogWindowAtStartup)
if (UIOptions.Options.OpenLogWindowAtStartup)
{
//TODO: this should be bound directly to WindowVisible property in two way fashion
// we need to study how to properly do it in XAML
@@ -126,7 +126,7 @@ namespace DICUI.Avalonia
if (this.Find<ComboBox>("DriveLetterComboBox").SelectedItem is Drive drive)
{
// Get the current media type
if (!UIOptions.SkipMediaTypeDetection)
if (!UIOptions.Options.SkipMediaTypeDetection)
{
ViewModels.LoggerViewModel.VerboseLog("Trying to detect media type for drive {0}.. ", drive.Letter);
CurrentMediaType = Validators.GetMediaType(drive);
@@ -210,7 +210,7 @@ namespace DICUI.Avalonia
// Set the output directory, if we changed drives or it's not already
if (driveChanged || string.IsNullOrEmpty(this.Find<TextBox>("OutputDirectoryTextBox").Text))
this.Find<TextBox>("OutputDirectoryTextBox").Text = Path.Combine(UIOptions.DefaultOutputPath, drive?.VolumeLabel ?? string.Empty);
this.Find<TextBox>("OutputDirectoryTextBox").Text = Path.Combine(UIOptions.Options.DefaultOutputPath, drive?.VolumeLabel ?? string.Empty);
// Get the extension for the file for the next two statements
string extension = Env?.GetExtension(mediaType);
@@ -236,7 +236,7 @@ namespace DICUI.Avalonia
this.Find<Button>("MediaScanButton").IsEnabled = true;
// Populate the list of drives and add it to the combo box
Drives = Validators.CreateListOfDrives(UIOptions.IgnoreFixedDrives);
Drives = Validators.CreateListOfDrives(UIOptions.Options.IgnoreFixedDrives);
this.Find<ComboBox>("DriveLetterComboBox").Items = Drives;
if (Drives.Any())
@@ -258,7 +258,7 @@ namespace DICUI.Avalonia
this.Find<Button>("CopyProtectScanButton").IsEnabled = true;
// Get the current media type
if (!UIOptions.SkipSystemDetection && index != -1)
if (!UIOptions.Options.SkipSystemDetection && index != -1)
{
ViewModels.LoggerViewModel.VerboseLog("Trying to detect system for drive {0}.. ", Drives[index].Letter);
var currentSystem = Validators.GetKnownSystem(Drives[index]);
@@ -546,7 +546,7 @@ namespace DICUI.Avalonia
result = await Env.VerifyAndSaveDumpOutput(resultProgress,
protectionProgress,
this.Find<CheckBox>("EjectWhenDoneCheckBox").IsChecked,
UIOptions.ResetDriveAfterDump,
UIOptions.Options.ResetDriveAfterDump,
(si) =>
{
var discInformationWindow = new DiscInformationWindow();
@@ -789,7 +789,7 @@ namespace DICUI.Avalonia
Env.EjectDisc();
}
if (UIOptions.ResetDriveAfterDump)
if (UIOptions.Options.ResetDriveAfterDump)
{
ViewModels.LoggerViewModel.VerboseLogLn($"Resetting drive {Env.Drive.Letter}");
Env.ResetDrive();

View File

@@ -9,18 +9,6 @@ namespace DICUI.Avalonia
// TODO: Is there any way that this can be made private?
public Options Options { get; set; }
#region Passthrough readonly values
// TODO: Can any of these be removed?
public string DefaultOutputPath { get { return Options.DefaultOutputPath; } }
public bool IgnoreFixedDrives { get { return Options.IgnoreFixedDrives; } }
public bool ResetDriveAfterDump { get { return Options.ResetDriveAfterDump; } }
public bool SkipMediaTypeDetection { get { return Options.SkipMediaTypeDetection; } }
public bool SkipSystemDetection { get { return Options.SkipSystemDetection; } }
public bool OpenLogWindowAtStartup { get { return Options.OpenLogWindowAtStartup; } }
#endregion
/// <summary>
/// Default constructor
/// </summary>

View File

@@ -184,6 +184,8 @@ namespace DICUI.Data
this._settings = settings ?? new Dictionary<string, string>();
}
#region Helpers
/// <summary>
/// Get a Boolean setting from a settings, dictionary
/// </summary>
@@ -243,6 +245,8 @@ namespace DICUI.Data
return defaultValue;
}
#endregion
#region IDictionary implementations
public ICollection<string> Keys => _settings.Keys;

View File

@@ -9,18 +9,6 @@ namespace DICUI
// TODO: Is there any way that this can be made private?
public Options Options { get; set; }
#region Passthrough readonly values
// TODO: Can any of these be removed?
public string DefaultOutputPath { get { return Options.DefaultOutputPath; } }
public bool IgnoreFixedDrives { get { return Options.IgnoreFixedDrives; } }
public bool ResetDriveAfterDump { get { return Options.ResetDriveAfterDump; } }
public bool SkipMediaTypeDetection { get { return Options.SkipMediaTypeDetection; } }
public bool SkipSystemDetection { get { return Options.SkipSystemDetection; } }
public bool OpenLogWindowAtStartup { get { return Options.OpenLogWindowAtStartup; } }
#endregion
/// <summary>
/// Default constructor
/// </summary>

View File

@@ -89,7 +89,7 @@ namespace DICUI.Windows
MediaScanButton.IsEnabled = false;
CopyProtectScanButton.IsEnabled = false;
if (UIOptions.OpenLogWindowAtStartup)
if (UIOptions.Options.OpenLogWindowAtStartup)
{
this.WindowStartupLocation = WindowStartupLocation.Manual;
double combinedHeight = this.Height + logWindow.Height + Constants.LogWindowMarginFromMainWindow;
@@ -125,7 +125,7 @@ namespace DICUI.Windows
if (DriveLetterComboBox.SelectedItem is Drive drive)
{
// Get the current media type
if (!UIOptions.SkipMediaTypeDetection)
if (!UIOptions.Options.SkipMediaTypeDetection)
{
ViewModels.LoggerViewModel.VerboseLog("Trying to detect media type for drive {0}.. ", drive.Letter);
CurrentMediaType = Validators.GetMediaType(drive);
@@ -209,7 +209,7 @@ namespace DICUI.Windows
// Set the output directory, if we changed drives or it's not already
if (driveChanged || string.IsNullOrEmpty(OutputDirectoryTextBox.Text))
OutputDirectoryTextBox.Text = Path.Combine(UIOptions.DefaultOutputPath, drive?.VolumeLabel ?? string.Empty);
OutputDirectoryTextBox.Text = Path.Combine(UIOptions.Options.DefaultOutputPath, drive?.VolumeLabel ?? string.Empty);
// Get the extension for the file for the next two statements
string extension = Env.GetExtension(mediaType);
@@ -235,7 +235,7 @@ namespace DICUI.Windows
MediaScanButton.IsEnabled = true;
// Populate the list of drives and add it to the combo box
Drives = Validators.CreateListOfDrives(UIOptions.IgnoreFixedDrives);
Drives = Validators.CreateListOfDrives(UIOptions.Options.IgnoreFixedDrives);
DriveLetterComboBox.ItemsSource = Drives;
if (DriveLetterComboBox.Items.Count > 0)
@@ -257,7 +257,7 @@ namespace DICUI.Windows
CopyProtectScanButton.IsEnabled = true;
// Get the current media type
if (!UIOptions.SkipSystemDetection && index != -1)
if (!UIOptions.Options.SkipSystemDetection && index != -1)
{
ViewModels.LoggerViewModel.VerboseLog("Trying to detect system for drive {0}.. ", Drives[index].Letter);
var currentSystem = Validators.GetKnownSystem(Drives[index]);
@@ -534,7 +534,7 @@ namespace DICUI.Windows
result = await Env.VerifyAndSaveDumpOutput(resultProgress,
protectionProgress,
EjectWhenDoneCheckBox.IsChecked,
UIOptions.ResetDriveAfterDump,
UIOptions.Options.ResetDriveAfterDump,
(si) =>
{
// lazy initialization
@@ -711,7 +711,7 @@ namespace DICUI.Windows
alreadyShown = true;
if (UIOptions.OpenLogWindowAtStartup)
if (UIOptions.Options.OpenLogWindowAtStartup)
{
//TODO: this should be bound directly to WindowVisible property in two way fashion
// we need to study how to properly do it in XAML
@@ -827,7 +827,7 @@ namespace DICUI.Windows
Env.EjectDisc();
}
if (UIOptions.ResetDriveAfterDump)
if (UIOptions.Options.ResetDriveAfterDump)
{
ViewModels.LoggerViewModel.VerboseLogLn($"Resetting drive {Env.Drive.Letter}");
Env.ResetDrive();