Compare commits

..

39 Commits
1.10 ... 1.11

Author SHA1 Message Date
Matt Nadareski
4539066af0 Update version numbers for 1.11 2018-10-08 12:53:59 -07:00
Matt Nadareski
ec23502275 Abstract out non-UI code to separate DLL (#122)
* Abstract out non-UI code to separate DLL

This change seems rather large, but it's mostly just moving anything that is not directly driving the UI to its own, separate library. This will make it easier at a later date for any UI improvements or changes as well as making the code much more discrete. One TODO has been added as a result of this change.

* Remove MessageBox from library

This change removes the last UI-driven elements from the library. This now makes the library (in theory) UI-agnostic and removes the TODO.

* Options is more UI-related

* Fix Nuget references in csproj

* Add Winforms UI

This is a clone of the current WPF UI but implemented in Windows Forms. WPF is not currently supported by Mono for Linux and macOS, so this can provide an alternative to those users who want to run on those systems instead. This also adds a second artifact for the Winforms build.
2018-10-08 11:06:22 -07:00
Matt Nadareski
331f875e7f Add better progress logging for dumps (fixes #121) 2018-09-24 12:17:57 -07:00
Matt Nadareski
e68f88062f Fix mundane test 2018-09-20 22:39:07 -07:00
Matt Nadareski
d1bb8184d1 Path correction 2018-09-20 22:18:07 -07:00
Matt Nadareski
b7b3f36402 Fix build 2018-09-20 21:30:13 -07:00
Matt Nadareski
859af8efea Format wars 2018-09-20 21:25:22 -07:00
Matt Nadareski
8594d7884c Update terminology (fixes #119) 2018-09-19 20:50:57 -07:00
Matt Nadareski
946dc929f1 Add profile for low-density part of GDROM
Currently, it's easier to just say "it's a CD" and call it a day
2018-09-19 20:49:33 -07:00
Matt Nadareski
1e5b1a205e Update DIC version for AppVeyor 2018-09-19 20:42:49 -07:00
Matt Nadareski
3271cd0ea3 Fix Saturn output info (fixes #118) 2018-09-10 18:27:13 -07:00
Matt Nadareski
647bab8cd3 Merge branch 'master' of https://github.com/reignstumble/DICUI 2018-09-10 16:44:49 -07:00
Matt Nadareski
89b2438dac Threefold fixes
1) Fix the issue where custom parameters that include the `/s 2` flag crash the program
2) Make editing custom parameters a little more intutive (still need to figure out either a way in-documentation or in-UI to explain the checkbox a little better). This part of the change needs to be more tested but there aren't many people using the current feature anyway.
3) Fix the random "Error count: -1" issue that some users were seeing (ended up being a result of more things being in the `_mainError.txt` file than originally anticipated)
2018-09-10 16:43:25 -07:00
Whovian9369
1dcd36d640 Change printable string misspellings relating to DIC (#117)
* Update DumpEnvironment.cs

Change Disk to Disc in printable strings of DumpEnvironment.cs

* Update OptionsWindow.xaml

Change Disk to Disc in printable strings of OptionsWindow.xaml
2018-09-03 13:16:03 -07:00
Matt Nadareski
2f63ebcd29 Fix unprotected DVD info; hopefully fix error count parsing 2018-09-03 00:38:52 -07:00
Matt Nadareski
316953f38c Add UmdImageCreator output parsing 2018-09-02 22:15:40 -07:00
Matt Nadareski
62813ac701 Fix tests 2018-09-01 18:03:48 -07:00
Matt Nadareski
22a936e60b XBOX CDs are not XISO formatted 2018-09-01 17:57:26 -07:00
Matt Nadareski
6412205fa3 Unknown sector ranges aren't recorded 2018-09-01 17:43:38 -07:00
Matt Nadareski
75c18ea3c4 Update for even more DIC changes 2018-09-01 17:02:09 -07:00
Matt Nadareski
6bdb93208e Add DVD-Video protection info 2018-08-29 14:40:35 -07:00
Matt Nadareski
588ed19692 Update README.md
The link for AppVeyor now goes directly to the artifacts page for easier downloading. Hopefully this reduces the issues that are seen with new users.
2018-08-28 21:44:07 -07:00
Matt Nadareski
d56ab5ab37 Update to new version of DIC in AppVeyor 2018-08-28 21:42:01 -07:00
Matt Nadareski
819d18112e My fault, this try/catch doesn't need to be here 2018-08-28 21:29:24 -07:00
Matt Nadareski
2e79cbb0db Fix XBOX/X360 outputs 2018-08-28 21:01:52 -07:00
Matt Nadareski
f024611de8 Take advantage of new XGD3 support in DIC (fixes #71) 2018-08-28 17:31:45 -07:00
Matt Nadareski
48e6283c37 Add PS4 PIC extraction (fixes #106) 2018-08-19 01:25:52 -07:00
Matt Nadareski
fec70f17bc ...wrong path 2018-08-19 00:50:58 -07:00
Matt Nadareski
257f7ab7df Last fix: subfoldering 2018-08-19 00:48:18 -07:00
Matt Nadareski
c1ed3aca02 Path is important 2018-08-19 00:43:32 -07:00
Matt Nadareski
ace6a78236 Attempt to fix AppVeyor 2018-08-19 00:41:34 -07:00
Matt Nadareski
f1e9f1d433 Add PS4 version finding, minor fixes (fixes #105) 2018-08-19 00:19:57 -07:00
Matt Nadareski
e83190c091 Writeback for updated path values (#111) 2018-08-17 20:22:08 -07:00
Matt Nadareski
82eabc12ca Try to fix output path checks (fixes #111) 2018-08-17 20:16:13 -07:00
Matt Nadareski
76b549d773 Add try/catch around dump (fixes #110) 2018-08-17 20:08:50 -07:00
Matt Nadareski
227688d7dc Fix PS2 VER spacing (fixes #112) 2018-08-17 19:24:55 -07:00
Matt Nadareski
4c9e2359af Update system info 2018-08-14 21:59:41 -07:00
Matt Nadareski
d179d7f464 Recognize new swap commands 2018-08-14 21:54:41 -07:00
Matt Nadareski
fff19e75fd Fix XBOX security sector format 2018-08-02 12:38:29 -07:00
60 changed files with 6083 additions and 799 deletions

View File

@@ -1,3 +1,17 @@
### 1.11 (2018-09-20)
- Fix formatting of XBOX and XBOX 360 security sector output
- Add new XBOX swap commands and outputs
- Fixes for some PlayStation 2 and 4 outputs
- Added external programs to AppVeyor builds
- Fixed `.` in path issues with DIC; attempted to fix issues with `&`
- Combined XBOX 360 XGD 2/3 due to new DIC support with Kreon drives
- Fixed (semi-)longstanding bug with XBOX disc layer detection
- Added DVD-Video protection output
- Made custom parameters work a little more intuitively
- Added *EXPERIMENTAL* Winforms-based UI
- And more! See the full Git commit list for more details
### 1.10 (2018-07-29)
- Added many new options for user customization

6
DICUI.Forms/App.config Normal file
View File

@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<startup>
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
</startup>
</configuration>

View File

@@ -4,13 +4,18 @@ using System.Linq;
using System.Windows.Media;
using DICUI.Data;
namespace DICUI.UI
namespace DICUI
{
/// <summary>
/// Gets allowed drive speeds for a given media type
/// Variables for UI elements
/// </summary>
public static class AllowedSpeeds
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();
@@ -22,17 +27,17 @@ namespace DICUI.UI
/// </summary>
/// <param name="type">MediaType? that represents the current item</param>
/// <returns>Read-only list of drive speeds</returns>
public static IReadOnlyList<int> GetForMediaType(MediaType? type)
public static IReadOnlyList<int> GetSpeedsForMediaType(MediaType? type)
{
switch (type)
{
case MediaType.CD:
case MediaType.CDROM:
case MediaType.GDROM:
return cd;
case MediaType.DVD:
case MediaType.HDDVD:
case MediaType.GameCubeGameDisc:
case MediaType.WiiOpticalDisc:
case MediaType.NintendoGameCube:
case MediaType.NintendoWiiOpticalDisc:
return dvd;
case MediaType.BluRay:
return bd;
@@ -42,9 +47,9 @@ namespace DICUI.UI
}
// Create collections for UI based on known drive speeds
public static DoubleCollection ForCDAsCollection { get; } = GetDoubleCollectionFromIntList(cd);
public static DoubleCollection ForDVDAsCollection { get; } = GetDoubleCollectionFromIntList(dvd);
public static DoubleCollection ForBDAsCollection { get; } = GetDoubleCollectionFromIntList(bd);
public static DoubleCollection SpeedsForCDAsCollection { get; } = GetDoubleCollectionFromIntList(cd);
public static DoubleCollection SpeedsForDVDAsCollection { get; } = GetDoubleCollectionFromIntList(dvd);
public static DoubleCollection SpeedsForBDAsCollection { get; } = GetDoubleCollectionFromIntList(bd);
private static DoubleCollection GetDoubleCollectionFromIntList(IReadOnlyList<int> list)
=> new DoubleCollection(list.Select(i => Convert.ToDouble(i)).ToList());
}

View File

@@ -0,0 +1,116 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{A6719A99-BF0E-4637-9A8E-CB38B1E16971}</ProjectGuid>
<OutputType>WinExe</OutputType>
<RootNamespace>DICUI.Forms</RootNamespace>
<AssemblyName>DICUI.Forms</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup>
<ApplicationIcon>Icon.ico</ApplicationIcon>
</PropertyGroup>
<ItemGroup>
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Drawing.Design" />
<Reference Include="System.Windows" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="WindowsBase" />
</ItemGroup>
<ItemGroup>
<Compile Include="Constants.cs" />
<Compile Include="EnumDescriptionConverter.cs" />
<Compile Include="KnownSystemComboBoxItem.cs" />
<Compile Include="Options.cs" />
<Compile Include="Properties\Settings1.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTimeSharedInput>True</DesignTimeSharedInput>
<DependentUpon>Settings1.settings</DependentUpon>
</Compile>
<Compile Include="ViewModels.cs" />
<Compile Include="Windows\LogWindow.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Windows\LogWindow.Designer.cs">
<DependentUpon>LogWindow.cs</DependentUpon>
</Compile>
<Compile Include="Windows\MainWindow.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Windows\MainWindow.Designer.cs">
<DependentUpon>MainWindow.cs</DependentUpon>
</Compile>
<Compile Include="Program.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Windows\OptionsWindow.cs">
<SubType>Form</SubType>
</Compile>
<Compile Include="Windows\OptionsWindow.Designer.cs">
<DependentUpon>OptionsWindow.cs</DependentUpon>
</Compile>
<EmbeddedResource Include="Windows\LogWindow.resx">
<DependentUpon>LogWindow.cs</DependentUpon>
</EmbeddedResource>
<EmbeddedResource Include="Windows\MainWindow.resx">
<DependentUpon>MainWindow.cs</DependentUpon>
<SubType>Designer</SubType>
</EmbeddedResource>
<EmbeddedResource Include="Windows\OptionsWindow.resx">
<DependentUpon>OptionsWindow.cs</DependentUpon>
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="Properties\Settings1.settings">
<Generator>SettingsSingleFileGenerator</Generator>
<LastGenOutput>Settings1.Designer.cs</LastGenOutput>
</None>
</ItemGroup>
<ItemGroup>
<Resource Include="Icon.ico" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DICUI.Library\DICUI.Library.csproj">
<Project>{51ab0928-13f9-44bf-a407-b6957a43a056}</Project>
<Name>DICUI.Library</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,33 @@
using System;
using System.Globalization;
using System.Windows.Data;
using DICUI.Data;
using DICUI.Utilities;
namespace DICUI.Forms
{
/// <summary>
/// Used to provide a converter to XAML files to render comboboxes with enum values
/// </summary>
public class EnumDescriptionConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is DICCommand)
return ((DICCommand)value).Name();
else if (value is DICFlag)
return ((DICFlag)value).Name();
else if (value is MediaType?)
return ((MediaType?)value).Name();
else if (value is KnownSystem?)
return ((KnownSystem?)value).Name();
else
return "";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return string.Empty;
}
}
}

BIN
DICUI.Forms/Icon.ico Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 71 KiB

View File

@@ -0,0 +1,35 @@
using System.Windows.Media;
using DICUI.Data;
using DICUI.Utilities;
namespace DICUI
{
/// <summary>
/// Represents a single item in the System combo box
/// </summary>
public class KnownSystemComboBoxItem
{
private object data;
public KnownSystemComboBoxItem(KnownSystem? system) => data = system;
public KnownSystemComboBoxItem(KnownSystemCategory? category) => data = category;
//public Brush Foreground { get => IsHeader() ? Brushes.Gray : Brushes.Black; } // TODO: Re-enable this
public bool IsHeader() => data is KnownSystemCategory?;
public bool IsSystem() => data is KnownSystem?;
public static implicit operator KnownSystem? (KnownSystemComboBoxItem item) => item.data as KnownSystem?;
public string Name
{
get
{
if (IsHeader())
return "---------- " + (data as KnownSystemCategory?).Name() + " ----------";
else
return (data as KnownSystem?).Name();
}
}
}
}

97
DICUI.Forms/Options.cs Normal file
View File

@@ -0,0 +1,97 @@
using System;
using System.Configuration;
using System.Reflection;
using DICUI.Data;
namespace DICUI
{
public class Options
{
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; }
public int preferredDumpSpeedBD { get; set; }
public bool QuietMode { get; set; }
public bool ParanoidMode { get; set; }
public bool ScanForProtection { get; set; }
public int RereadAmountForC2 { get; set; }
public bool SkipMediaTypeDetection { get; set; }
public bool VerboseLogging { get; set; }
public bool OpenLogWindowAtStartup { get; set; }
public void Save()
{
Configuration configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
//TODO: reflection is used
//TODO: is remove needed, doesn't the value get directly overridden
Array.ForEach(
GetType().GetProperties(BindingFlags.Public | BindingFlags.Instance),
p => {
configFile.AppSettings.Settings.Remove(p.Name);
configFile.AppSettings.Settings.Add(p.Name, Convert.ToString(p.GetValue(this)));
}
);
configFile.Save(ConfigurationSaveMode.Modified);
}
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";
this.preferredDumpSpeedCD = Int32.TryParse(ConfigurationManager.AppSettings["preferredDumpSpeedCD"], out int maxDumpSpeedCD) ? maxDumpSpeedCD : 72;
this.preferredDumpSpeedDVD = Int32.TryParse(ConfigurationManager.AppSettings["preferredDumpSpeedDVD"], out int maxDumpSpeedDVD) ? maxDumpSpeedDVD : 24;
this.preferredDumpSpeedBD = Int32.TryParse(ConfigurationManager.AppSettings["preferredDumpSpeedBD"], out int maxDumpSpeedBD) ? maxDumpSpeedBD : 16;
this.QuietMode = Boolean.TryParse(ConfigurationManager.AppSettings["QuietMode"], out bool quietMode) ? quietMode : false;
this.ParanoidMode = Boolean.TryParse(ConfigurationManager.AppSettings["ParanoidMode"], out bool paranoidMode) ? paranoidMode : false;
this.ScanForProtection = Boolean.TryParse(ConfigurationManager.AppSettings["ScanForProtection"], out bool scanForProtection) ? scanForProtection : true;
this.SkipMediaTypeDetection = Boolean.TryParse(ConfigurationManager.AppSettings["SkipMediaTypeDetection"], out bool skipMediaTypeDetection) ? skipMediaTypeDetection : false;
this.RereadAmountForC2 = Int32.TryParse(ConfigurationManager.AppSettings["RereadAmountForC2"], out int rereadAmountForC2) ? rereadAmountForC2 : 20;
this.VerboseLogging = Boolean.TryParse(ConfigurationManager.AppSettings["VerboseLogging"], out bool verboseLogging) ? verboseLogging : true;
this.OpenLogWindowAtStartup = Boolean.TryParse(ConfigurationManager.AppSettings["OpenLogWindowAtStartup"], out bool openLogWindowAtStartup) ? openLogWindowAtStartup : true;
}
//TODO: probably should be generic for non-string options
//TODO: using reflection for Set and Get is orthodox but it works, should be changed to a key,value map probably
public void Set(string key, string value)
{
GetType().GetProperty(key, BindingFlags.Public | BindingFlags.Instance).SetValue(this, value);
}
public string Get(string key)
{
return GetType().GetProperty(key, BindingFlags.Public | BindingFlags.Instance).GetValue(this) as string;
}
public int GetPreferredDumpSpeedForMediaType(MediaType? type)
{
switch (type)
{
case MediaType.CDROM:
case MediaType.GDROM:
return preferredDumpSpeedCD;
case MediaType.DVD:
case MediaType.HDDVD:
case MediaType.NintendoGameCube:
case MediaType.NintendoWiiOpticalDisc:
return preferredDumpSpeedDVD;
case MediaType.BluRay:
return preferredDumpSpeedBD;
default:
return 8;
}
}
}
}

20
DICUI.Forms/Program.cs Normal file
View File

@@ -0,0 +1,20 @@
using System;
using System.Windows.Forms;
using DICUI.Forms.Windows;
namespace DICUI.Forms
{
static class Program
{
/// <summary>
/// The main entry point for the application.
/// </summary>
[STAThread]
static void Main()
{
Application.EnableVisualStyles();
Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainWindow());
}
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DICUI.Forms")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DICUI.Forms")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("a6719a99-bf0e-4637-9a8e-cb38b1e16971")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.11")]
[assembly: AssemblyFileVersion("1.11.0.0")]

View File

@@ -0,0 +1,26 @@
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:4.0.30319.42000
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------
namespace DICUI.Forms.Properties {
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.8.0.0")]
internal sealed partial class Settings1 : global::System.Configuration.ApplicationSettingsBase {
private static Settings1 defaultInstance = ((Settings1)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings1())));
public static Settings1 Default {
get {
return defaultInstance;
}
}
}
}

View File

@@ -0,0 +1,6 @@
<?xml version='1.0' encoding='utf-8'?>
<SettingsFile xmlns="http://schemas.microsoft.com/VisualStudio/2004/01/settings" CurrentProfile="(Default)">
<Profiles>
<Profile Name="(Default)" />
</Profiles>
</SettingsFile>

107
DICUI.Forms/ViewModels.cs Normal file
View File

@@ -0,0 +1,107 @@
using System;
using System.Windows.Media;
using DICUI.Forms.Windows;
namespace DICUI.Forms
{
public class OptionsViewModel
{
private Options _options;
public OptionsViewModel(Options options)
{
this._options = options;
}
public bool QuietMode
{
get { return _options.QuietMode; }
set { _options.QuietMode = value; }
}
public bool ParanoidMode
{
get { return _options.ParanoidMode; }
set { _options.ParanoidMode = value; }
}
public bool ScanForProtection
{
get { return _options.ScanForProtection; }
set { _options.ScanForProtection = value; }
}
public bool SkipMediaTypeDetection
{
get { return _options.SkipMediaTypeDetection; }
set { _options.SkipMediaTypeDetection = value; }
}
public string RereadAmountForC2
{
get { return Convert.ToString(_options.RereadAmountForC2); }
set
{
if (Int32.TryParse(value, out int result))
_options.RereadAmountForC2 = result;
}
}
public bool VerboseLogging
{
get { return _options.VerboseLogging; }
set
{
_options.VerboseLogging = value;
_options.Save();
}
}
public bool OpenLogWindowAtStartup
{
get { return _options.OpenLogWindowAtStartup; }
set
{
_options.OpenLogWindowAtStartup = value;
_options.Save();
}
}
}
public class LoggerViewModel
{
private LogWindow _logWindow;
public void SetWindow(LogWindow logWindow) => _logWindow = logWindow;
public bool WindowVisible
{
get => _logWindow != null ? _logWindow.Visible : false;
set
{
if (value)
{
_logWindow.AdjustPositionToMainWindow();
_logWindow.Show();
}
else
_logWindow.Hide();
}
}
public void VerboseLog(string text)
{
if (ViewModels.OptionsViewModel.VerboseLogging)
_logWindow.AppendToTextBox(text, System.Drawing.Color.Yellow);
}
public void VerboseLog(string format, params object[] args) => VerboseLog(string.Format(format, args));
public void VerboseLogLn(string format, params object[] args) => VerboseLog(string.Format(format, args) + "\n");
}
public static class ViewModels
{
public static OptionsViewModel OptionsViewModel { get; set; }
public static LoggerViewModel LoggerViewModel { get; set; } = new LoggerViewModel();
}
}

175
DICUI.Forms/Windows/LogWindow.Designer.cs generated Normal file
View File

@@ -0,0 +1,175 @@
namespace DICUI.Forms.Windows
{
partial class LogWindow
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.progressBar = new System.Windows.Forms.ProgressBar();
this.output = new System.Windows.Forms.RichTextBox();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.Verbose = new System.Windows.Forms.CheckBox();
this.OpenAtStartupCheckBox = new System.Windows.Forms.CheckBox();
this.ClearButton = new System.Windows.Forms.Button();
this.HideButton = new System.Windows.Forms.Button();
this.tableLayoutPanel1.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel1.Controls.Add(this.progressBar, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.output, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel2, 0, 2);
this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 12);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 3;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(560, 287);
this.tableLayoutPanel1.TabIndex = 0;
//
// progressBar
//
this.progressBar.Dock = System.Windows.Forms.DockStyle.Fill;
this.progressBar.Location = new System.Drawing.Point(3, 3);
this.progressBar.Name = "progressBar";
this.progressBar.Size = new System.Drawing.Size(554, 34);
this.progressBar.TabIndex = 0;
//
// output
//
this.output.BackColor = System.Drawing.Color.DimGray;
this.output.Dock = System.Windows.Forms.DockStyle.Fill;
this.output.Font = new System.Drawing.Font("Consolas", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0)));
this.output.Location = new System.Drawing.Point(3, 43);
this.output.Name = "output";
this.output.ReadOnly = true;
this.output.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical;
this.output.Size = new System.Drawing.Size(554, 201);
this.output.TabIndex = 1;
this.output.Text = "";
this.output.TextChanged += new System.EventHandler(this.OnTextChanged);
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.ColumnCount = 5;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 20F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 35F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 15F));
this.tableLayoutPanel2.Controls.Add(this.Verbose, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.OpenAtStartupCheckBox, 1, 0);
this.tableLayoutPanel2.Controls.Add(this.ClearButton, 3, 0);
this.tableLayoutPanel2.Controls.Add(this.HideButton, 4, 0);
this.tableLayoutPanel2.Location = new System.Drawing.Point(3, 250);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 1;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(554, 34);
this.tableLayoutPanel2.TabIndex = 2;
//
// Verbose
//
this.Verbose.AutoSize = true;
this.Verbose.Dock = System.Windows.Forms.DockStyle.Left;
this.Verbose.Location = new System.Drawing.Point(3, 3);
this.Verbose.Name = "Verbose";
this.Verbose.Size = new System.Drawing.Size(65, 28);
this.Verbose.TabIndex = 1;
this.Verbose.Text = "Verbose";
this.Verbose.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
this.Verbose.UseVisualStyleBackColor = true;
//
// OpenAtStartupCheckBox
//
this.OpenAtStartupCheckBox.AutoSize = true;
this.OpenAtStartupCheckBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.OpenAtStartupCheckBox.Location = new System.Drawing.Point(86, 3);
this.OpenAtStartupCheckBox.Name = "OpenAtStartupCheckBox";
this.OpenAtStartupCheckBox.Size = new System.Drawing.Size(104, 28);
this.OpenAtStartupCheckBox.TabIndex = 2;
this.OpenAtStartupCheckBox.Text = "Open at startup";
this.OpenAtStartupCheckBox.UseVisualStyleBackColor = true;
//
// ClearButton
//
this.ClearButton.Dock = System.Windows.Forms.DockStyle.Fill;
this.ClearButton.Location = new System.Drawing.Point(389, 3);
this.ClearButton.Name = "ClearButton";
this.ClearButton.Size = new System.Drawing.Size(77, 28);
this.ClearButton.TabIndex = 3;
this.ClearButton.Text = "Clear";
this.ClearButton.UseVisualStyleBackColor = true;
this.ClearButton.Click += new System.EventHandler(this.OnClearButton);
//
// HideButton
//
this.HideButton.Dock = System.Windows.Forms.DockStyle.Fill;
this.HideButton.Location = new System.Drawing.Point(472, 3);
this.HideButton.Name = "HideButton";
this.HideButton.Size = new System.Drawing.Size(79, 28);
this.HideButton.TabIndex = 4;
this.HideButton.Text = "Hide";
this.HideButton.UseVisualStyleBackColor = true;
this.HideButton.SizeChanged += new System.EventHandler(this.ScrollViewer_SizeChanged);
this.HideButton.Click += new System.EventHandler(this.OnHideButton);
//
// LogWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(584, 311);
this.Controls.Add(this.tableLayoutPanel1);
this.Name = "LogWindow";
this.ShowIcon = false;
this.Text = "Log Window";
this.FormClosed += new System.Windows.Forms.FormClosedEventHandler(this.OnWindowClosed);
this.tableLayoutPanel1.ResumeLayout(false);
this.tableLayoutPanel2.ResumeLayout(false);
this.tableLayoutPanel2.PerformLayout();
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.ProgressBar progressBar;
private System.Windows.Forms.RichTextBox output;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.CheckBox Verbose;
private System.Windows.Forms.CheckBox OpenAtStartupCheckBox;
private System.Windows.Forms.Button ClearButton;
private System.Windows.Forms.Button HideButton;
}
}

View File

