mirror of
https://github.com/SabreTools/MPF.git
synced 2026-02-09 05:35:27 +00:00
Compare commits
8 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2a7789bd12 | ||
|
|
1d0417cc1c | ||
|
|
905c578d90 | ||
|
|
a457c85e53 | ||
|
|
36630fc0ed | ||
|
|
f509ac60da | ||
|
|
bf8aac6f81 | ||
|
|
ceddcc0722 |
@@ -1,3 +1,10 @@
|
||||
### 1.17.1 (2020-09-14)
|
||||
- Shuffled some shared, internal UI variables
|
||||
- Synced WPF and Avalonia UI internals
|
||||
- Made the disc information window less prone to bugs
|
||||
- Fixed DIC flags based on code (not documentation)
|
||||
- Added support for old(?) DIC flags: `/fix` and `/re`
|
||||
|
||||
### 1.17 (2020-09-12)
|
||||
- Updated to Aaru version 5.1
|
||||
- Updated to BurnOutSharp version 1.4.0
|
||||
|
||||
@@ -10,40 +10,12 @@ namespace DICUI.Avalonia
|
||||
/// </summary>
|
||||
public static class Constants
|
||||
{
|
||||
public const string StartDumping = "Start Dumping";
|
||||
public const string StopDumping = "Stop Dumping";
|
||||
|
||||
public const int LogWindowMarginFromMainWindow = 40;
|
||||
|
||||
// Private lists of known drive speed ranges
|
||||
private static IReadOnlyList<int> cd { get; } = new List<int> { 1, 2, 3, 4, 6, 8, 12, 16, 20, 24, 32, 40, 44, 48, 52, 56, 72 };
|
||||
private static IReadOnlyList<int> dvd { get; } = cd.Where(s => s <= 24).ToList();
|
||||
private static IReadOnlyList<int> bd { get; } = cd.Where(s => s <= 16).ToList();
|
||||
private static IReadOnlyList<int> unknown { get; } = cd; // TODO: All or {1}? Maybe null?
|
||||
|
||||
/// <summary>
|
||||
/// Get list of all drive speeds for a given MediaType
|
||||
/// </summary>
|
||||
/// <param name="type">MediaType? that represents the current item</param>
|
||||
/// <returns>Read-only list of drive speeds</returns>
|
||||
public static IReadOnlyList<int> GetSpeedsForMediaType(MediaType? type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
case MediaType.GDROM:
|
||||
return cd;
|
||||
case MediaType.DVD:
|
||||
case MediaType.HDDVD:
|
||||
case MediaType.NintendoGameCubeGameDisc:
|
||||
case MediaType.NintendoWiiOpticalDisc:
|
||||
return dvd;
|
||||
case MediaType.BluRay:
|
||||
return bd;
|
||||
default:
|
||||
return unknown;
|
||||
}
|
||||
}
|
||||
|
||||
// Create collections for UI based on known drive speeds
|
||||
public static List<double> SpeedsForCDAsCollection { get; } = GetDoubleCollectionFromIntList(cd);
|
||||
|
||||
@@ -11,9 +11,9 @@
|
||||
<Authors>Matt Nadareski;ReignStumble;Jakz</Authors>
|
||||
<Copyright>Copyright (c)2019-2020</Copyright>
|
||||
<RepositoryUrl>https://github.com/SabreTools/DICUI</RepositoryUrl>
|
||||
<Version>1.17.0</Version>
|
||||
<AssemblyVersion>1.17.0</AssemblyVersion>
|
||||
<FileVersion>1.17.0</FileVersion>
|
||||
<Version>1.17.1</Version>
|
||||
<AssemblyVersion>1.17.1</AssemblyVersion>
|
||||
<FileVersion>1.17.1</FileVersion>
|
||||
<IncludeSource>true</IncludeSource>
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -37,14 +37,20 @@ namespace DICUI.Avalonia
|
||||
#endregion
|
||||
|
||||
public DiscInformationWindow()
|
||||
: this(new SubmissionInfo())
|
||||
{
|
||||
}
|
||||
|
||||
public DiscInformationWindow(SubmissionInfo submissionInfo)
|
||||
{
|
||||
this.SubmissionInfo = submissionInfo;
|
||||
this.InitializeComponent();
|
||||
#if DEBUG
|
||||
this.AttachDevTools();
|
||||
#endif
|
||||
}
|
||||
|
||||
private void InitializeComponent()
|
||||
private void InitializeComponent()
|
||||
{
|
||||
AvaloniaXamlLoader.Load(this);
|
||||
|
||||
@@ -62,7 +68,7 @@ namespace DICUI.Avalonia
|
||||
private void DisableFieldsIfNeeded()
|
||||
{
|
||||
// Only disable for single-layer discs
|
||||
if (SubmissionInfo.SizeAndChecksums?.Layerbreak == default(long))
|
||||
if (SubmissionInfo?.SizeAndChecksums?.Layerbreak == default(long))
|
||||
{
|
||||
this.Find<TextBox>("L1MasteringRingTextBox").IsEnabled = false;
|
||||
this.Find<TextBox>("L1MasteringRingTextBox").Background = Brushes.Gray;
|
||||
|
||||
@@ -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]);
|
||||
@@ -454,7 +454,7 @@ namespace DICUI.Avalonia
|
||||
private void SetSupportedDriveSpeed()
|
||||
{
|
||||
// Set the drive speed list that's appropriate
|
||||
var values = Constants.GetSpeedsForMediaType(CurrentMediaType);
|
||||
var values = Interface.GetSpeedsForMediaType(CurrentMediaType);
|
||||
this.Find<ComboBox>("DriveSpeedComboBox").Items = values;
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Supported media speeds: {0}", string.Join(",", values));
|
||||
|
||||
@@ -464,6 +464,20 @@ namespace DICUI.Avalonia
|
||||
this.Find<ComboBox>("DriveSpeedComboBox").SelectedItem = speed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Show the disc information window
|
||||
/// </summary>
|
||||
/// <param name="submissionInfo">SubmissionInfo object to display and possibly change</param>
|
||||
/// <returns>Dialog open result</returns>
|
||||
private bool? ShowDiscInformationWindow(SubmissionInfo submissionInfo)
|
||||
{
|
||||
var discInformationWindow = new DiscInformationWindow(submissionInfo);
|
||||
discInformationWindow.Load();
|
||||
discInformationWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
||||
discInformationWindow.ShowDialog(this).ConfigureAwait(false).GetAwaiter().GetResult();
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Begin the dumping process using the given inputs
|
||||
/// </summary>
|
||||
@@ -516,7 +530,7 @@ namespace DICUI.Avalonia
|
||||
}
|
||||
}
|
||||
|
||||
this.Find<Button>("StartStopButton").Content = Constants.StopDumping;
|
||||
this.Find<Button>("StartStopButton").Content = Interface.StopDumping;
|
||||
this.Find<Button>("CopyProtectScanButton").IsEnabled = false;
|
||||
this.Find<TextBlock>("StatusLabel").Text = "Beginning dumping process";
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Starting dumping process..");
|
||||
@@ -535,7 +549,7 @@ namespace DICUI.Avalonia
|
||||
{
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("No dumping command was run, submission information will not be gathered.");
|
||||
this.Find<TextBlock>("StatusLabel").Text = "Execution complete!";
|
||||
this.Find<Button>("StartStopButton").Content = Constants.StartDumping;
|
||||
this.Find<Button>("StartStopButton").Content = Interface.StartDumping;
|
||||
this.Find<Button>("CopyProtectScanButton").IsEnabled = true;
|
||||
return;
|
||||
}
|
||||
@@ -546,16 +560,8 @@ namespace DICUI.Avalonia
|
||||
result = await Env.VerifyAndSaveDumpOutput(resultProgress,
|
||||
protectionProgress,
|
||||
this.Find<CheckBox>("EjectWhenDoneCheckBox").IsChecked,
|
||||
UIOptions.ResetDriveAfterDump,
|
||||
(si) =>
|
||||
{
|
||||
var discInformationWindow = new DiscInformationWindow();
|
||||
discInformationWindow.SubmissionInfo = si;
|
||||
discInformationWindow.Load();
|
||||
discInformationWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
||||
discInformationWindow.ShowDialog(this).ConfigureAwait(false).GetAwaiter().GetResult();
|
||||
return true;
|
||||
}
|
||||
UIOptions.Options.ResetDriveAfterDump,
|
||||
ShowDiscInformationWindow
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -565,7 +571,7 @@ namespace DICUI.Avalonia
|
||||
}
|
||||
finally
|
||||
{
|
||||
this.Find<Button>("StartStopButton").Content = Constants.StartDumping;
|
||||
this.Find<Button>("StartStopButton").Content = Interface.StartDumping;
|
||||
this.Find<Button>("CopyProtectScanButton").IsEnabled = true;
|
||||
}
|
||||
}
|
||||
@@ -773,11 +779,11 @@ namespace DICUI.Avalonia
|
||||
private void StartStopButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Dump or stop the dump
|
||||
if ((string)this.Find<Button>("StartStopButton").Content == Constants.StartDumping)
|
||||
if ((string)this.Find<Button>("StartStopButton").Content == Interface.StartDumping)
|
||||
{
|
||||
StartDumping();
|
||||
}
|
||||
else if ((string)this.Find<Button>("StartStopButton").Content == Constants.StopDumping)
|
||||
else if ((string)this.Find<Button>("StartStopButton").Content == Interface.StopDumping)
|
||||
{
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Canceling dumping process...");
|
||||
Env.CancelDumping();
|
||||
@@ -789,7 +795,7 @@ namespace DICUI.Avalonia
|
||||
Env.EjectDisc();
|
||||
}
|
||||
|
||||
if (UIOptions.ResetDriveAfterDump)
|
||||
if (UIOptions.Options.ResetDriveAfterDump)
|
||||
{
|
||||
ViewModels.LoggerViewModel.VerboseLogLn($"Resetting drive {Env.Drive.Letter}");
|
||||
Env.ResetDrive();
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -10,9 +10,9 @@
|
||||
<Authors>Matt Nadareski;ReignStumble;Jakz</Authors>
|
||||
<Copyright>Copyright (c)2019-2020</Copyright>
|
||||
<RepositoryUrl>https://github.com/SabreTools/DICUI</RepositoryUrl>
|
||||
<Version>1.17.0</Version>
|
||||
<AssemblyVersion>1.17.0</AssemblyVersion>
|
||||
<FileVersion>1.17.0</FileVersion>
|
||||
<Version>1.17.1</Version>
|
||||
<AssemblyVersion>1.17.1</AssemblyVersion>
|
||||
<FileVersion>1.17.1</FileVersion>
|
||||
<IncludeSource>true</IncludeSource>
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -8,9 +8,9 @@
|
||||
<Authors>Matt Nadareski;ReignStumble;Jakz</Authors>
|
||||
<Copyright>Copyright (c)2019-2020</Copyright>
|
||||
<RepositoryUrl>https://github.com/SabreTools/DICUI</RepositoryUrl>
|
||||
<Version>1.17.0</Version>
|
||||
<AssemblyVersion>1.17.0</AssemblyVersion>
|
||||
<FileVersion>1.17.0</FileVersion>
|
||||
<Version>1.17.1</Version>
|
||||
<AssemblyVersion>1.17.1</AssemblyVersion>
|
||||
<FileVersion>1.17.1</FileVersion>
|
||||
<IncludeSource>true</IncludeSource>
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
|
||||
@@ -1,5 +1,48 @@
|
||||
namespace DICUI.Data
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
|
||||
namespace DICUI.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Constant values for UI
|
||||
/// </summary>
|
||||
public static class Interface
|
||||
{
|
||||
// Button values
|
||||
public const string StartDumping = "Start Dumping";
|
||||
public const string StopDumping = "Stop Dumping";
|
||||
|
||||
// Private lists of known drive speed ranges
|
||||
private static IReadOnlyList<int> cd { get; } = new List<int> { 1, 2, 3, 4, 6, 8, 12, 16, 20, 24, 32, 40, 44, 48, 52, 56, 72 };
|
||||
private static IReadOnlyList<int> dvd { get; } = cd.Where(s => s <= 24).ToList();
|
||||
private static IReadOnlyList<int> bd { get; } = cd.Where(s => s <= 16).ToList();
|
||||
private static IReadOnlyList<int> unknown { get; } = new List<int> { 1 };
|
||||
|
||||
/// <summary>
|
||||
/// Get list of all drive speeds for a given MediaType
|
||||
/// </summary>
|
||||
/// <param name="type">MediaType? that represents the current item</param>
|
||||
/// <returns>Read-only list of drive speeds</returns>
|
||||
public static IReadOnlyList<int> GetSpeedsForMediaType(MediaType? type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
case MediaType.GDROM:
|
||||
return cd;
|
||||
case MediaType.DVD:
|
||||
case MediaType.HDDVD:
|
||||
case MediaType.NintendoGameCubeGameDisc:
|
||||
case MediaType.NintendoWiiOpticalDisc:
|
||||
return dvd;
|
||||
case MediaType.BluRay:
|
||||
return bd;
|
||||
default:
|
||||
return unknown;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Template field values for submission info
|
||||
/// </summary>
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -45,6 +45,7 @@ namespace DICUI.DiscImageCreator
|
||||
public const string D8Opcode = "/d8";
|
||||
public const string DisableBeep = "/q";
|
||||
public const string ExtractMicroSoftCabFile = "/mscf";
|
||||
public const string Fix = "/fix";
|
||||
public const string ForceUnitAccess = "/f";
|
||||
public const string MultiSession = "/ms";
|
||||
public const string NoFixSubP = "/np";
|
||||
@@ -54,6 +55,7 @@ namespace DICUI.DiscImageCreator
|
||||
public const string NoFixSubQSecuROM = "/ns";
|
||||
public const string NoSkipSS = "/nss";
|
||||
public const string Raw = "/raw";
|
||||
public const string Resume = "/re";
|
||||
public const string Reverse = "/r";
|
||||
public const string ScanAntiMod = "/am";
|
||||
public const string ScanFileProtect = "/sf";
|
||||
|
||||
@@ -214,6 +214,8 @@ namespace DICUI.DiscImageCreator
|
||||
return FlagStrings.DisableBeep;
|
||||
case Flag.ExtractMicroSoftCabFile:
|
||||
return FlagStrings.ExtractMicroSoftCabFile;
|
||||
case Flag.Fix:
|
||||
return FlagStrings.Fix;
|
||||
case Flag.ForceUnitAccess:
|
||||
return FlagStrings.ForceUnitAccess;
|
||||
case Flag.MultiSession:
|
||||
@@ -232,6 +234,8 @@ namespace DICUI.DiscImageCreator
|
||||
return FlagStrings.NoSkipSS;
|
||||
case Flag.Raw:
|
||||
return FlagStrings.Raw;
|
||||
case Flag.Resume:
|
||||
return FlagStrings.Resume;
|
||||
case Flag.Reverse:
|
||||
return FlagStrings.Reverse;
|
||||
case Flag.ScanAntiMod:
|
||||
|
||||
@@ -47,6 +47,7 @@ namespace DICUI.DiscImageCreator
|
||||
D8Opcode,
|
||||
DisableBeep,
|
||||
ExtractMicroSoftCabFile,
|
||||
Fix,
|
||||
ForceUnitAccess,
|
||||
MultiSession,
|
||||
NoFixSubP,
|
||||
@@ -56,6 +57,7 @@ namespace DICUI.DiscImageCreator
|
||||
NoFixSubQSecuROM,
|
||||
NoSkipSS,
|
||||
Raw,
|
||||
Resume,
|
||||
Reverse,
|
||||
ScanAntiMod,
|
||||
ScanFileProtect,
|
||||
|
||||
@@ -77,7 +77,7 @@ namespace DICUI.DiscImageCreator
|
||||
#region Flag Values
|
||||
|
||||
/// <summary>
|
||||
/// Manual offset for Audio CD
|
||||
/// Manual offset for Audio CD (default 0)
|
||||
/// </summary>
|
||||
public int? AddOffsetValue { get; set; }
|
||||
|
||||
@@ -85,17 +85,23 @@ namespace DICUI.DiscImageCreator
|
||||
/// 0xbe opcode value for dumping
|
||||
/// Possible values: raw (default), pack
|
||||
/// </summary>
|
||||
/// TODO: Make this an enum
|
||||
public string BEOpcodeValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// C2 reread options for dumping
|
||||
/// [0] - Reread value
|
||||
/// [0] - Reread value (default 4000)
|
||||
/// [1] - 0 reread issue sector (default), 1 reread all
|
||||
/// [2] - First LBA to reread (default 0)
|
||||
/// [3] - Last LBA to reread (default EOS)
|
||||
/// </summary>
|
||||
public int?[] C2OpcodeValue { get; set; } = new int?[4];
|
||||
|
||||
/// <summary>
|
||||
/// End LBA for fixing
|
||||
/// </summary>
|
||||
public int? FixValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set the force unit access flag value (default 1)
|
||||
/// </summary>
|
||||
@@ -106,13 +112,23 @@ namespace DICUI.DiscImageCreator
|
||||
/// </summary>
|
||||
public int? NoSkipSecuritySectorValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set the reverse End LBA value (required for DVD)
|
||||
/// </summary>
|
||||
public int? ReverseEndLBAValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set the reverse Start LBA value (required for DVD)
|
||||
/// </summary>
|
||||
public int? ReverseStartLBAValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set scan file timeout value (default 60)
|
||||
/// </summary>
|
||||
public int? ScanFileProtectValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Beginning and ending sectors to skip for physical protection
|
||||
/// Beginning and ending sectors to skip for physical protection (both default 0)
|
||||
/// </summary>
|
||||
public int?[] SkipSectorValue { get; set; } = new int?[2];
|
||||
|
||||
@@ -123,7 +139,7 @@ namespace DICUI.DiscImageCreator
|
||||
public int? SubchannelReadLevelValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set number of empty bytes to insert at the head of first track for VideoNow
|
||||
/// Set number of empty bytes to insert at the head of first track for VideoNow (default 0)
|
||||
/// </summary>
|
||||
public int? VideoNowValue { get; set; }
|
||||
|
||||
@@ -275,8 +291,6 @@ namespace DICUI.DiscImageCreator
|
||||
parameters.Add(Converters.LongName(Flag.AddOffset));
|
||||
if (AddOffsetValue != null)
|
||||
parameters.Add(AddOffsetValue.ToString());
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -322,7 +336,9 @@ namespace DICUI.DiscImageCreator
|
||||
if (C2OpcodeValue[1] != null)
|
||||
{
|
||||
if (C2OpcodeValue[1] == 0)
|
||||
{
|
||||
parameters.Add(C2OpcodeValue[1].ToString());
|
||||
}
|
||||
else if (C2OpcodeValue[1] == 1)
|
||||
{
|
||||
parameters.Add(C2OpcodeValue[1].ToString());
|
||||
@@ -334,11 +350,15 @@ namespace DICUI.DiscImageCreator
|
||||
parameters.Add(C2OpcodeValue[3].ToString());
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -364,6 +384,26 @@ namespace DICUI.DiscImageCreator
|
||||
parameters.Add(Converters.LongName(Flag.DisableBeep));
|
||||
}
|
||||
|
||||
// Extract MicroSoftCabFile
|
||||
if (GetSupportedCommands(Flag.ExtractMicroSoftCabFile).Contains(BaseCommand))
|
||||
{
|
||||
if (this[Flag.ExtractMicroSoftCabFile] == true)
|
||||
parameters.Add(Converters.LongName(Flag.ExtractMicroSoftCabFile));
|
||||
}
|
||||
|
||||
// Fix
|
||||
if (GetSupportedCommands(Flag.Fix).Contains(BaseCommand))
|
||||
{
|
||||
if (this[Flag.Fix] == true)
|
||||
{
|
||||
parameters.Add(Converters.LongName(Flag.Fix));
|
||||
if (FixValue != null)
|
||||
parameters.Add(FixValue.ToString());
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Force Unit Access
|
||||
if (GetSupportedCommands(Flag.ForceUnitAccess).Contains(BaseCommand))
|
||||
{
|
||||
@@ -375,13 +415,6 @@ namespace DICUI.DiscImageCreator
|
||||
}
|
||||
}
|
||||
|
||||
// Extract MicroSoftCabFile
|
||||
if (GetSupportedCommands(Flag.ExtractMicroSoftCabFile).Contains(BaseCommand))
|
||||
{
|
||||
if (this[Flag.ExtractMicroSoftCabFile] == true)
|
||||
parameters.Add(Converters.LongName(Flag.ExtractMicroSoftCabFile));
|
||||
}
|
||||
|
||||
// Multi-Session
|
||||
if (GetSupportedCommands(Flag.MultiSession).Contains(BaseCommand))
|
||||
{
|
||||
@@ -442,11 +475,29 @@ namespace DICUI.DiscImageCreator
|
||||
parameters.Add(Converters.LongName(Flag.Raw));
|
||||
}
|
||||
|
||||
// Resume
|
||||
if (GetSupportedCommands(Flag.Resume).Contains(BaseCommand))
|
||||
{
|
||||
if (this[Flag.Resume] == true)
|
||||
parameters.Add(Converters.LongName(Flag.Resume));
|
||||
}
|
||||
|
||||
// Reverse read
|
||||
if (GetSupportedCommands(Flag.Reverse).Contains(BaseCommand))
|
||||
{
|
||||
if (this[Flag.Reverse] == true)
|
||||
{
|
||||
parameters.Add(Converters.LongName(Flag.Reverse));
|
||||
|
||||
if (BaseCommand == Command.DigitalVideoDisc)
|
||||
{
|
||||
if (ReverseStartLBAValue == null || ReverseEndLBAValue == null)
|
||||
return null;
|
||||
|
||||
parameters.Add(ReverseStartLBAValue.ToString());
|
||||
parameters.Add(ReverseEndLBAValue.ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Scan PlayStation anti-mod strings
|
||||
@@ -491,19 +542,19 @@ namespace DICUI.DiscImageCreator
|
||||
{
|
||||
if (this[Flag.SkipSector] == true)
|
||||
{
|
||||
if (SkipSectorValue[0] != null && SkipSectorValue[1] != null)
|
||||
parameters.Add(Converters.LongName(Flag.SkipSector));
|
||||
if (SkipSectorValue[0] != null)
|
||||
{
|
||||
parameters.Add(Converters.LongName(Flag.SkipSector));
|
||||
if (SkipSectorValue[0] >= 0 && SkipSectorValue[1] >= 0)
|
||||
{
|
||||
if (SkipSectorValue[0] > 0)
|
||||
parameters.Add(SkipSectorValue[0].ToString());
|
||||
parameters.Add(SkipSectorValue[1].ToString());
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
else
|
||||
return null;
|
||||
if (SkipSectorValue[1] != null)
|
||||
{
|
||||
if (SkipSectorValue[1] == 0)
|
||||
parameters.Add(SkipSectorValue[1].ToString());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -643,6 +694,7 @@ namespace DICUI.DiscImageCreator
|
||||
AddOffsetValue = null;
|
||||
BEOpcodeValue = null;
|
||||
C2OpcodeValue = new int?[4];
|
||||
FixValue = null;
|
||||
ForceUnitAccessValue = null;
|
||||
NoSkipSecuritySectorValue = null;
|
||||
ScanFileProtectValue = null;
|
||||
@@ -1171,11 +1223,23 @@ namespace DICUI.DiscImageCreator
|
||||
{
|
||||
case FlagStrings.AddOffset:
|
||||
if (!GetSupportedCommands(Flag.AddOffset).Contains(BaseCommand))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!DoesExist(parts, i + 1))
|
||||
return false;
|
||||
{
|
||||
this[Flag.AddOffset] = true;
|
||||
break;
|
||||
}
|
||||
else if (IsFlag(parts[i + 1]))
|
||||
{
|
||||
this[Flag.AddOffset] = true;
|
||||
break;
|
||||
}
|
||||
else if (!IsValidInt32(parts[i + 1]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this[Flag.AddOffset] = true;
|
||||
AddOffsetValue = Int32.Parse(parts[i + 1]);
|
||||
@@ -1198,7 +1262,9 @@ namespace DICUI.DiscImageCreator
|
||||
|
||||
case FlagStrings.BEOpcode:
|
||||
if (!GetSupportedCommands(Flag.BEOpcode).Contains(BaseCommand))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!DoesExist(parts, i + 1))
|
||||
{
|
||||
this[Flag.BEOpcode] = true;
|
||||
@@ -1209,11 +1275,14 @@ namespace DICUI.DiscImageCreator
|
||||
this[Flag.BEOpcode] = true;
|
||||
break;
|
||||
}
|
||||
else if (parts[i + 1] != "raw" && (parts[i + 1] != "pack"))
|
||||
else if (!string.Equals(parts[i + 1], "raw", StringComparison.OrdinalIgnoreCase)
|
||||
&& !string.Equals(parts[i + 1], "pack", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this[Flag.BEOpcode] = true;
|
||||
BEOpcodeValue = parts[i + 1];
|
||||
BEOpcodeValue = parts[i + 1].ToLowerInvariant();
|
||||
i++;
|
||||
break;
|
||||
|
||||
@@ -1225,11 +1294,17 @@ namespace DICUI.DiscImageCreator
|
||||
for (int j = 0; j < 4; j++)
|
||||
{
|
||||
if (!DoesExist(parts, i + 1))
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (IsFlag(parts[i + 1]))
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (!IsValidInt32(parts[i + 1], lowerBound: 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
C2OpcodeValue[j] = Int32.Parse(parts[i + 1]);
|
||||
@@ -1267,9 +1342,24 @@ namespace DICUI.DiscImageCreator
|
||||
this[Flag.ExtractMicroSoftCabFile] = true;
|
||||
break;
|
||||
|
||||
case FlagStrings.Fix:
|
||||
if (!GetSupportedCommands(Flag.Fix).Contains(BaseCommand))
|
||||
return false;
|
||||
else if (!DoesExist(parts, i + 1))
|
||||
return false;
|
||||
else if (!IsValidInt32(parts[i + 1], lowerBound: 0))
|
||||
return false;
|
||||
|
||||
this[Flag.Fix] = true;
|
||||
FixValue = Int32.Parse(parts[i + 1]);
|
||||
i++;
|
||||
break;
|
||||
|
||||
case FlagStrings.ForceUnitAccess:
|
||||
if (!GetSupportedCommands(Flag.ForceUnitAccess).Contains(BaseCommand))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!DoesExist(parts, i + 1))
|
||||
{
|
||||
this[Flag.ForceUnitAccess] = true;
|
||||
@@ -1281,7 +1371,9 @@ namespace DICUI.DiscImageCreator
|
||||
break;
|
||||
}
|
||||
else if (!IsValidInt32(parts[i + 1], lowerBound: 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this[Flag.ForceUnitAccess] = true;
|
||||
ForceUnitAccessValue = Int32.Parse(parts[i + 1]);
|
||||
@@ -1316,13 +1408,6 @@ namespace DICUI.DiscImageCreator
|
||||
this[Flag.NoFixSubQLibCrypt] = true;
|
||||
break;
|
||||
|
||||
case FlagStrings.NoFixSubRtoW:
|
||||
if (!GetSupportedCommands(Flag.NoFixSubRtoW).Contains(BaseCommand))
|
||||
return false;
|
||||
|
||||
this[Flag.NoFixSubRtoW] = true;
|
||||
break;
|
||||
|
||||
case FlagStrings.NoFixSubQSecuROM:
|
||||
if (!GetSupportedCommands(Flag.NoFixSubQSecuROM).Contains(BaseCommand))
|
||||
return false;
|
||||
@@ -1330,9 +1415,18 @@ namespace DICUI.DiscImageCreator
|
||||
this[Flag.NoFixSubQSecuROM] = true;
|
||||
break;
|
||||
|
||||
case FlagStrings.NoFixSubRtoW:
|
||||
if (!GetSupportedCommands(Flag.NoFixSubRtoW).Contains(BaseCommand))
|
||||
return false;
|
||||
|
||||
this[Flag.NoFixSubRtoW] = true;
|
||||
break;
|
||||
|
||||
case FlagStrings.NoSkipSS:
|
||||
if (!GetSupportedCommands(Flag.NoSkipSS).Contains(BaseCommand))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!DoesExist(parts, i + 1))
|
||||
{
|
||||
this[Flag.NoSkipSS] = true;
|
||||
@@ -1344,10 +1438,12 @@ namespace DICUI.DiscImageCreator
|
||||
break;
|
||||
}
|
||||
else if (!IsValidInt32(parts[i + 1], lowerBound: 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this[Flag.NoSkipSS] = true;
|
||||
ForceUnitAccessValue = Int32.Parse(parts[i + 1]);
|
||||
NoSkipSecuritySectorValue = Int32.Parse(parts[i + 1]);
|
||||
i++;
|
||||
break;
|
||||
|
||||
@@ -1358,10 +1454,30 @@ namespace DICUI.DiscImageCreator
|
||||
this[Flag.Raw] = true;
|
||||
break;
|
||||
|
||||
case FlagStrings.Resume:
|
||||
if (!GetSupportedCommands(Flag.Resume).Contains(BaseCommand))
|
||||
return false;
|
||||
|
||||
this[Flag.Resume] = true;
|
||||
break;
|
||||
|
||||
case FlagStrings.Reverse:
|
||||
if (!GetSupportedCommands(Flag.Reverse).Contains(BaseCommand))
|
||||
return false;
|
||||
|
||||
// DVD specifically requires StartLBA and EndLBA
|
||||
if (BaseCommand == Command.DigitalVideoDisc)
|
||||
{
|
||||
if (!DoesExist(parts, i + 1) || !DoesExist(parts, i + 2))
|
||||
return false;
|
||||
else if (!IsValidInt32(parts[i + 1], lowerBound: 0) || !IsValidInt32(parts[i + 2], lowerBound: 0))
|
||||
return false;
|
||||
|
||||
ReverseStartLBAValue = Int32.Parse(parts[i + 1]);
|
||||
ReverseEndLBAValue = Int32.Parse(parts[i + 2]);
|
||||
i += 2;
|
||||
}
|
||||
|
||||
this[Flag.Reverse] = true;
|
||||
break;
|
||||
|
||||
@@ -1374,7 +1490,9 @@ namespace DICUI.DiscImageCreator
|
||||
|
||||
case FlagStrings.ScanFileProtect:
|
||||
if (!GetSupportedCommands(Flag.ScanFileProtect).Contains(BaseCommand))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!DoesExist(parts, i + 1))
|
||||
{
|
||||
this[Flag.ScanFileProtect] = true;
|
||||
@@ -1386,7 +1504,9 @@ namespace DICUI.DiscImageCreator
|
||||
break;
|
||||
}
|
||||
else if (!IsValidInt32(parts[i + 1], lowerBound: 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this[Flag.ScanFileProtect] = true;
|
||||
ScanFileProtectValue = Int32.Parse(parts[i + 1]);
|
||||
@@ -1410,22 +1530,36 @@ namespace DICUI.DiscImageCreator
|
||||
case FlagStrings.SkipSector:
|
||||
if (!GetSupportedCommands(Flag.SkipSector).Contains(BaseCommand))
|
||||
return false;
|
||||
else if (!DoesExist(parts, i + 1) || !DoesExist(parts, i + 2))
|
||||
return false;
|
||||
else if (IsFlag(parts[i + 1]) || IsFlag(parts[i + 2]))
|
||||
return false;
|
||||
else if (!IsValidInt32(parts[i + 1], lowerBound: 0) || !IsValidInt32(parts[i + 2], lowerBound: 0))
|
||||
return false;
|
||||
|
||||
this[Flag.SkipSector] = true;
|
||||
SkipSectorValue[0] = Int32.Parse(parts[i + 1]);
|
||||
SkipSectorValue[1] = Int32.Parse(parts[i + 2]);
|
||||
i += 2;
|
||||
for (int j = 0; j < 2; j++)
|
||||
{
|
||||
if (!DoesExist(parts, i + 1))
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (IsFlag(parts[i + 1]))
|
||||
{
|
||||
break;
|
||||
}
|
||||
else if (!IsValidInt32(parts[i + 1], lowerBound: 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
SkipSectorValue[j] = Int32.Parse(parts[i + 1]);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case FlagStrings.SubchannelReadLevel:
|
||||
if (!GetSupportedCommands(Flag.SubchannelReadLevel).Contains(BaseCommand))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!DoesExist(parts, i + 1))
|
||||
{
|
||||
this[Flag.SubchannelReadLevel] = true;
|
||||
@@ -1437,7 +1571,9 @@ namespace DICUI.DiscImageCreator
|
||||
break;
|
||||
}
|
||||
else if (!IsValidInt32(parts[i + 1], lowerBound: 0, upperBound: 2))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this[Flag.SubchannelReadLevel] = true;
|
||||
SubchannelReadLevelValue = Int32.Parse(parts[i + 1]);
|
||||
@@ -1453,7 +1589,9 @@ namespace DICUI.DiscImageCreator
|
||||
|
||||
case FlagStrings.VideoNow:
|
||||
if (!GetSupportedCommands(Flag.VideoNow).Contains(BaseCommand))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
else if (!DoesExist(parts, i + 1))
|
||||
{
|
||||
this[Flag.VideoNow] = true;
|
||||
@@ -1465,7 +1603,9 @@ namespace DICUI.DiscImageCreator
|
||||
break;
|
||||
}
|
||||
else if (!IsValidInt32(parts[i + 1], lowerBound: 0))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
this[Flag.VideoNow] = true;
|
||||
VideoNowValue = Int32.Parse(parts[i + 1]);
|
||||
@@ -1986,22 +2126,35 @@ namespace DICUI.DiscImageCreator
|
||||
commands.Add(Command.SACD);
|
||||
commands.Add(Command.Swap);
|
||||
commands.Add(Command.XBOX);
|
||||
commands.Add(Command.XBOXSwap);
|
||||
commands.Add(Command.XGD2Swap);
|
||||
commands.Add(Command.XGD3Swap);
|
||||
break;
|
||||
case Flag.ExtractMicroSoftCabFile:
|
||||
commands.Add(Command.CompactDisc);
|
||||
break;
|
||||
case Flag.Fix:
|
||||
commands.Add(Command.DigitalVideoDisc);
|
||||
break;
|
||||
case Flag.ForceUnitAccess:
|
||||
commands.Add(Command.Audio);
|
||||
commands.Add(Command.BluRay);
|
||||
commands.Add(Command.CompactDisc);
|
||||
commands.Add(Command.Data);
|
||||
commands.Add(Command.DigitalVideoDisc);
|
||||
commands.Add(Command.GDROM);
|
||||
commands.Add(Command.SACD);
|
||||
commands.Add(Command.Swap);
|
||||
commands.Add(Command.XBOX);
|
||||
commands.Add(Command.XBOXSwap);
|
||||
commands.Add(Command.XGD2Swap);
|
||||
commands.Add(Command.XGD3Swap);
|
||||
break;
|
||||
case Flag.MultiSession:
|
||||
commands.Add(Command.Audio);
|
||||
commands.Add(Command.CompactDisc);
|
||||
commands.Add(Command.Data);
|
||||
commands.Add(Command.Swap);
|
||||
break;
|
||||
case Flag.NoFixSubP:
|
||||
commands.Add(Command.Audio);
|
||||
@@ -2018,17 +2171,11 @@ namespace DICUI.DiscImageCreator
|
||||
commands.Add(Command.Swap);
|
||||
break;
|
||||
case Flag.NoFixSubQLibCrypt:
|
||||
commands.Add(Command.Audio);
|
||||
commands.Add(Command.CompactDisc);
|
||||
commands.Add(Command.Data);
|
||||
commands.Add(Command.GDROM);
|
||||
commands.Add(Command.Swap);
|
||||
break;
|
||||
case Flag.NoFixSubQSecuROM:
|
||||
commands.Add(Command.Audio);
|
||||
commands.Add(Command.CompactDisc);
|
||||
commands.Add(Command.Data);
|
||||
commands.Add(Command.GDROM);
|
||||
commands.Add(Command.Swap);
|
||||
break;
|
||||
case Flag.NoFixSubRtoW:
|
||||
@@ -2039,6 +2186,7 @@ namespace DICUI.DiscImageCreator
|
||||
commands.Add(Command.Swap);
|
||||
break;
|
||||
case Flag.NoSkipSS:
|
||||
commands.Add(Command.BluRay);
|
||||
commands.Add(Command.XBOX);
|
||||
commands.Add(Command.XBOXSwap);
|
||||
commands.Add(Command.XGD2Swap);
|
||||
@@ -2047,14 +2195,19 @@ namespace DICUI.DiscImageCreator
|
||||
case Flag.Raw:
|
||||
commands.Add(Command.DigitalVideoDisc);
|
||||
break;
|
||||
case Flag.Resume:
|
||||
commands.Add(Command.DigitalVideoDisc);
|
||||
break;
|
||||
case Flag.Reverse:
|
||||
commands.Add(Command.CompactDisc);
|
||||
commands.Add(Command.Audio);
|
||||
commands.Add(Command.Data);
|
||||
commands.Add(Command.DigitalVideoDisc);
|
||||
break;
|
||||
case Flag.ScanAntiMod:
|
||||
commands.Add(Command.Audio);
|
||||
commands.Add(Command.CompactDisc);
|
||||
commands.Add(Command.Data);
|
||||
commands.Add(Command.Swap);
|
||||
break;
|
||||
case Flag.ScanFileProtect:
|
||||
commands.Add(Command.Audio);
|
||||
@@ -2064,14 +2217,17 @@ namespace DICUI.DiscImageCreator
|
||||
commands.Add(Command.Swap);
|
||||
break;
|
||||
case Flag.ScanSectorProtect:
|
||||
commands.Add(Command.Audio);
|
||||
commands.Add(Command.CompactDisc);
|
||||
commands.Add(Command.Data);
|
||||
commands.Add(Command.Swap);
|
||||
break;
|
||||
case Flag.SeventyFour:
|
||||
commands.Add(Command.CompactDisc);
|
||||
commands.Add(Command.Swap);
|
||||
break;
|
||||
case Flag.SkipSector:
|
||||
commands.Add(Command.Audio);
|
||||
commands.Add(Command.Data);
|
||||
break;
|
||||
case Flag.SubchannelReadLevel:
|
||||
@@ -2088,12 +2244,15 @@ namespace DICUI.DiscImageCreator
|
||||
break;
|
||||
case Flag.VideoNow:
|
||||
commands.Add(Command.CompactDisc);
|
||||
commands.Add(Command.Swap);
|
||||
break;
|
||||
case Flag.VideoNowColor:
|
||||
commands.Add(Command.CompactDisc);
|
||||
commands.Add(Command.Swap);
|
||||
break;
|
||||
case Flag.VideoNowXP:
|
||||
commands.Add(Command.CompactDisc);
|
||||
commands.Add(Command.Swap);
|
||||
break;
|
||||
|
||||
case Flag.NONE:
|
||||
|
||||
@@ -10,11 +10,11 @@ namespace DICUI.Test.Data
|
||||
[InlineData(MediaType.CDROM, 72)]
|
||||
[InlineData(MediaType.DVD, 24)]
|
||||
[InlineData(MediaType.BluRay, 16)]
|
||||
[InlineData(MediaType.LaserDisc, 72)] // TODO: Update when fully determined
|
||||
[InlineData(null, 72)] // TODO: Update when fully determined
|
||||
[InlineData(MediaType.LaserDisc, 1)]
|
||||
[InlineData(null, 1)]
|
||||
public void GetAllowedDriveSpeedForMediaTypeTest(MediaType? mediaType, int maxExpected)
|
||||
{
|
||||
var actual = Constants.GetSpeedsForMediaType(mediaType);
|
||||
var actual = Interface.GetSpeedsForMediaType(mediaType);
|
||||
Assert.Equal(maxExpected, actual.Last());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using DICUI.Data;
|
||||
|
||||
namespace DICUI
|
||||
{
|
||||
@@ -11,40 +10,12 @@ namespace DICUI
|
||||
/// </summary>
|
||||
public static class Constants
|
||||
{
|
||||
public const string StartDumping = "Start Dumping";
|
||||
public const string StopDumping = "Stop Dumping";
|
||||
|
||||
public const int LogWindowMarginFromMainWindow = 10;
|
||||
|
||||
// Private lists of known drive speed ranges
|
||||
private static IReadOnlyList<int> cd { get; } = new List<int> { 1, 2, 3, 4, 6, 8, 12, 16, 20, 24, 32, 40, 44, 48, 52, 56, 72 };
|
||||
private static IReadOnlyList<int> dvd { get; } = cd.Where(s => s <= 24).ToList();
|
||||
private static IReadOnlyList<int> bd { get; } = cd.Where(s => s <= 16).ToList();
|
||||
private static IReadOnlyList<int> unknown { get; } = cd; // TODO: All or {1}? Maybe null?
|
||||
|
||||
/// <summary>
|
||||
/// Get list of all drive speeds for a given MediaType
|
||||
/// </summary>
|
||||
/// <param name="type">MediaType? that represents the current item</param>
|
||||
/// <returns>Read-only list of drive speeds</returns>
|
||||
public static IReadOnlyList<int> GetSpeedsForMediaType(MediaType? type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
case MediaType.GDROM:
|
||||
return cd;
|
||||
case MediaType.DVD:
|
||||
case MediaType.HDDVD:
|
||||
case MediaType.NintendoGameCubeGameDisc:
|
||||
case MediaType.NintendoWiiOpticalDisc:
|
||||
return dvd;
|
||||
case MediaType.BluRay:
|
||||
return bd;
|
||||
default:
|
||||
return unknown;
|
||||
}
|
||||
}
|
||||
|
||||
// Create collections for UI based on known drive speeds
|
||||
public static DoubleCollection SpeedsForCDAsCollection { get; } = GetDoubleCollectionFromIntList(cd);
|
||||
|
||||
@@ -13,9 +13,9 @@
|
||||
<Authors>Matt Nadareski;ReignStumble;Jakz</Authors>
|
||||
<Copyright>Copyright (c)2019-2020</Copyright>
|
||||
<RepositoryUrl>https://github.com/SabreTools/DICUI</RepositoryUrl>
|
||||
<Version>1.17.0</Version>
|
||||
<AssemblyVersion>1.17.0</AssemblyVersion>
|
||||
<FileVersion>1.17.0</FileVersion>
|
||||
<Version>1.17.1</Version>
|
||||
<AssemblyVersion>1.17.1</AssemblyVersion>
|
||||
<FileVersion>1.17.1</FileVersion>
|
||||
<IncludeSource>true</IncludeSource>
|
||||
<IncludeSymbols>true</IncludeSymbols>
|
||||
</PropertyGroup>
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -12,6 +12,8 @@ namespace DICUI.Windows
|
||||
/// </summary>
|
||||
public partial class DiscInformationWindow : Window
|
||||
{
|
||||
#region Fields
|
||||
|
||||
/// <summary>
|
||||
/// List of available disc categories
|
||||
/// </summary>
|
||||
@@ -32,10 +34,12 @@ namespace DICUI.Windows
|
||||
/// </summary>
|
||||
public List<LanguageComboBoxItem> Languages { get; private set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public DiscInformationWindow(SubmissionInfo submissionInfo)
|
||||
{
|
||||
this.SubmissionInfo = submissionInfo;
|
||||
InitializeComponent();
|
||||
SubmissionInfo = submissionInfo;
|
||||
|
||||
PopulateCategories();
|
||||
PopulateRegions();
|
||||
@@ -49,7 +53,7 @@ namespace DICUI.Windows
|
||||
private void DisableFieldsIfNeeded()
|
||||
{
|
||||
// Only disable for single-layer discs
|
||||
if (SubmissionInfo.SizeAndChecksums.Layerbreak == default(long))
|
||||
if (SubmissionInfo?.SizeAndChecksums?.Layerbreak == default(long))
|
||||
{
|
||||
L1MasteringRingTextBox.IsEnabled = false;
|
||||
L1MasteringRingTextBox.Background = Brushes.Gray;
|
||||
|
||||
@@ -56,21 +56,11 @@ namespace DICUI.Windows
|
||||
/// </summary>
|
||||
private bool alreadyShown;
|
||||
|
||||
/// <summary>
|
||||
/// Current attached DiscInformationWindow
|
||||
/// </summary>
|
||||
private DiscInformationWindow discInformationWindow;
|
||||
|
||||
/// <summary>
|
||||
/// Current attached LogWindow
|
||||
/// </summary>
|
||||
private readonly LogWindow logWindow;
|
||||
|
||||
/// <summary>
|
||||
/// Currently attached OptionsWindow
|
||||
/// </summary>
|
||||
private OptionsWindow optionsWindow;
|
||||
|
||||
#endregion
|
||||
|
||||
public MainWindow()
|
||||
@@ -89,7 +79,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 +115,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 +199,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 +225,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 +247,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]);
|
||||
@@ -444,7 +434,7 @@ namespace DICUI.Windows
|
||||
private void SetSupportedDriveSpeed()
|
||||
{
|
||||
// Set the drive speed list that's appropriate
|
||||
var values = Constants.GetSpeedsForMediaType(CurrentMediaType);
|
||||
var values = Interface.GetSpeedsForMediaType(CurrentMediaType);
|
||||
DriveSpeedComboBox.ItemsSource = values;
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Supported media speeds: {0}", string.Join(",", values));
|
||||
|
||||
@@ -454,6 +444,20 @@ namespace DICUI.Windows
|
||||
DriveSpeedComboBox.SelectedValue = speed;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Show the disc information window
|
||||
/// </summary>
|
||||
/// <param name="submissionInfo">SubmissionInfo object to display and possibly change</param>
|
||||
/// <returns>Dialog open result</returns>
|
||||
private bool? ShowDiscInformationWindow(SubmissionInfo submissionInfo)
|
||||
{
|
||||
var discInformationWindow = new DiscInformationWindow(submissionInfo);
|
||||
discInformationWindow.Owner = this;
|
||||
discInformationWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
||||
discInformationWindow.Load();
|
||||
return discInformationWindow.ShowDialog();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Begin the dumping process using the given inputs
|
||||
/// </summary>
|
||||
@@ -504,7 +508,7 @@ namespace DICUI.Windows
|
||||
}
|
||||
}
|
||||
|
||||
StartStopButton.Content = Constants.StopDumping;
|
||||
StartStopButton.Content = Interface.StopDumping;
|
||||
CopyProtectScanButton.IsEnabled = false;
|
||||
StatusLabel.Content = "Beginning dumping process";
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Starting dumping process..");
|
||||
@@ -523,7 +527,7 @@ namespace DICUI.Windows
|
||||
{
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("No dumping command was run, submission information will not be gathered.");
|
||||
StatusLabel.Content = "Execution complete!";
|
||||
StartStopButton.Content = Constants.StartDumping;
|
||||
StartStopButton.Content = Interface.StartDumping;
|
||||
CopyProtectScanButton.IsEnabled = true;
|
||||
return;
|
||||
}
|
||||
@@ -534,24 +538,8 @@ namespace DICUI.Windows
|
||||
result = await Env.VerifyAndSaveDumpOutput(resultProgress,
|
||||
protectionProgress,
|
||||
EjectWhenDoneCheckBox.IsChecked,
|
||||
UIOptions.ResetDriveAfterDump,
|
||||
(si) =>
|
||||
{
|
||||
// lazy initialization
|
||||
if (discInformationWindow == null)
|
||||
{
|
||||
discInformationWindow = new DiscInformationWindow(si);
|
||||
discInformationWindow.Closed += delegate
|
||||
{
|
||||
discInformationWindow = null;
|
||||
};
|
||||
}
|
||||
|
||||
discInformationWindow.Owner = this;
|
||||
discInformationWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
||||
discInformationWindow.Load();
|
||||
return discInformationWindow.ShowDialog();
|
||||
}
|
||||
UIOptions.Options.ResetDriveAfterDump,
|
||||
ShowDiscInformationWindow
|
||||
);
|
||||
}
|
||||
}
|
||||
@@ -561,7 +549,7 @@ namespace DICUI.Windows
|
||||
}
|
||||
finally
|
||||
{
|
||||
StartStopButton.Content = Constants.StartDumping;
|
||||
StartStopButton.Content = Interface.StartDumping;
|
||||
CopyProtectScanButton.IsEnabled = true;
|
||||
}
|
||||
}
|
||||
@@ -711,7 +699,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
|
||||
@@ -742,21 +730,13 @@ namespace DICUI.Windows
|
||||
/// <summary>
|
||||
/// Handler for OptionsMenuItem Click event
|
||||
/// </summary>
|
||||
/// TODO: Re-evaluate this based on Avalonia code
|
||||
private void OptionsMenuItemClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// lazy initialization
|
||||
if (optionsWindow == null)
|
||||
{
|
||||
optionsWindow = new OptionsWindow(this, UIOptions);
|
||||
optionsWindow.Closed += delegate
|
||||
{
|
||||
optionsWindow = null;
|
||||
};
|
||||
}
|
||||
|
||||
// Show the window and wait for the response
|
||||
var optionsWindow = new OptionsWindow();
|
||||
optionsWindow.UIOptions = UIOptions;
|
||||
optionsWindow.Owner = this;
|
||||
optionsWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
||||
optionsWindow.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
optionsWindow.Refresh();
|
||||
optionsWindow.Show();
|
||||
}
|
||||
@@ -811,11 +791,11 @@ namespace DICUI.Windows
|
||||
private void StartStopButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Dump or stop the dump
|
||||
if ((string)StartStopButton.Content == Constants.StartDumping)
|
||||
if ((string)StartStopButton.Content == Interface.StartDumping)
|
||||
{
|
||||
StartDumping();
|
||||
}
|
||||
else if ((string)StartStopButton.Content == Constants.StopDumping)
|
||||
else if ((string)StartStopButton.Content == Interface.StopDumping)
|
||||
{
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Canceling dumping process...");
|
||||
Env.CancelDumping();
|
||||
@@ -827,7 +807,7 @@ namespace DICUI.Windows
|
||||
Env.EjectDisc();
|
||||
}
|
||||
|
||||
if (UIOptions.ResetDriveAfterDump)
|
||||
if (UIOptions.Options.ResetDriveAfterDump)
|
||||
{
|
||||
ViewModels.LoggerViewModel.VerboseLogLn($"Resetting drive {Env.Drive.Letter}");
|
||||
Env.ResetDrive();
|
||||
|
||||
@@ -13,14 +13,18 @@ namespace DICUI.Windows
|
||||
/// </summary>
|
||||
public partial class OptionsWindow : Window
|
||||
{
|
||||
private readonly MainWindow _mainWindow;
|
||||
private readonly UIOptions _uiOptions;
|
||||
#region Fields
|
||||
|
||||
public OptionsWindow(MainWindow mainWindow, UIOptions options)
|
||||
/// <summary>
|
||||
/// Current UI options
|
||||
/// </summary>
|
||||
public UIOptions UIOptions { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
public OptionsWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
_mainWindow = mainWindow;
|
||||
_uiOptions = options;
|
||||
}
|
||||
|
||||
private OpenFileDialog CreateOpenFileDialog()
|
||||
@@ -96,7 +100,7 @@ namespace DICUI.Windows
|
||||
public void Refresh()
|
||||
{
|
||||
// Handle non-bindable fields
|
||||
RedumpPasswordBox.Password = _uiOptions.Options.Password;
|
||||
RedumpPasswordBox.Password = UIOptions.Options.Password;
|
||||
}
|
||||
|
||||
#region Event Handlers
|
||||
@@ -104,12 +108,12 @@ namespace DICUI.Windows
|
||||
private void OnAcceptClick(object sender, EventArgs e)
|
||||
{
|
||||
// Handle non-bindable fields
|
||||
_uiOptions.Options.Password = RedumpPasswordBox.Password;
|
||||
UIOptions.Options.Password = RedumpPasswordBox.Password;
|
||||
|
||||
_uiOptions.Save();
|
||||
UIOptions.Save();
|
||||
Hide();
|
||||
|
||||
_mainWindow.OnOptionsUpdated();
|
||||
(Owner as MainWindow).OnOptionsUpdated();
|
||||
}
|
||||
|
||||
private void OnCancelClick(object sender, EventArgs e)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
# version format
|
||||
version: 1.17-{build}
|
||||
version: 1.17.1-{build}
|
||||
|
||||
# pull request template
|
||||
pull_requests:
|
||||
|
||||
Reference in New Issue
Block a user