diff --git a/Constants.cs b/Constants.cs
index cb4dec62..73220e85 100644
--- a/Constants.cs
+++ b/Constants.cs
@@ -116,4 +116,4 @@
public const string OptionalValue = "(OPTIONAL)";
public const string YesNoValue = "Yes/No";
}
-}
+}
\ No newline at end of file
diff --git a/Enumerations.cs b/Enumerations.cs
index cb699a05..46bcecc6 100644
--- a/Enumerations.cs
+++ b/Enumerations.cs
@@ -151,5 +151,7 @@
VideoCD,
#endregion
+
+ Custom = -1
}
}
diff --git a/MainWindow.xaml b/MainWindow.xaml
index 9f8e491d..6b10954a 100644
--- a/MainWindow.xaml
+++ b/MainWindow.xaml
@@ -42,8 +42,9 @@
-
-
+
+
+
@@ -53,7 +54,7 @@
-
+
diff --git a/MainWindow.xaml.cs b/MainWindow.xaml.cs
index e29466c8..1e71effa 100644
--- a/MainWindow.xaml.cs
+++ b/MainWindow.xaml.cs
@@ -24,7 +24,8 @@ namespace DICUI
// Private UI-related variables
private List> _drives { get; set; }
private List _driveSpeeds { get { return new List { 1, 2, 3, 4, 6, 8, 12, 16, 20, 24, 32, 40, 44, 48, 52, 56, 72 }; } }
- private List> _systems { get; set; }
+ private List> _systems { get; set; }
+ private List> _discTypes { get; set; }
private Process childProcess { get; set; }
private Window childWindow { get; set; }
@@ -79,7 +80,14 @@ namespace DICUI
EnsureDiscInformation();
}
- private void cmb_DiscType_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ private void cmb_SystemType_SelectionChanged(object sender, SelectionChangedEventArgs e)
+ {
+ GetOutputNames();
+ PopulateDiscTypeAccordingToChosenSystem();
+ EnsureDiscInformation();
+ }
+
+ private void cmb_DiscType_SelectionChanged(object sencder, SelectionChangedEventArgs e)
{
GetOutputNames();
EnsureDiscInformation();
@@ -133,16 +141,48 @@ namespace DICUI
#region Helpers
+ ///
+ /// Populate disc type according to system type
+ private void PopulateDiscTypeAccordingToChosenSystem()
+ {
+ cmb_DiscType.SelectedIndex = -1;
+
+ var currentSystem = cmb_SystemType.SelectedItem as Tuple;
+
+ if (currentSystem != null)
+ {
+ List> allowedDiscTypesForSystem = Utilities.Validation.GetValidDiscTypes(currentSystem.Item2)
+ .ConvertAll(d => Tuple.Create(Utilities.Converters.DiscTypeToString(d), d));
+
+ cmb_DiscType.ItemsSource = allowedDiscTypesForSystem;
+ cmb_DiscType.DisplayMemberPath = "Item1";
+
+ cmb_DiscType.IsEnabled = allowedDiscTypesForSystem.Count > 1;
+
+ if (!cmb_DiscType.IsEnabled)
+ cmb_DiscType.SelectedIndex = 0;
+ }
+ else
+ {
+ cmb_DiscType.IsEnabled = false;
+ cmb_DiscType.ItemsSource = null;
+ cmb_DiscType.SelectedIndex = 0;
+ }
+ }
+ ///
+
///
/// Get a complete list of supported systems and fill the combo box
///
private void PopulateSystems()
{
_systems = Utilities.Validation.CreateListOfSystems();
- cmb_DiscType.ItemsSource = _systems;
- cmb_DiscType.DisplayMemberPath = "Item1";
- cmb_DiscType.SelectedIndex = 0;
- cmb_DiscType_SelectionChanged(null, null);
+ _discTypes = Utilities.Validation.CreateListOfDiscTypesForKnownSystems(_systems.ConvertAll(s => s.Item2));
+
+ cmb_SystemType.ItemsSource = _systems;
+ cmb_SystemType.DisplayMemberPath = "Item1";
+ cmb_SystemType.SelectedIndex = 0;
+ cmb_SystemType_SelectionChanged(null, null);
btn_StartStop.IsEnabled = false;
}
@@ -210,7 +250,7 @@ namespace DICUI
string outputDirectory = txt_OutputDirectory.Text;
string outputFilename = txt_OutputFilename.Text;
- var selected = cmb_DiscType.SelectedValue as Tuple;
+ var selected = cmb_SystemType.SelectedValue as Tuple;
string systemName = selected.Item1;
KnownSystem? system = selected.Item2;
DiscType? type = selected.Item3;
@@ -228,7 +268,7 @@ namespace DICUI
}
// If we have a custom configuration, we need to extract the best possible information from it
- if (systemName == "Custom Input" && system == KnownSystem.NONE && type == DiscType.NONE)
+ if (system == KnownSystem.Custom)
{
Utilities.Validation.DetermineFlags(customParameters, out type, out system, out string letter, out string path);
driveLetter = letter[0];
@@ -446,54 +486,65 @@ namespace DICUI
///
private void EnsureDiscInformation()
{
- // If we're on a separator, go to the next item
- var tuple = cmb_DiscType.SelectedItem as Tuple;
- if (tuple.Item2 == null && tuple.Item3 == null)
- {
- cmb_DiscType.SelectedIndex++;
- tuple = cmb_DiscType.SelectedItem as Tuple;
- }
+ var systemTuple = cmb_SystemType.SelectedItem as Tuple;
+ var discTypeTuple = cmb_DiscType.SelectedItem as Tuple;
- // If we're on an unsupported type, update the status accordingly
- switch (tuple.Item3)
+ // If we're on a separator, go to the next item
+ if (systemTuple.Item2 == null)
+ systemTuple = cmb_SystemType.Items[++cmb_SystemType.SelectedIndex] as Tuple;
+
+ var selectedSystem = systemTuple.Item2;
+ var selectedDiscType = discTypeTuple != null ? discTypeTuple.Item2 : DiscType.NONE;
+
+ // No system chosen, update status
+ if (selectedSystem == KnownSystem.NONE)
{
- case DiscType.NONE:
- lbl_Status.Content = "Please select a valid disc type";
- btn_StartStop.IsEnabled = false;
- break;
- case DiscType.GameCubeGameDisc:
- case DiscType.GDROM:
- lbl_Status.Content = string.Format("{0} discs are partially supported by DIC", Converters.DiscTypeToString(tuple.Item3));
- btn_StartStop.IsEnabled = (_drives.Count > 0 ? true : false);
- break;
- case DiscType.HDDVD:
- case DiscType.UMD:
- case DiscType.WiiOpticalDisc:
- case DiscType.WiiUOpticalDisc:
- lbl_Status.Content = string.Format("{0} discs are not currently supported by DIC", Converters.DiscTypeToString(tuple.Item3));
- btn_StartStop.IsEnabled = false;
- break;
- case DiscType.DVD5:
- case DiscType.DVD9:
- if (tuple.Item2 == KnownSystem.MicrosoftXBOX360XDG3)
- {
- lbl_Status.Content = string.Format("{0} discs are not currently supported by DIC", Converters.DiscTypeToString(tuple.Item3));
+ lbl_Status.Content = "Please select a valid system";
+ btn_StartStop.IsEnabled = false;
+ }
+ else if (selectedSystem != KnownSystem.Custom)
+ {
+ // If we're on an unsupported type, update the status accordingly
+ switch (selectedDiscType)
+ {
+ case DiscType.NONE:
+ lbl_Status.Content = "Please select a valid disc type";
btn_StartStop.IsEnabled = false;
- }
- else
- {
- lbl_Status.Content = string.Format("{0} ready to dump", Converters.DiscTypeToString(tuple.Item3));
+ break;
+ case DiscType.GameCubeGameDisc:
+ case DiscType.GDROM:
+ lbl_Status.Content = string.Format("{0} discs are partially supported by DIC", discTypeTuple.Item1);
btn_StartStop.IsEnabled = (_drives.Count > 0 ? true : false);
- }
- break;
- default:
- lbl_Status.Content = string.Format("{0} ready to dump", Converters.DiscTypeToString(tuple.Item3));
- btn_StartStop.IsEnabled = (_drives.Count > 0 ? true : false);
- break;
+ break;
+ case DiscType.HDDVD:
+ case DiscType.UMD:
+ case DiscType.WiiOpticalDisc:
+ case DiscType.WiiUOpticalDisc:
+ lbl_Status.Content = string.Format("{0} discs are not currently supported by DIC", discTypeTuple.Item1);
+ btn_StartStop.IsEnabled = false;
+ break;
+ case DiscType.DVD5:
+ case DiscType.DVD9:
+ if (selectedSystem == KnownSystem.MicrosoftXBOX360XDG3)
+ {
+ lbl_Status.Content = string.Format("{0} discs are not currently supported by DIC", discTypeTuple.Item1);
+ btn_StartStop.IsEnabled = false;
+ }
+ else
+ {
+ lbl_Status.Content = string.Format("{0} ready to dump", discTypeTuple.Item1);
+ btn_StartStop.IsEnabled = (_drives.Count > 0 ? true : false);
+ }
+ break;
+ default:
+ lbl_Status.Content = string.Format("{0} ready to dump", discTypeTuple.Item1);
+ btn_StartStop.IsEnabled = (_drives.Count > 0 ? true : false);
+ break;
+ }
}
// If we're in a type that doesn't support drive speeds
- switch (tuple.Item3)
+ switch (selectedDiscType)
{
case DiscType.Floppy:
case DiscType.BD25:
@@ -501,9 +552,9 @@ namespace DICUI
cmb_DriveSpeed.IsEnabled = false;
break;
default:
- if (tuple.Item2 == KnownSystem.MicrosoftXBOX
- || tuple.Item2 == KnownSystem.MicrosoftXBOX360XDG2
- || tuple.Item2 == KnownSystem.MicrosoftXBOX360XDG3)
+ if (selectedSystem == KnownSystem.MicrosoftXBOX
+ || selectedSystem == KnownSystem.MicrosoftXBOX360XDG2
+ || selectedSystem == KnownSystem.MicrosoftXBOX360XDG3)
{
cmb_DriveSpeed.IsEnabled = false;
}
@@ -515,7 +566,7 @@ namespace DICUI
}
// Special case for Custom input
- if (tuple.Item1 == "Custom Input" && tuple.Item2 == KnownSystem.NONE && tuple.Item3 == DiscType.NONE)
+ if (selectedSystem == KnownSystem.Custom)
{
txt_Parameters.IsEnabled = true;
txt_OutputFilename.IsEnabled = false;
@@ -535,28 +586,25 @@ namespace DICUI
cmb_DriveLetter.IsEnabled = true;
// Populate with the correct params for inputs (if we're not on the default option)
- if (cmb_DiscType.SelectedIndex > 0)
+ if (selectedSystem != KnownSystem.NONE && selectedDiscType != DiscType.NONE)
{
- var selected = cmb_DiscType.SelectedValue as Tuple;
var driveletter = cmb_DriveLetter.SelectedValue as Tuple;
- // If either item is invalid, skip this
- if (selected == null || driveletter == null)
- {
+ // If drive letter is invalid, skip this
+ if (driveletter == null)
return;
- }
- string discType = Converters.KnownSystemAndDiscTypeToBaseCommand(selected.Item2, selected.Item3);
- List defaultParams = Converters.KnownSystemAndDiscTypeToParameters(selected.Item2, selected.Item3);
+ string discType = Converters.KnownSystemAndDiscTypeToBaseCommand(selectedSystem, selectedDiscType);
+ List defaultParams = Converters.KnownSystemAndDiscTypeToParameters(selectedSystem, selectedDiscType);
txt_Parameters.Text = discType
+ " " + driveletter.Item1
+ " \"" + Path.Combine(txt_OutputDirectory.Text, txt_OutputFilename.Text) + "\" "
- + (selected.Item3 != DiscType.Floppy
- && selected.Item3 != DiscType.BD25
- && selected.Item3 != DiscType.BD50
- && selected.Item2 != KnownSystem.MicrosoftXBOX
- && selected.Item2 != KnownSystem.MicrosoftXBOX360XDG2
- && selected.Item2 != KnownSystem.MicrosoftXBOX360XDG3
+ + (selectedDiscType != DiscType.Floppy
+ && selectedDiscType != DiscType.BD25
+ && selectedDiscType != DiscType.BD50
+ && selectedSystem != KnownSystem.MicrosoftXBOX
+ && selectedSystem != KnownSystem.MicrosoftXBOX360XDG2
+ && selectedSystem != KnownSystem.MicrosoftXBOX360XDG3
? (int)cmb_DriveSpeed.SelectedItem + " " : "")
+ string.Join(" ", defaultParams);
}
@@ -569,12 +617,13 @@ namespace DICUI
private void GetOutputNames()
{
var driveTuple = cmb_DriveLetter.SelectedItem as Tuple;
- var discTuple = cmb_DiscType.SelectedItem as Tuple;
+ var systemTuple = cmb_SystemType.SelectedItem as Tuple;
+ var discTuple = cmb_DiscType.SelectedItem as Tuple;
- if (driveTuple != null && discTuple != null)
+ if (driveTuple != null && systemTuple != null && discTuple != null)
{
txt_OutputDirectory.Text = Path.Combine(defaultOutputPath, driveTuple.Item2);
- txt_OutputFilename.Text = driveTuple.Item2 + Converters.DiscTypeToExtension(discTuple.Item3);
+ txt_OutputFilename.Text = driveTuple.Item2 + Converters.DiscTypeToExtension(discTuple.Item2);
}
else
{
diff --git a/Utilities/Converters.cs b/Utilities/Converters.cs
index 977dfdb9..bf1f93fd 100644
--- a/Utilities/Converters.cs
+++ b/Utilities/Converters.cs
@@ -498,10 +498,13 @@ namespace DICUI.Utilities
#endregion
+ case KnownSystem.Custom:
+ return "Custom Input";
+
case KnownSystem.NONE:
default:
return "Unknown";
}
}
}
-}
+}
\ No newline at end of file
diff --git a/Utilities/DumpInformation.cs b/Utilities/DumpInformation.cs
index 0caaa5b1..948cdcb0 100644
--- a/Utilities/DumpInformation.cs
+++ b/Utilities/DumpInformation.cs
@@ -619,7 +619,7 @@ namespace DICUI.Utilities
{
byte[] sub = new byte[16];
Array.Copy(headerBytes, ptr, sub, 0, 16);
- headerString += ptr.ToString("X").PadLeft(4, '0') + " : "
+ headerString += ptr.ToString("X").PadLeft(4, '0') + " : "
+ BitConverter.ToString(sub).Replace("-", " ") + " "
+ Encoding.ASCII.GetString(sub) + "\n";
ptr += 16;
@@ -830,7 +830,7 @@ namespace DICUI.Utilities
break;
}
output.Add(Template.BarcodeField + ": " + info[Template.BarcodeField]);
- switch(sys)
+ switch (sys)
{
case KnownSystem.AppleMacintosh:
case KnownSystem.IBMPCCompatible:
@@ -950,4 +950,4 @@ namespace DICUI.Utilities
return true;
}
}
-}
+}
\ No newline at end of file
diff --git a/Utilities/Validation.cs b/Utilities/Validation.cs
index 0665e0e5..44d62a85 100644
--- a/Utilities/Validation.cs
+++ b/Utilities/Validation.cs
@@ -17,7 +17,7 @@ namespace DICUI.Utilities
public static List GetValidDiscTypes(KnownSystem? sys)
{
List types = new List();
-
+
switch (sys)
{
#region Consoles
@@ -405,12 +405,11 @@ namespace DICUI.Utilities
/// This returns a List of Tuples whose structure is as follows:
/// Item 1: Printable name
/// Item 2: KnownSystem mapping
- /// Item 3: DiscType mapping
- /// If something has a "string, null, null" value, it should be assumed that it is a separator
+ /// If something has a "string, null" value, it should be assumed that it is a separator
///
- public static List> CreateListOfSystems()
+ public static List> CreateListOfSystems()
{
- List> mapping = new List>();
+ List> mapping = new List>();
foreach (KnownSystem system in Enum.GetValues(typeof(KnownSystem)))
{
@@ -419,49 +418,45 @@ namespace DICUI.Utilities
{
// Consoles section
case KnownSystem.BandaiPlaydiaQuickInteractiveSystem:
- mapping.Add(new Tuple("---------- Consoles ----------", null, null));
+ mapping.Add(new Tuple("---------- Consoles ----------", null));
break;
// Computers section
case KnownSystem.AcornArchimedes:
- mapping.Add(new Tuple("---------- Computers ----------", null, null));
+ mapping.Add(new Tuple("---------- Computers ----------", null));
break;
// Arcade section
case KnownSystem.AmigaCUBOCD32:
- mapping.Add(new Tuple("---------- Arcade ----------", null, null));
+ mapping.Add(new Tuple("---------- Arcade ----------", null));
break;
// Other section
case KnownSystem.AudioCD:
- mapping.Add(new Tuple("---------- Others ----------", null, null));
+ mapping.Add(new Tuple("---------- Others ----------", null));
break;
}
- // First, get a list of all DiscTypes for a given KnownSystem
- List types = GetValidDiscTypes(system);
-
- // If we have a single type, we don't want to postfix the system name with it
- if (types.Count == 1)
- {
- mapping.Add(new Tuple(Converters.KnownSystemToString(system), system, types[0]));
- }
- // Otherwise, postfix the system name properly
- else
- {
- foreach (DiscType type in types)
- {
- mapping.Add(new Tuple(Converters.KnownSystemToString(system) + " (" + Converters.DiscTypeToString(type) + ")", system, type));
- }
- }
+ mapping.Add(new Tuple(Converters.KnownSystemToString(system), system));
}
- // Add final mapping for "Custom"
- mapping.Add(new Tuple("Custom Input", KnownSystem.NONE, DiscType.NONE));
-
return mapping;
}
+ ///
+ /// Create a list of all actually used DiskTypes for current Knownystem list
+ ///
+ public static List> CreateListOfDiscTypesForKnownSystems(List systems)
+ {
+ return systems
+ .ConvertAll(s => GetValidDiscTypes(s))
+ .SelectMany(d => d)
+ .Distinct()
+ .Select(d => Tuple.Create(Converters.DiscTypeToString(d), d))
+ .OrderBy(t => t.Item1)
+ .ToList();
+ }
+
///
/// Create a list of active optical drives matched to their volume labels
///
@@ -713,7 +708,7 @@ namespace DICUI.Utilities
{
for (int i = index; i < parts.Count; i++)
{
- switch(parts[i])
+ switch (parts[i])
{
case DICFlags.DisableBeep:
if (parts[0] != DICCommands.CompactDisc
@@ -819,7 +814,7 @@ namespace DICUI.Utilities
{
return false;
}
-
+
// If the next item doesn't exist, it's good
if (!DoesNextExist(parts, i))
{