@@ -0,0 +1,380 @@
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading.Tasks;
using System.Windows.Forms;
using System.Windows.Threading;
namespace DICUI.Forms.Windows
{
public partial class LogWindow : Form
{
private const int GWL_STYLE = -16;
private const int WS_SYSMENU = 0x80000;
[DllImport("user32.dll", SetLastError = true)]
private static extern int GetWindowLong(IntPtr hWnd, int nIndex);
[DllImport("user32.dll")]
private static extern int SetWindowLong(IntPtr hWnd, int nIndex, int dwNewLong);
private MainWindow _mainWindow;
private List<Matcher> _matchers;
volatile Process _process;
public LogWindow(MainWindow mainWindow)
{
InitializeComponent();
this._mainWindow = mainWindow;
_matchers = new List<Matcher>();
_matchers.Add(new Matcher(
"Descrambling data sector of img (LBA)",
@"\s*(\d+)\/\s*(\d+)$",
match => {
if (UInt32.TryParse(match.Groups[1].Value, out uint current) && UInt32.TryParse(match.Groups[2].Value, out uint total))
{
float percentProgress = (current / (float)total) * 100;
progressBar.Value = (int)percentProgress;
//progressBar.Text = string.Format("Descrambling image.. ({0:##.##}%)", percentProgress);
}
}));
_matchers.Add(new Matcher(
@"Creating .scm (LBA)",
@"\s*(\d+)\/\s*(\d+)$",
match => {
if (UInt32.TryParse(match.Groups[1].Value, out uint current) && UInt32.TryParse(match.Groups[2].Value, out uint total))
{
float percentProgress = (current / (float)total) * 100;
progressBar.Value = (int)percentProgress;
//progressBar.Text = string.Format("Creating scrambled image.. ({0:##.##}%)", percentProgress);
}
}));
_matchers.Add(new Matcher(
"Checking sectors (LBA)",
@"\s*(\d+)\/\s*(\d+)$",
match => {
if (UInt32.TryParse(match.Groups[1].Value, out uint current) && UInt32.TryParse(match.Groups[2].Value, out uint total))
{
float percentProgress = (current / (float)total) * 100;
progressBar.Value = (int)percentProgress;
//progressBar.Text = string.Format("Checking for errors.. ({0:##.##}%)", percentProgress);
}
}));
_matchers.Add(new Matcher(
"Scanning sector (LBA)",
@"\s*(\d+)\/\s*(\d+)$",
match => {
if (UInt32.TryParse(match.Groups[1].Value, out uint current) && UInt32.TryParse(match.Groups[2].Value, out uint total))
{
float percentProgress = (current / (float)total) * 100;
progressBar.Value = (int)percentProgress;
//progressBar.Text = string.Format("Scanning sectors for protection.. ({0:##.##}%)", percentProgress);
}
}));
}
protected override bool ShowWithoutActivation
{
get { return true; }
}
public void StartDump(string args)
{
AppendToTextBox(string.Format("Launching DIC with args: {0}\r\n", args), System.Drawing.Color.Orange);
Task.Run(() =>
{
_process = new Process()
{
StartInfo = new ProcessStartInfo()
{
FileName = @"Programs/DiscImageCreator.exe",
Arguments = args,
CreateNoWindow = true,
UseShellExecute = false,
RedirectStandardOutput = true,
RedirectStandardError = true,
},
};
StreamState stdoutState = new StreamState(false);
StreamState stderrState = new StreamState(true);
//_cmd.ErrorDataReceived += (process, text) => Dispatcher.CurrentDispatcher.Invoke(() => UpdateConsole(text.Data, Brushes.Red));
_process.Start();
var _1 = ConsumeOutput(_process.StandardOutput, s => Dispatcher.CurrentDispatcher.Invoke(() => UpdateConsole(s, stdoutState)));
var _2 = ConsumeOutput(_process.StandardError, s => Dispatcher.CurrentDispatcher.Invoke(() => UpdateConsole(s, stderrState)));
_process.EnableRaisingEvents = true;
_process.Exited += OnProcessExit;
});
}
public void AdjustPositionToMainWindow()
{
this.Left = _mainWindow.Left;
this.Top = _mainWindow.Top + _mainWindow.Height + Constants.LogWindowMarginFromMainWindow;
this.BringToFront();
}
private void GracefullyTerminateProcess()
{
if (_process != null)
{
_process.Exited -= OnProcessExit;
bool isForced = !_process.HasExited;
if (isForced)
{
AppendToTextBox("\r\nForcefully Killing the process\r\n", System.Drawing.Color.Red);
_process.Kill();
_process.WaitForExit();
}
AppendToTextBox(string.Format("\r\nExit Code: {0}\r\n", _process.ExitCode), _process.ExitCode == 0 ? System.Drawing.Color.Green : System.Drawing.Color.Red);
if (_process.ExitCode == 0)
{
Dispatcher.CurrentDispatcher.Invoke(() =>
{
//progressBar.Text = "Done!";
progressBar.Value = 100;
progressBar.ForeColor = System.Drawing.Color.Green;
});
}
else
{
Dispatcher.CurrentDispatcher.Invoke(() =>
{
//progressBar.Text = isForced ? "Aborted by user" : "Error, please check log!";
progressBar.Value = 100;
progressBar.ForeColor = System.Drawing.Color.Red;
});
}
_process.Close();
}
_process = null;
}
private void ScrollViewer_SizeChanged(object sender, EventArgs e)
{
output.ScrollToCaret();
}
async Task ConsumeOutput(TextReader reader, Action<string> callback)
{
char[] buffer = new char[256];
int cch;
while ((cch = await reader.ReadAsync(buffer, 0, buffer.Length)) > 0)
{
callback(new string(buffer, 0, cch));
}
}
// this is used to optimize the work since we need to process A LOT of text
struct Matcher
{
private readonly String prefix;
private readonly Regex regex;
private readonly int start;
private readonly Action<Match> lambda;
public Matcher(String prefix, String regex, Action<Match> lambda)
{
this.prefix = prefix;
this.regex = new Regex(regex);
this.start = prefix.Length;
this.lambda = lambda;
}
public bool Matches(ref string text) => text.StartsWith(prefix);
public void Apply(ref string text)
{
Match match = regex.Match(text, start);
lambda.Invoke(match);
}
}
private void ProcessStringForProgressBar(string text)
{
foreach (Matcher matcher in _matchers)
{
if (matcher.Matches(ref text))
{
matcher.Apply(ref text);
return;
}
}
}
class StreamState
{
public enum State
{
BEGIN,
READ_CARRIAGE,
};
public State state;
public readonly StringBuilder buffer;
public readonly bool isError;
public StreamState(bool isError)
{
this.state = State.BEGIN;
this.buffer = new StringBuilder();
this.isError = isError;
}
public bool HasData() => buffer.Length > 0;
public string Fetch() => buffer.ToString();
public void Clear() => buffer.Clear();
public void Append(char c) => buffer.Append(c);
public bool Is(State state) => this.state == state;
public void Set(State state) => this.state = state;
}
public void AppendToTextBox(string text, System.Drawing.Color color)
{
if (Dispatcher.CurrentDispatcher.CheckAccess())
{
output.ForeColor = color;
output.AppendText(text);
}
else
Dispatcher.CurrentDispatcher.Invoke(() =>
{
output.ForeColor = color;
output.AppendText(text);
});
}
private void UpdateConsole(string text, StreamState state)
{
/*if (c == '\r') { output.Inlines.Add(@"\r"); file.Write("\\r"); }
else if (c == '\n') { output.Inlines.Add(@"\n"); file.Write("\\n\n"); }
output.Inlines.Add(""+c);
file.Write(c);
file.Flush();
continue;*/
if (text != null)
{
foreach (char c in text)
{
switch (c)
{
case '\r' when (state.Is(StreamState.State.BEGIN)):
{
state.Set(StreamState.State.READ_CARRIAGE);
break;
}
case '\n' when (state.Is(StreamState.State.READ_CARRIAGE)):
{
if (state.buffer.Length > 0)
{
string buffer = state.Fetch();
AppendToTextBox(buffer, state.isError ? System.Drawing.Color.Red : System.Drawing.Color.White);
if (!state.isError)
ProcessStringForProgressBar(buffer);
}
output.AppendText(Environment.NewLine);
state.Clear();
state.Set(StreamState.State.BEGIN);
break;
}
default:
if (state.Is(StreamState.State.READ_CARRIAGE) && state.HasData())
{
if (!String.IsNullOrEmpty(output.Lines.Last()))
output.Lines[output.Lines.Length] = string.Empty;
string buffer = state.Fetch();
AppendToTextBox(buffer, state.isError ? System.Drawing.Color.Red : System.Drawing.Color.White);
if (!state.isError)
ProcessStringForProgressBar(buffer);
state.Clear();
}
state.Set(StreamState.State.BEGIN);
state.Append(c);
break;
}
}
}
}
#region EventHandlers
private void OnWindowClosed(object sender, FormClosedEventArgs e)
{
GracefullyTerminateProcess();
}
private void OnWindowLoaded(object sender, EventArgs e)
{
var hwnd = this.Handle;
SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);
}
void OnProcessExit(object sender, EventArgs e)
{
//Dispatcher.CurrentDispatcher.Invoke(() => AbortButton.IsEnabled = false);
GracefullyTerminateProcess();
}
private void OnHideButton(object sender, EventArgs e)
{
ViewModels.LoggerViewModel.WindowVisible = false;
//TODO: this should be bound directly to WindowVisible property in two way fashion
// we need to study how to properly do it in XAML
_mainWindow.showLogWindowToolStripMenuItem.Checked = false;
}
private void OnClearButton(object sender, EventArgs e)
{
output.Clear();
}
private void OnAbortButton(object sender, EventArgs args)
{
GracefullyTerminateProcess();
}
private void OnStartButton(object sender, EventArgs args)
{
StartDump("cd e Gam.iso 16");
}
private void OnTextChanged(object sender, EventArgs e)
{
output.ScrollToCaret();
}
#endregion
}
}

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

530
DICUI.Forms/Windows/MainWindow.Designer.cs generated Normal file
View File

@@ -0,0 +1,530 @@
namespace DICUI.Forms.Windows
{
partial class MainWindow
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(MainWindow));
this.MenuBar = new System.Windows.Forms.MenuStrip();
this.mainWindowLayout = new System.Windows.Forms.TableLayoutPanel();
this.settingsGroupBox = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.parametersLabel = new System.Windows.Forms.Label();
this.driveSpeedLabel = new System.Windows.Forms.Label();
this.driveLetterLabel = new System.Windows.Forms.Label();
this.outputDirectoryLabel = new System.Windows.Forms.Label();
this.outputFilenameLabel = new System.Windows.Forms.Label();
this.systemMediaTypeLabel = new System.Windows.Forms.Label();
this.OutputFilenameTextBox = new System.Windows.Forms.TextBox();
this.SystemTypeComboBox = new System.Windows.Forms.ComboBox();
this.MediaTypeComboBox = new System.Windows.Forms.ComboBox();
this.OutputDirectoryTextBox = new System.Windows.Forms.TextBox();
this.OutputDirectoryBrowseButton = new System.Windows.Forms.Button();
this.DriveLetterComboBox = new System.Windows.Forms.ComboBox();
this.DriveSpeedComboBox = new System.Windows.Forms.ComboBox();
this.ParametersTextBox = new System.Windows.Forms.TextBox();
this.EnableParametersCheckBox = new System.Windows.Forms.CheckBox();
this.controlsGroupBox = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.StartStopButton = new System.Windows.Forms.Button();
this.DiscScanButton = new System.Windows.Forms.Button();
this.CopyProtectScanButton = new System.Windows.Forms.Button();
this.EjectWhenDoneCheckBox = new System.Windows.Forms.CheckBox();
this.statusGroupBox = new System.Windows.Forms.GroupBox();
this.StatusLabel = new System.Windows.Forms.TextBox();
this.fileToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.toolsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.helpToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.exitToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.optionsToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.showLogWindowToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.aboutToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
this.MenuBar.SuspendLayout();
this.mainWindowLayout.SuspendLayout();
this.settingsGroupBox.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
this.controlsGroupBox.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout();
this.statusGroupBox.SuspendLayout();
this.SuspendLayout();
//
// MenuBar
//
this.MenuBar.Location = new System.Drawing.Point(0, 0);
this.MenuBar.Name = "MenuBar";
this.MenuBar.Size = new System.Drawing.Size(584, 24);
this.MenuBar.TabIndex = 0;
this.MenuBar.Text = "menuStrip1";
this.MenuBar.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
fileToolStripMenuItem, toolsToolStripMenuItem, helpToolStripMenuItem});
//
// mainWindowLayout
//
this.mainWindowLayout.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom)
| System.Windows.Forms.AnchorStyles.Left)
| System.Windows.Forms.AnchorStyles.Right)));
this.mainWindowLayout.ColumnCount = 1;
this.mainWindowLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.mainWindowLayout.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.mainWindowLayout.Controls.Add(this.settingsGroupBox, 0, 0);
this.mainWindowLayout.Controls.Add(this.controlsGroupBox, 0, 1);
this.mainWindowLayout.Controls.Add(this.statusGroupBox, 0, 2);
this.mainWindowLayout.Location = new System.Drawing.Point(13, 28);
this.mainWindowLayout.Name = "mainWindowLayout";
this.mainWindowLayout.RowCount = 3;
this.mainWindowLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 82.66254F));
this.mainWindowLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 17.33746F));
this.mainWindowLayout.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 47F));
this.mainWindowLayout.Size = new System.Drawing.Size(559, 371);
this.mainWindowLayout.TabIndex = 1;
//
// settingsGroupBox
//
this.settingsGroupBox.Controls.Add(this.tableLayoutPanel2);
this.settingsGroupBox.Location = new System.Drawing.Point(3, 3);
this.settingsGroupBox.Name = "settingsGroupBox";
this.settingsGroupBox.Size = new System.Drawing.Size(553, 259);
this.settingsGroupBox.TabIndex = 0;
this.settingsGroupBox.TabStop = false;
this.settingsGroupBox.Text = "Settings";
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.ColumnCount = 3;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 26.32794F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 73.67206F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 144F));
this.tableLayoutPanel2.Controls.Add(this.parametersLabel, 0, 5);
this.tableLayoutPanel2.Controls.Add(this.driveSpeedLabel, 0, 4);
this.tableLayoutPanel2.Controls.Add(this.driveLetterLabel, 0, 3);
this.tableLayoutPanel2.Controls.Add(this.outputDirectoryLabel, 0, 2);
this.tableLayoutPanel2.Controls.Add(this.outputFilenameLabel, 0, 1);
this.tableLayoutPanel2.Controls.Add(this.systemMediaTypeLabel, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.OutputFilenameTextBox, 1, 1);
this.tableLayoutPanel2.Controls.Add(this.SystemTypeComboBox, 1, 0);
this.tableLayoutPanel2.Controls.Add(this.MediaTypeComboBox, 2, 0);
this.tableLayoutPanel2.Controls.Add(this.OutputDirectoryTextBox, 1, 2);
this.tableLayoutPanel2.Controls.Add(this.OutputDirectoryBrowseButton, 2, 2);
this.tableLayoutPanel2.Controls.Add(this.DriveLetterComboBox, 1, 3);
this.tableLayoutPanel2.Controls.Add(this.DriveSpeedComboBox, 1, 4);
this.tableLayoutPanel2.Controls.Add(this.ParametersTextBox, 1, 5);
this.tableLayoutPanel2.Controls.Add(this.EnableParametersCheckBox, 2, 5);
this.tableLayoutPanel2.Location = new System.Drawing.Point(0, 19);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.Padding = new System.Windows.Forms.Padding(0, 5, 0, 5);
this.tableLayoutPanel2.RowCount = 6;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 16.66667F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(553, 234);
this.tableLayoutPanel2.TabIndex = 0;
//
// parametersLabel
//
this.parametersLabel.AutoSize = true;
this.parametersLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.parametersLabel.Location = new System.Drawing.Point(3, 190);
this.parametersLabel.Name = "parametersLabel";
this.parametersLabel.Size = new System.Drawing.Size(101, 39);
this.parametersLabel.TabIndex = 10;
this.parametersLabel.Text = "Parameters";
this.parametersLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// driveSpeedLabel
//
this.driveSpeedLabel.AutoSize = true;
this.driveSpeedLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.driveSpeedLabel.Location = new System.Drawing.Point(3, 153);
this.driveSpeedLabel.Name = "driveSpeedLabel";
this.driveSpeedLabel.Size = new System.Drawing.Size(101, 37);
this.driveSpeedLabel.TabIndex = 8;
this.driveSpeedLabel.Text = "Drive Speed";
this.driveSpeedLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// driveLetterLabel
//
this.driveLetterLabel.AutoSize = true;
this.driveLetterLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.driveLetterLabel.Location = new System.Drawing.Point(3, 116);
this.driveLetterLabel.Name = "driveLetterLabel";
this.driveLetterLabel.Size = new System.Drawing.Size(101, 37);
this.driveLetterLabel.TabIndex = 6;
this.driveLetterLabel.Text = "Drive Letter";
this.driveLetterLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// outputDirectoryLabel
//
this.outputDirectoryLabel.AutoSize = true;
this.outputDirectoryLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.outputDirectoryLabel.Location = new System.Drawing.Point(3, 79);
this.outputDirectoryLabel.Name = "outputDirectoryLabel";
this.outputDirectoryLabel.Size = new System.Drawing.Size(101, 37);
this.outputDirectoryLabel.TabIndex = 4;
this.outputDirectoryLabel.Text = "Output Directory";
this.outputDirectoryLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// outputFilenameLabel
//
this.outputFilenameLabel.AutoSize = true;
this.outputFilenameLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.outputFilenameLabel.Location = new System.Drawing.Point(3, 42);
this.outputFilenameLabel.Name = "outputFilenameLabel";
this.outputFilenameLabel.Size = new System.Drawing.Size(101, 37);
this.outputFilenameLabel.TabIndex = 2;
this.outputFilenameLabel.Text = "Output Filename";
this.outputFilenameLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// systemMediaTypeLabel
//
this.systemMediaTypeLabel.AutoSize = true;
this.systemMediaTypeLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.systemMediaTypeLabel.Location = new System.Drawing.Point(3, 5);
this.systemMediaTypeLabel.Name = "systemMediaTypeLabel";
this.systemMediaTypeLabel.Size = new System.Drawing.Size(101, 37);
this.systemMediaTypeLabel.TabIndex = 0;
this.systemMediaTypeLabel.Text = "System/Media Type";
this.systemMediaTypeLabel.TextAlign = System.Drawing.ContentAlignment.MiddleCenter;
//
// OutputFilenameTextBox
//
this.OutputFilenameTextBox.Anchor = System.Windows.Forms.AnchorStyles.None;
this.tableLayoutPanel2.SetColumnSpan(this.OutputFilenameTextBox, 2);
this.OutputFilenameTextBox.Location = new System.Drawing.Point(111, 50);
this.OutputFilenameTextBox.Name = "OutputFilenameTextBox";
this.OutputFilenameTextBox.Size = new System.Drawing.Size(438, 20);
this.OutputFilenameTextBox.TabIndex = 11;
this.OutputFilenameTextBox.TextChanged += new System.EventHandler(this.OutputFilenameTextBoxTextChanged);
//
// SystemTypeComboBox
//
this.SystemTypeComboBox.Anchor = System.Windows.Forms.AnchorStyles.None;
this.SystemTypeComboBox.DisplayMember = "Name";
this.SystemTypeComboBox.DropDownWidth = 250;
this.SystemTypeComboBox.FormattingEnabled = true;
this.SystemTypeComboBox.Location = new System.Drawing.Point(110, 13);
this.SystemTypeComboBox.Name = "SystemTypeComboBox";
this.SystemTypeComboBox.Size = new System.Drawing.Size(295, 21);
this.SystemTypeComboBox.TabIndex = 13;
this.SystemTypeComboBox.SelectedIndexChanged += new System.EventHandler(this.SystemTypeComboBoxSelectionChanged);
//
// MediaTypeComboBox
//
this.MediaTypeComboBox.Anchor = System.Windows.Forms.AnchorStyles.None;
this.MediaTypeComboBox.DisplayMember = "Name";
this.MediaTypeComboBox.FormattingEnabled = true;
this.MediaTypeComboBox.Location = new System.Drawing.Point(415, 13);
this.MediaTypeComboBox.Name = "MediaTypeComboBox";
this.MediaTypeComboBox.Size = new System.Drawing.Size(131, 21);
this.MediaTypeComboBox.TabIndex = 14;
this.MediaTypeComboBox.SelectedIndexChanged += new System.EventHandler(this.MediaTypeComboBoxSelectionChanged);
//
// OutputDirectoryTextBox
//
this.OutputDirectoryTextBox.Anchor = System.Windows.Forms.AnchorStyles.None;
this.OutputDirectoryTextBox.Location = new System.Drawing.Point(110, 87);
this.OutputDirectoryTextBox.Name = "OutputDirectoryTextBox";
this.OutputDirectoryTextBox.Size = new System.Drawing.Size(295, 20);
this.OutputDirectoryTextBox.TabIndex = 15;
this.OutputDirectoryTextBox.TextChanged += new System.EventHandler(this.OutputDirectoryTextBoxTextChanged);
//
// OutputDirectoryBrowseButton
//
this.OutputDirectoryBrowseButton.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Left | System.Windows.Forms.AnchorStyles.Right)));
this.OutputDirectoryBrowseButton.Location = new System.Drawing.Point(411, 84);
this.OutputDirectoryBrowseButton.Name = "OutputDirectoryBrowseButton";
this.OutputDirectoryBrowseButton.Size = new System.Drawing.Size(139, 26);
this.OutputDirectoryBrowseButton.TabIndex = 16;
this.OutputDirectoryBrowseButton.Text = "Browse";
this.OutputDirectoryBrowseButton.UseVisualStyleBackColor = true;
this.OutputDirectoryBrowseButton.Click += new System.EventHandler(this.OutputDirectoryBrowseButtonClick);
//
// DriveLetterComboBox
//
this.DriveLetterComboBox.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.DriveLetterComboBox.DisplayMember = "Letter";
this.DriveLetterComboBox.FormattingEnabled = true;
this.DriveLetterComboBox.Location = new System.Drawing.Point(110, 124);
this.DriveLetterComboBox.Name = "DriveLetterComboBox";
this.DriveLetterComboBox.Size = new System.Drawing.Size(121, 21);
this.DriveLetterComboBox.TabIndex = 17;
this.DriveLetterComboBox.SelectedIndexChanged += new System.EventHandler(this.DriveLetterComboBoxSelectionChanged);
//
// DriveSpeedComboBox
//
this.DriveSpeedComboBox.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.DriveSpeedComboBox.FormattingEnabled = true;
this.DriveSpeedComboBox.Location = new System.Drawing.Point(110, 161);
this.DriveSpeedComboBox.Name = "DriveSpeedComboBox";
this.DriveSpeedComboBox.Size = new System.Drawing.Size(121, 21);
this.DriveSpeedComboBox.TabIndex = 18;
this.DriveSpeedComboBox.SelectedIndexChanged += new System.EventHandler(this.DriveSpeedComboBoxSelectionChanged);
//
// ParametersTextBox
//
this.ParametersTextBox.Anchor = System.Windows.Forms.AnchorStyles.None;
this.ParametersTextBox.Enabled = false;
this.ParametersTextBox.Location = new System.Drawing.Point(110, 199);
this.ParametersTextBox.Name = "ParametersTextBox";
this.ParametersTextBox.ReadOnly = true;
this.ParametersTextBox.Size = new System.Drawing.Size(295, 20);
this.ParametersTextBox.TabIndex = 19;
//
// EnableParametersCheckBox
//
this.EnableParametersCheckBox.AutoSize = true;
this.EnableParametersCheckBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.EnableParametersCheckBox.Location = new System.Drawing.Point(411, 193);
this.EnableParametersCheckBox.Name = "EnableParametersCheckBox";
this.EnableParametersCheckBox.Size = new System.Drawing.Size(139, 33);
this.EnableParametersCheckBox.TabIndex = 20;
this.EnableParametersCheckBox.Text = "Enable Editing";
this.EnableParametersCheckBox.UseVisualStyleBackColor = true;
this.EnableParametersCheckBox.CheckedChanged += new System.EventHandler(this.EnableParametersCheckBoxClick);
//
// controlsGroupBox
//
this.controlsGroupBox.Controls.Add(this.tableLayoutPanel3);
this.controlsGroupBox.Location = new System.Drawing.Point(3, 270);
this.controlsGroupBox.Name = "controlsGroupBox";
this.controlsGroupBox.Size = new System.Drawing.Size(553, 50);
this.controlsGroupBox.TabIndex = 1;
this.controlsGroupBox.TabStop = false;
this.controlsGroupBox.Text = "Controls";
//
// tableLayoutPanel3
//
this.tableLayoutPanel3.ColumnCount = 4;
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel3.Controls.Add(this.StartStopButton, 0, 0);
this.tableLayoutPanel3.Controls.Add(this.DiscScanButton, 1, 0);
this.tableLayoutPanel3.Controls.Add(this.CopyProtectScanButton, 2, 0);
this.tableLayoutPanel3.Controls.Add(this.EjectWhenDoneCheckBox, 3, 0);
this.tableLayoutPanel3.Location = new System.Drawing.Point(0, 20);
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 1;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(553, 32);
this.tableLayoutPanel3.TabIndex = 0;
//
// StartStopButton
//
this.StartStopButton.Dock = System.Windows.Forms.DockStyle.Fill;
this.StartStopButton.Enabled = false;
this.StartStopButton.Location = new System.Drawing.Point(3, 3);
this.StartStopButton.Name = "StartStopButton";
this.StartStopButton.Size = new System.Drawing.Size(132, 26);
this.StartStopButton.TabIndex = 0;
this.StartStopButton.Text = "Start Dumping";
this.StartStopButton.UseVisualStyleBackColor = true;
this.StartStopButton.Click += new System.EventHandler(this.StartStopButtonClick);
//
// DiscScanButton
//
this.DiscScanButton.Dock = System.Windows.Forms.DockStyle.Fill;
this.DiscScanButton.Location = new System.Drawing.Point(141, 3);
this.DiscScanButton.Name = "DiscScanButton";
this.DiscScanButton.Size = new System.Drawing.Size(132, 26);
this.DiscScanButton.TabIndex = 1;
this.DiscScanButton.Text = "Scan For Discs";
this.DiscScanButton.UseVisualStyleBackColor = true;
this.DiscScanButton.Click += new System.EventHandler(this.DiscScanButtonClick);
//
// CopyProtectScanButton
//
this.CopyProtectScanButton.Dock = System.Windows.Forms.DockStyle.Fill;
this.CopyProtectScanButton.Location = new System.Drawing.Point(279, 3);
this.CopyProtectScanButton.Name = "CopyProtectScanButton";
this.CopyProtectScanButton.Size = new System.Drawing.Size(132, 26);
this.CopyProtectScanButton.TabIndex = 2;
this.CopyProtectScanButton.Text = "Scan For Protection";
this.CopyProtectScanButton.UseVisualStyleBackColor = true;
this.CopyProtectScanButton.Click += new System.EventHandler(this.CopyProtectScanButtonClick);
//
// EjectWhenDoneCheckBox
//
this.EjectWhenDoneCheckBox.AutoSize = true;
this.EjectWhenDoneCheckBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.EjectWhenDoneCheckBox.Location = new System.Drawing.Point(417, 3);
this.EjectWhenDoneCheckBox.Name = "EjectWhenDoneCheckBox";
this.EjectWhenDoneCheckBox.Size = new System.Drawing.Size(133, 26);
this.EjectWhenDoneCheckBox.TabIndex = 3;
this.EjectWhenDoneCheckBox.Text = "Eject When Done";
this.EjectWhenDoneCheckBox.UseVisualStyleBackColor = true;
//
// statusGroupBox
//
this.statusGroupBox.Controls.Add(this.StatusLabel);
this.statusGroupBox.Location = new System.Drawing.Point(3, 326);
this.statusGroupBox.Name = "statusGroupBox";
this.statusGroupBox.Size = new System.Drawing.Size(553, 42);
this.statusGroupBox.TabIndex = 2;
this.statusGroupBox.TabStop = false;
this.statusGroupBox.Text = "Status";
//
// StatusLabel
//
this.StatusLabel.Dock = System.Windows.Forms.DockStyle.Fill;
this.StatusLabel.Enabled = false;
this.StatusLabel.Location = new System.Drawing.Point(3, 16);
this.StatusLabel.Name = "StatusLabel";
this.StatusLabel.ReadOnly = true;
this.StatusLabel.Size = new System.Drawing.Size(547, 20);
this.StatusLabel.TabIndex = 0;
this.StatusLabel.Text = "Waiting for media...";
this.StatusLabel.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
//
// fileToolStripMenuItem
//
this.fileToolStripMenuItem.Name = "fileToolStripMenuItem";
this.fileToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.F)));
this.fileToolStripMenuItem.Size = new System.Drawing.Size(37, 20);
this.fileToolStripMenuItem.Text = "File";
//
// toolsToolStripMenuItem
//
this.toolsToolStripMenuItem.Name = "toolsToolStripMenuItem";
this.toolsToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.T)));
this.toolsToolStripMenuItem.Size = new System.Drawing.Size(47, 20);
this.toolsToolStripMenuItem.Text = "Tools";
//
// helpToolStripMenuItem
//
this.helpToolStripMenuItem.Name = "helpToolStripMenuItem";
this.helpToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.H)));
this.helpToolStripMenuItem.Size = new System.Drawing.Size(44, 20);
this.helpToolStripMenuItem.Text = "Help";
//
// exitToolStripMenuItem
//
this.exitToolStripMenuItem.Name = "exitToolStripMenuItem";
this.exitToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.X)));
this.exitToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.exitToolStripMenuItem.Text = "Exit";
this.exitToolStripMenuItem.Click += new System.EventHandler(this.AppExitClick);
//
// optionsToolStripMenuItem
//
this.optionsToolStripMenuItem.Name = "optionsToolStripMenuItem";
this.optionsToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.O)));
this.optionsToolStripMenuItem.Size = new System.Drawing.Size(209, 22);
this.optionsToolStripMenuItem.Text = "Options";
this.optionsToolStripMenuItem.Click += new System.EventHandler(this.OptionsClick);
//
// showLogWindowToolStripMenuItem
//
this.showLogWindowToolStripMenuItem.Checked = true;
this.showLogWindowToolStripMenuItem.CheckState = System.Windows.Forms.CheckState.Checked;
this.showLogWindowToolStripMenuItem.Name = "showLogWindowToolStripMenuItem";
this.showLogWindowToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.L)));
this.showLogWindowToolStripMenuItem.Size = new System.Drawing.Size(209, 22);
this.showLogWindowToolStripMenuItem.Text = "Show Log Window";
//
// aboutToolStripMenuItem
//
this.aboutToolStripMenuItem.Name = "aboutToolStripMenuItem";
this.aboutToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.A)));
this.aboutToolStripMenuItem.Size = new System.Drawing.Size(180, 22);
this.aboutToolStripMenuItem.Text = "About";
this.aboutToolStripMenuItem.Click += new System.EventHandler(this.AboutClick);
//
// MainWindow
//
this.AcceptButton = this.StartStopButton;
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(584, 411);
this.Controls.Add(this.mainWindowLayout);
this.Controls.Add(this.MenuBar);
this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
this.MainMenuStrip = this.MenuBar;
this.Name = "MainWindow";
this.Text = "DiscImageCreator GUI";
this.Activated += new System.EventHandler(this.MainWindowActivated);
this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.MainWindowClosing);
this.Load += new System.EventHandler(this.OnContentRendered);
this.LocationChanged += new System.EventHandler(this.MainWindowLocationChanged);
this.MenuBar.ResumeLayout(false);
this.MenuBar.PerformLayout();
this.mainWindowLayout.ResumeLayout(false);
this.settingsGroupBox.ResumeLayout(false);
this.tableLayoutPanel2.ResumeLayout(false);
this.tableLayoutPanel2.PerformLayout();
this.controlsGroupBox.ResumeLayout(false);
this.tableLayoutPanel3.ResumeLayout(false);
this.tableLayoutPanel3.PerformLayout();
this.statusGroupBox.ResumeLayout(false);
this.statusGroupBox.PerformLayout();
this.ResumeLayout(false);
this.PerformLayout();
}
#endregion
private System.Windows.Forms.MenuStrip MenuBar;
private System.Windows.Forms.TableLayoutPanel mainWindowLayout;
private System.Windows.Forms.GroupBox settingsGroupBox;
private System.Windows.Forms.GroupBox controlsGroupBox;
private System.Windows.Forms.GroupBox statusGroupBox;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.Label systemMediaTypeLabel;
private System.Windows.Forms.Label parametersLabel;
private System.Windows.Forms.Label driveSpeedLabel;
private System.Windows.Forms.Label driveLetterLabel;
private System.Windows.Forms.Label outputDirectoryLabel;
private System.Windows.Forms.Label outputFilenameLabel;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
private System.Windows.Forms.Button StartStopButton;
private System.Windows.Forms.Button DiscScanButton;
private System.Windows.Forms.Button CopyProtectScanButton;
private System.Windows.Forms.CheckBox EjectWhenDoneCheckBox;
private System.Windows.Forms.TextBox OutputFilenameTextBox;
private System.Windows.Forms.ComboBox SystemTypeComboBox;
private System.Windows.Forms.ComboBox MediaTypeComboBox;
private System.Windows.Forms.TextBox OutputDirectoryTextBox;
private System.Windows.Forms.Button OutputDirectoryBrowseButton;
private System.Windows.Forms.ComboBox DriveLetterComboBox;
private System.Windows.Forms.ComboBox DriveSpeedComboBox;
private System.Windows.Forms.TextBox ParametersTextBox;
private System.Windows.Forms.CheckBox EnableParametersCheckBox;
private System.Windows.Forms.TextBox StatusLabel;
private System.Windows.Forms.ToolStripMenuItem fileToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem toolsToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem helpToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem exitToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem optionsToolStripMenuItem;
internal System.Windows.Forms.ToolStripMenuItem showLogWindowToolStripMenuItem;
private System.Windows.Forms.ToolStripMenuItem aboutToolStripMenuItem;
}
}

