Bits and Bobs (#88)

* Finally overhaul UI element naming

* Re-enable disk scan button

* Add cabfile scanning

* Fix csproj

* Fix TODO

* Add a couple more protections, disable one for now

* Fix SecuROM 7 detection

Thanks antimatter for helping test

* No beep for eject and speed check

* Fix Options after renames

* Ensure disc information in  couple places again
This commit is contained in:
Matt Nadareski
2018-07-07 00:08:22 -07:00
committed by GitHub
parent c034df4266
commit 96d6e8bd2f
11 changed files with 224 additions and 151 deletions

View File

@@ -1,9 +1,9 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="dicPath" value="Programs\DiscImageCreator.exe"/>
<add key="subdumpPath" value="subdump.exe"/>
<add key="defaultOutputPath" value="ISO"/>
<add key="DICPath" value="Programs\DiscImageCreator.exe"/>
<add key="SubDumpPath" value="subdump.exe"/>
<add key="DefaultOutputPath" value="ISO"/>
<add key="preferredDumpSpeedCD" value="72"/>
<add key="preferredDumpSpeedDVD" value="24"/>
</appSettings>

View File

@@ -67,6 +67,12 @@
</PropertyGroup>
<PropertyGroup />
<ItemGroup>
<Reference Include="LessIO, Version=0.5.0.0, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\LessIO.0.5.0\lib\net40\LessIO.dll</HintPath>
</Reference>
<Reference Include="libmspackn, Version=0.8.0.0, Culture=neutral, processorArchitecture=x86">
<HintPath>..\packages\libmspack4n.0.8.0\lib\net40\libmspackn.dll</HintPath>
</Reference>
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Data" />
@@ -130,6 +136,7 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
@@ -166,5 +173,10 @@
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<Content Include="mspack.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -21,6 +21,7 @@ using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Text;
using LibMSPackN;
namespace DICUI.External
{
@@ -88,7 +89,7 @@ namespace DICUI.External
/// Scan an individual file for copy protection
/// </summary>
/// <remarks>
/// TODO: Handle archives (zip, arc, cab[ms], cab[is])
/// TODO: Handle archives (zip, arc, cab[is])
/// TODO: Find protection mentions in text files
/// TODO: Might have to work on Streams instead to later support archives
/// </remarks>
@@ -98,7 +99,10 @@ namespace DICUI.External
#region EXE/DLL/ICD/DAT Content Checks
if (extension == "exe" || extension == "dll" || extension == "dat" || extension == "icd")
if (extension == "exe" || extension == "ex_"
|| extension == "dll" || extension == "dl_"
|| extension == "dat"
|| extension == "icd")
{
try
{
@@ -205,7 +209,8 @@ namespace DICUI.External
if ((position = FileContent.IndexOf("" + (char)0xCA + (char)0xDD + (char)0xDD + (char)0xAC + (char)0x03)) > -1)
return "SecuROM " + GetSecuROM4and5Version(file, position);
if (FileContent.StartsWith(".securom" + (char)0xE0 + (char)0xC0))
if (FileContent.Contains(".securom"))
//if (FileContent.StartsWith(".securom" + (char)0xE0 + (char)0xC0))
return "SecuROM " + GetSecuROM7Version(file);
if (FileContent.Contains("_and_play.dll" + (char)0x00 + "drm_pagui_doit"))
@@ -228,7 +233,7 @@ namespace DICUI.External
string desc = FileVersionInfo.GetVersionInfo(file).FileDescription.ToLower();
if (!string.IsNullOrEmpty(version) && desc.Contains("solidshield"))
return "SolidShield Core.dll " + version;
return "SolidShield EXE Wrapper";
//return "SolidShield EXE Wrapper";
}
}
@@ -349,10 +354,44 @@ namespace DICUI.External
#region Archive Content Checks
if (extension == "7z" || extension == "cab" || extension == "rar" || extension == "zip")
if (extension == "7z" || extension == "rar" || extension == "zip")
{
// No-op
}
else if (extension == "cab")
{
string tempPath = Path.Combine(Path.GetTempPath(), Guid.NewGuid().ToString());
Directory.CreateDirectory(tempPath);
try
{
MSCabinet cabfile = new MSCabinet(file);
foreach (var sub in cabfile.GetFiles())
{
string tempfile = Path.Combine(tempPath, sub.Filename);
sub.ExtractTo(tempfile);
string protection = ScanInFile(tempfile);
File.Delete(tempfile);
if (!String.IsNullOrEmpty(protection))
{
return protection;
}
}
}
catch
{
// We assume it's an InstallShield CAB and ignore
}
finally
{
try
{
Directory.Delete(tempPath, true);
}
catch { }
}
}
#endregion
@@ -1119,6 +1158,12 @@ namespace DICUI.External
// CopyKiller
mapping["Tom Commander"] = "CopyKiller";
// Cucko (EA Custom) - TODO: Verify this doesn't over-match
mapping["EASTL"] = "Cucko (EA Custom)";
// dotFuscator - Not a protection
//mapping["DotfuscatorAttribute"] = "dotFuscator";
// EXE Stealth
mapping["??[[__[[_" + (char)0x00 + "{{" + (char)0x0
+ (char)0x00 + "{{" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x0
@@ -1142,6 +1187,9 @@ namespace DICUI.External
mapping["LASERLOK_INIT" + (char)0xC + "LASERLOK_RUN" + (char)0xE + "LASERLOK_CHECK"
+ (char)0xF + "LASERLOK_CHECK2" + (char)0xF + "LASERLOK_CHECK3"] = "LaserLock 5";
// PE Compact 2 - Not a protection
//mapping["PEC2"] = "PE Compact 2";
// Ring-Protech
mapping[(char)0x00 + "Allocator" + (char)0x00 + (char)0x00 + (char)0x00 + (char)0x00] = "Ring-Protech";

View File

@@ -56,14 +56,14 @@
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Content="System/Media Type" />
<ComboBox x:Name="cmb_SystemType" Grid.Row="0" Grid.Column="1" Height="22" Width="250" HorizontalAlignment="left" SelectionChanged="cmb_SystemType_SelectionChanged">
<ComboBox x:Name="SystemTypeComboBox" Grid.Row="0" Grid.Column="1" Height="22" Width="250" HorizontalAlignment="left" SelectionChanged="SystemTypeComboBoxSelectionChanged">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Name}" Foreground="{Binding Path=Foreground}" />
</DataTemplate>
</ComboBox.ItemTemplate>
</ComboBox>
<ComboBox x:Name="cmb_MediaType" Grid.Row="0" Grid.Column="1" Height="22" Width="140" HorizontalAlignment="right" SelectionChanged="cmb_MediaType_SelectionChanged">
<ComboBox x:Name="MediaTypeComboBox" Grid.Row="0" Grid.Column="1" Height="22" Width="140" HorizontalAlignment="right" SelectionChanged="MediaTypeComboBoxSelectionChanged">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Converter={StaticResource enumConverter}}" />
@@ -72,14 +72,14 @@
</ComboBox>
<Label Grid.Row="1" Grid.Column="0" VerticalAlignment="Center">Output Filename</Label>
<TextBox x:Name="txt_OutputFilename" Grid.Row="1" Grid.Column="1" Height="22" TextChanged="txt_OutputFilename_TextChanged" />
<TextBox x:Name="OutputFilenameTextBox" Grid.Row="1" Grid.Column="1" Height="22" TextChanged="OutputFilenameTextBoxTextChanged" />
<Label Grid.Row="2" Grid.Column="0" VerticalAlignment="Center">Output Directory</Label>
<TextBox x:Name="txt_OutputDirectory" Grid.Row="2" Grid.Column="1" Height="22" Width="345" HorizontalAlignment="left" TextChanged="txt_OutputDirectory_TextChanged" />
<Button x:Name="btn_OutputDirectoryBrowse" Grid.Row="2" Grid.Column="1" Height="22" Width="50" HorizontalAlignment="Right" Content="Browse" Click="btn_OutputDirectoryBrowse_Click"/>
<TextBox x:Name="OutputDirectoryTextBox" Grid.Row="2" Grid.Column="1" Height="22" Width="345" HorizontalAlignment="left" TextChanged="OutputDirectoryTextBoxTextChanged" />
<Button x:Name="OutputDirectoryBrowseButton" Grid.Row="2" Grid.Column="1" Height="22" Width="50" HorizontalAlignment="Right" Content="Browse" Click="OutputDirectoryBrowseButtonClick"/>
<Label Grid.Row="3" Grid.Column="0" VerticalAlignment="Center">Drive Letter</Label>
<ComboBox x:Name="cmb_DriveLetter" Grid.Row="3" Grid.Column="1" Height="22" Width="60" HorizontalAlignment="left" SelectionChanged="cmb_DriveLetter_SelectionChanged">
<ComboBox x:Name="DriveLetterComboBox" Grid.Row="3" Grid.Column="1" Height="22" Width="60" HorizontalAlignment="left" SelectionChanged="DriveLetterComboBoxSelectionChanged">
<ComboBox.ItemTemplate>
<DataTemplate>
<TextBlock Text="{Binding Path=Letter}" />
@@ -88,10 +88,10 @@
</ComboBox>
<Label Grid.Row="4" Grid.Column="0" VerticalAlignment="Center">Drive Speed</Label>
<ComboBox x:Name="cmb_DriveSpeed" Grid.Row="4" Grid.Column="1" Height="22" Width="60" HorizontalAlignment="left" SelectionChanged="cmb_DriveSpeed_SelectionChanged" />
<ComboBox x:Name="DriveSpeedComboBox" Grid.Row="4" Grid.Column="1" Height="22" Width="60" HorizontalAlignment="left" SelectionChanged="DriveSpeedComboBoxSelectionChanged" />
<Label Grid.Row="5" Grid.Column="0" VerticalAlignment="Center">Parameters</Label>
<TextBox x:Name="txt_Parameters" Grid.Row="5" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" IsEnabled="False" />
<TextBox x:Name="ParametersTextBox" Grid.Row="5" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" IsEnabled="False" />
</Grid>
<Grid Grid.Row="2" Grid.Column="0" Margin="15,19.6,15.2,9.8" Grid.ColumnSpan="2">
@@ -105,10 +105,10 @@
<RowDefinition/>
</Grid.RowDefinitions>
<Button x:Name="btn_StartStop" Grid.Row="0" Grid.Column="0" Height="22" Width="125" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Start Dumping" Click="btn_StartStop_Click" IsEnabled="False" />
<Button x:Name="btn_Search" Grid.Row="0" Grid.Column="1" Height="22" Width="125" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Scan for disks" Click="btn_Search_Click" />
<Button x:Name="btn_Scan" Grid.Row="0" Grid.Column="2" Height="22" Width="125" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Scan for protection" Click="btn_Scan_Click" />
<CheckBox x:Name="chk_EjectWhenDone" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Eject When Done" IsChecked="False" />
<Button x:Name="StartStopButton" Grid.Row="0" Grid.Column="0" Height="22" Width="125" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Start Dumping" Click="StartStopButtonClick" IsEnabled="False" />
<Button x:Name="DiskScanButton" Grid.Row="0" Grid.Column="1" Height="22" Width="125" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Scan for disks" Click="DiskScanButtonClick" />
<Button x:Name="CopyProtectScanButton" Grid.Row="0" Grid.Column="2" Height="22" Width="125" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Scan for protection" Click="CopyProtectScanButtonClick" />
<CheckBox x:Name="EjectWhenDoneCheckBox" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Eject When Done" IsChecked="False" />
</Grid>
<Grid Grid.Row="3" Grid.Column="0" Margin="15,20.2,15.2,9.8" Grid.ColumnSpan="2">
@@ -119,7 +119,7 @@
<RowDefinition/>
</Grid.RowDefinitions>
<Label x:Name="lbl_Status" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Waiting for CD or DVD..." />
<Label x:Name="StatusLabel" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Waiting for CD or DVD..." />
</Grid>
</Grid>
</Window>

View File

@@ -35,9 +35,9 @@ namespace DICUI
_options.Load();
// Disable buttons until we load fully
btn_StartStop.IsEnabled = false;
btn_Search.IsEnabled = false;
btn_Scan.IsEnabled = false;
StartStopButton.IsEnabled = false;
DiskScanButton.IsEnabled = false;
CopyProtectScanButton.IsEnabled = false;
}
#region Events
@@ -52,73 +52,75 @@ namespace DICUI
_alreadyShown = true;
// Populate the list of systems
lbl_Status.Content = "Creating system list, please wait!";
StatusLabel.Content = "Creating system list, please wait!";
PopulateSystems();
// Populate the list of drives
lbl_Status.Content = "Creating drive list, please wait!";
StatusLabel.Content = "Creating drive list, please wait!";
PopulateDrives();
}
private void btn_StartStop_Click(object sender, RoutedEventArgs e)
private void StartStopButtonClick(object sender, RoutedEventArgs e)
{
// Dump or stop the dump
if ((string)btn_StartStop.Content == UIElements.StartDumping)
if ((string)StartStopButton.Content == UIElements.StartDumping)
{
StartDumping();
}
else if ((string)btn_StartStop.Content == UIElements.StopDumping)
else if ((string)StartStopButton.Content == UIElements.StopDumping)
{
_env.CancelDumping();
btn_Scan.IsEnabled = true;
CopyProtectScanButton.IsEnabled = true;
if (chk_EjectWhenDone.IsChecked == true)
if (EjectWhenDoneCheckBox.IsChecked == true)
_env.EjectDisc();
}
}
private void btn_OutputDirectoryBrowse_Click(object sender, RoutedEventArgs e)
private void OutputDirectoryBrowseButtonClick(object sender, RoutedEventArgs e)
{
BrowseFolder();
EnsureDiscInformation();
}
private void btn_Search_Click(object sender, RoutedEventArgs e)
private void DiskScanButtonClick(object sender, RoutedEventArgs e)
{
PopulateDrives();
}
private void btn_Scan_Click(object sender, RoutedEventArgs e)
private void CopyProtectScanButtonClick(object sender, RoutedEventArgs e)
{
ScanAndShowProtection();
}
private void cmb_SystemType_SelectionChanged(object sender, SelectionChangedEventArgs e)
private void SystemTypeComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
{
// If we're on a separator, go to the next item and return
if ((cmb_SystemType.SelectedItem as KnownSystemComboBoxItem).IsHeader())
if ((SystemTypeComboBox.SelectedItem as KnownSystemComboBoxItem).IsHeader())
{
cmb_SystemType.SelectedIndex++;
SystemTypeComboBox.SelectedIndex++;
return;
}
PopulateMediaType();
EnsureDiscInformation();
}
private void cmb_MediaType_SelectionChanged(object sender, SelectionChangedEventArgs e)
private void MediaTypeComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
{
// Only change the media type if the selection and not the list has changed
if (e.RemovedItems.Count == 1 && e.AddedItems.Count == 1)
{
_currentMediaType = cmb_MediaType.SelectedItem as MediaType?;
_currentMediaType = MediaTypeComboBox.SelectedItem as MediaType?;
}
// TODO: This is giving people the benefit of the doubt that their change is valid
SetSupportedDriveSpeed();
GetOutputNames();
EnsureDiscInformation();
}
private void cmb_DriveLetter_SelectionChanged(object sender, SelectionChangedEventArgs e)
private void DriveLetterComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
{
CacheCurrentDiscType();
SetCurrentDiscType();
@@ -126,17 +128,17 @@ namespace DICUI
SetSupportedDriveSpeed();
}
private void cmb_DriveSpeed_SelectionChanged(object sender, SelectionChangedEventArgs e)
private void DriveSpeedComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
{
EnsureDiscInformation();
}
private void txt_OutputFilename_TextChanged(object sender, TextChangedEventArgs e)
private void OutputFilenameTextBoxTextChanged(object sender, TextChangedEventArgs e)
{
EnsureDiscInformation();
}
private void txt_OutputDirectory_TextChanged(object sender, TextChangedEventArgs e)
private void OutputDirectoryTextBoxTextChanged(object sender, TextChangedEventArgs e)
{
EnsureDiscInformation();
}
@@ -190,21 +192,21 @@ namespace DICUI
/// </summary>
private void PopulateMediaType()
{
KnownSystem? currentSystem = cmb_SystemType.SelectedItem as KnownSystemComboBoxItem;
KnownSystem? currentSystem = SystemTypeComboBox.SelectedItem as KnownSystemComboBoxItem;
if (currentSystem != null)
{
_mediaTypes = Validators.GetValidMediaTypes(currentSystem).ToList();
cmb_MediaType.ItemsSource = _mediaTypes;
MediaTypeComboBox.ItemsSource = _mediaTypes;
cmb_MediaType.IsEnabled = _mediaTypes.Count > 1;
cmb_MediaType.SelectedIndex = (_mediaTypes.IndexOf(_currentMediaType) >= 0 ? _mediaTypes.IndexOf(_currentMediaType) : 0);
MediaTypeComboBox.IsEnabled = _mediaTypes.Count > 1;
MediaTypeComboBox.SelectedIndex = (_mediaTypes.IndexOf(_currentMediaType) >= 0 ? _mediaTypes.IndexOf(_currentMediaType) : 0);
}
else
{
cmb_MediaType.IsEnabled = false;
cmb_MediaType.ItemsSource = null;
cmb_MediaType.SelectedIndex = -1;
MediaTypeComboBox.IsEnabled = false;
MediaTypeComboBox.ItemsSource = null;
MediaTypeComboBox.SelectedIndex = -1;
}
}
@@ -232,10 +234,10 @@ namespace DICUI
group.Value.ForEach(system => comboBoxItems.Add(new KnownSystemComboBoxItem(system)));
}
cmb_SystemType.ItemsSource = comboBoxItems;
cmb_SystemType.SelectedIndex = 0;
SystemTypeComboBox.ItemsSource = comboBoxItems;
SystemTypeComboBox.SelectedIndex = 0;
btn_StartStop.IsEnabled = false;
StartStopButton.IsEnabled = false;
}
/// <summary>
@@ -244,23 +246,26 @@ namespace DICUI
/// <remarks>TODO: Find a way for this to periodically run, or have it hook to a "drive change" event</remarks>
private void PopulateDrives()
{
// Always enable the disk scan
DiskScanButton.IsEnabled = true;
// Populate the list of drives and add it to the combo box
_drives = Validators.CreateListOfDrives();
cmb_DriveLetter.ItemsSource = _drives;
DriveLetterComboBox.ItemsSource = _drives;
if (cmb_DriveLetter.Items.Count > 0)
if (DriveLetterComboBox.Items.Count > 0)
{
cmb_DriveLetter.SelectedIndex = 0;
lbl_Status.Content = "Valid media found! Choose your Media Type";
btn_StartStop.IsEnabled = true;
btn_Scan.IsEnabled = true;
DriveLetterComboBox.SelectedIndex = 0;
StatusLabel.Content = "Valid media found! Choose your Media Type";
StartStopButton.IsEnabled = true;
CopyProtectScanButton.IsEnabled = true;
}
else
{
cmb_DriveLetter.SelectedIndex = -1;
lbl_Status.Content = "No valid media found!";
btn_StartStop.IsEnabled = false;
btn_Scan.IsEnabled = false;
DriveLetterComboBox.SelectedIndex = -1;
StatusLabel.Content = "No valid media found!";
StartStopButton.IsEnabled = false;
CopyProtectScanButton.IsEnabled = false;
}
}
@@ -274,7 +279,7 @@ namespace DICUI
if (result == WinForms.DialogResult.OK)
{
txt_OutputDirectory.Text = folderDialog.SelectedPath;
OutputDirectoryTextBox.Text = folderDialog.SelectedPath;
}
}
@@ -287,40 +292,43 @@ namespace DICUI
return new DumpEnvironment()
{
// Paths to tools
SubdumpPath = _options.subdumpPath,
DICPath = _options.dicPath,
SubdumpPath = _options.SubDumpPath,
DICPath = _options.DICPath,
OutputDirectory = txt_OutputDirectory.Text,
OutputFilename = txt_OutputFilename.Text,
OutputDirectory = OutputDirectoryTextBox.Text,
OutputFilename = OutputFilenameTextBox.Text,
// Get the currently selected options
Drive = cmb_DriveLetter.SelectedItem as Drive,
Drive = DriveLetterComboBox.SelectedItem as Drive,
DICParameters = txt_Parameters.Text,
DICParameters = ParametersTextBox.Text,
System = cmb_SystemType.SelectedItem as KnownSystemComboBoxItem,
Type = cmb_MediaType.SelectedItem as MediaType?
System = SystemTypeComboBox.SelectedItem as KnownSystemComboBoxItem,
Type = MediaTypeComboBox.SelectedItem as MediaType?
};
}
/// <summary>
/// Begin the dumping process using the given inputs
/// </summary>
/// <remarks>
/// TODO: Add the scan and output steps back here for label updates
/// </remarks>
private async void StartDumping()
{
_env = DetermineEnvironment();
btn_StartStop.Content = UIElements.StopDumping;
btn_Scan.IsEnabled = false;
lbl_Status.Content = "Beginning dumping process";
StartStopButton.Content = UIElements.StopDumping;
CopyProtectScanButton.IsEnabled = false;
StatusLabel.Content = "Beginning dumping process";
Result result = await _env.StartDumping();
lbl_Status.Content = result ? "Dumping complete!" : result.Message;
btn_StartStop.Content = UIElements.StartDumping;
btn_Scan.IsEnabled = true;
StatusLabel.Content = result ? "Dumping complete!" : result.Message;
StartStopButton.Content = UIElements.StartDumping;
CopyProtectScanButton.IsEnabled = true;
if (chk_EjectWhenDone.IsChecked == true)
if (EjectWhenDoneCheckBox.IsChecked == true)
_env.EjectDisc();
}
@@ -340,40 +348,40 @@ namespace DICUI
// Get the status to write out
Result result = Validators.GetSupportStatus(_env.System, _env.Type);
lbl_Status.Content = result.Message;
StatusLabel.Content = result.Message;
// Set the index for the current disc type
SetCurrentDiscType();
btn_StartStop.IsEnabled = result && (_drives != null && _drives.Count > 0 ? true : false);
StartStopButton.IsEnabled = result && (_drives != null && _drives.Count > 0 ? true : false);
// If we're in a type that doesn't support drive speeds
cmb_DriveSpeed.IsEnabled = _env.Type.DoesSupportDriveSpeed() && _env.System.DoesSupportDriveSpeed();
DriveSpeedComboBox.IsEnabled = _env.Type.DoesSupportDriveSpeed() && _env.System.DoesSupportDriveSpeed();
// Special case for Custom input
if (_env.System == KnownSystem.Custom)
{
txt_Parameters.IsEnabled = true;
txt_OutputFilename.IsEnabled = false;
txt_OutputDirectory.IsEnabled = false;
btn_OutputDirectoryBrowse.IsEnabled = false;
cmb_DriveLetter.IsEnabled = false;
cmb_DriveSpeed.IsEnabled = false;
btn_StartStop.IsEnabled = (_drives.Count > 0 ? true : false);
lbl_Status.Content = "User input mode";
ParametersTextBox.IsEnabled = true;
OutputFilenameTextBox.IsEnabled = false;
OutputDirectoryTextBox.IsEnabled = false;
OutputDirectoryBrowseButton.IsEnabled = false;
DriveLetterComboBox.IsEnabled = false;
DriveSpeedComboBox.IsEnabled = false;
StartStopButton.IsEnabled = (_drives.Count > 0 ? true : false);
StatusLabel.Content = "User input mode";
}
else
{
txt_Parameters.IsEnabled = false;
txt_OutputFilename.IsEnabled = true;
txt_OutputDirectory.IsEnabled = true;
btn_OutputDirectoryBrowse.IsEnabled = true;
cmb_DriveLetter.IsEnabled = true;
ParametersTextBox.IsEnabled = false;
OutputFilenameTextBox.IsEnabled = true;
OutputDirectoryTextBox.IsEnabled = true;
OutputDirectoryBrowseButton.IsEnabled = true;
DriveLetterComboBox.IsEnabled = true;
// Generate the full parameters from the environment
string generated = _env.GetFullParameters((int?)cmb_DriveSpeed.SelectedItem);
string generated = _env.GetFullParameters((int?)DriveSpeedComboBox.SelectedItem);
if (generated != null)
txt_Parameters.Text = generated;
ParametersTextBox.Text = generated;
}
}
@@ -382,9 +390,9 @@ namespace DICUI
/// </summary>
private void GetOutputNames()
{
Drive drive = cmb_DriveLetter.SelectedItem as Drive;
KnownSystem? systemType = cmb_SystemType.SelectedItem as KnownSystemComboBoxItem;
MediaType? mediaType = cmb_MediaType.SelectedItem as MediaType?;
Drive drive = DriveLetterComboBox.SelectedItem as Drive;
KnownSystem? systemType = SystemTypeComboBox.SelectedItem as KnownSystemComboBoxItem;
MediaType? mediaType = MediaTypeComboBox.SelectedItem as MediaType?;
if (drive != null
&& !String.IsNullOrWhiteSpace(drive.VolumeLabel)
@@ -392,13 +400,13 @@ namespace DICUI
&& systemType != null
&& mediaType != null)
{
txt_OutputDirectory.Text = Path.Combine(_options.defaultOutputPath, drive.VolumeLabel);
txt_OutputFilename.Text = drive.VolumeLabel + mediaType.Extension();
OutputDirectoryTextBox.Text = Path.Combine(_options.DefaultOutputPath, drive.VolumeLabel);
OutputFilenameTextBox.Text = drive.VolumeLabel + mediaType.Extension();
}
else
{
txt_OutputDirectory.Text = _options.defaultOutputPath;
txt_OutputFilename.Text = "disc.bin";
OutputDirectoryTextBox.Text = _options.DefaultOutputPath;
OutputFilenameTextBox.Text = "disc.bin";
}
}
@@ -410,19 +418,19 @@ namespace DICUI
var env = DetermineEnvironment();
if (env.Drive.Letter != default(char))
{
var tempContent = lbl_Status.Content;
lbl_Status.Content = "Scanning for copy protection... this might take a while!";
btn_StartStop.IsEnabled = false;
btn_Search.IsEnabled = false;
btn_Scan.IsEnabled = false;
var tempContent = StatusLabel.Content;
StatusLabel.Content = "Scanning for copy protection... this might take a while!";
StartStopButton.IsEnabled = false;
DiskScanButton.IsEnabled = false;
CopyProtectScanButton.IsEnabled = false;
string protections = await Validators.RunProtectionScanOnPath(env.Drive.Letter + ":\\");
MessageBox.Show(protections, "Detected Protection", MessageBoxButton.OK, MessageBoxImage.Information);
lbl_Status.Content = tempContent;
btn_StartStop.IsEnabled = true;
btn_Search.IsEnabled = true;
btn_Scan.IsEnabled = true;
StatusLabel.Content = tempContent;
StartStopButton.IsEnabled = true;
DiskScanButton.IsEnabled = true;
CopyProtectScanButton.IsEnabled = true;
}
}
@@ -433,8 +441,8 @@ namespace DICUI
{
// Set the drive speed list that's appropriate
var values = AllowedSpeeds.GetForMediaType(_currentMediaType);
cmb_DriveSpeed.ItemsSource = values;
cmb_DriveSpeed.SelectedIndex = values.Count / 2;
DriveSpeedComboBox.ItemsSource = values;
DriveSpeedComboBox.SelectedIndex = values.Count / 2;
// Get the current environment
_env = DetermineEnvironment();
@@ -453,7 +461,7 @@ namespace DICUI
_options.preferredDumpSpeedCD
);
cmb_DriveSpeed.SelectedValue = chosenSpeed;
DriveSpeedComboBox.SelectedValue = chosenSpeed;
}
/// <summary>
@@ -462,7 +470,7 @@ namespace DICUI
private void CacheCurrentDiscType()
{
// Get the drive letter from the selected item
Drive drive = cmb_DriveLetter.SelectedItem as Drive;
Drive drive = DriveLetterComboBox.SelectedItem as Drive;
if (drive == null || drive.IsFloppy)
return;
@@ -482,9 +490,9 @@ namespace DICUI
// Now set the selected item, if possible
int index = _mediaTypes.FindIndex(kvp => kvp.Value == _currentMediaType);
if (index != -1)
cmb_MediaType.SelectedIndex = index;
MediaTypeComboBox.SelectedIndex = index;
else
lbl_Status.Content = $"Disc of type '{Converters.MediaTypeToString(_currentMediaType)}' found, but the current system does not support it!";
StatusLabel.Content = $"Disc of type '{Converters.MediaTypeToString(_currentMediaType)}' found, but the current system does not support it!";
}
#endregion

