Fix eject and reset

This commit is contained in:
Matt Nadareski
2020-05-06 16:06:30 -07:00
parent dc90f9af3f
commit 230b6ca721
2 changed files with 15 additions and 6 deletions

View File

@@ -23,6 +23,12 @@ namespace DICUI.Utilities
{
#region Tool paths
/// <summary>
/// Path to DiscImageCreator executable
/// </summary>
/// <remarks>DiscImageCreator is both used as an internal tool and an extra tool</remarks>
public string DiscImageCreatorPath { get; set; }
/// <summary>
/// Path to Subdump executable
/// </summary>
@@ -160,6 +166,7 @@ namespace DICUI.Utilities
string parameters)
{
// Tool paths
this.DiscImageCreatorPath = options.CreatorPath;
this.SubdumpPath = options.SubDumpPath;
// Output paths
@@ -259,12 +266,12 @@ namespace DICUI.Utilities
}
/// <summary>
/// Eject the disc using DIC
/// Eject the disc using DiscImageCreator
/// </summary>
public async void EjectDisc()
{
// Validate that the required program exists
if (!File.Exists(Parameters.Path))
if (!File.Exists(this.DiscImageCreatorPath))
return;
CancelDumping();
@@ -277,6 +284,7 @@ namespace DICUI.Utilities
{
BaseCommand = DiscImageCreator.Command.Eject,
DriveLetter = Drive.Letter.ToString(),
Path = this.DiscImageCreatorPath,
};
await ExecuteInternalProgram(parameters);
@@ -400,12 +408,12 @@ namespace DICUI.Utilities
}
/// <summary>
/// Reset the current drive using DIC
/// Reset the current drive using DiscImageCreator
/// </summary>
public async void ResetDrive()
{
// Validate that the required program exists
if (!File.Exists(Parameters.Path))
if (!File.Exists(this.DiscImageCreatorPath))
return;
// Precautionary check for dumping, just in case
@@ -419,6 +427,7 @@ namespace DICUI.Utilities
{
BaseCommand = DiscImageCreator.Command.Reset,
DriveLetter = Drive.Letter.ToString(),
Path = this.DiscImageCreatorPath,
};
await ExecuteInternalProgram(parameters);

View File

@@ -546,8 +546,8 @@ namespace DICUI.Windows
_uiOptions.Options.ResetDriveAfterDump,
(si) =>
{
// lazy initialization
if (_discInformationWindow == null)
// lazy initialization
if (_discInformationWindow == null)
{
_discInformationWindow = new DiscInformationWindow(this, si);
_discInformationWindow.Closed += delegate