View File

@@ -0,0 +1,723 @@
using System;
using System.Collections.Generic;
using System.Data;
using System.Drawing;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Forms;
using DICUI.Data;
using DICUI.Utilities;
namespace DICUI.Forms.Windows
{
public partial class MainWindow : Form
{
// Private UI-related variables
private List<Drive> _drives;
private MediaType? _currentMediaType;
private List<KnownSystem?> _systems;
private List<MediaType?> _mediaTypes;
private bool _alreadyShown;
private DumpEnvironment _env;
// Option related
private Options _options;
private OptionsWindow _optionsWindow;
private LogWindow _logWindow;
public MainWindow()
{
InitializeComponent();
// Initializes and load Options object
_options = new Options();
_options.Load();
ViewModels.OptionsViewModel = new OptionsViewModel(_options);
_logWindow = new LogWindow(this);
ViewModels.LoggerViewModel.SetWindow(_logWindow);
// Disable buttons until we load fully
StartStopButton.Enabled = false;
DiscScanButton.Enabled = false;
CopyProtectScanButton.Enabled = false;
if (_options.OpenLogWindowAtStartup)
{
this.StartPosition = FormStartPosition.CenterScreen;
double combinedHeight = this.Height + _logWindow.Height + Constants.LogWindowMarginFromMainWindow;
Rectangle bounds = GetScaledCoordinates(Screen.PrimaryScreen.WorkingArea);
this.Left = (int)(bounds.Left + (bounds.Width - this.Width) / 2);
this.Top = (int)(bounds.Top + (bounds.Height - combinedHeight) / 2);
}
}
#region Events
private void OnContentRendered(object sender, EventArgs e)
{
if (_alreadyShown)
return;
_alreadyShown = true;
if (_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
showLogWindowToolStripMenuItem.Checked = true;
ViewModels.LoggerViewModel.WindowVisible = true;
}
// Populate the list of systems
StatusLabel.Text = "Creating system list, please wait!";
PopulateSystems();
// Populate the list of drives
StatusLabel.Text = "Creating drive list, please wait!";
PopulateDrives();
// Set the position of the log window
if (_logWindow.Visible)
{
_logWindow.AdjustPositionToMainWindow();
this.Focus();
}
}
private void StartStopButtonClick(object sender, EventArgs e)
{
// Dump or stop the dump
if (StartStopButton.Text == Constants.StartDumping)
{
StartDumping();
}
else if (StartStopButton.Text == Constants.StopDumping)
{
ViewModels.LoggerViewModel.VerboseLogLn("Canceling dumping process...");
_env.CancelDumping();
CopyProtectScanButton.Enabled = true;
if (EjectWhenDoneCheckBox.Checked == true)
{
ViewModels.LoggerViewModel.VerboseLogLn($"Ejecting disc in drive {_env.Drive.Letter}");
_env.EjectDisc();
}
}
}
private void OutputDirectoryBrowseButtonClick(object sender, EventArgs e)
{
BrowseFolder();
EnsureDiscInformation();
}
private void DiscScanButtonClick(object sender, EventArgs e)
{
PopulateDrives();
}
private void CopyProtectScanButtonClick(object sender, EventArgs e)
{
ScanAndShowProtection();
}
private void SystemTypeComboBoxSelectionChanged(object sender, EventArgs e)
{
// If we're on a separator, go to the next item and return
if ((SystemTypeComboBox.SelectedItem as KnownSystemComboBoxItem).IsHeader())
{
SystemTypeComboBox.SelectedIndex++;
return;
}
ViewModels.LoggerViewModel.VerboseLogLn("Changed system to: {0}", (SystemTypeComboBox.SelectedItem as KnownSystemComboBoxItem).Name);
PopulateMediaType();
EnsureDiscInformation();
}
private void MediaTypeComboBoxSelectionChanged(object sender, EventArgs e)
{
_currentMediaType = MediaTypeComboBox.SelectedItem as MediaType?;
SetSupportedDriveSpeed();
GetOutputNames();
EnsureDiscInformation();
}
private void DriveLetterComboBoxSelectionChanged(object sender, EventArgs e)
{
CacheCurrentDiscType();
SetCurrentDiscType();
GetOutputNames();
SetSupportedDriveSpeed();
}
private void DriveSpeedComboBoxSelectionChanged(object sender, EventArgs e)
{
EnsureDiscInformation();
}
private void OutputFilenameTextBoxTextChanged(object sender, EventArgs e)
{
EnsureDiscInformation();
}
private void OutputDirectoryTextBoxTextChanged(object sender, EventArgs e)
{
EnsureDiscInformation();
}
private void ProgressUpdated(object sender, Result value)
{
StatusLabel.Text = value.Message;
ViewModels.LoggerViewModel.VerboseLogLn(value.Message);
}
private void MainWindowLocationChanged(object sender, EventArgs e)
{
if (_logWindow.Visible)
_logWindow.AdjustPositionToMainWindow();
}
private void MainWindowActivated(object sender, EventArgs e)
{
if (!_logWindow.Visible)
_logWindow.BringToFront();
this.BringToFront();
}
private void MainWindowClosing(object sender, FormClosingEventArgs e)
{
if (_logWindow.Visible)
_logWindow.Close();
}
private void EnableParametersCheckBoxClick(object sender, EventArgs e)
{
if (EnableParametersCheckBox.Checked)
{
ParametersTextBox.ReadOnly = false;
ParametersTextBox.Enabled = true;
}
else
{
ParametersTextBox.ReadOnly = true;
ParametersTextBox.Enabled = false;
ProcessCustomParameters();
}
}
// Toolbar Events
private void AppExitClick(object sender, EventArgs e)
{
System.Windows.Application.Current.Shutdown();
}
private void AboutClick(object sender, EventArgs e)
{
System.Windows.MessageBox.Show($"ReignStumble - Project Lead / UI Design{Environment.NewLine}" +
$"darksabre76 - Project Co-Lead / Backend Design{Environment.NewLine}" +
$"Jakz - Feature Contributor{Environment.NewLine}" +
$"NHellFire - Feature Contributor{Environment.NewLine}" +
$"Dizzzy - Concept/Ideas/Beta tester{Environment.NewLine}", "About", MessageBoxButton.OK, MessageBoxImage.Information);
}
private void OptionsClick(object sender, EventArgs e)
{
// lazy initialization
if (_optionsWindow == null)
{
_optionsWindow = new OptionsWindow(this, _options);
_optionsWindow.Closed += delegate
{
_optionsWindow = null;
};
}
_optionsWindow.Owner = this;
_optionsWindow.StartPosition = FormStartPosition.CenterParent;
_optionsWindow.RefreshSettings();
_optionsWindow.Show();
}
public void OnOptionsUpdated()
{
GetOutputNames();
SetSupportedDriveSpeed();
EnsureDiscInformation();
}
#endregion
#region Helpers
/// <summary>
/// Populate media type according to system type
/// </summary>
private void PopulateMediaType()
{
KnownSystem? currentSystem = SystemTypeComboBox.SelectedItem as KnownSystemComboBoxItem;
if (currentSystem != null)
{
_mediaTypes = Validators.GetValidMediaTypes(currentSystem).ToList();
MediaTypeComboBox.DataSource = _mediaTypes;
MediaTypeComboBox.Enabled = _mediaTypes.Count > 1;
MediaTypeComboBox.SelectedIndex = (_mediaTypes.IndexOf(_currentMediaType) >= 0 ? _mediaTypes.IndexOf(_currentMediaType) : 0);
}
else
{
MediaTypeComboBox.Enabled = false;
MediaTypeComboBox.DataSource = null;
MediaTypeComboBox.SelectedIndex = -1;
}
}
/// <summary>
/// Get a complete list of supported systems and fill the combo box
/// </summary>
private void PopulateSystems()
{
_systems = Validators.CreateListOfSystems();
ViewModels.LoggerViewModel.VerboseLogLn("Populating systems, {0} systems found.", _systems.Count);
Dictionary<KnownSystemCategory, List<KnownSystem?>> mapping = _systems
.GroupBy(s => s.Category())
.ToDictionary(
k => k.Key,
v => v
.OrderBy(s => s.Name())
.ToList()
);
List<KnownSystemComboBoxItem> comboBoxItems = new List<KnownSystemComboBoxItem>();
comboBoxItems.Add(new KnownSystemComboBoxItem(KnownSystem.NONE));
foreach (var group in mapping)
{
comboBoxItems.Add(new KnownSystemComboBoxItem(group.Key));
group.Value.ForEach(system => comboBoxItems.Add(new KnownSystemComboBoxItem(system)));
}
SystemTypeComboBox.DataSource = comboBoxItems;
SystemTypeComboBox.SelectedIndex = 0;
StartStopButton.Enabled = false;
}
/// <summary>
/// Get a complete list of active disc drives and fill the combo box
/// </summary>
/// <remarks>TODO: Find a way for this to periodically run, or have it hook to a "drive change" event</remarks>
private void PopulateDrives()
{
ViewModels.LoggerViewModel.VerboseLogLn("Scanning for drives..");
// Always enable the disk scan
DiscScanButton.Enabled = true;
// Populate the list of drives and add it to the combo box
_drives = Validators.CreateListOfDrives();
DriveLetterComboBox.DataSource = _drives;
if (DriveLetterComboBox.Items.Count > 0)
{
int index = _drives.FindIndex(d => d.MarkedActive);
DriveLetterComboBox.SelectedIndex = (index != -1 ? index : 0);
StatusLabel.Text = "Valid drive found! Choose your Media Type";
StartStopButton.Enabled = true;
CopyProtectScanButton.Enabled = true;
ViewModels.LoggerViewModel.VerboseLogLn("Found {0} drives: {1}", _drives.Count, String.Join(", ", _drives.Select(d => d.Letter)));
}
else
{
DriveLetterComboBox.SelectedIndex = -1;
StatusLabel.Text = "No valid drive found!";
StartStopButton.Enabled = false;
CopyProtectScanButton.Enabled = false;
ViewModels.LoggerViewModel.VerboseLogLn("Found no drives");
}
}
/// <summary>
/// Browse for an output folder
/// </summary>
private void BrowseFolder()
{
FolderBrowserDialog folderDialog = new FolderBrowserDialog { ShowNewFolderButton = false, SelectedPath = System.AppDomain.CurrentDomain.BaseDirectory };
DialogResult result = folderDialog.ShowDialog();
if (result == DialogResult.OK)
{
OutputDirectoryTextBox.Text = folderDialog.SelectedPath;
}
}
/// <summary>
/// Create a DumpEnvironment with all current settings
/// </summary>
/// <returns>Filled DumpEnvironment instance</returns>
private DumpEnvironment DetermineEnvironment()
{
// Populate the new environment
var env = new DumpEnvironment()
{
// Paths to tools
SubdumpPath = _options.SubDumpPath,
DICPath = _options.DICPath,
OutputDirectory = OutputDirectoryTextBox.Text,
OutputFilename = OutputFilenameTextBox.Text,
// Get the currently selected options
Drive = DriveLetterComboBox.SelectedItem as Drive,
DICParameters = new Parameters(ParametersTextBox.Text),
QuietMode = _options.QuietMode,
ParanoidMode = _options.ParanoidMode,
ScanForProtection = _options.ScanForProtection,
RereadAmountC2 = _options.RereadAmountForC2,
System = SystemTypeComboBox.SelectedItem as KnownSystemComboBoxItem,
Type = MediaTypeComboBox.SelectedItem as MediaType?
};
// Fix the output paths
env.FixOutputPaths();
// Disable automatic reprocessing of the textboxes until we're done
OutputDirectoryTextBox.TextChanged -= OutputDirectoryTextBoxTextChanged;
OutputFilenameTextBox.TextChanged -= OutputFilenameTextBoxTextChanged;
OutputDirectoryTextBox.Text = env.OutputDirectory;
OutputFilenameTextBox.Text = env.OutputFilename;
OutputDirectoryTextBox.TextChanged += OutputDirectoryTextBoxTextChanged;
OutputFilenameTextBox.TextChanged += OutputFilenameTextBoxTextChanged;
return env;
}
/// <summary>
/// Begin the dumping process using the given inputs
/// </summary>
private async void StartDumping()
{
if (_env == null)
_env = DetermineEnvironment();
// If still in custom parameter mode, check that users meant to continue or not
if (EnableParametersCheckBox.Checked == true)
{
MessageBoxResult result = System.Windows.MessageBox.Show("It looks like you have custom parameters that have not been saved. Would you like to apply those changes before starting to dump?", "Custom Changes", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
EnableParametersCheckBox.Checked = false;
ParametersTextBox.Enabled = false;
ProcessCustomParameters();
}
else if (result == MessageBoxResult.Cancel)
return;
// If "No", then we continue with the current known environment
}
try
{
// Check for the firmware first
// TODO: Remove this (and method) once DIC end-to-end logging becomes a thing
if (!await _env.DriveHasLatestFimrware())
{
System.Windows.MessageBox.Show($"DiscImageCreator has reported that drive {_env.Drive.Letter} is not updated to the most recent firmware. Please update the firmware for your drive and try again.", "Outdated Firmware", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
// Validate that the user explicitly wants an inactive drive to be considered for dumping
if (!_env.Drive.MarkedActive)
{
MessageBoxResult mbresult = System.Windows.MessageBox.Show("The currently selected drive does not appear to contain a disc! Are you sure you want to continue?", "Missing Disc", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
if (mbresult == MessageBoxResult.No || mbresult == MessageBoxResult.Cancel || mbresult == MessageBoxResult.None)
{
ViewModels.LoggerViewModel.VerboseLogLn("Dumping aborted!");
return;
}
}
// If a complete dump already exists
if (_env.FoundAllFiles())
{
MessageBoxResult mbresult = System.Windows.MessageBox.Show("A complete dump already exists! Are you sure you want to overwrite?", "Overwrite?", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
if (mbresult == MessageBoxResult.No || mbresult == MessageBoxResult.Cancel || mbresult == MessageBoxResult.None)
{
ViewModels.LoggerViewModel.VerboseLogLn("Dumping aborted!");
return;
}
}
StartStopButton.Text = Constants.StopDumping;
CopyProtectScanButton.Enabled = false;
StatusLabel.Text = "Beginning dumping process";
ViewModels.LoggerViewModel.VerboseLogLn("Starting dumping process..");
var progress = new Progress<Result>();
progress.ProgressChanged += ProgressUpdated;
Result result = await _env.StartDumping(progress);
StatusLabel.Text = result ? "Dumping complete!" : result.Message;
ViewModels.LoggerViewModel.VerboseLogLn(result ? "Dumping complete!" : result.Message);
}
catch
{
// No-op, we don't care what it was
}
finally
{
StartStopButton.Text = Constants.StartDumping;
CopyProtectScanButton.Enabled = true;
}
if (EjectWhenDoneCheckBox.Checked == true)
{
ViewModels.LoggerViewModel.VerboseLogLn($"Ejecting disc in drive {_env.Drive.Letter}");
_env.EjectDisc();
}
}
/// <summary>
/// Ensure information is consistent with the currently selected disc type
/// </summary>
private void EnsureDiscInformation()
{
// Get the current environment information
_env = DetermineEnvironment();
// Take care of null cases
if (_env.System == null)
_env.System = KnownSystem.NONE;
if (_env.Type == null)
_env.Type = MediaType.NONE;
// Get the status to write out
Result result = Validators.GetSupportStatus(_env.System, _env.Type);
StatusLabel.Text = result.Message;
// Set the index for the current disc type
SetCurrentDiscType();
StartStopButton.Enabled = result && (_drives != null && _drives.Count > 0 ? true : false);
// If we're in a type that doesn't support drive speeds
DriveSpeedComboBox.Enabled = _env.Type.DoesSupportDriveSpeed();
// If input params are not enabled, generate the full parameters from the environment
if (!ParametersTextBox.Enabled)
{
string generated = _env.GetFullParameters((int?)DriveSpeedComboBox.SelectedItem);
if (generated != null)
ParametersTextBox.Text = generated;
}
}
/// <summary>
/// Get the default output directory name from the currently selected drive
/// </summary>
private void GetOutputNames()
{
Drive drive = DriveLetterComboBox.SelectedItem as Drive;
KnownSystem? systemType = SystemTypeComboBox.SelectedItem as KnownSystemComboBoxItem;
MediaType? mediaType = MediaTypeComboBox.SelectedItem as MediaType?;
OutputDirectoryTextBox.Text = Path.Combine(_options.DefaultOutputPath, drive?.VolumeLabel ?? string.Empty);
OutputFilenameTextBox.Text = (drive?.VolumeLabel ?? "disc") + (mediaType.Extension() ?? ".bin");
}
/// <summary>
/// Scan and show copy protection for the current disc
/// </summary>
private async void ScanAndShowProtection()
{
if (_env == null)
_env = DetermineEnvironment();
if (_env.Drive.Letter != default(char))
{
ViewModels.LoggerViewModel.VerboseLogLn("Scanning for copy protection in {0}", _env.Drive.Letter);
var tempContent = StatusLabel.Text;
StatusLabel.Text = "Scanning for copy protection... this might take a while!";
StartStopButton.Enabled = false;
DiscScanButton.Enabled = false;
CopyProtectScanButton.Enabled = false;
string protections = await Validators.RunProtectionScanOnPath(_env.Drive.Letter + ":\\");
if (!ViewModels.LoggerViewModel.WindowVisible)
System.Windows.MessageBox.Show(protections, "Detected Protection", MessageBoxButton.OK, MessageBoxImage.Information);
ViewModels.LoggerViewModel.VerboseLog("Detected the following protections in {0}:\r\n\r\n{1}", _env.Drive.Letter, protections);
StatusLabel.Text = tempContent;
StartStopButton.Enabled = true;
DiscScanButton.Enabled = true;
CopyProtectScanButton.Enabled = true;
}
}
/// <summary>
/// Set the drive speed based on reported maximum and user-defined option
/// </summary>
private void SetSupportedDriveSpeed()
{
// Set the drive speed list that's appropriate
var values = Constants.GetSpeedsForMediaType(_currentMediaType);
DriveSpeedComboBox.DataSource = values;
ViewModels.LoggerViewModel.VerboseLogLn("Supported media speeds: {0}", string.Join(",", values));
// Find the minimum set to compare against
int preferred = 100;
switch (_currentMediaType)
{
case MediaType.CDROM:
case MediaType.GDROM:
preferred = _options.preferredDumpSpeedCD;
break;
case MediaType.DVD:
case MediaType.HDDVD:
case MediaType.NintendoGameCube:
case MediaType.NintendoWiiOpticalDisc:
preferred = _options.preferredDumpSpeedDVD;
break;
case MediaType.BluRay:
preferred = _options.preferredDumpSpeedBD;
break;
default:
preferred = _options.preferredDumpSpeedCD;
break;
}
// Choose the lower of the two speeds between the allowed speeds and the user-defined one
// TODO: Inform more users about setting preferences in the settings so this comparison doesn't need to happen
int chosenSpeed = Math.Min(
values.Where(s => s <= values[values.Count / 2]).Last(),
preferred
);
// Set the selected speed
ViewModels.LoggerViewModel.VerboseLogLn("Setting drive speed to: {0}", chosenSpeed);
DriveSpeedComboBox.SelectedIndex = values.ToList().IndexOf(chosenSpeed);
}
/// <summary>
/// Cache the current disc type to internal variable
/// </summary>
private void CacheCurrentDiscType()
{
// Get the drive letter from the selected item
Drive drive = DriveLetterComboBox.SelectedItem as Drive;
if (drive == null || drive.IsFloppy)
return;
// Get the current optical disc type
if (!_options.SkipMediaTypeDetection)
{
ViewModels.LoggerViewModel.VerboseLog("Trying to detect media type for drive {0}.. ", drive.Letter);
_currentMediaType = Validators.GetDiscType(drive.Letter);
ViewModels.LoggerViewModel.VerboseLogLn(_currentMediaType != null ? "unable to detect." : ("detected " + _currentMediaType.Name() + "."));
}
}
/// <summary>
/// Set the current disc type in the combo box
/// </summary>
private void SetCurrentDiscType()
{
// If we have an invalid current type, we don't care and return
if (_currentMediaType == null || _currentMediaType == MediaType.NONE)
return;
// Now set the selected item, if possible
int index = _mediaTypes.FindIndex(kvp => kvp.Value == _currentMediaType);
if (index != -1)
MediaTypeComboBox.SelectedIndex = index;
else
StatusLabel.Text = $"Disc of type '{Converters.MediaTypeToString(_currentMediaType)}' found, but the current system does not support it!";
}
/// <summary>
/// Process the current custom parameters back into UI values
/// </summary>
private void ProcessCustomParameters()
{
_env.DICParameters = new Parameters(ParametersTextBox.Text);
int driveIndex = _drives.Select(d => d.Letter).ToList().IndexOf(_env.DICParameters.DriveLetter[0]);
if (driveIndex > -1)
DriveLetterComboBox.SelectedIndex = driveIndex;
int driveSpeed = _env.DICParameters.DriveSpeed ?? -1;
if (driveSpeed > 0)
DriveSpeedComboBox.SelectedIndex = ((IReadOnlyList<int>)(DriveSpeedComboBox.DataSource)).ToList().IndexOf(driveSpeed);
else
_env.DICParameters.DriveSpeed = (int?)DriveSpeedComboBox.SelectedValue;
string trimmedPath = _env.DICParameters.Filename?.Trim('"') ?? string.Empty;
string outputDirectory = Path.GetDirectoryName(trimmedPath);
string outputFilename = Path.GetFileName(trimmedPath);
if (!String.IsNullOrWhiteSpace(outputDirectory))
OutputDirectoryTextBox.Text = outputDirectory;
else
outputDirectory = OutputDirectoryTextBox.Text;
if (!String.IsNullOrWhiteSpace(outputFilename))
OutputFilenameTextBox.Text = outputFilename;
else
outputFilename = OutputFilenameTextBox.Text;
MediaType? mediaType = Converters.BaseCommmandToMediaType(_env.DICParameters.Command);
int mediaTypeIndex = _mediaTypes.IndexOf(mediaType);
if (mediaTypeIndex > -1)
MediaTypeComboBox.SelectedIndex = mediaTypeIndex;
}
#endregion
#region UI Helpers
/// <summary>
/// Get pixel coordinates based on DPI scaling
/// </summary>
/// <param name="bounds">Rectangle representing the bounds to transform</param>
/// <returns>Rectangle representing the scaled bounds</returns>
private Rectangle GetScaledCoordinates(Rectangle bounds)
{
using (Graphics g = Graphics.FromHwnd(IntPtr.Zero))
{
return new Rectangle(
TransformCoordinate(bounds.Left, g.DpiX),
TransformCoordinate(bounds.Top, g.DpiY),
TransformCoordinate(bounds.Width, g.DpiX),
TransformCoordinate(bounds.Height, g.DpiY));
}
}
/// <summary>
/// Transform an individual coordinate using DPI scaling
/// </summary>
/// <param name="coord">Current integer coordinate</param>
/// <param name="dpi">DPI scaling factor</param>
/// <returns>Scaled integer coordinate</returns>
private int TransformCoordinate(int coord, float dpi)
{
return (int)(coord / ((double)dpi / 96));
}
#endregion
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,565 @@
namespace DICUI.Forms.Windows
{
partial class OptionsWindow
{
/// <summary>
/// Required designer variable.
/// </summary>
private System.ComponentModel.IContainer components = null;
/// <summary>
/// Clean up any resources being used.
/// </summary>
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
protected override void Dispose(bool disposing)
{
if (disposing && (components != null))
{
components.Dispose();
}
base.Dispose(disposing);
}
#region Windows Form Designer generated code
/// <summary>
/// Required method for Designer support - do not modify
/// the contents of this method with the code editor.
/// </summary>
private void InitializeComponent()
{
this.tableLayoutPanel1 = new System.Windows.Forms.TableLayoutPanel();
this.pathsGroupBox = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel2 = new System.Windows.Forms.TableLayoutPanel();
this.DefaultOutputPathButton = new System.Windows.Forms.Button();
this.SubDumpPathButton = new System.Windows.Forms.Button();
this.discImageCreatorPathLabel = new System.Windows.Forms.Label();
this.subdumpPathLabel = new System.Windows.Forms.Label();
this.defaultOutputPathLabel = new System.Windows.Forms.Label();
this.DICPathTextBox = new System.Windows.Forms.TextBox();
this.SubDumpPathTextBox = new System.Windows.Forms.TextBox();
this.DefaultOutputPathTextBox = new System.Windows.Forms.TextBox();
this.DICPathButton = new System.Windows.Forms.Button();
this.preferredSpeedGroupBox = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel3 = new System.Windows.Forms.TableLayoutPanel();
this.DumpSpeedCDLabel = new System.Windows.Forms.Label();
this.DumpSpeedDVDLabel = new System.Windows.Forms.Label();
this.DumpSpeedBDLabel = new System.Windows.Forms.Label();
this.DumpSpeedCDSlider = new System.Windows.Forms.TrackBar();
this.DumpSpeedDVDSlider = new System.Windows.Forms.TrackBar();
this.DumpSpeedBDSlider = new System.Windows.Forms.TrackBar();
this.DumpSpeedCDTextBox = new System.Windows.Forms.TextBox();
this.DumpSpeedDVDTextBox = new System.Windows.Forms.TextBox();
this.DumpSpeedBDTextBox = new System.Windows.Forms.TextBox();
this.optionsGroupBox = new System.Windows.Forms.GroupBox();
this.tableLayoutPanel4 = new System.Windows.Forms.TableLayoutPanel();
this.QuietModeCheckBox = new System.Windows.Forms.CheckBox();
this.AutoScanCheckBox = new System.Windows.Forms.CheckBox();
this.ParanoidModeCheckBox = new System.Windows.Forms.CheckBox();
this.SkipDetectionCheckBox = new System.Windows.Forms.CheckBox();
this.C2RereadTimesTextBox = new System.Windows.Forms.TextBox();
this.C2RereadLabel = new System.Windows.Forms.Label();
this.tableLayoutPanel5 = new System.Windows.Forms.TableLayoutPanel();
this.AcceptButton = new System.Windows.Forms.Button();
this.CancelButton = new System.Windows.Forms.Button();
this.tableLayoutPanel1.SuspendLayout();
this.pathsGroupBox.SuspendLayout();
this.tableLayoutPanel2.SuspendLayout();
this.preferredSpeedGroupBox.SuspendLayout();
this.tableLayoutPanel3.SuspendLayout();
((System.ComponentModel.ISupportInitialize)(this.DumpSpeedCDSlider)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.DumpSpeedDVDSlider)).BeginInit();
((System.ComponentModel.ISupportInitialize)(this.DumpSpeedBDSlider)).BeginInit();
this.optionsGroupBox.SuspendLayout();
this.tableLayoutPanel4.SuspendLayout();
this.tableLayoutPanel5.SuspendLayout();
this.SuspendLayout();
//
// tableLayoutPanel1
//
this.tableLayoutPanel1.ColumnCount = 1;
this.tableLayoutPanel1.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.Controls.Add(this.pathsGroupBox, 0, 0);
this.tableLayoutPanel1.Controls.Add(this.preferredSpeedGroupBox, 0, 1);
this.tableLayoutPanel1.Controls.Add(this.optionsGroupBox, 0, 2);
this.tableLayoutPanel1.Controls.Add(this.tableLayoutPanel5, 0, 3);
this.tableLayoutPanel1.Location = new System.Drawing.Point(12, 12);
this.tableLayoutPanel1.Name = "tableLayoutPanel1";
this.tableLayoutPanel1.RowCount = 4;
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 150F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 100F));
this.tableLayoutPanel1.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel1.Size = new System.Drawing.Size(475, 417);
this.tableLayoutPanel1.TabIndex = 0;
this.tableLayoutPanel1.UseWaitCursor = true;
//
// pathsGroupBox
//
this.pathsGroupBox.Controls.Add(this.tableLayoutPanel2);
this.pathsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.pathsGroupBox.Location = new System.Drawing.Point(3, 3);
this.pathsGroupBox.Name = "pathsGroupBox";
this.pathsGroupBox.Size = new System.Drawing.Size(469, 121);
this.pathsGroupBox.TabIndex = 0;
this.pathsGroupBox.TabStop = false;
this.pathsGroupBox.Text = "Paths";
this.pathsGroupBox.UseWaitCursor = true;
//
// tableLayoutPanel2
//
this.tableLayoutPanel2.ColumnCount = 3;
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 29.41176F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 58.82353F));
this.tableLayoutPanel2.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 11.76471F));
this.tableLayoutPanel2.Controls.Add(this.DefaultOutputPathButton, 2, 2);
this.tableLayoutPanel2.Controls.Add(this.SubDumpPathButton, 2, 1);
this.tableLayoutPanel2.Controls.Add(this.discImageCreatorPathLabel, 0, 0);
this.tableLayoutPanel2.Controls.Add(this.subdumpPathLabel, 0, 1);
this.tableLayoutPanel2.Controls.Add(this.defaultOutputPathLabel, 0, 2);
this.tableLayoutPanel2.Controls.Add(this.DICPathTextBox, 1, 0);
this.tableLayoutPanel2.Controls.Add(this.SubDumpPathTextBox, 1, 1);
this.tableLayoutPanel2.Controls.Add(this.DefaultOutputPathTextBox, 1, 2);
this.tableLayoutPanel2.Controls.Add(this.DICPathButton, 2, 0);
this.tableLayoutPanel2.Location = new System.Drawing.Point(6, 15);
this.tableLayoutPanel2.Name = "tableLayoutPanel2";
this.tableLayoutPanel2.RowCount = 3;
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel2.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel2.Size = new System.Drawing.Size(457, 100);
this.tableLayoutPanel2.TabIndex = 0;
this.tableLayoutPanel2.UseWaitCursor = true;
//
// DefaultOutputPathButton
//
this.DefaultOutputPathButton.Location = new System.Drawing.Point(405, 69);
this.DefaultOutputPathButton.Name = "DefaultOutputPathButton";
this.DefaultOutputPathButton.Size = new System.Drawing.Size(49, 23);
this.DefaultOutputPathButton.TabIndex = 8;
this.DefaultOutputPathButton.Text = "...";
this.DefaultOutputPathButton.UseVisualStyleBackColor = true;
this.DefaultOutputPathButton.UseWaitCursor = true;
this.DefaultOutputPathButton.Click += new System.EventHandler(this.BrowseForPathClick);
//
// SubDumpPathButton
//
this.SubDumpPathButton.Location = new System.Drawing.Point(405, 36);
this.SubDumpPathButton.Name = "SubDumpPathButton";
this.SubDumpPathButton.Size = new System.Drawing.Size(49, 23);
this.SubDumpPathButton.TabIndex = 7;
this.SubDumpPathButton.Text = "...";
this.SubDumpPathButton.UseVisualStyleBackColor = true;
this.SubDumpPathButton.UseWaitCursor = true;
this.SubDumpPathButton.Click += new System.EventHandler(this.BrowseForPathClick);
//
// discImageCreatorPathLabel
//
this.discImageCreatorPathLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.discImageCreatorPathLabel.AutoSize = true;
this.discImageCreatorPathLabel.Cursor = System.Windows.Forms.Cursors.WaitCursor;
this.discImageCreatorPathLabel.Location = new System.Drawing.Point(15, 10);
this.discImageCreatorPathLabel.Name = "discImageCreatorPathLabel";
this.discImageCreatorPathLabel.Size = new System.Drawing.Size(116, 13);
this.discImageCreatorPathLabel.TabIndex = 0;
this.discImageCreatorPathLabel.Text = "DiscImageCreator Path";
//
// subdumpPathLabel
//
this.subdumpPathLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.subdumpPathLabel.AutoSize = true;
this.subdumpPathLabel.Location = new System.Drawing.Point(56, 43);
this.subdumpPathLabel.Name = "subdumpPathLabel";
this.subdumpPathLabel.Size = new System.Drawing.Size(75, 13);
this.subdumpPathLabel.TabIndex = 1;
this.subdumpPathLabel.Text = "subdump Path";
this.subdumpPathLabel.UseWaitCursor = true;
//
// defaultOutputPathLabel
//
this.defaultOutputPathLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.defaultOutputPathLabel.AutoSize = true;
this.defaultOutputPathLabel.Location = new System.Drawing.Point(30, 76);
this.defaultOutputPathLabel.Name = "defaultOutputPathLabel";
this.defaultOutputPathLabel.Size = new System.Drawing.Size(101, 13);
this.defaultOutputPathLabel.TabIndex = 2;
this.defaultOutputPathLabel.Text = "Default Output Path";
this.defaultOutputPathLabel.UseWaitCursor = true;
//
// DICPathTextBox
//
this.DICPathTextBox.Anchor = System.Windows.Forms.AnchorStyles.None;
this.DICPathTextBox.Location = new System.Drawing.Point(138, 6);
this.DICPathTextBox.Name = "DICPathTextBox";
this.DICPathTextBox.Size = new System.Drawing.Size(259, 20);
this.DICPathTextBox.TabIndex = 3;
this.DICPathTextBox.UseWaitCursor = true;
//
// SubDumpPathTextBox
//
this.SubDumpPathTextBox.Anchor = System.Windows.Forms.AnchorStyles.None;
this.SubDumpPathTextBox.Location = new System.Drawing.Point(138, 39);
this.SubDumpPathTextBox.Name = "SubDumpPathTextBox";
this.SubDumpPathTextBox.Size = new System.Drawing.Size(259, 20);
this.SubDumpPathTextBox.TabIndex = 4;
this.SubDumpPathTextBox.UseWaitCursor = true;
//
// DefaultOutputPathTextBox
//
this.DefaultOutputPathTextBox.Anchor = System.Windows.Forms.AnchorStyles.None;
this.DefaultOutputPathTextBox.Location = new System.Drawing.Point(138, 73);
this.DefaultOutputPathTextBox.Name = "DefaultOutputPathTextBox";
this.DefaultOutputPathTextBox.Size = new System.Drawing.Size(259, 20);
this.DefaultOutputPathTextBox.TabIndex = 5;
this.DefaultOutputPathTextBox.UseWaitCursor = true;
//
// DICPathButton
//
this.DICPathButton.Location = new System.Drawing.Point(405, 3);
this.DICPathButton.Name = "DICPathButton";
this.DICPathButton.Size = new System.Drawing.Size(49, 23);
this.DICPathButton.TabIndex = 6;
this.DICPathButton.Text = "...";
this.DICPathButton.UseVisualStyleBackColor = true;
this.DICPathButton.UseWaitCursor = true;
this.DICPathButton.Click += new System.EventHandler(this.BrowseForPathClick);
//
// preferredSpeedGroupBox
//
this.preferredSpeedGroupBox.Controls.Add(this.tableLayoutPanel3);
this.preferredSpeedGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.preferredSpeedGroupBox.Location = new System.Drawing.Point(3, 130);
this.preferredSpeedGroupBox.Name = "preferredSpeedGroupBox";
this.preferredSpeedGroupBox.Size = new System.Drawing.Size(469, 144);
this.preferredSpeedGroupBox.TabIndex = 1;
this.preferredSpeedGroupBox.TabStop = false;
this.preferredSpeedGroupBox.Text = "Preferred Dump Speed";
this.preferredSpeedGroupBox.UseWaitCursor = true;
//
// tableLayoutPanel3
//
this.tableLayoutPanel3.ColumnCount = 3;
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 80F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel3.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Absolute, 40F));
this.tableLayoutPanel3.Controls.Add(this.DumpSpeedCDLabel, 0, 0);
this.tableLayoutPanel3.Controls.Add(this.DumpSpeedDVDLabel, 0, 1);
this.tableLayoutPanel3.Controls.Add(this.DumpSpeedBDLabel, 0, 2);
this.tableLayoutPanel3.Controls.Add(this.DumpSpeedCDSlider, 1, 0);
this.tableLayoutPanel3.Controls.Add(this.DumpSpeedDVDSlider, 1, 1);
this.tableLayoutPanel3.Controls.Add(this.DumpSpeedBDSlider, 1, 2);
this.tableLayoutPanel3.Controls.Add(this.DumpSpeedCDTextBox, 2, 0);
this.tableLayoutPanel3.Controls.Add(this.DumpSpeedDVDTextBox, 2, 1);
this.tableLayoutPanel3.Controls.Add(this.DumpSpeedBDTextBox, 2, 2);
this.tableLayoutPanel3.Location = new System.Drawing.Point(6, 19);
this.tableLayoutPanel3.Name = "tableLayoutPanel3";
this.tableLayoutPanel3.RowCount = 3;
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel3.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 33.33333F));
this.tableLayoutPanel3.Size = new System.Drawing.Size(457, 119);
this.tableLayoutPanel3.TabIndex = 0;
this.tableLayoutPanel3.UseWaitCursor = true;
//
// DumpSpeedCDLabel
//
this.DumpSpeedCDLabel.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.DumpSpeedCDLabel.AutoSize = true;
this.DumpSpeedCDLabel.Location = new System.Drawing.Point(3, 13);
this.DumpSpeedCDLabel.Name = "DumpSpeedCDLabel";
this.DumpSpeedCDLabel.Size = new System.Drawing.Size(50, 13);
this.DumpSpeedCDLabel.TabIndex = 0;
this.DumpSpeedCDLabel.Text = "CD-ROM";
this.DumpSpeedCDLabel.UseWaitCursor = true;
//
// DumpSpeedDVDLabel
//
this.DumpSpeedDVDLabel.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.DumpSpeedDVDLabel.AutoSize = true;
this.DumpSpeedDVDLabel.Location = new System.Drawing.Point(3, 52);
this.DumpSpeedDVDLabel.Name = "DumpSpeedDVDLabel";
this.DumpSpeedDVDLabel.Size = new System.Drawing.Size(58, 13);
this.DumpSpeedDVDLabel.TabIndex = 1;
this.DumpSpeedDVDLabel.Text = "DVD-ROM";
this.DumpSpeedDVDLabel.UseWaitCursor = true;
//
// DumpSpeedBDLabel
//
this.DumpSpeedBDLabel.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.DumpSpeedBDLabel.AutoSize = true;
this.DumpSpeedBDLabel.Location = new System.Drawing.Point(3, 92);
this.DumpSpeedBDLabel.Name = "DumpSpeedBDLabel";
this.DumpSpeedBDLabel.Size = new System.Drawing.Size(50, 13);
this.DumpSpeedBDLabel.TabIndex = 2;
this.DumpSpeedBDLabel.Text = "BD-ROM";
this.DumpSpeedBDLabel.UseWaitCursor = true;
//
// DumpSpeedCDSlider
//
this.DumpSpeedCDSlider.Dock = System.Windows.Forms.DockStyle.Fill;
this.DumpSpeedCDSlider.Location = new System.Drawing.Point(83, 3);
this.DumpSpeedCDSlider.Name = "DumpSpeedCDSlider";
this.DumpSpeedCDSlider.Size = new System.Drawing.Size(331, 33);
this.DumpSpeedCDSlider.TabIndex = 3;
this.DumpSpeedCDSlider.UseWaitCursor = true;
this.DumpSpeedCDSlider.Value = 1;
this.DumpSpeedCDSlider.Scroll += new System.EventHandler(this.SliderChanged);
//
// DumpSpeedDVDSlider
//
this.DumpSpeedDVDSlider.Dock = System.Windows.Forms.DockStyle.Fill;
this.DumpSpeedDVDSlider.Location = new System.Drawing.Point(83, 42);
this.DumpSpeedDVDSlider.Name = "DumpSpeedDVDSlider";
this.DumpSpeedDVDSlider.Size = new System.Drawing.Size(331, 33);
this.DumpSpeedDVDSlider.TabIndex = 4;
this.DumpSpeedDVDSlider.UseWaitCursor = true;
this.DumpSpeedDVDSlider.Value = 1;
this.DumpSpeedDVDSlider.Scroll += new System.EventHandler(this.SliderChanged);
//
// DumpSpeedBDSlider
//
this.DumpSpeedBDSlider.Dock = System.Windows.Forms.DockStyle.Fill;
this.DumpSpeedBDSlider.Location = new System.Drawing.Point(83, 81);
this.DumpSpeedBDSlider.Name = "DumpSpeedBDSlider";
this.DumpSpeedBDSlider.Size = new System.Drawing.Size(331, 35);
this.DumpSpeedBDSlider.TabIndex = 5;
this.DumpSpeedBDSlider.UseWaitCursor = true;
this.DumpSpeedBDSlider.Value = 1;
this.DumpSpeedBDSlider.Scroll += new System.EventHandler(this.SliderChanged);
//
// DumpSpeedCDTextBox
//
this.DumpSpeedCDTextBox.Anchor = System.Windows.Forms.AnchorStyles.None;
this.DumpSpeedCDTextBox.Enabled = false;
this.DumpSpeedCDTextBox.Location = new System.Drawing.Point(420, 9);
this.DumpSpeedCDTextBox.Name = "DumpSpeedCDTextBox";
this.DumpSpeedCDTextBox.ReadOnly = true;
this.DumpSpeedCDTextBox.Size = new System.Drawing.Size(34, 20);
this.DumpSpeedCDTextBox.TabIndex = 6;
this.DumpSpeedCDTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.DumpSpeedCDTextBox.UseWaitCursor = true;
//
// DumpSpeedDVDTextBox
//
this.DumpSpeedDVDTextBox.Anchor = System.Windows.Forms.AnchorStyles.None;
this.DumpSpeedDVDTextBox.Enabled = false;
this.DumpSpeedDVDTextBox.Location = new System.Drawing.Point(420, 48);
this.DumpSpeedDVDTextBox.Name = "DumpSpeedDVDTextBox";
this.DumpSpeedDVDTextBox.ReadOnly = true;
this.DumpSpeedDVDTextBox.Size = new System.Drawing.Size(34, 20);
this.DumpSpeedDVDTextBox.TabIndex = 7;
this.DumpSpeedDVDTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.DumpSpeedDVDTextBox.UseWaitCursor = true;
//
// DumpSpeedBDTextBox
//
this.DumpSpeedBDTextBox.Anchor = System.Windows.Forms.AnchorStyles.None;
this.DumpSpeedBDTextBox.Enabled = false;
this.DumpSpeedBDTextBox.Location = new System.Drawing.Point(420, 88);
this.DumpSpeedBDTextBox.Name = "DumpSpeedBDTextBox";
this.DumpSpeedBDTextBox.ReadOnly = true;
this.DumpSpeedBDTextBox.Size = new System.Drawing.Size(34, 20);
this.DumpSpeedBDTextBox.TabIndex = 8;
this.DumpSpeedBDTextBox.TextAlign = System.Windows.Forms.HorizontalAlignment.Center;
this.DumpSpeedBDTextBox.UseWaitCursor = true;
//
// optionsGroupBox
//
this.optionsGroupBox.Controls.Add(this.tableLayoutPanel4);
this.optionsGroupBox.Dock = System.Windows.Forms.DockStyle.Fill;
this.optionsGroupBox.Location = new System.Drawing.Point(3, 280);
this.optionsGroupBox.Name = "optionsGroupBox";
this.optionsGroupBox.Size = new System.Drawing.Size(469, 94);
this.optionsGroupBox.TabIndex = 2;
this.optionsGroupBox.TabStop = false;
this.optionsGroupBox.Text = "Options";
//
// tableLayoutPanel4
//
this.tableLayoutPanel4.ColumnCount = 4;
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel4.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 25F));
this.tableLayoutPanel4.Controls.Add(this.QuietModeCheckBox, 0, 0);
this.tableLayoutPanel4.Controls.Add(this.AutoScanCheckBox, 0, 1);
this.tableLayoutPanel4.Controls.Add(this.ParanoidModeCheckBox, 1, 0);
this.tableLayoutPanel4.Controls.Add(this.SkipDetectionCheckBox, 2, 1);
this.tableLayoutPanel4.Controls.Add(this.C2RereadTimesTextBox, 3, 0);
this.tableLayoutPanel4.Controls.Add(this.C2RereadLabel, 2, 0);
this.tableLayoutPanel4.Location = new System.Drawing.Point(6, 19);
this.tableLayoutPanel4.Name = "tableLayoutPanel4";
this.tableLayoutPanel4.RowCount = 2;
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel4.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel4.Size = new System.Drawing.Size(457, 69);
this.tableLayoutPanel4.TabIndex = 0;
//
// QuietModeCheckBox
//
this.QuietModeCheckBox.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.QuietModeCheckBox.AutoSize = true;
this.QuietModeCheckBox.Location = new System.Drawing.Point(3, 8);
this.QuietModeCheckBox.Name = "QuietModeCheckBox";
this.QuietModeCheckBox.Size = new System.Drawing.Size(81, 17);
this.QuietModeCheckBox.TabIndex = 0;
this.QuietModeCheckBox.Text = "Quiet Mode";
this.QuietModeCheckBox.UseVisualStyleBackColor = true;
//
// AutoScanCheckBox
//
this.AutoScanCheckBox.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.AutoScanCheckBox.AutoSize = true;
this.tableLayoutPanel4.SetColumnSpan(this.AutoScanCheckBox, 2);
this.AutoScanCheckBox.Location = new System.Drawing.Point(3, 43);
this.AutoScanCheckBox.Name = "AutoScanCheckBox";
this.AutoScanCheckBox.Size = new System.Drawing.Size(182, 17);
this.AutoScanCheckBox.TabIndex = 1;
this.AutoScanCheckBox.Text = "Automatically Scan for Protection";
this.AutoScanCheckBox.UseVisualStyleBackColor = true;
//
// ParanoidModeCheckBox
//
this.ParanoidModeCheckBox.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.ParanoidModeCheckBox.AutoSize = true;
this.ParanoidModeCheckBox.Location = new System.Drawing.Point(117, 8);
this.ParanoidModeCheckBox.Name = "ParanoidModeCheckBox";
this.ParanoidModeCheckBox.Size = new System.Drawing.Size(98, 17);
this.ParanoidModeCheckBox.TabIndex = 2;
this.ParanoidModeCheckBox.Text = "Paranoid Mode";
this.ParanoidModeCheckBox.UseVisualStyleBackColor = true;
//
// SkipDetectionCheckBox
//
this.SkipDetectionCheckBox.Anchor = System.Windows.Forms.AnchorStyles.Left;
this.SkipDetectionCheckBox.AutoSize = true;
this.tableLayoutPanel4.SetColumnSpan(this.SkipDetectionCheckBox, 2);
this.SkipDetectionCheckBox.Location = new System.Drawing.Point(231, 43);
this.SkipDetectionCheckBox.Name = "SkipDetectionCheckBox";
this.SkipDetectionCheckBox.Size = new System.Drawing.Size(155, 17);
this.SkipDetectionCheckBox.TabIndex = 3;
this.SkipDetectionCheckBox.Text = "Skip Media Type Detection";
this.SkipDetectionCheckBox.UseVisualStyleBackColor = true;
//
// C2RereadTimesTextBox
//
this.C2RereadTimesTextBox.Anchor = System.Windows.Forms.AnchorStyles.None;
this.C2RereadTimesTextBox.Location = new System.Drawing.Point(349, 7);
this.C2RereadTimesTextBox.Name = "C2RereadTimesTextBox";
this.C2RereadTimesTextBox.Size = new System.Drawing.Size(100, 20);
this.C2RereadTimesTextBox.TabIndex = 4;
//
// C2RereadLabel
//
this.C2RereadLabel.Anchor = System.Windows.Forms.AnchorStyles.Right;
this.C2RereadLabel.AutoSize = true;
this.C2RereadLabel.Location = new System.Drawing.Point(250, 10);
this.C2RereadLabel.Name = "C2RereadLabel";
this.C2RereadLabel.Size = new System.Drawing.Size(89, 13);
this.C2RereadLabel.TabIndex = 5;
this.C2RereadLabel.Text = "C2 Reread Times";
//
// tableLayoutPanel5
//
this.tableLayoutPanel5.ColumnCount = 2;
this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel5.ColumnStyles.Add(new System.Windows.Forms.ColumnStyle(System.Windows.Forms.SizeType.Percent, 50F));
this.tableLayoutPanel5.Controls.Add(this.AcceptButton, 0, 0);
this.tableLayoutPanel5.Controls.Add(this.CancelButton, 1, 0);
this.tableLayoutPanel5.Dock = System.Windows.Forms.DockStyle.Fill;
this.tableLayoutPanel5.Location = new System.Drawing.Point(3, 380);
this.tableLayoutPanel5.Name = "tableLayoutPanel5";
this.tableLayoutPanel5.RowCount = 1;
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Percent, 100F));
this.tableLayoutPanel5.RowStyles.Add(new System.Windows.Forms.RowStyle(System.Windows.Forms.SizeType.Absolute, 20F));
this.tableLayoutPanel5.Size = new System.Drawing.Size(469, 34);
this.tableLayoutPanel5.TabIndex = 3;
//
// AcceptButton
//
this.AcceptButton.Anchor = System.Windows.Forms.AnchorStyles.None;
this.AcceptButton.Location = new System.Drawing.Point(79, 5);
this.AcceptButton.Name = "AcceptButton";
this.AcceptButton.Size = new System.Drawing.Size(75, 23);
this.AcceptButton.TabIndex = 0;
this.AcceptButton.Text = "Accept";
this.AcceptButton.UseVisualStyleBackColor = true;
this.AcceptButton.Click += new System.EventHandler(this.OnAcceptClick);
//
// CancelButton
//
this.CancelButton.Anchor = System.Windows.Forms.AnchorStyles.None;
this.CancelButton.Location = new System.Drawing.Point(314, 5);
this.CancelButton.Name = "CancelButton";
this.CancelButton.Size = new System.Drawing.Size(75, 23);
this.CancelButton.TabIndex = 1;
this.CancelButton.Text = "Cancel";
this.CancelButton.UseVisualStyleBackColor = true;
this.CancelButton.Click += new System.EventHandler(this.OnCancelClick);
//
// OptionsWindow
//
this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F);
this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this.ClientSize = new System.Drawing.Size(499, 441);
this.Controls.Add(this.tableLayoutPanel1);
this.Name = "OptionsWindow";
this.ShowIcon = false;
this.Text = "Options";
this.UseWaitCursor = true;
this.tableLayoutPanel1.ResumeLayout(false);
this.pathsGroupBox.ResumeLayout(false);
this.tableLayoutPanel2.ResumeLayout(false);
this.tableLayoutPanel2.PerformLayout();
this.preferredSpeedGroupBox.ResumeLayout(false);
this.tableLayoutPanel3.ResumeLayout(false);
this.tableLayoutPanel3.PerformLayout();
((System.ComponentModel.ISupportInitialize)(this.DumpSpeedCDSlider)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.DumpSpeedDVDSlider)).EndInit();
((System.ComponentModel.ISupportInitialize)(this.DumpSpeedBDSlider)).EndInit();
this.optionsGroupBox.ResumeLayout(false);
this.tableLayoutPanel4.ResumeLayout(false);
this.tableLayoutPanel4.PerformLayout();
this.tableLayoutPanel5.ResumeLayout(false);
this.ResumeLayout(false);
}
#endregion
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel1;
private System.Windows.Forms.GroupBox pathsGroupBox;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel2;
private System.Windows.Forms.Label discImageCreatorPathLabel;
private System.Windows.Forms.Label subdumpPathLabel;
private System.Windows.Forms.Label defaultOutputPathLabel;
private System.Windows.Forms.TextBox DICPathTextBox;
private System.Windows.Forms.TextBox SubDumpPathTextBox;
private System.Windows.Forms.TextBox DefaultOutputPathTextBox;
private System.Windows.Forms.Button DICPathButton;
private System.Windows.Forms.Button DefaultOutputPathButton;
private System.Windows.Forms.Button SubDumpPathButton;
private System.Windows.Forms.GroupBox preferredSpeedGroupBox;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel3;
private System.Windows.Forms.Label DumpSpeedCDLabel;
private System.Windows.Forms.Label DumpSpeedDVDLabel;
private System.Windows.Forms.Label DumpSpeedBDLabel;
private System.Windows.Forms.TrackBar DumpSpeedCDSlider;
private System.Windows.Forms.TrackBar DumpSpeedDVDSlider;
private System.Windows.Forms.TrackBar DumpSpeedBDSlider;
private System.Windows.Forms.TextBox DumpSpeedCDTextBox;
private System.Windows.Forms.TextBox DumpSpeedDVDTextBox;
private System.Windows.Forms.TextBox DumpSpeedBDTextBox;
private System.Windows.Forms.GroupBox optionsGroupBox;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel4;
private System.Windows.Forms.CheckBox QuietModeCheckBox;
private System.Windows.Forms.CheckBox AutoScanCheckBox;
private System.Windows.Forms.CheckBox ParanoidModeCheckBox;
private System.Windows.Forms.CheckBox SkipDetectionCheckBox;
private System.Windows.Forms.TextBox C2RereadTimesTextBox;
private System.Windows.Forms.Label C2RereadLabel;
private System.Windows.Forms.TableLayoutPanel tableLayoutPanel5;
private System.Windows.Forms.Button AcceptButton;
private System.Windows.Forms.Button CancelButton;
}
}