View File

@@ -7,9 +7,9 @@ namespace DICUI
{
public class Options
{
public string defaultOutputPath { get; private set; }
public string dicPath { get; private set; }
public string subdumpPath { get; private set; }
public string DefaultOutputPath { get; private set; }
public string DICPath { get; private set; }
public string SubDumpPath { get; private set; }
public int preferredDumpSpeedCD { get; set; }
public int preferredDumpSpeedDVD { get; set; }
@@ -40,9 +40,9 @@ namespace DICUI
public void Load()
{
//TODO: hardcoded, we should find a better way
dicPath = ConfigurationManager.AppSettings["dicPath"] ?? @"Programs\DiscImageCreator.exe";
subdumpPath = ConfigurationManager.AppSettings["subdumpPath"] ?? "subdump.exe";
defaultOutputPath = ConfigurationManager.AppSettings["defaultOutputPath"] ?? "ISO";
DICPath = ConfigurationManager.AppSettings["DICPath"] ?? @"Programs\DiscImageCreator.exe";
SubDumpPath = ConfigurationManager.AppSettings["SubDumpPath"] ?? "subdump.exe";
DefaultOutputPath = ConfigurationManager.AppSettings["DefaultOutputPath"] ?? "ISO";
this.preferredDumpSpeedCD = Int32.TryParse(ConfigurationManager.AppSettings["preferredDumpSpeedCD"], out int maxDumpSpeedCD) ? maxDumpSpeedCD : 72;
this.preferredDumpSpeedDVD = Int32.TryParse(ConfigurationManager.AppSettings["preferredDumpSpeedDVD"], out int maxDumpSpeedDVD) ? maxDumpSpeedDVD : 72;

View File

@@ -29,16 +29,16 @@
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="DicImageCreator Path" />
<TextBox x:Name="txt_dicPath" Grid.Row="0" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
<Button x:Name="btn_dicPath" Grid.Row="0" Grid.Column="2" Height="22" Width="22" Content="..." Click="btn_BrowseForPath_Click" />
<TextBox x:Name="DICPathTextBox" Grid.Row="0" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
<Button x:Name="DICPathButton" Grid.Row="0" Grid.Column="2" Height="22" Width="22" Content="..." Click="BrowseForPathClick" />
<Label Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="subdump Path" />
<TextBox x:Name="txt_subdumpPath" Grid.Row="1" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
<Button x:Name="btn_subdumpPath" Grid.Row="1" Grid.Column="2" Height="22" Width="22" Content="..." Click="btn_BrowseForPath_Click"/>
<TextBox x:Name="SubDumpPathTextBox" Grid.Row="1" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
<Button x:Name="SubDumpPathButton" Grid.Row="1" Grid.Column="2" Height="22" Width="22" Content="..." Click="BrowseForPathClick"/>
<Label Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Default Output Path" />
<TextBox x:Name="txt_defaultOutputPath" Grid.Row="2" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
<Button x:Name="btn_defaultOutputPath" Grid.Row="2" Grid.Column="2" Height="22" Width="22" Content="..." Click="btn_BrowseForPath_Click" />
<TextBox x:Name="DefaultOutputPathTextBox" Grid.Row="2" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
<Button x:Name="DefaultOutputPathButton" Grid.Row="2" Grid.Column="2" Height="22" Width="22" Content="..." Click="BrowseForPathClick" />
</Grid>
<GroupBox Grid.Row="1" Margin="5,5,5,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Header="Preferred Dump Speed">
@@ -55,12 +55,12 @@
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="CD-ROM" />
<Slider x:Name="slider_DumpSpeedCD" Grid.Row="0" Grid.Column="1" Minimum="1" Maximum="72" IsSnapToTickEnabled="True" TickPlacement="BottomRight" Ticks="{Binding Source={x:Static lui:AllowedSpeeds.ForCDAsCollection}}" />
<TextBox x:Name="txt_DumpSpeedCD" Grid.Row="0" Grid.Column="2" Width="22" Height="22" TextAlignment="Center" IsReadOnly="True" IsReadOnlyCaretVisible="False" VerticalAlignment="Center" Text="{Binding ElementName=slider_DumpSpeedCD, Path=Value, UpdateSourceTrigger=PropertyChanged}" Background="LightGray" Foreground="Gray"/>
<Slider x:Name="DumpSpeedCDSlider" Grid.Row="0" Grid.Column="1" Minimum="1" Maximum="72" IsSnapToTickEnabled="True" TickPlacement="BottomRight" Ticks="{Binding Source={x:Static lui:AllowedSpeeds.ForCDAsCollection}}" />
<TextBox x:Name="DumpSpeedCDTextBox" Grid.Row="0" Grid.Column="2" Width="22" Height="22" TextAlignment="Center" IsReadOnly="True" IsReadOnlyCaretVisible="False" VerticalAlignment="Center" Text="{Binding ElementName=DumpSpeedCDSlider, Path=Value, UpdateSourceTrigger=PropertyChanged}" Background="LightGray" Foreground="Gray"/>
<Label Grid.Row="1" Grid.Column="0" Content="DVD-ROM" />
<Slider x:Name="slider_DumpSpeedDVD" Grid.Row="1" Grid.Column="1" Minimum="1" Maximum="24" IsSnapToTickEnabled="True" TickPlacement="BottomRight" Ticks="{Binding Source={x:Static lui:AllowedSpeeds.ForDVDAsCollection}}" />
<TextBox x:Name="txt_DumpSpeedDVD" Grid.Row="1" Grid.Column="2" Width="22" Height="22" TextAlignment="Center" IsReadOnly="True" IsReadOnlyCaretVisible="False" VerticalAlignment="Center" Text="{Binding ElementName=slider_DumpSpeedDVD, Path=Value, UpdateSourceTrigger=PropertyChanged}" Background="LightGray" Foreground="Gray"/>
<Slider x:Name="DumpSpeedDVDSlider" Grid.Row="1" Grid.Column="1" Minimum="1" Maximum="24" IsSnapToTickEnabled="True" TickPlacement="BottomRight" Ticks="{Binding Source={x:Static lui:AllowedSpeeds.ForDVDAsCollection}}" />
<TextBox x:Name="DumpSpeedDVDTextBox" Grid.Row="1" Grid.Column="2" Width="22" Height="22" TextAlignment="Center" IsReadOnly="True" IsReadOnlyCaretVisible="False" VerticalAlignment="Center" Text="{Binding ElementName=DumpSpeedDVDSlider, Path=Value, UpdateSourceTrigger=PropertyChanged}" Background="LightGray" Foreground="Gray"/>
</Grid>
@@ -73,8 +73,8 @@
<ColumnDefinition Width="1*"/>
</Grid.ColumnDefinitions>
<Button x:Name="btn_Accept" Grid.Row="0" Grid.Column="1" Height="22" Width="80" Content="Accept" Click="OnAcceptClick" />
<Button x:Name="btn_Cancel" Grid.Row="0" Grid.Column="2" Height="22" Width="80" Content="Cancel" Click="OnCancelClick" />
<Button x:Name="AcceptButton" Grid.Row="0" Grid.Column="1" Height="22" Width="80" Content="Accept" Click="OnAcceptClick" />
<Button x:Name="CancelButton" Grid.Row="0" Grid.Column="2" Height="22" Width="80" Content="Cancel" Click="OnCancelClick" />
</Grid>
</Grid>

View File

@@ -26,7 +26,7 @@ namespace DICUI
{
OpenFileDialog dialog = new OpenFileDialog();
dialog.InitialDirectory = System.AppDomain.CurrentDomain.BaseDirectory;
dialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;
dialog.Filter = "Executables (*.exe)|*.exe";
dialog.FilterIndex = 0;
dialog.RestoreDirectory = true;
@@ -42,23 +42,23 @@ namespace DICUI
private string[] PathSettings()
{
string[] pathSettings = { "defaultOutputPath", "dicPath", "subdumpPath" };
string[] pathSettings = { "DefaultOutputPath", "DICPath", "SubDumpPath" };
return pathSettings;
}
private TextBox TextBoxForPathSetting(string name)
{
return FindName("txt_" + name) as TextBox;
return FindName(name + "TextBox") as TextBox;
}
private void btn_BrowseForPath_Click(object sender, EventArgs e)
private void BrowseForPathClick(object sender, EventArgs e)
{
Button button = sender as Button;
// strips button prefix to obtain the setting name
string pathSettingName = button.Name.Substring("btn_".Length);
string pathSettingName = button.Name.Substring(0, button.Name.IndexOf("Button"));
// TODO: hack for now, then we'll see
bool shouldBrowseForPath = pathSettingName == "defaultOutputPath";
bool shouldBrowseForPath = pathSettingName == "DefaultOutputPath";
CommonDialog dialog = shouldBrowseForPath ? (CommonDialog)CreateFolderBrowserDialog() : CreateOpenFileDialog();
using (dialog)
@@ -100,8 +100,8 @@ namespace DICUI
{
Array.ForEach(PathSettings(), setting => TextBoxForPathSetting(setting).Text = _options.Get(setting));
slider_DumpSpeedCD.Value = _options.preferredDumpSpeedCD;
slider_DumpSpeedDVD.Value = _options.preferredDumpSpeedDVD;
DumpSpeedCDSlider.Value = _options.preferredDumpSpeedCD;
DumpSpeedDVDSlider.Value = _options.preferredDumpSpeedDVD;
}
#region Event Handlers
@@ -110,8 +110,8 @@ namespace DICUI
{
Array.ForEach(PathSettings(), setting => _options.Set(setting, TextBoxForPathSetting(setting).Text));
_options.preferredDumpSpeedCD = Convert.ToInt32(slider_DumpSpeedCD.Value);
_options.preferredDumpSpeedDVD = Convert.ToInt32(slider_DumpSpeedDVD.Value);
_options.preferredDumpSpeedCD = Convert.ToInt32(DumpSpeedCDSlider.Value);
_options.preferredDumpSpeedDVD = Convert.ToInt32(DumpSpeedDVDSlider.Value);
_options.Save();
Hide();

View File

@@ -93,7 +93,7 @@ namespace DICUI.Utilities
StartInfo = new ProcessStartInfo()
{
FileName = DICPath,
Arguments = DICCommands.Eject + " " + Drive.Letter,
Arguments = DICCommands.Eject + " " + Drive.Letter + " " + DICFlags.DisableBeep,
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardOutput = true,
@@ -135,7 +135,7 @@ namespace DICUI.Utilities
StartInfo = new ProcessStartInfo()
{
FileName = DICPath,
Arguments = DICCommands.DriveSpeed + " " + Drive.Letter,
Arguments = DICCommands.DriveSpeed + " " + Drive.Letter + " " + DICFlags.DisableBeep,
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardOutput = true,
@@ -215,8 +215,8 @@ namespace DICUI.Utilities
// TODO: don't return, just keep generating output from DIC
/*if (!result.Item1)
{
lbl_Status.Content = result.Item2;
btn_StartStop.Content = UIElements.StartDumping;
StatusLabel.Content = result.Item2;
StartStopButton.Content = UIElements.StartDumping;
return;
}*/

BIN
DICUI/mspack.dll Normal file

Binary file not shown.

5
DICUI/packages.config Normal file
View File

@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="LessIO" version="0.5.0" targetFramework="net461" />
<package id="libmspack4n" version="0.8.0" targetFramework="net461" />
</packages>