View File

@@ -0,0 +1,179 @@
using System;
using System.IO;
using System.Linq;
using System.Windows;
using System.Windows.Forms;
namespace DICUI.Forms.Windows
{
/// <summary>
/// Interaction logic for OptionsWindow
/// </summary>
public partial class OptionsWindow : Form
{
private readonly MainWindow _mainWindow;
private readonly Options _options;
public OptionsWindow(MainWindow mainWindow, Options options)
{
InitializeComponent();
_mainWindow = mainWindow;
_options = options;
// Create data sets
DumpSpeedCDSlider.Minimum = (int)Constants.SpeedsForCDAsCollection.First();
DumpSpeedCDSlider.Maximum = (int)Constants.SpeedsForCDAsCollection.Last();
DumpSpeedDVDSlider.Minimum = (int)Constants.SpeedsForDVDAsCollection.First();
DumpSpeedDVDSlider.Maximum = (int)Constants.SpeedsForDVDAsCollection.Last();
DumpSpeedBDSlider.Minimum = (int)Constants.SpeedsForBDAsCollection.First();
DumpSpeedBDSlider.Maximum = (int)Constants.SpeedsForBDAsCollection.Last();
// Select the current values
DumpSpeedCDSlider.Value = _options.preferredDumpSpeedCD;
DumpSpeedDVDSlider.Value = _options.preferredDumpSpeedDVD;
DumpSpeedBDSlider.Value = _options.preferredDumpSpeedBD;
// Create textbox outputs
DumpSpeedCDTextBox.Text = DumpSpeedCDSlider.Value.ToString();
DumpSpeedDVDTextBox.Text = DumpSpeedDVDSlider.Value.ToString();
DumpSpeedBDTextBox.Text = DumpSpeedBDSlider.Value.ToString();
// Set options
QuietModeCheckBox.Checked = _options.QuietMode;
ParanoidModeCheckBox.Checked = _options.ParanoidMode;
C2RereadTimesTextBox.Text = _options.RereadAmountForC2.ToString();
AutoScanCheckBox.Checked = _options.ScanForProtection;
SkipDetectionCheckBox.Checked = _options.SkipMediaTypeDetection;
}
private OpenFileDialog CreateOpenFileDialog()
{
OpenFileDialog dialog = new OpenFileDialog();
dialog.InitialDirectory = AppDomain.CurrentDomain.BaseDirectory;
dialog.Filter = "Executables (*.exe)|*.exe";
dialog.FilterIndex = 0;
dialog.RestoreDirectory = true;
return dialog;
}
private FolderBrowserDialog CreateFolderBrowserDialog()
{
FolderBrowserDialog dialog = new FolderBrowserDialog();
return dialog;
}
private string[] PathSettings()
{
string[] pathSettings = { "DefaultOutputPath", "DICPath", "SubDumpPath" };
return pathSettings;
}
private TextBox TextBoxForPathSetting(string name)
{
switch (name)
{
case "DICPath":
return DICPathTextBox;
case "SubDumpPath":
return SubDumpPathTextBox;
case "DefaultOutputPath":
return DefaultOutputPathTextBox;
default:
return null;
}
}
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(0, button.Name.IndexOf("Button"));
// TODO: hack for now, then we'll see
bool shouldBrowseForPath = pathSettingName == "DefaultOutputPath";
CommonDialog dialog = shouldBrowseForPath ? (CommonDialog)CreateFolderBrowserDialog() : CreateOpenFileDialog();
using (dialog)
{
DialogResult result = dialog.ShowDialog();
if (result == System.Windows.Forms.DialogResult.OK)
{
string path;
bool exists;
if (shouldBrowseForPath)
{
path = (dialog as FolderBrowserDialog).SelectedPath;
exists = Directory.Exists(path);
}
else
{
path = (dialog as OpenFileDialog).FileName;
exists = File.Exists(path);
}
if (exists)
TextBoxForPathSetting(pathSettingName).Text = path;
else
{
System.Windows.MessageBox.Show(
"Specified path doesn't exists!",
"Error",
MessageBoxButton.OK,
MessageBoxImage.Error
);
}
}
}
}
public void RefreshSettings()
{
Array.ForEach(PathSettings(), setting => TextBoxForPathSetting(setting).Text = _options.Get(setting));
DumpSpeedCDSlider.Value = _options.preferredDumpSpeedCD;
DumpSpeedDVDSlider.Value = _options.preferredDumpSpeedDVD;
DumpSpeedBDSlider.Value = _options.preferredDumpSpeedBD;
}
#region Event Handlers
private void SliderChanged(object sender, EventArgs e)
{
DumpSpeedCDTextBox.Text = DumpSpeedCDSlider.Value.ToString();
DumpSpeedDVDTextBox.Text = DumpSpeedDVDSlider.Value.ToString();
DumpSpeedBDTextBox.Text = DumpSpeedBDSlider.Value.ToString();
}
private void OnAcceptClick(object sender, EventArgs e)
{
Array.ForEach(PathSettings(), setting => _options.Set(setting, TextBoxForPathSetting(setting).Text));
_options.preferredDumpSpeedCD = Convert.ToInt32(DumpSpeedCDSlider.Value);
_options.preferredDumpSpeedDVD = Convert.ToInt32(DumpSpeedDVDSlider.Value);
_options.preferredDumpSpeedBD = Convert.ToInt32(DumpSpeedBDSlider.Value);
_options.QuietMode = QuietModeCheckBox.Checked;
_options.ParanoidMode = ParanoidModeCheckBox.Checked;
_options.RereadAmountForC2 = Convert.ToInt32(C2RereadTimesTextBox.Text);
_options.ScanForProtection = AutoScanCheckBox.Checked;
_options.SkipMediaTypeDetection = SkipDetectionCheckBox.Checked;
_options.Save();
Hide();
_mainWindow.OnOptionsUpdated();
}
private void OnCancelClick(object sender, EventArgs e)
{
// just hide the window and don't care
Hide();
}
#endregion
}
}

View File

@@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<metadata name="$this.Locked" type="System.Boolean, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089">
<value>True</value>
</metadata>
</root>

View File

@@ -0,0 +1,101 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{51AB0928-13F9-44BF-A407-B6957A43A056}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>DICUI.Library</RootNamespace>
<AssemblyName>DICUI.Library</AssemblyName>
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<Deterministic>true</Deterministic>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<ItemGroup>
<Reference Include="BurnOutSharp, Version=1.3.7.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\BurnOutSharp.1.3.7.1\lib\net461\BurnOutSharp.dll</HintPath>
</Reference>
<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="PresentationFramework" />
<Reference Include="System" />
<Reference Include="System.Configuration" />
<Reference Include="System.Core" />
<Reference Include="System.Management" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Data" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xml" />
<Reference Include="UnshieldSharp, Version=1.4.2.2, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\UnshieldSharp.1.4.2.2\lib\net461\UnshieldSharp.dll</HintPath>
</Reference>
<Reference Include="zlib.net, Version=1.0.3.0, Culture=neutral, PublicKeyToken=47d7877cb3620160">
<HintPath>..\packages\zlib.net.1.0.4.0\lib\zlib.net.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<Compile Include="Data\Constants.cs" />
<Compile Include="Data\Enumerations.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="Utilities\Converters.cs" />
<Compile Include="Utilities\DumpEnvironment.cs" />
<Compile Include="Utilities\Extensions.cs" />
<Compile Include="Utilities\Parameters.cs" />
<Compile Include="Utilities\Result.cs" />
<Compile Include="Utilities\Validators.cs" />
</ItemGroup>
<ItemGroup>
<Content Include="mspack.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
</ItemGroup>
<ItemGroup>
<COMReference Include="IMAPI2">
<Guid>{2735412F-7F64-5B0F-8F00-5D77AFBE261E}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
<COMReference Include="IMAPI2FS">
<Guid>{2C941FD0-975B-59BE-A960-9A2A262853A5}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -1,17 +1,5 @@
namespace DICUI.Data
{
/// <summary>
/// Variables for UI elements
/// </summary>
public static class UIElements
{
public const string DiscNotDetected = "Disc Not Detected";
public const string StartDumping = "Start Dumping";
public const string StopDumping = "Stop Dumping";
public const int LogWindowMarginFromMainWindow = 10;
}
/// <summary>
/// Top-level commands for DiscImageCreator
/// </summary>
@@ -34,6 +22,9 @@
public const string Sub = "sub";
public const string Swap = "swap";
public const string XBOX = "xbox";
public const string XBOXSwap = "xboxswap";
public const string XGD2Swap = "xgd2swap";
public const string XGD3Swap = "xgd3swap";
}
/// <summary>
@@ -107,12 +98,14 @@
public const string PlayStationEDCField = "EDC";
public const string PlayStationAntiModchipField = "Anti-modchip";
public const string PlayStationLibCryptField = "LibCrypt";
public const string PlayStation4PICField = "Permanent Information & Control (PIC)";
public const string SaturnHeaderField = "Header";
public const string SaturnBuildDateField = "Build Date";
public const string XBOXDMIHash = "DMI.bin Hashes";
public const string XBOXPFIHash = "PFI.bin Hashes";
public const string XBOXSSHash = "SS.bin Hashes";
public const string XBOXSSRanges = "Security Sector Ranges";
public const string XBOXSSVersion = "Security Sector Version";
// Default values
@@ -120,5 +113,6 @@
public const string RequiredIfExistsValue = "(REQUIRED, IF EXISTS)";
public const string OptionalValue = "(OPTIONAL)";
public const string YesNoValue = "Yes/No";
public const string DiscNotDetected = "Disc Not Detected";
}
}

View File

@@ -23,6 +23,9 @@
Sub,
Swap,
XBOX,
XBOXSwap,
XGD2Swap,
XGD3Swap,
}
/// <summary>
@@ -70,8 +73,7 @@
CommodoreAmigaCDTV,
MattelHyperscan,
MicrosoftXBOX,
MicrosoftXBOX360XDG2,
MicrosoftXBOX360XDG3,
MicrosoftXBOX360,
MicrosoftXBOXOne,
NECPCEngineTurboGrafxCD,
NECPCFX,
@@ -162,7 +164,7 @@
SegaRingEdge,
SegaRingEdge2,
SegaRingWide,
SegaSTV,
SegaTitanVideo,
SegaSystem32,
SeibuCATSSystem,
TABAustriaQuizard,
@@ -194,8 +196,6 @@
MarkerOtherEnd,
#endregion
Custom,
}
/// <summary>
@@ -215,25 +215,52 @@
/// </summary>
public enum MediaType
{
// Generic Optical Formats
NONE = 0,
CD,
#region Punched Media
ApertureCard,
JacquardLoomCard,
MagneticStripeCard,
OpticalPhonecard,
PunchedCard,
PunchedTape,
#endregion
#region Tape
Cassette,
DataCartridge,
OpenReel,
#endregion
#region Disc / Disc
BluRay,
CDROM,
DVD,
FloppyDisk,
Floptical,
GDROM,
HDDVD,
BluRay,
LaserDisc,
// Special Optical Formats
GameCubeGameDisc,
WiiOpticalDisc,
WiiUOpticalDisc,
HardDisk,
IomegaBernoulliDisk,
IomegaJaz,
IomegaZip,
LaserDisc, // LD-ROM and LV-ROM variants
Nintendo64DD,
NintendoFamicomDiskSystem,
NintendoGameCube,
NintendoWiiOpticalDisc,
NintendoWiiUOpticalDisc,
UMD,
// Non-Optical Formats
Floppy,
#endregion
// Unsorted Formats
Cartridge,
Cassette,
CED,
}
}

View File

@@ -0,0 +1,36 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
[assembly: AssemblyTitle("DICUI.Library")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DICUI.Library")]
[assembly: AssemblyCopyright("Copyright © 2018")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
[assembly: Guid("51ab0928-13f9-44bf-a407-b6957a43a056")]
// Version information for an assembly consists of the following four values:
//
// Major Version
// Minor Version
// Build Number
// Revision
//
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.11")]
[assembly: AssemblyFileVersion("1.11.0.0")]

View File

@@ -1,36 +1,8 @@
using System;
using System.Globalization;
using System.Windows.Data;
using IMAPI2;
using IMAPI2;
using DICUI.Data;
namespace DICUI.Utilities
{
/// <summary>
/// Used to provide a converter to XAML files to render comboboxes with enum values
/// </summary>
public class EnumDescriptionConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is DICCommand)
return ((DICCommand)value).Name();
else if (value is DICFlag)
return ((DICFlag)value).Name();
else if (value is MediaType?)
return ((MediaType?)value).Name();
else if (value is KnownSystem?)
return ((KnownSystem?)value).Name();
else
return "";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return string.Empty;
}
}
public static class Converters
{
/// <summary>
@@ -46,19 +18,22 @@ namespace DICUI.Utilities
case DICCommand.Audio:
case DICCommand.CompactDisc:
case DICCommand.Data:
return MediaType.CD;
return MediaType.CDROM;
case DICCommand.GDROM:
case DICCommand.Swap:
return MediaType.GDROM;
case DICCommand.DigitalVideoDisc:
case DICCommand.XBOX:
case DICCommand.XBOXSwap:
case DICCommand.XGD2Swap:
case DICCommand.XGD3Swap:
return MediaType.DVD;
case DICCommand.BluRay:
return MediaType.BluRay;
// Non-optical
case DICCommand.Floppy:
return MediaType.Floppy;
return MediaType.FloppyDisk;
default:
return null;
}
@@ -86,7 +61,11 @@ namespace DICUI.Utilities
case DICCommand.BluRay:
return KnownSystem.SonyPlayStation3;
case DICCommand.XBOX:
case DICCommand.XBOXSwap:
return KnownSystem.MicrosoftXBOX;
case DICCommand.XGD2Swap:
case DICCommand.XGD3Swap:
return KnownSystem.MicrosoftXBOX360;
default:
return null;
}
@@ -135,6 +114,12 @@ namespace DICUI.Utilities
return DICCommandStrings.Swap;
case DICCommand.XBOX:
return DICCommandStrings.XBOX;
case DICCommand.XBOXSwap:
return DICCommandStrings.XBOXSwap;
case DICCommand.XGD2Swap:
return DICCommandStrings.XGD2Swap;
case DICCommand.XGD3Swap:
return DICCommandStrings.XGD3Swap;
case DICCommand.NONE:
default:
@@ -208,38 +193,38 @@ namespace DICUI.Utilities
/// <param name="type">IMAPI_MEDIA_PHYSICAL_TYPE value to check</param>
/// <returns>MediaType if possible, null on error</returns>
public static MediaType? IMAPIDiskTypeToMediaType(IMAPI_MEDIA_PHYSICAL_TYPE type)
{
switch (type)
{
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_UNKNOWN:
return MediaType.NONE;
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_CDROM:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_CDR:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_CDRW:
return MediaType.CD;
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDROM:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDRAM:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDPLUSR:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDPLUSRW:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDPLUSR_DUALLAYER:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDDASHR:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDDASHRW:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDDASHR_DUALLAYER:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DISK:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDPLUSRW_DUALLAYER:
return MediaType.DVD;
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_HDDVDROM:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_HDDVDR:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_HDDVDRAM:
return MediaType.HDDVD;
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_BDROM:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_BDR:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_BDRE:
return MediaType.BluRay;
default:
return null;
}
}
{
switch (type)
{
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_UNKNOWN:
return MediaType.NONE;
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_CDROM:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_CDR:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_CDRW:
return MediaType.CDROM;
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDROM:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDRAM:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDPLUSR:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDPLUSRW:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDPLUSR_DUALLAYER:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDDASHR:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDDASHRW:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDDASHR_DUALLAYER:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DISK:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDPLUSRW_DUALLAYER:
return MediaType.DVD;
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_HDDVDROM:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_HDDVDR:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_HDDVDRAM:
return MediaType.HDDVD;
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_BDROM:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_BDR:
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_BDRE:
return MediaType.BluRay;
default:
return null;
}
}
/// <summary>
/// Get the default extension for a given disc type
@@ -250,22 +235,22 @@ namespace DICUI.Utilities
{
switch (type)
{
case MediaType.CD:
case MediaType.CDROM:
case MediaType.GDROM:
case MediaType.Cartridge:
return ".bin";
case MediaType.DVD:
case MediaType.HDDVD:
case MediaType.BluRay:
case MediaType.WiiOpticalDisc:
case MediaType.NintendoWiiOpticalDisc:
case MediaType.UMD:
return ".iso";
case MediaType.LaserDisc:
case MediaType.GameCubeGameDisc:
case MediaType.NintendoGameCube:
return ".raw";
case MediaType.WiiUOpticalDisc:
case MediaType.NintendoWiiUOpticalDisc:
return ".wud";
case MediaType.Floppy:
case MediaType.FloppyDisk:
return ".img";
case MediaType.Cassette:
return ".wav";
@@ -285,36 +270,80 @@ namespace DICUI.Utilities
{
switch (type)
{
case MediaType.CD:
#region Punched Media
case MediaType.ApertureCard:
return "Aperture card";
case MediaType.JacquardLoomCard:
return "Jacquard Loom card";
case MediaType.MagneticStripeCard:
return "Magnetic stripe card";
case MediaType.OpticalPhonecard:
return "Optical phonecard";
case MediaType.PunchedCard:
return "Punched card";
case MediaType.PunchedTape:
return "Punched tape";
#endregion
#region Tape
case MediaType.OpenReel:
return "Open Reel Tape";
case MediaType.DataCartridge:
return "Data Tape Cartridge";
case MediaType.Cassette:
return "Cassette Tape";
#endregion
#region Disc / Disc
case MediaType.BluRay:
return "BD-ROM";
case MediaType.CDROM:
return "CD-ROM";
case MediaType.DVD:
return "DVD";
return "DVD-ROM";
case MediaType.FloppyDisk:
return "Floppy Disk";
case MediaType.Floptical:
return "Floptical";
case MediaType.GDROM:
return "GD-ROM";
case MediaType.HDDVD:
return "HD-DVD";
case MediaType.BluRay:
return "BluRay";
return "HD-DVD-ROM";
case MediaType.HardDisk:
return "Hard Disk";
case MediaType.IomegaBernoulliDisk:
return "Iomega Bernoulli Disk";
case MediaType.IomegaJaz:
return "Iomega Jaz";
case MediaType.IomegaZip:
return "Iomega Zip";
case MediaType.LaserDisc:
return "LaserDisc";
case MediaType.CED:
return "CED";
case MediaType.GameCubeGameDisc:
return "GameCube Game";
case MediaType.WiiOpticalDisc:
return "Wii Optical";
case MediaType.WiiUOpticalDisc:
return "Wii U Optical";
return "LD-ROM / LV-ROM";
case MediaType.Nintendo64DD:
return "64DD Disk";
case MediaType.NintendoFamicomDiskSystem:
return "Famicom Disk System Disk";
case MediaType.NintendoGameCube:
return "GameCube Disc";
case MediaType.NintendoWiiOpticalDisc:
return "Wii Optical Disc";
case MediaType.NintendoWiiUOpticalDisc:
return "Wii U Optical Disc";
case MediaType.UMD:
return "UMD";
#endregion
// Unsorted Formats
case MediaType.Cartridge:
return "Cartridge";
case MediaType.Cassette:
return "Cassette Tape";
case MediaType.Floppy:
return "Floppy Disk";
case MediaType.CED:
return "CED";
case MediaType.NONE:
default:
@@ -345,10 +374,8 @@ namespace DICUI.Utilities
return "Mattel HyperScan";
case KnownSystem.MicrosoftXBOX:
return "Microsoft XBOX";
case KnownSystem.MicrosoftXBOX360XDG2:
return "Microsoft XBOX 360 (XDG2)";
case KnownSystem.MicrosoftXBOX360XDG3:
return "Microsoft XBOX 360 (XDG3)";
case KnownSystem.MicrosoftXBOX360:
return "Microsoft XBOX 360";
case KnownSystem.MicrosoftXBOXOne:
return "Microsoft XBOX One";
case KnownSystem.NECPCEngineTurboGrafxCD:
@@ -511,8 +538,8 @@ namespace DICUI.Utilities
return "Sega RingEdge 2";
case KnownSystem.SegaRingWide:
return "Sega RingWide";
case KnownSystem.SegaSTV:
return "Sega STV";
case KnownSystem.SegaTitanVideo:
return "Sega Titan Video";
case KnownSystem.SegaSystem32:
return "Sega System 32";
case KnownSystem.SeibuCATSSystem:
@@ -561,9 +588,6 @@ namespace DICUI.Utilities
#endregion
case KnownSystem.Custom:
return "Custom Input";
case KnownSystem.NONE:
default:
return "Unknown";

View File

@@ -43,12 +43,13 @@ namespace DICUI.Utilities
{
switch (type)
{
case MediaType.CD:
case MediaType.CDROM:
case MediaType.DVD:
case MediaType.GDROM:
case MediaType.HDDVD:
case MediaType.GameCubeGameDisc:
case MediaType.WiiOpticalDisc:
case MediaType.BluRay:
case MediaType.NintendoGameCube:
case MediaType.NintendoWiiOpticalDisc:
return true;
default:
return false;
@@ -66,19 +67,6 @@ namespace DICUI.Utilities
return Converters.KnownSystemToString(system);
}
public static bool DoesSupportDriveSpeed(this KnownSystem? system)
{
switch (system)
{
case KnownSystem.MicrosoftXBOX:
case KnownSystem.MicrosoftXBOX360XDG2:
case KnownSystem.MicrosoftXBOX360XDG3:
return false;
default:
return true;
}
}
public static KnownSystemCategory Category(this KnownSystem? system)
{
if (system < KnownSystem.MarkerConsoleEnd)

View File

@@ -17,7 +17,7 @@ namespace DICUI.Utilities
// Drive Information
public string DriveLetter;
int? DriveSpeed;
public int? DriveSpeed;
// Path Information
public string Filename;
@@ -146,7 +146,7 @@ namespace DICUI.Utilities
// GameCube and Wii
if (this[DICFlag.Raw])
{
type = MediaType.GameCubeGameDisc;
type = MediaType.NintendoGameCube;
system = KnownSystem.NintendoGameCube;
}
@@ -154,14 +154,14 @@ namespace DICUI.Utilities
else if (this[DICFlag.NoFixSubQLibCrypt]
|| this[DICFlag.ScanAntiMod])
{
type = MediaType.CD;
type = MediaType.CDROM;
system = KnownSystem.SonyPlayStation;
}
// Saturn
else if (this[DICFlag.SeventyFour])
{
type = MediaType.CD;
type = MediaType.CDROM;
system = KnownSystem.SegaSaturn;
}
@@ -199,7 +199,10 @@ namespace DICUI.Utilities
|| Command == DICCommand.Start
|| Command == DICCommand.Stop
|| Command == DICCommand.Swap
|| Command == DICCommand.XBOX)
|| Command == DICCommand.XBOX
|| Command == DICCommand.XBOXSwap
|| Command == DICCommand.XGD2Swap
|| Command == DICCommand.XGD3Swap)
{
if (DriveLetter != null)
parameters.Add(DriveLetter);
@@ -218,7 +221,10 @@ namespace DICUI.Utilities
|| Command == DICCommand.MDS
|| Command == DICCommand.Swap
|| Command == DICCommand.Sub
|| Command == DICCommand.XBOX)
|| Command == DICCommand.XBOX
|| Command == DICCommand.XBOXSwap
|| Command == DICCommand.XGD2Swap
|| Command == DICCommand.XGD3Swap)
{
if (Filename != null)
parameters.Add("\"" + Filename.Trim('"') + "\"");
@@ -228,11 +234,16 @@ namespace DICUI.Utilities
// Drive Speed
if (Command == DICCommand.Audio
|| Command == DICCommand.BluRay
|| Command == DICCommand.CompactDisc
|| Command == DICCommand.Data
|| Command == DICCommand.DigitalVideoDisc
|| Command == DICCommand.GDROM
|| Command == DICCommand.Swap)
|| Command == DICCommand.Swap
|| Command == DICCommand.XBOX
|| Command == DICCommand.XBOXSwap
|| Command == DICCommand.XGD2Swap
|| Command == DICCommand.XGD3Swap)
{
if (DriveSpeed != null)
parameters.Add(DriveSpeed.ToString());
@@ -604,8 +615,13 @@ namespace DICUI.Utilities
else
Filename = parts[2];
if (!DoesExist(parts, 3) || !IsValidNumber(parts[3], lowerBound: 0, upperBound: 72))
return false;
else
DriveSpeed = Int32.Parse(parts[3]);
Command = DICCommand.BluRay;
index = 3;
index = 4;
break;
case DICCommandStrings.Close:
@@ -842,10 +858,40 @@ namespace DICUI.Utilities
else
Filename = parts[2];
if (!DoesExist(parts, 3) || !IsValidNumber(parts[3], lowerBound: 0, upperBound: 72))
return false;
else
DriveSpeed = Int32.Parse(parts[3]);
Command = DICCommand.XBOX;
index = 3;
index = 4;
break;
case DICCommandStrings.XBOXSwap:
case DICCommandStrings.XGD2Swap:
case DICCommandStrings.XGD3Swap:
if (!DoesExist(parts, 1) || !IsValidDriveLetter(parts[1]))
return false;
else
DriveLetter = parts[1];
if (!DoesExist(parts, 2) || IsFlag(parts[2]))
return false;
else
Filename = parts[2];
if (!DoesExist(parts, 3) || !IsValidNumber(parts[3], lowerBound: 0, upperBound: 72))
return false;
else
DriveSpeed = Int32.Parse(parts[3]);
for (int i = 4; i < parts.Count; i++)
{
if (!Int64.TryParse(parts[i], out long temp))
return false;
}
break;
default:
return false;
}
@@ -1110,7 +1156,7 @@ namespace DICUI.Utilities
&& parts[0] != DICCommandStrings.Data
&& parts[0] != DICCommandStrings.GDROM)
return false;
else if (DoesExist(parts, i + 1))
else if (!DoesExist(parts, i + 1))
{
this[DICFlag.SubchannelReadLevel] = true;
break;
@@ -1212,18 +1258,12 @@ namespace DICUI.Utilities
switch (type)
{
case MediaType.CD:
if (system == KnownSystem.MicrosoftXBOX)
{
Command = DICCommand.XBOX;
return;
}
case MediaType.CDROM:
Command = DICCommand.CompactDisc;
return;
case MediaType.DVD:
if (system == KnownSystem.MicrosoftXBOX
|| system == KnownSystem.MicrosoftXBOX360XDG2
|| system == KnownSystem.MicrosoftXBOX360XDG3)
|| system == KnownSystem.MicrosoftXBOX360)
{
Command = DICCommand.XBOX;
return;
@@ -1239,13 +1279,13 @@ namespace DICUI.Utilities
case MediaType.BluRay:
Command = DICCommand.BluRay;
return;
case MediaType.GameCubeGameDisc:
case MediaType.NintendoGameCube:
Command = DICCommand.DigitalVideoDisc;
return;
case MediaType.WiiOpticalDisc:
case MediaType.NintendoWiiOpticalDisc:
Command = DICCommand.DigitalVideoDisc;
return;
case MediaType.Floppy:
case MediaType.FloppyDisk:
Command = DICCommand.Floppy;
return;
@@ -1289,7 +1329,7 @@ namespace DICUI.Utilities
List<string> parameters = new List<string>();
switch (type)
{
case MediaType.CD:
case MediaType.CDROM:
this[DICFlag.C2Opcode] = true;
switch (system)
@@ -1331,15 +1371,15 @@ namespace DICUI.Utilities
break;
// Special Formats
case MediaType.GameCubeGameDisc:
case MediaType.NintendoGameCube:
this[DICFlag.Raw] = true;
break;
case MediaType.WiiOpticalDisc:
case MediaType.NintendoWiiOpticalDisc:
this[DICFlag.Raw] = true;
break;
// Non-optical
case MediaType.Floppy:
case MediaType.FloppyDisk:
// Currently no defaults set
break;
}

View File

@@ -26,78 +26,75 @@ namespace DICUI.Utilities
#region Consoles
case KnownSystem.BandaiPlaydiaQuickInteractiveSystem:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.BandaiApplePippin:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.CommodoreAmigaCD32:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.CommodoreAmigaCDTV:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.MattelHyperscan:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.MicrosoftXBOX:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
types.Add(MediaType.DVD);
break;
case KnownSystem.MicrosoftXBOX360XDG2:
types.Add(MediaType.CD);
types.Add(MediaType.DVD);
break;
case KnownSystem.MicrosoftXBOX360XDG3:
types.Add(MediaType.CD);
case KnownSystem.MicrosoftXBOX360:
types.Add(MediaType.CDROM);
types.Add(MediaType.DVD);
break;
case KnownSystem.MicrosoftXBOXOne:
types.Add(MediaType.BluRay);
break;
case KnownSystem.NECPCEngineTurboGrafxCD:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.NECPCFX:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.NintendoGameCube:
types.Add(MediaType.GameCubeGameDisc);
types.Add(MediaType.NintendoGameCube);
break;
case KnownSystem.NintendoWii:
types.Add(MediaType.WiiOpticalDisc);
types.Add(MediaType.NintendoWiiOpticalDisc);
break;
case KnownSystem.NintendoWiiU:
types.Add(MediaType.WiiUOpticalDisc);
types.Add(MediaType.NintendoWiiUOpticalDisc);
break;
case KnownSystem.Panasonic3DOInteractiveMultiplayer:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.PhilipsCDi:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.SegaCDMegaCD:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.SegaDreamcast:
types.Add(MediaType.GDROM);
types.Add(MediaType.CDROM); // Low density partition
types.Add(MediaType.GDROM); // Hight density partition
break;
case KnownSystem.SegaSaturn:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.SNKNeoGeoCD:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.SonyPlayStation:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.SonyPlayStation2:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
types.Add(MediaType.DVD);
break;
case KnownSystem.SonyPlayStation3:
types.Add(MediaType.BluRay);
types.Add(MediaType.CD); // TODO: Confirm this
types.Add(MediaType.CDROM); // TODO: Confirm this
break;
case KnownSystem.SonyPlayStation4:
types.Add(MediaType.BluRay);
@@ -110,7 +107,7 @@ namespace DICUI.Utilities
types.Add(MediaType.DVD);
break;
case KnownSystem.VTechVFlashVSmilePro:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.ZAPiTGamesGameWaveFamilyEntertainmentSystem:
types.Add(MediaType.DVD);
@@ -121,32 +118,32 @@ namespace DICUI.Utilities
#region Computers
case KnownSystem.AcornArchimedes:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.AppleMacintosh:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
types.Add(MediaType.DVD);
types.Add(MediaType.Floppy);
types.Add(MediaType.FloppyDisk);
break;
case KnownSystem.CommodoreAmigaCD:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.FujitsuFMTowns:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.IBMPCCompatible:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
types.Add(MediaType.DVD);
types.Add(MediaType.Floppy);
types.Add(MediaType.FloppyDisk);
break;
case KnownSystem.NECPC88:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.NECPC98:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.SharpX68000:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
#endregion
@@ -154,31 +151,31 @@ namespace DICUI.Utilities
#region Arcade
case KnownSystem.AmigaCUBOCD32:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.AmericanLaserGames3DO:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.Atari3DO:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.Atronic:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.AUSCOMSystem1:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.BallyGameMagic:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.CapcomCPSystemIII:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.GlobalVRVarious:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.GlobalVRVortek:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.GlobalVRVortekV3:
types.Add(MediaType.DVD); // TODO: Confirm
@@ -187,23 +184,23 @@ namespace DICUI.Utilities
types.Add(MediaType.DVD);
break;
case KnownSystem.IncredibleTechnologiesEagle:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.IncredibleTechnologiesVarious:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
types.Add(MediaType.DVD);
break;
case KnownSystem.KonamieAmusement:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.KonamiFirebeat:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.KonamiGVSystem:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.KonamiM2:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.KonamiPython:
types.Add(MediaType.DVD); // TODO: Confirm
@@ -212,65 +209,66 @@ namespace DICUI.Utilities
types.Add(MediaType.DVD); // TODO: Confirm
break;
case KnownSystem.KonamiSystem573:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.KonamiTwinkle:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.KonamiVarious:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
types.Add(MediaType.DVD);
break;
case KnownSystem.MeritIndustriesBoardwalk:
types.Add(MediaType.CD); // TODO: Confirm
types.Add(MediaType.CDROM); // TODO: Confirm
break;
case KnownSystem.MeritIndustriesMegaTouchAurora:
types.Add(MediaType.CD); // TODO: Confirm
types.Add(MediaType.CDROM); // TODO: Confirm
break;
case KnownSystem.MeritIndustriesMegaTouchForce:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
types.Add(MediaType.DVD);
break;
case KnownSystem.MeritIndustriesMegaTouchION:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
types.Add(MediaType.DVD);
break;
case KnownSystem.MeritIndustriesMegaTouchMaxx:
types.Add(MediaType.DVD);
break;
case KnownSystem.MeritIndustriesMegaTouchXL:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.NamcoCapcomSystem256:
types.Add(MediaType.DVD);
break;
case KnownSystem.NamcoCapcomTaitoSystem246:
types.Add(MediaType.CDROM);
types.Add(MediaType.DVD);
break;
case KnownSystem.NamcoSegaNintendoTriforce:
types.Add(MediaType.GDROM);
break;
case KnownSystem.NamcoSystem12:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.NamcoSystem357:
types.Add(MediaType.DVD);
types.Add(MediaType.BluRay);
break;
case KnownSystem.NewJatreCDi:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.NichibutsuHighRateSystem:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.NichibutsuSuperCD:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.NichibutsuXRateSystem:
types.Add(MediaType.DVD);
break;
case KnownSystem.PhotoPlayVarious:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.RawThrillsVarious:
types.Add(MediaType.DVD);
@@ -303,23 +301,23 @@ namespace DICUI.Utilities
case KnownSystem.SegaRingWide:
types.Add(MediaType.DVD);
break;
case KnownSystem.SegaSTV:
types.Add(MediaType.CD);
case KnownSystem.SegaTitanVideo:
types.Add(MediaType.CDROM);
break;
case KnownSystem.SegaSystem32:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.SeibuCATSSystem:
types.Add(MediaType.DVD);
break;
case KnownSystem.TABAustriaQuizard:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.TandyMemorexVisualInformationSystem:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.TsunamiTsuMoMultiGameMotionSystem:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
#endregion
@@ -327,7 +325,7 @@ namespace DICUI.Utilities
#region Others
case KnownSystem.AudioCD:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.BDVideo:
types.Add(MediaType.BluRay);
@@ -336,7 +334,7 @@ namespace DICUI.Utilities
types.Add(MediaType.DVD);
break;
case KnownSystem.EnhancedCD:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.EnhancedDVD:
types.Add(MediaType.DVD);
@@ -348,28 +346,28 @@ namespace DICUI.Utilities
types.Add(MediaType.HDDVD);
break;
case KnownSystem.PalmOS:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.PhilipsCDiDigitalVideo:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.PhotoCD:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.PlayStationGameSharkUpdates:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.RainbowDisc:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.TaoiKTV:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.TomyKissSite:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
case KnownSystem.VideoCD:
types.Add(MediaType.CD);
types.Add(MediaType.CDROM);
break;
#endregion
@@ -433,7 +431,7 @@ namespace DICUI.Utilities
// Get the optical disc drives
List<Drive> discDrives = DriveInfo.GetDrives()
.Where(d => d.DriveType == DriveType.CDRom)
.Select(d => Drive.Optical(d.Name[0], (d.IsReady ? d.VolumeLabel : UIElements.DiscNotDetected), d.IsReady))
.Select(d => Drive.Optical(d.Name[0], (d.IsReady ? d.VolumeLabel : Template.DiscNotDetected), d.IsReady))
.ToList();
// Add the two lists together and order
@@ -526,38 +524,34 @@ namespace DICUI.Utilities
// No system chosen, update status
if (system == KnownSystem.NONE)
return Result.Failure("Please select a valid system");
// custom system chosen, then don't check anything
else if (system == KnownSystem.Custom)
return Result.Success("{0} ready to dump", type.Name());
// If we're on an unsupported type, update the status accordingly
switch (type)
{
// Fully supported types
case MediaType.CD:
case MediaType.CDROM:
case MediaType.DVD:
case MediaType.HDDVD:
case MediaType.BluRay:
if (system == KnownSystem.MicrosoftXBOX360XDG3)
{
return Result.Failure("{0} discs are not currently supported by DIC", type.Name());
}
return Result.Success("{0} ready to dump", type.Name());
// Partially supported types
case MediaType.GDROM:
case MediaType.GameCubeGameDisc:
case MediaType.WiiOpticalDisc:
return Result.Success("{0} discs are partially supported by DIC", type.Name());
case MediaType.NintendoGameCube:
case MediaType.NintendoWiiOpticalDisc:
return Result.Success("{0} partially supported for dumping", type.Name());
// Special case for other supported tools
case MediaType.UMD:
return Result.Success("{0} supported for submission info parsing", type.Name());
// Undumpable but recognized types
case MediaType.LaserDisc:
case MediaType.WiiUOpticalDisc:
case MediaType.NintendoWiiUOpticalDisc:
case MediaType.CED:
case MediaType.UMD:
case MediaType.Cartridge:
case MediaType.Cassette:
return Result.Failure("{0} discs are not currently supported by DIC", type.Name());
return Result.Failure("{0} discs are not supported for dumping", type.Name());
// Invalid or unknown types
case MediaType.NONE:
@@ -573,15 +567,22 @@ namespace DICUI.Utilities
/// <returns>Copy protection detected in the envirionment, if any</returns>
public static async Task<string> RunProtectionScanOnPath(string path)
{
var found = await Task.Run(() =>
try
{
return ProtectionFind.Scan(path);
});
var found = await Task.Run(() =>
{
return ProtectionFind.Scan(path);
});
if (found == null || found.Count == 0)
return "None found";
if (found == null || found.Count == 0)
return "None found";
return string.Join("\n", found.Select(kvp => kvp.Key + ": " + kvp.Value).ToArray());
return string.Join("\n", found.Select(kvp => kvp.Key + ": " + kvp.Value).ToArray());
}
catch
{
return "Disc could not be scanned!";
}
}
}
}

View File

@@ -78,14 +78,18 @@
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\xunit.analyzers.0.10.0\analyzers\dotnet\cs\xunit.analyzers.dll" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\DICUI.Library\DICUI.Library.csproj">
<Project>{51ab0928-13f9-44bf-a407-b6957a43a056}</Project>
<Name>DICUI.Library</Name>
</ProjectReference>
<ProjectReference Include="..\DICUI\DICUI.csproj">
<Project>{7b1b75eb-8940-466f-bd51-76471a57f9be}</Project>
<Name>DICUI</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Analyzer Include="..\packages\xunit.analyzers.0.10.0\analyzers\dotnet\cs\xunit.analyzers.dll" />
</ItemGroup>
<Import Project="$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets" Condition="Exists('$(VSToolsPath)\TeamTest\Microsoft.TestTools.targets')" />
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">

View File

@@ -1,6 +1,5 @@
using System.Linq;
using DICUI.Data;
using DICUI.UI;
using Xunit;
namespace DICUI.Test.Data
@@ -8,14 +7,14 @@ namespace DICUI.Test.Data
public class UIElementsTest
{
[Theory]
[InlineData(MediaType.CD, 72)]
[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
public void GetAllowedDriveSpeedForMediaTypeTest(MediaType? mediaType, int maxExpected)
{
var actual = AllowedSpeeds.GetForMediaType(mediaType);
var actual = Constants.GetSpeedsForMediaType(mediaType);
Assert.Equal(maxExpected, actual.Last());
}
}

View File

@@ -8,14 +8,14 @@ namespace DICUI.Test.Utilities
public class ConvertersTest
{
[Theory]
[InlineData(DICCommand.Audio, MediaType.CD)]
[InlineData(DICCommand.Audio, MediaType.CDROM)]
[InlineData(DICCommand.BluRay, MediaType.BluRay)]
[InlineData(DICCommand.Close, null)]
[InlineData(DICCommand.CompactDisc, MediaType.CD)]
[InlineData(DICCommand.Data, MediaType.CD)]
[InlineData(DICCommand.CompactDisc, MediaType.CDROM)]
[InlineData(DICCommand.Data, MediaType.CDROM)]
[InlineData(DICCommand.DigitalVideoDisc, MediaType.DVD)]
[InlineData(DICCommand.Eject, null)]
[InlineData(DICCommand.Floppy, MediaType.Floppy)]
[InlineData(DICCommand.Floppy, MediaType.FloppyDisk)]
[InlineData(DICCommand.GDROM, MediaType.GDROM)]
[InlineData(DICCommand.MDS, null)]
[InlineData(DICCommand.Reset, null)]
@@ -54,11 +54,11 @@ namespace DICUI.Test.Utilities
}
[Theory]
[InlineData(MediaType.CD, ".bin")]
[InlineData(MediaType.CDROM, ".bin")]
[InlineData(MediaType.DVD, ".iso")]
[InlineData(MediaType.LaserDisc, ".raw")]
[InlineData(MediaType.WiiUOpticalDisc, ".wud")]
[InlineData(MediaType.Floppy, ".img")]
[InlineData(MediaType.NintendoWiiUOpticalDisc, ".wud")]
[InlineData(MediaType.FloppyDisk, ".img")]
[InlineData(MediaType.Cassette, ".wav")]
[InlineData(MediaType.NONE, null)]
public void MediaTypeToExtensionTest(MediaType? mediaType, string expected)
@@ -68,8 +68,8 @@ namespace DICUI.Test.Utilities
}
[Theory]
[InlineData(MediaType.CD, "CD-ROM")]
[InlineData(MediaType.LaserDisc, "LaserDisc")]
[InlineData(MediaType.CDROM, "CD-ROM")]
[InlineData(MediaType.LaserDisc, "LD-ROM / LV-ROM")]
[InlineData(MediaType.NONE, "Unknown")]
public void MediaTypeToStringTest(MediaType? mediaType, string expected)
{
@@ -82,7 +82,6 @@ namespace DICUI.Test.Utilities
[InlineData(KnownSystem.NECPC88, "NEC PC-88")]
[InlineData(KnownSystem.KonamiPython, "Konami Python")]
[InlineData(KnownSystem.HDDVDVideo, "HD-DVD-Video")]
[InlineData(KnownSystem.Custom, "Custom Input")]
[InlineData(KnownSystem.NONE, "Unknown")]
public void KnownSystemToStringTest(KnownSystem? knownSystem, string expected)
{
@@ -97,7 +96,7 @@ namespace DICUI.Test.Utilities
KnownSystem[] markers = { KnownSystem.MarkerArcadeEnd, KnownSystem.MarkerConsoleEnd, KnownSystem.MarkerComputerEnd, KnownSystem.MarkerOtherEnd };
values.ForEach(system => {
if (system == KnownSystem.NONE || system == KnownSystem.Custom)
if (system == KnownSystem.NONE)
return;
// we check that the category is the first category value higher than the system

View File

@@ -11,9 +11,9 @@ namespace DICUI.Test
[Theory]
[InlineData(null, 'D', false, MediaType.NONE, false)]
[InlineData("", 'D', false, MediaType.NONE, false)]
[InlineData("cd F test.bin 8 /c2 20", 'F', false, MediaType.CD, true)]
[InlineData("fd A test.img", 'A', true, MediaType.Floppy, true)]
[InlineData("dvd X test.iso 8 /raw", 'X', false, MediaType.Floppy, false)]
[InlineData("cd F test.bin 8 /c2 20", 'F', false, MediaType.CDROM, true)]
[InlineData("fd A test.img", 'A', true, MediaType.FloppyDisk, true)]
[InlineData("dvd X test.iso 8 /raw", 'X', false, MediaType.FloppyDisk, false)]
[InlineData("stop D", 'D', false, MediaType.DVD, true)]
public void ParametersValidTest(string parameters, char letter, bool isFloppy, MediaType? mediaType, bool expected)
{
@@ -28,29 +28,6 @@ namespace DICUI.Test
Assert.Equal(expected, actual);
}
[Theory]
[InlineData(null, null, null, new char(), null, null)]
[InlineData("", null, null, new char(), null, null)]
[InlineData("cd F test.bin 8 /c2 20", MediaType.CD, KnownSystem.IBMPCCompatible, 'F', "", "test.bin")]
[InlineData("fd A blah\\test.img", MediaType.Floppy, KnownSystem.IBMPCCompatible, 'A', "blah", "test.img")]
[InlineData("dvd X super\\blah\\test.iso 8 /raw", MediaType.GameCubeGameDisc, KnownSystem.NintendoGameCube, 'X', "super\\blah", "test.iso")]
[InlineData("stop D", null, null, 'D', null, null)]
public void AdjustForCustomConfigurationTest(string parameters, MediaType? expectedMediaType, KnownSystem? expectedKnownSystem, char expectedDriveLetter, string expectedOutputDirectory, string expectedOutputFilename)
{
var env = new DumpEnvironment
{
DICParameters = new Parameters(parameters),
System = KnownSystem.Custom,
};
env.AdjustForCustomConfiguration();
Assert.Equal(expectedMediaType, env.Type);
Assert.Equal(expectedKnownSystem, env.System);
Assert.Equal(expectedDriveLetter, env.Drive.Letter);
Assert.Equal(expectedOutputDirectory, env.OutputDirectory);
Assert.Equal(expectedOutputFilename, env.OutputFilename);
}
[Theory]
[InlineData(null, null, null, null)]
[InlineData(" ", "", " ", "")]
@@ -81,9 +58,9 @@ namespace DICUI.Test
}
[Theory]
[InlineData(MediaType.CD)]
[InlineData(MediaType.CDROM)]
[InlineData(MediaType.DVD)]
[InlineData(MediaType.Floppy)]
[InlineData(MediaType.FloppyDisk)]
[InlineData(MediaType.LaserDisc)]
public void FoundAllFilesTest(MediaType? mediaType)
{
@@ -93,11 +70,11 @@ namespace DICUI.Test
}
[Theory]
[InlineData(KnownSystem.AppleMacintosh, MediaType.CD)]
[InlineData(KnownSystem.PhilipsCDi, MediaType.CD)]
[InlineData(KnownSystem.SegaSaturn, MediaType.CD)]
[InlineData(KnownSystem.SonyPlayStation, MediaType.CD)]
[InlineData(KnownSystem.SonyPlayStation2, MediaType.CD)]
[InlineData(KnownSystem.AppleMacintosh, MediaType.CDROM)]
[InlineData(KnownSystem.PhilipsCDi, MediaType.CDROM)]
[InlineData(KnownSystem.SegaSaturn, MediaType.CDROM)]
[InlineData(KnownSystem.SonyPlayStation, MediaType.CDROM)]
[InlineData(KnownSystem.SonyPlayStation2, MediaType.CDROM)]
[InlineData(KnownSystem.AppleMacintosh, MediaType.DVD)]
[InlineData(KnownSystem.DVDVideo, MediaType.DVD)]
[InlineData(KnownSystem.MicrosoftXBOX, MediaType.DVD)]

View File

@@ -20,18 +20,6 @@ namespace DICUI.Test.Utilities
}
}
[Theory]
[InlineData(KnownSystem.AppleMacintosh, true)]
[InlineData(KnownSystem.MicrosoftXBOX, false)]
[InlineData(KnownSystem.MicrosoftXBOX360XDG2, false)]
[InlineData(KnownSystem.MicrosoftXBOX360XDG3, false)]
[InlineData(KnownSystem.SonyPlayStation3, true)]
public void DriveSpeedSupportedTest(KnownSystem? knownSystem, bool expected)
{
bool actual = knownSystem.DoesSupportDriveSpeed();
Assert.Equal(expected, actual);
}
[Fact]
public void IsMarkerTest()
{

View File

@@ -7,7 +7,7 @@ namespace DICUI.Test.Utilities
public class MediaTypeExtensionsTest
{
[Theory]
[InlineData(MediaType.CD)]
[InlineData(MediaType.CDROM)]
[InlineData(MediaType.LaserDisc)]
[InlineData(MediaType.NONE)]
public void NameTest(MediaType? mediaType)
@@ -20,10 +20,10 @@ namespace DICUI.Test.Utilities
}
[Theory]
[InlineData(MediaType.CD)]
[InlineData(MediaType.CDROM)]
[InlineData(MediaType.DVD)]
[InlineData(MediaType.LaserDisc)]
[InlineData(MediaType.Floppy)]
[InlineData(MediaType.FloppyDisk)]
[InlineData(MediaType.NONE)]
public void ExtensionTest(MediaType? mediaType)
{
@@ -34,10 +34,10 @@ namespace DICUI.Test.Utilities
}
[Theory]
[InlineData(MediaType.CD, true)]
[InlineData(MediaType.CDROM, true)]
[InlineData(MediaType.DVD, true)]
[InlineData(MediaType.Floppy, false)]
[InlineData(MediaType.BluRay, false)]
[InlineData(MediaType.FloppyDisk, false)]
[InlineData(MediaType.BluRay, true)]
[InlineData(MediaType.LaserDisc, false)]
public void DriveSpeedSupportedTest(MediaType? mediaType, bool expected)
{

View File

@@ -9,11 +9,11 @@ namespace DICUI.Test.Utilities
public class ParametersTest
{
[Theory]
[InlineData(KnownSystem.MicrosoftXBOX, MediaType.CD, DICCommand.XBOX)]
[InlineData(KnownSystem.MicrosoftXBOX, MediaType.CDROM, DICCommand.CompactDisc)]
[InlineData(KnownSystem.MicrosoftXBOX, MediaType.DVD, DICCommand.XBOX)]
[InlineData(KnownSystem.MicrosoftXBOX, MediaType.LaserDisc, DICCommand.NONE)]
[InlineData(KnownSystem.SegaNu, MediaType.BluRay, DICCommand.BluRay)]
[InlineData(KnownSystem.AppleMacintosh, MediaType.Floppy, DICCommand.Floppy)]
[InlineData(KnownSystem.AppleMacintosh, MediaType.FloppyDisk, DICCommand.Floppy)]
[InlineData(KnownSystem.RawThrillsVarious, MediaType.GDROM, DICCommand.NONE)]
public void ParametersFromSystemAndTypeTest(KnownSystem? knownSystem, MediaType? mediaType, DICCommand expected)
{
@@ -23,11 +23,11 @@ namespace DICUI.Test.Utilities
[Theory]
[InlineData(KnownSystem.AppleMacintosh, MediaType.LaserDisc, true, 20, null, null)]
[InlineData(KnownSystem.NintendoGameCube, MediaType.GameCubeGameDisc, false, 20, null, new DICFlag[] { DICFlag.Raw })]
[InlineData(KnownSystem.NintendoGameCube, MediaType.NintendoGameCube, false, 20, null, new DICFlag[] { DICFlag.Raw })]
[InlineData(KnownSystem.IBMPCCompatible, MediaType.DVD, false, 20, null, new DICFlag[] { })]
/* paranoid mode tests */
[InlineData(KnownSystem.IBMPCCompatible, MediaType.CD, true, 1000, 2, new DICFlag[] { DICFlag.C2Opcode, DICFlag.NoFixSubQSecuROM, DICFlag.ScanFileProtect, DICFlag.ScanSectorProtect, DICFlag.SubchannelReadLevel })]
[InlineData(KnownSystem.AppleMacintosh, MediaType.CD, false, 20, null, new DICFlag[] { DICFlag.C2Opcode, DICFlag.NoFixSubQSecuROM, DICFlag.ScanFileProtect })]
[InlineData(KnownSystem.IBMPCCompatible, MediaType.CDROM, true, 1000, 2, new DICFlag[] { DICFlag.C2Opcode, DICFlag.NoFixSubQSecuROM, DICFlag.ScanFileProtect, DICFlag.ScanSectorProtect, DICFlag.SubchannelReadLevel })]
[InlineData(KnownSystem.AppleMacintosh, MediaType.CDROM, false, 20, null, new DICFlag[] { DICFlag.C2Opcode, DICFlag.NoFixSubQSecuROM, DICFlag.ScanFileProtect })]
[InlineData(KnownSystem.IBMPCCompatible, MediaType.DVD, true, 500, null, new DICFlag[] { DICFlag.CopyrightManagementInformation })]
[InlineData(KnownSystem.HDDVDVideo, MediaType.HDDVD, true, 500, null, new DICFlag[] { DICFlag.CopyrightManagementInformation })]
[InlineData(KnownSystem.IBMPCCompatible, MediaType.DVD, false, 500, null, new DICFlag[] { })]
@@ -53,9 +53,9 @@ namespace DICUI.Test.Utilities
[Theory]
[InlineData(null, null, null, null, null)]
[InlineData("", null, null, null, null)]
[InlineData("cd F test.bin 8 /c2 20", MediaType.CD, KnownSystem.IBMPCCompatible, "F", "test.bin")]
[InlineData("fd A blah\\test.img", MediaType.Floppy, KnownSystem.IBMPCCompatible, "A", "blah\\test.img")]
[InlineData("dvd X super\\blah\\test.iso 8 /raw", MediaType.GameCubeGameDisc, KnownSystem.NintendoGameCube, "X", "super\\blah\\test.iso")]
[InlineData("cd F test.bin 8 /c2 20", MediaType.CDROM, KnownSystem.IBMPCCompatible, "F", "test.bin")]
[InlineData("fd A blah\\test.img", MediaType.FloppyDisk, KnownSystem.IBMPCCompatible, "A", "blah\\test.img")]
[InlineData("dvd X super\\blah\\test.iso 8 /raw", MediaType.NintendoGameCube, KnownSystem.NintendoGameCube, "X", "super\\blah\\test.iso")]
[InlineData("stop D", null, null, "D", null)]
public void DetermineFlagsTest(string parameters, MediaType? expectedMediaType, KnownSystem? expectedKnownSystem, string expectedDriveLetter, string expectedPath)
{
@@ -73,7 +73,7 @@ namespace DICUI.Test.Utilities
[InlineData("cd F test.bin 8 /c2 20", true)]
[InlineData("fd A test.img", true)]
[InlineData("dvd X super\\test.iso 8 /raw", true)]
[InlineData("bd D longer\\path_test.iso 16", false)]
[InlineData("bd D longer\\path_test.iso 16", true)]
[InlineData("stop D", true)]
[InlineData("ls", false)]
public void ValidateParametersTest(string parameters, bool expected)

View File

@@ -8,11 +8,11 @@ namespace DICUI.Test.Utilities
public class ValidatorsTest
{
[Theory]
[InlineData(KnownSystem.BandaiApplePippin, MediaType.CD)]
[InlineData(KnownSystem.BandaiApplePippin, MediaType.CDROM)]
[InlineData(KnownSystem.MicrosoftXBOX, MediaType.DVD)]
[InlineData(KnownSystem.NintendoGameCube, MediaType.GameCubeGameDisc)]
[InlineData(KnownSystem.NintendoWii, MediaType.WiiOpticalDisc)]
[InlineData(KnownSystem.NintendoWiiU, MediaType.WiiUOpticalDisc)]
[InlineData(KnownSystem.NintendoGameCube, MediaType.NintendoGameCube)]
[InlineData(KnownSystem.NintendoWii, MediaType.NintendoWiiOpticalDisc)]
[InlineData(KnownSystem.NintendoWiiU, MediaType.NintendoWiiUOpticalDisc)]
[InlineData(KnownSystem.SonyPlayStationPortable, MediaType.UMD)]
public void GetValidMediaTypesTest(KnownSystem? knownSystem, MediaType? expected)
{

View File

@@ -7,6 +7,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DICUI", "DICUI\DICUI.csproj
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DICUI.Test", "DICUI.Test\DICUI.Test.csproj", "{7CC064D2-38AB-4A05-8519-28660DE4562A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DICUI.Library", "DICUI.Library\DICUI.Library.csproj", "{51AB0928-13F9-44BF-A407-B6957A43A056}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DICUI.Forms", "DICUI.Forms\DICUI.Forms.csproj", "{A6719A99-BF0E-4637-9A8E-CB38B1E16971}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -21,6 +25,14 @@ Global
{7CC064D2-38AB-4A05-8519-28660DE4562A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7CC064D2-38AB-4A05-8519-28660DE4562A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7CC064D2-38AB-4A05-8519-28660DE4562A}.Release|Any CPU.Build.0 = Release|Any CPU
{51AB0928-13F9-44BF-A407-B6957A43A056}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{51AB0928-13F9-44BF-A407-B6957A43A056}.Debug|Any CPU.Build.0 = Debug|Any CPU
{51AB0928-13F9-44BF-A407-B6957A43A056}.Release|Any CPU.ActiveCfg = Release|Any CPU
{51AB0928-13F9-44BF-A407-B6957A43A056}.Release|Any CPU.Build.0 = Release|Any CPU
{A6719A99-BF0E-4637-9A8E-CB38B1E16971}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{A6719A99-BF0E-4637-9A8E-CB38B1E16971}.Debug|Any CPU.Build.0 = Debug|Any CPU
{A6719A99-BF0E-4637-9A8E-CB38B1E16971}.Release|Any CPU.ActiveCfg = Release|Any CPU
{A6719A99-BF0E-4637-9A8E-CB38B1E16971}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE

View File

@@ -2,7 +2,7 @@
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:DICUI"
StartupUri="MainWindow.xaml">
StartupUri="Windows\MainWindow.xaml">
<Application.Resources>
</Application.Resources>

View File

@@ -1,10 +1,4 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
using System.Windows;
namespace DICUI
{

56
DICUI/Constants.cs Normal file
View File

@@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Media;
using DICUI.Data;
namespace DICUI
{
/// <summary>
/// Variables for UI elements
/// </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.NintendoGameCube:
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);
public static DoubleCollection SpeedsForDVDAsCollection { get; } = GetDoubleCollectionFromIntList(dvd);
public static DoubleCollection SpeedsForBDAsCollection { get; } = GetDoubleCollectionFromIntList(bd);
private static DoubleCollection GetDoubleCollectionFromIntList(IReadOnlyList<int> list)
=> new DoubleCollection(list.Select(i => Convert.ToDouble(i)).ToList());
}
}

View File

@@ -67,68 +67,42 @@
</PropertyGroup>
<PropertyGroup />
<ItemGroup>
<Reference Include="BurnOutSharp, Version=1.3.7.1, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\BurnOutSharp.1.3.7.1\lib\net461\BurnOutSharp.dll</HintPath>
</Reference>
<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" />
<Reference Include="System.Drawing" />
<Reference Include="System.Management" />
<Reference Include="System.Management.Instrumentation" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="Microsoft.CSharp" />
<Reference Include="System.Core" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Net.Http" />
<Reference Include="System.Xaml">
<RequiredTargetFramework>4.0</RequiredTargetFramework>
</Reference>
<Reference Include="UnshieldSharp, Version=1.4.2.2, Culture=neutral, processorArchitecture=MSIL">
<HintPath>..\packages\UnshieldSharp.1.4.2.2\lib\net461\UnshieldSharp.dll</HintPath>
</Reference>
<Reference Include="WindowsBase" />
<Reference Include="PresentationCore" />
<Reference Include="PresentationFramework" />
<Reference Include="zlib.net, Version=1.0.3.0, Culture=neutral, PublicKeyToken=47d7877cb3620160">
<HintPath>..\packages\zlib.net.1.0.4.0\lib\zlib.net.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</ApplicationDefinition>
<Compile Include="LogWindow.xaml.cs">
<Compile Include="Constants.cs" />
<Compile Include="EnumDescriptionConverter.cs" />
<Compile Include="Options.cs" />
<Compile Include="Windows\LogWindow.xaml.cs">
<DependentUpon>LogWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Data\Constants.cs" />
<Compile Include="Options.cs" />
<Compile Include="UI\KnownSystemComboBoxItem.cs" />
<Compile Include="UI\AllowedSpeeds.cs" />
<Compile Include="UI\ViewModels.cs" />
<Compile Include="Utilities\DumpEnvironment.cs" />
<Compile Include="Utilities\Extensions.cs" />
<Compile Include="Utilities\Parameters.cs" />
<Compile Include="Utilities\Result.cs" />
<Compile Include="Utilities\Validators.cs" />
<Compile Include="Utilities\Converters.cs" />
<Compile Include="OptionsWindow.xaml.cs">
<Compile Include="Windows\OptionsWindow.xaml.cs">
<DependentUpon>OptionsWindow.xaml</DependentUpon>
</Compile>
<Page Include="LogWindow.xaml">
<Compile Include="KnownSystemComboBoxItem.cs" />
<Compile Include="ViewModels.cs" />
<Page Include="Windows\LogWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="MainWindow.xaml">
<Page Include="Windows\MainWindow.xaml">
<Generator>MSBuild:Compile</Generator>
<SubType>Designer</SubType>
</Page>
@@ -136,12 +110,11 @@
<DependentUpon>App.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Compile Include="Data\Enumerations.cs" />
<Compile Include="MainWindow.xaml.cs">
<Compile Include="Windows\MainWindow.xaml.cs">
<DependentUpon>MainWindow.xaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
<Page Include="OptionsWindow.xaml">
<Page Include="Windows\OptionsWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
@@ -153,7 +126,6 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<None Include="packages.config" />
</ItemGroup>
<ItemGroup>
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
@@ -171,29 +143,10 @@
<Resource Include="Icon.ico" />
</ItemGroup>
<ItemGroup>
<COMReference Include="IMAPI2">
<Guid>{2735412F-7F64-5B0F-8F00-5D77AFBE261E}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
<COMReference Include="IMAPI2FS">
<Guid>{2C941FD0-975B-59BE-A960-9A2A262853A5}</Guid>
<VersionMajor>1</VersionMajor>
<VersionMinor>0</VersionMinor>
<Lcid>0</Lcid>
<WrapperTool>tlbimp</WrapperTool>
<Isolated>False</Isolated>
<EmbedInteropTypes>True</EmbedInteropTypes>
</COMReference>
</ItemGroup>
<ItemGroup>
<Content Include="mspack.dll">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<ProjectReference Include="..\DICUI.Library\DICUI.Library.csproj">
<Project>{51ab0928-13f9-44bf-a407-b6957a43a056}</Project>
<Name>DICUI.Library</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>

View File

@@ -0,0 +1,33 @@
using System;
using System.Globalization;
using System.Windows.Data;
using DICUI.Data;
using DICUI.Utilities;
namespace DICUI
{
/// <summary>
/// Used to provide a converter to XAML files to render comboboxes with enum values
/// </summary>
public class EnumDescriptionConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{
if (value is DICCommand)
return ((DICCommand)value).Name();
else if (value is DICFlag)
return ((DICFlag)value).Name();
else if (value is MediaType?)
return ((MediaType?)value).Name();
else if (value is KnownSystem?)
return ((KnownSystem?)value).Name();
else
return "";
}
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
{
return string.Empty;
}
}
}

View File

@@ -2,7 +2,7 @@
using DICUI.Data;
using DICUI.Utilities;
namespace DICUI.UI
namespace DICUI
{
/// <summary>
/// Represents a single item in the System combo box

View File

@@ -13,6 +13,7 @@ namespace DICUI
public int preferredDumpSpeedCD { get; set; }
public int preferredDumpSpeedDVD { get; set; }
public int preferredDumpSpeedBD { get; set; }
public bool QuietMode { get; set; }
public bool ParanoidMode { get; set; }
@@ -49,7 +50,8 @@ namespace DICUI
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;
this.preferredDumpSpeedDVD = Int32.TryParse(ConfigurationManager.AppSettings["preferredDumpSpeedDVD"], out int maxDumpSpeedDVD) ? maxDumpSpeedDVD : 24;
this.preferredDumpSpeedBD = Int32.TryParse(ConfigurationManager.AppSettings["preferredDumpSpeedBD"], out int maxDumpSpeedBD) ? maxDumpSpeedBD : 16;
this.QuietMode = Boolean.TryParse(ConfigurationManager.AppSettings["QuietMode"], out bool quietMode) ? quietMode : false;
this.ParanoidMode = Boolean.TryParse(ConfigurationManager.AppSettings["ParanoidMode"], out bool paranoidMode) ? paranoidMode : false;
@@ -77,9 +79,18 @@ namespace DICUI
{
switch (type)
{
case MediaType.CD: return preferredDumpSpeedCD;
case MediaType.DVD: return preferredDumpSpeedDVD;
default: return 8;
case MediaType.CDROM:
case MediaType.GDROM:
return preferredDumpSpeedCD;
case MediaType.DVD:
case MediaType.HDDVD:
case MediaType.NintendoGameCube:
case MediaType.NintendoWiiOpticalDisc:
return preferredDumpSpeedDVD;
case MediaType.BluRay:
return preferredDumpSpeedBD;
default:
return 8;
}
}
}

View File

@@ -51,8 +51,8 @@ using System.Windows;
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion("1.11")]
[assembly: AssemblyFileVersion("1.11.0.0")]
// Anything marked as internal can be used by the test methods
[assembly: InternalsVisibleTo("DICUI.Test")]

View File

@@ -1,7 +1,8 @@
using System;
using System.Windows.Media;
using DICUI.Windows;
namespace DICUI.UI
namespace DICUI
{
public class OptionsViewModel
{

View File

@@ -1,7 +1,7 @@
<Window x:Class="DICUI.LogWindow"
<Window x:Class="DICUI.Windows.LogWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:lui="clr-namespace:DICUI.UI"
xmlns:local="clr-namespace:DICUI"
xmlns:diag="clr-namespace:System.Diagnostics;assembly=WindowsBase"
Title="Log Window" Height="350" Width="600" Closed="OnWindowClosed" Loaded="OnWindowLoaded"
>
@@ -35,12 +35,12 @@
<CheckBox Content="Verbose" Margin="10 0 0 10" Grid.Column="0" VerticalAlignment="Center"
ToolTip="Enable verbose logging of tasks"
DataContext="{Binding Source={x:Static lui:ViewModels.OptionsViewModel}}"
DataContext="{Binding Source={x:Static local:ViewModels.OptionsViewModel}}"
IsChecked="{Binding Path=VerboseLogging}"
/>
<CheckBox Content="Open at startup" Margin="10 0 0 10" Grid.Column="1" Grid.ColumnSpan="2" VerticalAlignment="Center"
ToolTip="Open this window at startup"
DataContext="{Binding Source={x:Static lui:ViewModels.OptionsViewModel}}"
DataContext="{Binding Source={x:Static local:ViewModels.OptionsViewModel}}"
IsChecked="{Binding Path=OpenLogWindowAtStartup}"
/>
<Button Margin="0 0 10 10" Grid.Column="3" Height="22" Width="60" Content="Clear" HorizontalAlignment="Right" Click="OnClearButton" />

View File

@@ -11,10 +11,8 @@ using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Interop;
using System.Windows.Media;
using DICUI.Data;
using DICUI.UI;
namespace DICUI
namespace DICUI.Windows
{
public partial class LogWindow : Window
{
@@ -131,7 +129,7 @@ namespace DICUI
public void AdjustPositionToMainWindow()
{
this.Left = _mainWindow.Left;
this.Top = _mainWindow.Top + _mainWindow.Height + UIElements.LogWindowMarginFromMainWindow;
this.Top = _mainWindow.Top + _mainWindow.Height + Constants.LogWindowMarginFromMainWindow;
}
private void GracefullyTerminateProcess()

View File

@@ -1,17 +1,15 @@
<Window x:Class="DICUI.MainWindow"
<Window x:Class="DICUI.Windows.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:DICUI"
xmlns:lui="clr-namespace:DICUI.UI"
xmlns:utilities="clr-namespace:DICUI.Utilities"
mc:Ignorable="d"
Title="Disc Image Creator GUI" Height="450" Width="600" WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize"
LocationChanged="MainWindowLocationChanged" Activated="MainWindowActivated" Closing="MainWindowClosing">
<Window.Resources>
<utilities:EnumDescriptionConverter x:Key="enumConverter" />
<local:EnumDescriptionConverter x:Key="enumConverter" />
</Window.Resources>
<Grid>
@@ -34,7 +32,7 @@
<MenuItem Header="_Tools">
<MenuItem x:Name="OptionsMenuItem" Header="_Options" HorizontalAlignment="Left" Width="140" Click="OptionsClick"/>
<MenuItem x:Name="ShowLogMenuItem" Header="Show _Log Window" IsCheckable="true" HorizontalAlignment="Left"
DataContext="{Binding Source={x:Static lui:ViewModels.LoggerViewModel}}"
DataContext="{Binding Source={x:Static local:ViewModels.LoggerViewModel}}"
IsChecked="{Binding Path=WindowVisible}"
/>
</MenuItem>
@@ -62,14 +60,14 @@
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Content="System/Media Type" />
<ComboBox x:Name="SystemTypeComboBox" Grid.Row="0" Grid.Column="1" Height="22" Width="250" HorizontalAlignment="left" SelectionChanged="SystemTypeComboBoxSelectionChanged">
<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="MediaTypeComboBox" Grid.Row="0" Grid.Column="1" Height="22" Width="140" HorizontalAlignment="right" SelectionChanged="MediaTypeComboBoxSelectionChanged">
<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}}" />
@@ -81,11 +79,11 @@
<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="OutputDirectoryTextBox" Grid.Row="2" Grid.Column="1" Height="22" Width="345" HorizontalAlignment="left" TextChanged="OutputDirectoryTextBoxTextChanged" />
<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="DriveLetterComboBox" Grid.Row="3" Grid.Column="1" Height="22" Width="60" HorizontalAlignment="left" SelectionChanged="DriveLetterComboBoxSelectionChanged">
<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}" />
@@ -94,10 +92,11 @@
</ComboBox>
<Label Grid.Row="4" Grid.Column="0" VerticalAlignment="Center">Drive Speed</Label>
<ComboBox x:Name="DriveSpeedComboBox" Grid.Row="4" Grid.Column="1" Height="22" Width="60" HorizontalAlignment="left" SelectionChanged="DriveSpeedComboBoxSelectionChanged" />
<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="ParametersTextBox" Grid.Row="5" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" IsEnabled="False" />
<TextBox x:Name="ParametersTextBox" Grid.Row="5" Grid.Column="1" Height="22" Width="370" HorizontalAlignment="Left" IsEnabled="False" />
<CheckBox x:Name="EnableParametersCheckBox" Grid.Row="5" Grid.Column="1" Height="22" HorizontalAlignment="Right" IsChecked="False" Click="EnableParametersCheckBoxClick" />
</Grid>
<Grid Grid.Row="2" Grid.Column="0" Margin="15,19.6,15.2,9.8" Grid.ColumnSpan="2">
@@ -125,7 +124,7 @@
<RowDefinition/>
</Grid.RowDefinitions>
<Label x:Name="StatusLabel" 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 media..." />
</Grid>
</Grid>
</Window>

View File

@@ -8,11 +8,9 @@ using System.Windows.Controls;
using WinForms = System.Windows.Forms;
using DICUI.Data;
using DICUI.Utilities;
using DICUI.UI;
namespace DICUI
namespace DICUI.Windows
{
public partial class MainWindow : Window
{
// Private UI-related variables
@@ -50,7 +48,7 @@ namespace DICUI
if (_options.OpenLogWindowAtStartup)
{
this.WindowStartupLocation = WindowStartupLocation.Manual;
double combinedHeight = this.Height + _logWindow.Height + UIElements.LogWindowMarginFromMainWindow;
double combinedHeight = this.Height + _logWindow.Height + Constants.LogWindowMarginFromMainWindow;
Rectangle bounds = GetScaledCoordinates(WinForms.Screen.PrimaryScreen.WorkingArea);
this.Left = bounds.Left + (bounds.Width - this.Width) / 2;
@@ -89,17 +87,21 @@ namespace DICUI
private void StartStopButtonClick(object sender, RoutedEventArgs e)
{
// Dump or stop the dump
if ((string)StartStopButton.Content == UIElements.StartDumping)
if ((string)StartStopButton.Content == Constants.StartDumping)
{
StartDumping();
}
else if ((string)StartStopButton.Content == UIElements.StopDumping)
else if ((string)StartStopButton.Content == Constants.StopDumping)
{
ViewModels.LoggerViewModel.VerboseLogLn("Canceling dumping process...");
_env.CancelDumping();
CopyProtectScanButton.IsEnabled = true;
if (EjectWhenDoneCheckBox.IsChecked == true)
{
ViewModels.LoggerViewModel.VerboseLogLn($"Ejecting disc in drive {_env.Drive.Letter}");
_env.EjectDisc();
}
}
}
@@ -196,6 +198,17 @@ namespace DICUI
_logWindow.Close();
}
private void EnableParametersCheckBoxClick(object sender, RoutedEventArgs e)
{
if (EnableParametersCheckBox.IsChecked == true)
ParametersTextBox.IsEnabled = true;
else
{
ParametersTextBox.IsEnabled = false;
ProcessCustomParameters();
}
}
// Toolbar Events
private void AppExitClick(object sender, RoutedEventArgs e)
@@ -354,7 +367,8 @@ namespace DICUI
/// <returns>Filled DumpEnvironment instance</returns>
private DumpEnvironment DetermineEnvironment()
{
return new DumpEnvironment()
// Populate the new environment
var env = new DumpEnvironment()
{
// Paths to tools
SubdumpPath = _options.SubDumpPath,
@@ -376,6 +390,21 @@ namespace DICUI
System = SystemTypeComboBox.SelectedItem as KnownSystemComboBoxItem,
Type = MediaTypeComboBox.SelectedItem as MediaType?
};
// Fix the output paths
env.FixOutputPaths();
// Disable automatic reprocessing of the textboxes until we're done
OutputDirectoryTextBox.TextChanged -= OutputDirectoryTextBoxTextChanged;
OutputFilenameTextBox.TextChanged -= OutputFilenameTextBoxTextChanged;
OutputDirectoryTextBox.Text = env.OutputDirectory;
OutputFilenameTextBox.Text = env.OutputFilename;
OutputDirectoryTextBox.TextChanged += OutputDirectoryTextBoxTextChanged;
OutputFilenameTextBox.TextChanged += OutputFilenameTextBoxTextChanged;
return env;
}
/// <summary>
@@ -383,29 +412,83 @@ namespace DICUI
/// </summary>
private async void StartDumping()
{
_env = DetermineEnvironment();
if (_env == null)
_env = DetermineEnvironment();
// Check for the firmware first
// TODO: Remove this (and method) once DIC end-to-end logging becomes a thing
if (!await _env.DriveHasLatestFimrware())
return;
// If still in custom parameter mode, check that users meant to continue or not
if (EnableParametersCheckBox.IsChecked == true)
{
MessageBoxResult result = MessageBox.Show("It looks like you have custom parameters that have not been saved. Would you like to apply those changes before starting to dump?", "Custom Changes", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
if (result == MessageBoxResult.Yes)
{
EnableParametersCheckBox.IsChecked = false;
ParametersTextBox.IsEnabled = false;
ProcessCustomParameters();
}
else if (result == MessageBoxResult.Cancel)
return;
// If "No", then we continue with the current known environment
}
StartStopButton.Content = UIElements.StopDumping;
CopyProtectScanButton.IsEnabled = false;
StatusLabel.Content = "Beginning dumping process";
ViewModels.LoggerViewModel.VerboseLogLn("Starting dumping process..");
try
{
// Check for the firmware first
// TODO: Remove this (and method) once DIC end-to-end logging becomes a thing
if (!await _env.DriveHasLatestFimrware())
{
MessageBox.Show($"DiscImageCreator has reported that drive {_env.Drive.Letter} is not updated to the most recent firmware. Please update the firmware for your drive and try again.", "Outdated Firmware", MessageBoxButton.OK, MessageBoxImage.Error);
return;
}
var progress = new Progress<Result>();
progress.ProgressChanged += ProgressUpdated;
Result result = await _env.StartDumping(progress);
// Validate that the user explicitly wants an inactive drive to be considered for dumping
if (!_env.Drive.MarkedActive)
{
MessageBoxResult mbresult = MessageBox.Show("The currently selected drive does not appear to contain a disc! Are you sure you want to continue?", "Missing Disc", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
if (mbresult == MessageBoxResult.No || mbresult == MessageBoxResult.Cancel || mbresult == MessageBoxResult.None)
{
ViewModels.LoggerViewModel.VerboseLogLn("Dumping aborted!");
return;
}
}
StatusLabel.Content = result ? "Dumping complete!" : result.Message;
ViewModels.LoggerViewModel.VerboseLogLn(result ? "Dumping complete!" : result.Message);
StartStopButton.Content = UIElements.StartDumping;
CopyProtectScanButton.IsEnabled = true;
// If a complete dump already exists
if (_env.FoundAllFiles())
{
MessageBoxResult mbresult = MessageBox.Show("A complete dump already exists! Are you sure you want to overwrite?", "Overwrite?", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
if (mbresult == MessageBoxResult.No || mbresult == MessageBoxResult.Cancel || mbresult == MessageBoxResult.None)
{
ViewModels.LoggerViewModel.VerboseLogLn("Dumping aborted!");
return;
}
}
StartStopButton.Content = Constants.StopDumping;
CopyProtectScanButton.IsEnabled = false;
StatusLabel.Content = "Beginning dumping process";
ViewModels.LoggerViewModel.VerboseLogLn("Starting dumping process..");
var progress = new Progress<Result>();
progress.ProgressChanged += ProgressUpdated;
Result result = await _env.StartDumping(progress);
StatusLabel.Content = result ? "Dumping complete!" : result.Message;
ViewModels.LoggerViewModel.VerboseLogLn(result ? "Dumping complete!" : result.Message);
}
catch
{
// No-op, we don't care what it was
}
finally
{
StartStopButton.Content = Constants.StartDumping;
CopyProtectScanButton.IsEnabled = true;
}
if (EjectWhenDoneCheckBox.IsChecked == true)
{
ViewModels.LoggerViewModel.VerboseLogLn($"Ejecting disc in drive {_env.Drive.Letter}");
_env.EjectDisc();
}
}
/// <summary>
@@ -432,29 +515,11 @@ namespace DICUI
StartStopButton.IsEnabled = result && (_drives != null && _drives.Count > 0 ? true : false);
// If we're in a type that doesn't support drive speeds
DriveSpeedComboBox.IsEnabled = _env.Type.DoesSupportDriveSpeed() && _env.System.DoesSupportDriveSpeed();
DriveSpeedComboBox.IsEnabled = _env.Type.DoesSupportDriveSpeed();
// Special case for Custom input
if (_env.System == KnownSystem.Custom)
// If input params are not enabled, generate the full parameters from the environment
if (!ParametersTextBox.IsEnabled)
{
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
{
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?)DriveSpeedComboBox.SelectedItem);
if (generated != null)
ParametersTextBox.Text = generated;
@@ -479,8 +544,10 @@ namespace DICUI
/// </summary>
private async void ScanAndShowProtection()
{
var env = DetermineEnvironment();
if (env.Drive.Letter != default(char))
if (_env == null)
_env = DetermineEnvironment();
if (_env.Drive.Letter != default(char))
{
ViewModels.LoggerViewModel.VerboseLogLn("Scanning for copy protection in {0}", _env.Drive.Letter);
@@ -490,10 +557,10 @@ namespace DICUI
DiskScanButton.IsEnabled = false;
CopyProtectScanButton.IsEnabled = false;
string protections = await Validators.RunProtectionScanOnPath(env.Drive.Letter + ":\\");
string protections = await Validators.RunProtectionScanOnPath(_env.Drive.Letter + ":\\");
if (!ViewModels.LoggerViewModel.WindowVisible)
MessageBox.Show(protections, "Detected Protection", MessageBoxButton.OK, MessageBoxImage.Information);
ViewModels.LoggerViewModel.VerboseLog("Detected the following protections in {0}:\r\n\r\n{1}", env.Drive.Letter, protections);
ViewModels.LoggerViewModel.VerboseLog("Detected the following protections in {0}:\r\n\r\n{1}", _env.Drive.Letter, protections);
StatusLabel.Content = tempContent;
StartStopButton.IsEnabled = true;
@@ -508,14 +575,37 @@ namespace DICUI
private void SetSupportedDriveSpeed()
{
// Set the drive speed list that's appropriate
var values = AllowedSpeeds.GetForMediaType(_currentMediaType);
var values = Constants.GetSpeedsForMediaType(_currentMediaType);
DriveSpeedComboBox.ItemsSource = values;
ViewModels.LoggerViewModel.VerboseLogLn("Supported media speeds: {0}", string.Join(",", values));
// Find the minimum set to compare against
int preferred = 100;
switch (_currentMediaType)
{
case MediaType.CDROM:
case MediaType.GDROM:
preferred = _options.preferredDumpSpeedCD;
break;
case MediaType.DVD:
case MediaType.HDDVD:
case MediaType.NintendoGameCube:
case MediaType.NintendoWiiOpticalDisc:
preferred = _options.preferredDumpSpeedDVD;
break;
case MediaType.BluRay:
preferred = _options.preferredDumpSpeedBD;
break;
default:
preferred = _options.preferredDumpSpeedCD;
break;
}
// Choose the lower of the two speeds between the allowed speeds and the user-defined one
// TODO: Inform more users about setting preferences in the settings so this comparison doesn't need to happen
int chosenSpeed = Math.Min(
values.Where(s => s <= values[values.Count / 2]).Last(),
_options.preferredDumpSpeedCD
preferred
);
// Set the selected speed
@@ -559,6 +649,41 @@ namespace DICUI
StatusLabel.Content = $"Disc of type '{Converters.MediaTypeToString(_currentMediaType)}' found, but the current system does not support it!";
}
/// <summary>
/// Process the current custom parameters back into UI values
/// </summary>
private void ProcessCustomParameters()
{
_env.DICParameters = new Parameters(ParametersTextBox.Text);
int driveIndex = _drives.Select(d => d.Letter).ToList().IndexOf(_env.DICParameters.DriveLetter[0]);
if (driveIndex > -1)
DriveLetterComboBox.SelectedIndex = driveIndex;
int driveSpeed = _env.DICParameters.DriveSpeed ?? -1;
if (driveSpeed > 0)
DriveSpeedComboBox.SelectedValue = driveSpeed;
else
_env.DICParameters.DriveSpeed = (int?)DriveSpeedComboBox.SelectedValue;
string trimmedPath = _env.DICParameters.Filename?.Trim('"') ?? string.Empty;
string outputDirectory = Path.GetDirectoryName(trimmedPath);
string outputFilename = Path.GetFileName(trimmedPath);
if (!String.IsNullOrWhiteSpace(outputDirectory))
OutputDirectoryTextBox.Text = outputDirectory;
else
outputDirectory = OutputDirectoryTextBox.Text;
if (!String.IsNullOrWhiteSpace(outputFilename))
OutputFilenameTextBox.Text = outputFilename;
else
outputFilename = OutputFilenameTextBox.Text;
MediaType? mediaType = Converters.BaseCommmandToMediaType(_env.DICParameters.Command);
int mediaTypeIndex = _mediaTypes.IndexOf(mediaType);
if (mediaTypeIndex > -1)
MediaTypeComboBox.SelectedIndex = mediaTypeIndex;
}
#endregion
#region UI Helpers

View File

@@ -1,17 +1,16 @@
<Window x:Class="DICUI.OptionsWindow"
<Window x:Class="DICUI.Windows.OptionsWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:lui="clr-namespace:DICUI.UI"
xmlns:l="clr-namespace:DICUI"
xmlns:local="clr-namespace:DICUI"
mc:Ignorable="d"
Title="Options" Height="400" Width="515.132">
Title="Options" Height="480" Width="515.132">
<Grid>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition Height="100"/>
<RowDefinition Height="150"/>
<RowDefinition Height="100"/>
<RowDefinition Height="40"/>
</Grid.RowDefinitions>
@@ -45,7 +44,7 @@
</Grid>
<GroupBox Grid.Row="1" Margin="5,5,5,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Header="Preferred Dump Speed">
<Grid Height="60">
<Grid Height="100">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="80"/>
<ColumnDefinition Width="2.0*"/>
@@ -55,16 +54,21 @@
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Label Grid.Row="0" Grid.Column="0" Content="CD-ROM" />
<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}}" />
<Slider x:Name="DumpSpeedCDSlider" Grid.Row="0" Grid.Column="1" Minimum="1" Maximum="72" IsSnapToTickEnabled="True" TickPlacement="BottomRight" Ticks="{Binding Source={x:Static local:Constants.SpeedsForCDAsCollection}}" />
<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="DumpSpeedDVDSlider" Grid.Row="1" Grid.Column="1" Minimum="1" Maximum="24" IsSnapToTickEnabled="True" TickPlacement="BottomRight" Ticks="{Binding Source={x:Static lui:AllowedSpeeds.ForDVDAsCollection}}" />
<Slider x:Name="DumpSpeedDVDSlider" Grid.Row="1" Grid.Column="1" Minimum="1" Maximum="24" IsSnapToTickEnabled="True" TickPlacement="BottomRight" Ticks="{Binding Source={x:Static local:Constants.SpeedsForDVDAsCollection}}" />
<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"/>
<Label Grid.Row="2" Grid.Column="0" Content="BD-ROM" />
<Slider x:Name="DumpSpeedBDSlider" Grid.Row="2" Grid.Column="1" Minimum="1" Maximum="16" IsSnapToTickEnabled="True" TickPlacement="BottomRight" Ticks="{Binding Source={x:Static local:Constants.SpeedsForBDAsCollection}}" />
<TextBox x:Name="DumpSpeedBDTextBox" Grid.Row="2" Grid.Column="2" Width="22" Height="22" TextAlignment="Center" IsReadOnly="True" IsReadOnlyCaretVisible="False" VerticalAlignment="Center" Text="{Binding ElementName=DumpSpeedBDSlider, Path=Value, UpdateSourceTrigger=PropertyChanged}" Background="LightGray" Foreground="Gray"/>
</Grid>
</GroupBox>
@@ -85,12 +89,12 @@
<CheckBox Grid.Column="0" VerticalAlignment="Center" Content="Quiet Mode"
DataContext="{Binding Source={x:Static lui:ViewModels.OptionsViewModel}}"
DataContext="{Binding Source={x:Static local:ViewModels.OptionsViewModel}}"
IsChecked="{Binding Path=QuietMode}"
ToolTip="Disable DiskImageCreator sounds"
ToolTip="Disable DiscImageCreator sounds"
/>
<CheckBox Grid.Column="1" VerticalAlignment="Center" Content="Paranoid Mode"
DataContext="{Binding Source={x:Static lui:ViewModels.OptionsViewModel}}"
DataContext="{Binding Source={x:Static local:ViewModels.OptionsViewModel}}"
IsChecked="{Binding Path=ParanoidMode}"
ToolTip="Enable pedandic and super-safe flags"
/>
@@ -102,20 +106,20 @@
<Label Grid.Column="0" Content="C2 Reread Tries:" />
<TextBox Grid.Column="1" VerticalAlignment="Center"
DataContext="{Binding Source={x:Static lui:ViewModels.OptionsViewModel}}"
DataContext="{Binding Source={x:Static local:ViewModels.OptionsViewModel}}"
Text="{Binding Path=RereadAmountForC2}"
ToolTip="Specifies how many rereads are attempted on C2 error"
/>
</Grid>
<CheckBox Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" VerticalAlignment="Top" Content="Automatically Scan for Protection"
DataContext="{Binding Source={x:Static lui:ViewModels.OptionsViewModel}}"
DataContext="{Binding Source={x:Static local:ViewModels.OptionsViewModel}}"
IsChecked="{Binding Path=ScanForProtection}"
ToolTip="Enable automatic checking for copy protection on dumped media" Margin="0,4,0,0"
/>
<CheckBox Grid.Column="2" Grid.Row="1" Grid.ColumnSpan="2" VerticalAlignment="Center" Content="Skip Media Type Detection"
DataContext="{Binding Source={x:Static lui:ViewModels.OptionsViewModel}}"
DataContext="{Binding Source={x:Static local:ViewModels.OptionsViewModel}}"
IsChecked="{Binding Path=SkipMediaTypeDetection}"
ToolTip="Disable trying to guess media type inserted (may improve performance at startup)"
/>

View File

@@ -5,7 +5,7 @@ using System.Windows.Forms;
using Button = System.Windows.Controls.Button;
using TextBox = System.Windows.Controls.TextBox;
namespace DICUI
namespace DICUI.Windows
{
/// <summary>
/// Interaction logic for OptionsWindow.xaml
@@ -102,6 +102,7 @@ namespace DICUI
DumpSpeedCDSlider.Value = _options.preferredDumpSpeedCD;
DumpSpeedDVDSlider.Value = _options.preferredDumpSpeedDVD;
DumpSpeedBDSlider.Value = _options.preferredDumpSpeedBD;
}
#region Event Handlers
@@ -112,6 +113,7 @@ namespace DICUI
_options.preferredDumpSpeedCD = Convert.ToInt32(DumpSpeedCDSlider.Value);
_options.preferredDumpSpeedDVD = Convert.ToInt32(DumpSpeedDVDSlider.Value);
_options.preferredDumpSpeedBD = Convert.ToInt32(DumpSpeedBDSlider.Value);
_options.Save();
Hide();

View File

@@ -2,7 +2,7 @@
DiscImageCreator UI in C#
[![Build status](https://ci.appveyor.com/api/projects/status/3ldav3v0c373jeqa?svg=true)](https://ci.appveyor.com/project/mnadareski/dicui)
[![Build status](https://ci.appveyor.com/api/projects/status/3ldav3v0c373jeqa?svg=true)](https://ci.appveyor.com/project/mnadareski/dicui/build/artifacts)
This is a community project, so if you have some time and knowledge to give, we'll be glad to add you to the contributor of this project :)
@@ -12,7 +12,7 @@ This project relies on two open-source code ports to help perform copy protectio
## System Requirements
Even though this is written in C#, this program can only be used on Windows systems due to the base program, DiscImageCreator, being Windows-only.
Even though this is written in C#, this program can only be used on Windows systems due to the base program, DiscImageCreator, being Windows-only. There is some preliminary support for Linux underway, and we will try to integrate with that when the time comes.
- Windows 7 (newest version of Windows recommended)
- .NET Framework 4.6.1 Runtimes

View File

@@ -1,5 +1,9 @@
# version format
version: 1.06_{build}
version: 1.10-{build}
# pull request template
pull_requests:
do_not_increment_build_number: true
# vm template
image: Visual Studio 2017
@@ -28,9 +32,20 @@ build:
# post-build step
after_build:
- 7z a DICUI.zip DICUI\bin\Debug
- ps: appveyor DownloadFile https://github.com/saramibreak/DiscImageCreator/files/2385718/DiscImageCreator_20180915.zip
- ps: appveyor DownloadFile http://www.rawdump.net/tools/subdump_fua_0x28.zip
- 7z e DiscImageCreator_20180915.zip -oDICUI\bin\Debug\Programs Release_ANSI\*
- 7z e DiscImageCreator_20180915.zip -oDICUI.Forms\bin\Debug\Programs Release_ANSI\*
- 7z e subdump_fua_0x28.zip -oDICUI\bin\Debug *
- 7z e subdump_fua_0x28.zip -oDICUI.Forms\bin\Debug *
- mv DICUI\bin\Debug\subdump_fua_0x28.exe DICUI\bin\Debug\subdump.exe
- mv DICUI.Forms\bin\Debug\subdump_fua_0x28.exe DICUI.Forms\bin\Debug\subdump.exe
- 7z a DICUI.zip DICUI\bin\Debug\*
- 7z a DICUI-Winforms.zip DICUI.Forms\bin\Debug\*
# artifact linking
artifacts:
- path: DICUI.zip
name: DICUI
name: DICUI
- path: DICUI-Winforms.zip
name: DICUI Winforms