mirror of
https://github.com/SabreTools/MPF.git
synced 2026-02-04 13:45:29 +00:00
Compare commits
213 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
4539066af0 | ||
|
|
ec23502275 | ||
|
|
331f875e7f | ||
|
|
e68f88062f | ||
|
|
d1bb8184d1 | ||
|
|
b7b3f36402 | ||
|
|
859af8efea | ||
|
|
8594d7884c | ||
|
|
946dc929f1 | ||
|
|
1e5b1a205e | ||
|
|
3271cd0ea3 | ||
|
|
647bab8cd3 | ||
|
|
89b2438dac | ||
|
|
1dcd36d640 | ||
|
|
2f63ebcd29 | ||
|
|
316953f38c | ||
|
|
62813ac701 | ||
|
|
22a936e60b | ||
|
|
6412205fa3 | ||
|
|
75c18ea3c4 | ||
|
|
6bdb93208e | ||
|
|
588ed19692 | ||
|
|
d56ab5ab37 | ||
|
|
819d18112e | ||
|
|
2e79cbb0db | ||
|
|
f024611de8 | ||
|
|
48e6283c37 | ||
|
|
fec70f17bc | ||
|
|
257f7ab7df | ||
|
|
c1ed3aca02 | ||
|
|
ace6a78236 | ||
|
|
f1e9f1d433 | ||
|
|
e83190c091 | ||
|
|
82eabc12ca | ||
|
|
76b549d773 | ||
|
|
227688d7dc | ||
|
|
4c9e2359af | ||
|
|
d179d7f464 | ||
|
|
fff19e75fd | ||
|
|
2175ccfb26 | ||
|
|
621923bdba | ||
|
|
3c216aa309 | ||
|
|
d85186e5cd | ||
|
|
1a94ad3d23 | ||
|
|
91776d939c | ||
|
|
3d058e633f | ||
|
|
94c0564fe8 | ||
|
|
87ecc7588e | ||
|
|
8a5c114a7e | ||
|
|
e307cb217f | ||
|
|
b8c56bea58 | ||
|
|
564a6af9b8 | ||
|
|
5bcde889b3 | ||
|
|
b39c96cdd2 | ||
|
|
2cc73a30f5 | ||
|
|
be7d745d10 | ||
|
|
d51adccab4 | ||
|
|
6141ce8539 | ||
|
|
96d6e8bd2f | ||
|
|
c034df4266 | ||
|
|
fe04c6df73 | ||
|
|
aff195eb71 | ||
|
|
3aca999b63 | ||
|
|
0e7ce76f01 | ||
|
|
6d72417512 | ||
|
|
ac89f06843 | ||
|
|
39ce56d579 | ||
|
|
9dbd30adba | ||
|
|
48de63513e | ||
|
|
56eaf7c2c5 | ||
|
|
c1bd30e008 | ||
|
|
4176f22d79 | ||
|
|
1e16e952cf | ||
|
|
9f493ae27a | ||
|
|
2021230836 | ||
|
|
12ba5702fd | ||
|
|
2cf083eb89 | ||
|
|
c1f22d47dc | ||
|
|
11287d081d | ||
|
|
8652af5697 | ||
|
|
69561cb1a0 | ||
|
|
d587d2b4b3 | ||
|
|
a19418e46f | ||
|
|
de22ead07c | ||
|
|
f777869103 | ||
|
|
aec1131271 | ||
|
|
308fad3ed2 | ||
|
|
61ce45667b | ||
|
|
ababfdd2ed | ||
|
|
9683074197 | ||
|
|
ab2bc8f50c | ||
|
|
aa86ddaf47 | ||
|
|
68afebace4 | ||
|
|
bebe3ab8a0 | ||
|
|
1f314df8c1 | ||
|
|
38c3638f21 | ||
|
|
cde4b671fc | ||
|
|
578854cd3b | ||
|
|
1cd7885194 | ||
|
|
c0de39c229 | ||
|
|
a1148f80c8 | ||
|
|
632654d00b | ||
|
|
a6d6b800a5 | ||
|
|
8527cc5746 | ||
|
|
f94f54f4d7 | ||
|
|
2091ef1d92 | ||
|
|
af865bca9e | ||
|
|
23588fa5ae | ||
|
|
e763fec01e | ||
|
|
732ff2ccca | ||
|
|
f960aca8a9 | ||
|
|
335c1388d4 | ||
|
|
87c0d5b44b | ||
|
|
1a44fb5c8a | ||
|
|
285921cae3 | ||
|
|
2255dba640 | ||
|
|
99158f31c9 | ||
|
|
53a2ef227b | ||
|
|
c0efc63741 | ||
|
|
905bd1a7dc | ||
|
|
5d49d4833f | ||
|
|
8fd3e2d405 | ||
|
|
1521a918f3 | ||
|
|
5f580ee025 | ||
|
|
9c7cee0aa3 | ||
|
|
d549609a0f | ||
|
|
207fdbb49c | ||
|
|
63e63a0033 | ||
|
|
73be55a645 | ||
|
|
d913aa247e | ||
|
|
d9a9f3bfd4 | ||
|
|
ea3e040b3f | ||
|
|
ed67522675 | ||
|
|
6e3902bbb1 | ||
|
|
3f802e8548 | ||
|
|
c3c4cf6e5b | ||
|
|
39258c4e85 | ||
|
|
df81259fba | ||
|
|
a835c81951 | ||
|
|
af4f3e8444 | ||
|
|
085916e1e6 | ||
|
|
557354c844 | ||
|
|
a23a74ffa4 | ||
|
|
958aeeae32 | ||
|
|
c73ff42500 | ||
|
|
24a93e298b | ||
|
|
ae81bb0743 | ||
|
|
cf7863fbb2 | ||
|
|
5e0e71120d | ||
|
|
5adbdd29e6 | ||
|
|
fd855b9024 | ||
|
|
17c283ff67 | ||
|
|
a37e6aaf18 | ||
|
|
1dbf23ca95 | ||
|
|
2e52d00107 | ||
|
|
eb69b74b4a | ||
|
|
db4a785558 | ||
|
|
9bdd2d6951 | ||
|
|
de48c8f0f9 | ||
|
|
c59f7c2dae | ||
|
|
2740a6a1c1 | ||
|
|
56e8470069 | ||
|
|
a5f1a12aee | ||
|
|
8749b486a8 | ||
|
|
3446957f68 | ||
|
|
cb9813db3d | ||
|
|
6e6b716c18 | ||
|
|
400ef38c60 | ||
|
|
87d5fc0e66 | ||
|
|
d5d8ae0501 | ||
|
|
fae7a5254d | ||
|
|
97be13f020 | ||
|
|
dd0dfc5cf5 | ||
|
|
a7a295434d | ||
|
|
319f5563cb | ||
|
|
939174d8c4 | ||
|
|
1d5d7b265e | ||
|
|
a2ac7222f9 | ||
|
|
4f0b5904c3 | ||
|
|
7ff848347c | ||
|
|
a1c89d17b8 | ||
|
|
3575c43703 | ||
|
|
928c9966fa | ||
|
|
a404a270f1 | ||
|
|
dfba97685a | ||
|
|
8de2f1c9bb | ||
|
|
f57b29615b | ||
|
|
565a9bb09a | ||
|
|
d9d61cf665 | ||
|
|
106f16d703 | ||
|
|
8b600a6a35 | ||
|
|
b251ae7927 | ||
|
|
3a749b67e3 | ||
|
|
3abc277aab | ||
|
|
894f2c6fde | ||
|
|
8c43615235 | ||
|
|
bbf51a7f94 | ||
|
|
515e58fae8 | ||
|
|
f3319f4ee2 | ||
|
|
e2789ddd11 | ||
|
|
1c04f6e30c | ||
|
|
c7d4d319ce | ||
|
|
13a5f02082 | ||
|
|
a188cad6ee | ||
|
|
039cbf6de4 | ||
|
|
c0cf207776 | ||
|
|
16ae5e1c66 | ||
|
|
bfca66951d | ||
|
|
5b777c3bb5 | ||
|
|
4b840ebe4f | ||
|
|
d38c5cd051 | ||
|
|
7fa9c5c296 | ||
|
|
3a28bc798a |
17
App.xaml.cs
17
App.xaml.cs
@@ -1,17 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
|
||||
namespace DICUI
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
||||
96
CHANGELIST.md
Normal file
96
CHANGELIST.md
Normal file
@@ -0,0 +1,96 @@
|
||||
### 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
|
||||
- Added unit testing and an AppVeyor build
|
||||
- Many code refactorings
|
||||
- **LOG WINDOW**
|
||||
- Separated out protection scan and Unshield ports to new projects
|
||||
- Added "empty drive" support; should help with 3DO and HFS dumping
|
||||
- And much more! See the full Git commit list for more details
|
||||
|
||||
### 1.07 (2018-06-27)
|
||||
|
||||
- Separated system and media type for easier navigation
|
||||
- Combined instances of single- and dual-layer discs
|
||||
- Removed reliance on **sg-raw** and **psxt001z**
|
||||
- Added system and disc type to the submission info
|
||||
- First attempt at getting current disc type
|
||||
- Made the three PSX-specific fields (**EDC**, **Anti-modchip**, and **LibCrypt**) automatically filled in, when possible
|
||||
- Many, many, many behind the scenes updates for speed, future features, and stability
|
||||
|
||||
### 1.06 (2018-06-15)
|
||||
|
||||
- Fixed not being able to use the `/c2` flag properly
|
||||
- Fixed times when the ability to start dumping was improperly allowed
|
||||
- Added full support for XBOX and XBOX360 (XDG1, XDG2) dumping through DIC (using a Kreon, or presumably a 0800)
|
||||
|
||||
### 1.05a (2018-06-14)
|
||||
|
||||
- Fixed some ordering and nullability issues
|
||||
- Added automatic fields for PS1, PS2, Saturn
|
||||
|
||||
### 1.05 (2018-06-14)
|
||||
|
||||
- Miscellaneous fixes around custom parameter validation, dump information accuracy, settings window, and TODO cleanup
|
||||
- Add many more supported platforms, mostly arcade (based on publicly available information)
|
||||
- Add floppy disk dumping support
|
||||
- Add optional disc eject on completion
|
||||
- Add subdump for Sega Saturn
|
||||
- Fully support newest version of DIC including all new flags and commands
|
||||
- PlayStation and Saturn discs still don't have all internal information automatically generated
|
||||
|
||||
### 1.04b (2018-06-13)
|
||||
|
||||
- Added subIntention reading
|
||||
- Fixed extra extensions being appended
|
||||
- Fixed internationalization error (number formatting)
|
||||
- Fixed "Custom Input" not working
|
||||
|
||||
### 1.04a (2018-06-13)
|
||||
|
||||
- Fixed issue with empty trays
|
||||
- Added settings dialog
|
||||
|
||||
### 1.04 (2018-06-13)
|
||||
|
||||
- Behind-the-scenes fixes and formatting
|
||||
- Better checks for external programs
|
||||
- Automatically changing disc information
|
||||
- Custom parameters (and parameter validation)
|
||||
- Automatic drive speed selection
|
||||
- Automatic submission information creation
|
||||
- Add ability to stop a dump from the UI
|
||||
|
||||
### 1.03 (2018-06-08)
|
||||
|
||||
- edccchk now run on all CD-Roms
|
||||
- Discs unsupported by Windows are now regonized
|
||||
- Extra \ when accepting default save has been removed.
|
||||
|
||||
### 1.02b (2018-05-18)
|
||||
|
||||
- Added missing DLL
|
||||
|
||||
### 1.02 (2018-05-18)
|
||||
|
||||
- Fixed XBOX One and PS4 Drive Speed issue.
|
||||
- Started implementing DiscImageCreator Path selection.
|
||||
- Conforming my naming for objects and variable
|
||||
|
||||
### 1.01d (2018-05-18)
|
||||
|
||||
-Combine IBM PC-CD options, misc fixes.
|
||||
56
DICUI.Forms/Constants.cs
Normal file
56
DICUI.Forms/Constants.cs
Normal 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());
|
||||
}
|
||||
}
|
||||
116
DICUI.Forms/DICUI.Forms.csproj
Normal file
116
DICUI.Forms/DICUI.Forms.csproj
Normal 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>
|
||||
33
DICUI.Forms/EnumDescriptionConverter.cs
Normal file
33
DICUI.Forms/EnumDescriptionConverter.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Before Width: | Height: | Size: 71 KiB After Width: | Height: | Size: 71 KiB |
35
DICUI.Forms/KnownSystemComboBoxItem.cs
Normal file
35
DICUI.Forms/KnownSystemComboBoxItem.cs
Normal 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
97
DICUI.Forms/Options.cs
Normal 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
20
DICUI.Forms/Program.cs
Normal 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());
|
||||
}
|
||||
}
|
||||
}
|
||||
36
DICUI.Forms/Properties/AssemblyInfo.cs
Normal file
36
DICUI.Forms/Properties/AssemblyInfo.cs
Normal 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")]
|
||||
@@ -8,16 +8,16 @@
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace DICUI.Properties {
|
||||
namespace DICUI.Forms.Properties {
|
||||
|
||||
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Microsoft.VisualStudio.Editors.SettingsDesigner.SettingsSingleFileGenerator", "15.6.0.0")]
|
||||
internal sealed partial class Settings : global::System.Configuration.ApplicationSettingsBase {
|
||||
[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 Settings defaultInstance = ((Settings)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings())));
|
||||
private static Settings1 defaultInstance = ((Settings1)(global::System.Configuration.ApplicationSettingsBase.Synchronized(new Settings1())));
|
||||
|
||||
public static Settings Default {
|
||||
public static Settings1 Default {
|
||||
get {
|
||||
return defaultInstance;
|
||||
}
|
||||
6
DICUI.Forms/Properties/Settings1.settings
Normal file
6
DICUI.Forms/Properties/Settings1.settings
Normal 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
107
DICUI.Forms/ViewModels.cs
Normal 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
175
DICUI.Forms/Windows/LogWindow.Designer.cs
generated
Normal 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;
|
||||
}
|
||||
}
|
||||
380
DICUI.Forms/Windows/LogWindow.cs
Normal file
380
DICUI.Forms/Windows/LogWindow.cs
Normal 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
|
||||
}
|
||||
}
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
@@ -60,6 +60,7 @@
|
||||
: 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">
|
||||
@@ -68,9 +69,10 @@
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<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">
|
||||
@@ -85,9 +87,10 @@
|
||||
<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" msdata:Ordinal="1" />
|
||||
<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">
|
||||
@@ -109,9 +112,12 @@
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<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=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
<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
530
DICUI.Forms/Windows/MainWindow.Designer.cs
generated
Normal 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;
|
||||
}
|
||||
}
|
||||
|
||||
723
DICUI.Forms/Windows/MainWindow.cs
Normal file
723
DICUI.Forms/Windows/MainWindow.cs
Normal 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
|
||||
}
|
||||
}
|
||||
1395
DICUI.Forms/Windows/MainWindow.resx
Normal file
1395
DICUI.Forms/Windows/MainWindow.resx
Normal file
File diff suppressed because it is too large
Load Diff
565
DICUI.Forms/Windows/OptionsWindow.Designer.cs
generated
Normal file
565
DICUI.Forms/Windows/OptionsWindow.Designer.cs
generated
Normal 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;
|
||||
}
|
||||
}
|
||||
179
DICUI.Forms/Windows/OptionsWindow.cs
Normal file
179
DICUI.Forms/Windows/OptionsWindow.cs
Normal 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
|
||||
}
|
||||
}
|
||||
123
DICUI.Forms/Windows/OptionsWindow.resx
Normal file
123
DICUI.Forms/Windows/OptionsWindow.resx
Normal 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>
|
||||
101
DICUI.Library/DICUI.Library.csproj
Normal file
101
DICUI.Library/DICUI.Library.csproj
Normal 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>
|
||||
118
DICUI.Library/Data/Constants.cs
Normal file
118
DICUI.Library/Data/Constants.cs
Normal file
@@ -0,0 +1,118 @@
|
||||
namespace DICUI.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Top-level commands for DiscImageCreator
|
||||
/// </summary>
|
||||
public static class DICCommandStrings
|
||||
{
|
||||
public const string Audio = "audio";
|
||||
public const string BluRay = "bd";
|
||||
public const string Close = "close";
|
||||
public const string CompactDisc = "cd";
|
||||
public const string Data = "data";
|
||||
public const string DigitalVideoDisc = "dvd";
|
||||
public const string DriveSpeed = "ls";
|
||||
public const string Eject = "eject";
|
||||
public const string Floppy = "fd";
|
||||
public const string GDROM = "gd";
|
||||
public const string MDS = "mds";
|
||||
public const string Reset = "reset";
|
||||
public const string Start = "start";
|
||||
public const string Stop = "stop";
|
||||
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>
|
||||
/// Dumping flags for DiscImageCreator
|
||||
/// </summary>
|
||||
public static class DICFlagStrings
|
||||
{
|
||||
public const string AddOffset = "/a";
|
||||
public const string AMSF = "/p";
|
||||
public const string BEOpcode = "/be";
|
||||
public const string C2Opcode = "/c2";
|
||||
public const string CopyrightManagementInformation = "/c";
|
||||
public const string D8Opcode = "/d8";
|
||||
public const string DisableBeep = "/q";
|
||||
public const string ForceUnitAccess = "/f";
|
||||
public const string MCN = "/m";
|
||||
public const string MultiSession = "/ms";
|
||||
public const string NoFixSubP = "/np";
|
||||
public const string NoFixSubQ = "/nq";
|
||||
public const string NoFixSubQLibCrypt = "/nl";
|
||||
public const string NoFixSubQSecuROM = "/ns";
|
||||
public const string NoFixSubRtoW = "/nr";
|
||||
public const string Raw = "/raw";
|
||||
public const string Reverse = "/r";
|
||||
public const string ScanAntiMod = "/am";
|
||||
public const string ScanFileProtect = "/sf";
|
||||
public const string ScanSectorProtect = "/ss";
|
||||
public const string SeventyFour = "/74";
|
||||
public const string SubchannelReadLevel = "/s";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Template field values for submission info
|
||||
/// </summary>
|
||||
public static class Template
|
||||
{
|
||||
// Manual information
|
||||
|
||||
public const string TitleField = "Title";
|
||||
public const string DiscNumberField = "Disc Number / Letter";
|
||||
public const string DiscTitleField = "Disc Title";
|
||||
public const string SystemField = "System";
|
||||
public const string MediaTypeField = "Media Type";
|
||||
public const string CategoryField = "Category";
|
||||
public const string RegionField = "Region";
|
||||
public const string LanguagesField = "Languages";
|
||||
public const string DiscSerialField = "Disc Serial";
|
||||
public const string BarcodeField = "Barcode";
|
||||
public const string ISBNField = "ISBN";
|
||||
public const string CommentsField = "Comments";
|
||||
public const string ContentsField = "Contents";
|
||||
public const string VersionField = "Version";
|
||||
public const string EditionField = "Edition/Release";
|
||||
public const string CopyProtectionField = "Copy Protection";
|
||||
public const string MasteringRingField = "Mastering Ring";
|
||||
public const string MasteringSIDField = "Mastering SID Code";
|
||||
public const string MouldSIDField = "Mould SID Code";
|
||||
public const string AdditionalMouldField = "Additional Mould";
|
||||
public const string ToolstampField = "Toolstamp or Mastering Code";
|
||||
|
||||
// Automatic Information
|
||||
|
||||
public const string PVDField = "Primary Volume Descriptor (PVD)";
|
||||
public const string DATField = "DAT";
|
||||
public const string ErrorCountField = "Error Count";
|
||||
public const string CuesheetField = "Cuesheet";
|
||||
public const string SubIntentionField = "SubIntention Data (SecuROM/LibCrypt)";
|
||||
public const string WriteOffsetField = "Write Offset";
|
||||
public const string LayerbreakField = "Layerbreak";
|
||||
public const string PlaystationEXEDateField = "EXE Date";
|
||||
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
|
||||
|
||||
public const string RequiredValue = "(REQUIRED)";
|
||||
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";
|
||||
}
|
||||
}
|
||||
266
DICUI.Library/Data/Enumerations.cs
Normal file
266
DICUI.Library/Data/Enumerations.cs
Normal file
@@ -0,0 +1,266 @@
|
||||
namespace DICUI.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Supported DIC commands
|
||||
/// </summary>
|
||||
public enum DICCommand
|
||||
{
|
||||
NONE = 0,
|
||||
Audio,
|
||||
BluRay,
|
||||
Close,
|
||||
CompactDisc,
|
||||
Data,
|
||||
DigitalVideoDisc,
|
||||
DriveSpeed,
|
||||
Eject,
|
||||
Floppy,
|
||||
GDROM,
|
||||
MDS,
|
||||
Reset,
|
||||
Start,
|
||||
Stop,
|
||||
Sub,
|
||||
Swap,
|
||||
XBOX,
|
||||
XBOXSwap,
|
||||
XGD2Swap,
|
||||
XGD3Swap,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Supported DIC flags
|
||||
/// </summary>
|
||||
public enum DICFlag
|
||||
{
|
||||
NONE = 0,
|
||||
AddOffset,
|
||||
AMSF,
|
||||
BEOpcode,
|
||||
C2Opcode,
|
||||
CopyrightManagementInformation,
|
||||
D8Opcode,
|
||||
DisableBeep,
|
||||
ForceUnitAccess,
|
||||
MCN,
|
||||
MultiSession,
|
||||
NoFixSubP,
|
||||
NoFixSubQ,
|
||||
NoFixSubQLibCrypt,
|
||||
NoFixSubQSecuROM,
|
||||
NoFixSubRtoW,
|
||||
Raw,
|
||||
Reverse,
|
||||
ScanAntiMod,
|
||||
ScanFileProtect,
|
||||
ScanSectorProtect,
|
||||
SeventyFour,
|
||||
SubchannelReadLevel,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Known systems
|
||||
/// </summary>
|
||||
public enum KnownSystem
|
||||
{
|
||||
NONE = 0,
|
||||
|
||||
#region Consoles
|
||||
|
||||
BandaiPlaydiaQuickInteractiveSystem,
|
||||
BandaiApplePippin,
|
||||
CommodoreAmigaCD32,
|
||||
CommodoreAmigaCDTV,
|
||||
MattelHyperscan,
|
||||
MicrosoftXBOX,
|
||||
MicrosoftXBOX360,
|
||||
MicrosoftXBOXOne,
|
||||
NECPCEngineTurboGrafxCD,
|
||||
NECPCFX,
|
||||
NintendoGameCube,
|
||||
NintendoWii,
|
||||
NintendoWiiU,
|
||||
Panasonic3DOInteractiveMultiplayer,
|
||||
PhilipsCDi,
|
||||
SegaCDMegaCD,
|
||||
SegaDreamcast,
|
||||
SegaSaturn,
|
||||
SNKNeoGeoCD,
|
||||
SonyPlayStation,
|
||||
SonyPlayStation2,
|
||||
SonyPlayStation3,
|
||||
SonyPlayStation4,
|
||||
SonyPlayStationPortable,
|
||||
VMLabsNuon,
|
||||
VTechVFlashVSmilePro,
|
||||
ZAPiTGamesGameWaveFamilyEntertainmentSystem,
|
||||
|
||||
MarkerConsoleEnd,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Computers
|
||||
|
||||
AcornArchimedes,
|
||||
AppleMacintosh,
|
||||
CommodoreAmigaCD,
|
||||
FujitsuFMTowns,
|
||||
IBMPCCompatible,
|
||||
NECPC88,
|
||||
NECPC98,
|
||||
SharpX68000,
|
||||
|
||||
MarkerComputerEnd,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Arcade
|
||||
|
||||
AmigaCUBOCD32,
|
||||
AmericanLaserGames3DO,
|
||||
Atari3DO,
|
||||
Atronic,
|
||||
AUSCOMSystem1,
|
||||
BallyGameMagic,
|
||||
CapcomCPSystemIII,
|
||||
GlobalVRVarious,
|
||||
GlobalVRVortek,
|
||||
GlobalVRVortekV3,
|
||||
ICEPCHardware,
|
||||
IncredibleTechnologiesEagle,
|
||||
IncredibleTechnologiesVarious,
|
||||
KonamieAmusement,
|
||||
KonamiFirebeat,
|
||||
KonamiGVSystem,
|
||||
KonamiM2,
|
||||
KonamiPython,
|
||||
KonamiPython2,
|
||||
KonamiSystem573,
|
||||
KonamiTwinkle,
|
||||
KonamiVarious,
|
||||
MeritIndustriesBoardwalk,
|
||||
MeritIndustriesMegaTouchAurora,
|
||||
MeritIndustriesMegaTouchForce,
|
||||
MeritIndustriesMegaTouchION,
|
||||
MeritIndustriesMegaTouchMaxx,
|
||||
MeritIndustriesMegaTouchXL,
|
||||
NamcoCapcomSystem256,
|
||||
NamcoCapcomTaitoSystem246,
|
||||
NamcoSegaNintendoTriforce,
|
||||
NamcoSystem12,
|
||||
NamcoSystem357,
|
||||
NewJatreCDi,
|
||||
NichibutsuHighRateSystem,
|
||||
NichibutsuSuperCD,
|
||||
NichibutsuXRateSystem,
|
||||
PhotoPlayVarious,
|
||||
RawThrillsVarious,
|
||||
SegaChihiro,
|
||||
SegaEuropaR,
|
||||
SegaLindbergh,
|
||||
SegaNaomi,
|
||||
SegaNaomi2,
|
||||
SegaNu,
|
||||
SegaRingEdge,
|
||||
SegaRingEdge2,
|
||||
SegaRingWide,
|
||||
SegaTitanVideo,
|
||||
SegaSystem32,
|
||||
SeibuCATSSystem,
|
||||
TABAustriaQuizard,
|
||||
TandyMemorexVisualInformationSystem,
|
||||
TsunamiTsuMoMultiGameMotionSystem,
|
||||
|
||||
MarkerArcadeEnd,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Other
|
||||
|
||||
AudioCD,
|
||||
BDVideo,
|
||||
DVDVideo,
|
||||
EnhancedCD,
|
||||
EnhancedDVD,
|
||||
EnhancedBD,
|
||||
HDDVDVideo,
|
||||
PalmOS,
|
||||
PhilipsCDiDigitalVideo,
|
||||
PhotoCD,
|
||||
PlayStationGameSharkUpdates,
|
||||
RainbowDisc,
|
||||
TaoiKTV,
|
||||
TomyKissSite,
|
||||
VideoCD,
|
||||
|
||||
MarkerOtherEnd,
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Known system category
|
||||
/// </summary>
|
||||
public enum KnownSystemCategory
|
||||
{
|
||||
Console = 0,
|
||||
Computer,
|
||||
Arcade,
|
||||
Other,
|
||||
Custom
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Known media types
|
||||
/// </summary>
|
||||
public enum MediaType
|
||||
{
|
||||
NONE = 0,
|
||||
|
||||
#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,
|
||||
HardDisk,
|
||||
IomegaBernoulliDisk,
|
||||
IomegaJaz,
|
||||
IomegaZip,
|
||||
LaserDisc, // LD-ROM and LV-ROM variants
|
||||
Nintendo64DD,
|
||||
NintendoFamicomDiskSystem,
|
||||
NintendoGameCube,
|
||||
NintendoWiiOpticalDisc,
|
||||
NintendoWiiUOpticalDisc,
|
||||
UMD,
|
||||
|
||||
#endregion
|
||||
|
||||
// Unsorted Formats
|
||||
Cartridge,
|
||||
CED,
|
||||
}
|
||||
}
|
||||
36
DICUI.Library/Properties/AssemblyInfo.cs
Normal file
36
DICUI.Library/Properties/AssemblyInfo.cs
Normal 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")]
|
||||
597
DICUI.Library/Utilities/Converters.cs
Normal file
597
DICUI.Library/Utilities/Converters.cs
Normal file
@@ -0,0 +1,597 @@
|
||||
using IMAPI2;
|
||||
using DICUI.Data;
|
||||
|
||||
namespace DICUI.Utilities
|
||||
{
|
||||
public static class Converters
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the MediaType associated with a given base command
|
||||
/// </summary>
|
||||
/// <param name="baseCommand">DICCommand value to check</param>
|
||||
/// <returns>MediaType if possible, null on error</returns>
|
||||
/// <remarks>This takes the "safe" route by assuming the larger of any given format</remarks>
|
||||
public static MediaType? BaseCommmandToMediaType(DICCommand baseCommand)
|
||||
{
|
||||
switch (baseCommand)
|
||||
{
|
||||
case DICCommand.Audio:
|
||||
case DICCommand.CompactDisc:
|
||||
case DICCommand.Data:
|
||||
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.FloppyDisk;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the most common known system for a given MediaType
|
||||
/// </summary>
|
||||
/// <param name="baseCommand">DICCommand value to check</param>
|
||||
/// <returns>KnownSystem if possible, null on error</returns>
|
||||
public static KnownSystem? BaseCommandToKnownSystem(DICCommand baseCommand)
|
||||
{
|
||||
switch (baseCommand)
|
||||
{
|
||||
case DICCommand.Audio:
|
||||
return KnownSystem.AudioCD;
|
||||
case DICCommand.CompactDisc:
|
||||
case DICCommand.Data:
|
||||
case DICCommand.DigitalVideoDisc:
|
||||
case DICCommand.Floppy:
|
||||
return KnownSystem.IBMPCCompatible;
|
||||
case DICCommand.GDROM:
|
||||
case DICCommand.Swap:
|
||||
return KnownSystem.SegaDreamcast;
|
||||
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;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the string representation of the DICCommand enum values
|
||||
/// </summary>
|
||||
/// <param name="command">DICCommand value to convert</param>
|
||||
/// <returns>String representing the value, if possible</returns>
|
||||
public static string DICCommandToString(DICCommand command)
|
||||
{
|
||||
switch (command)
|
||||
{
|
||||
case DICCommand.Audio:
|
||||
return DICCommandStrings.Audio;
|
||||
case DICCommand.BluRay:
|
||||
return DICCommandStrings.BluRay;
|
||||
case DICCommand.Close:
|
||||
return DICCommandStrings.Close;
|
||||
case DICCommand.CompactDisc:
|
||||
return DICCommandStrings.CompactDisc;
|
||||
case DICCommand.Data:
|
||||
return DICCommandStrings.Data;
|
||||
case DICCommand.DigitalVideoDisc:
|
||||
return DICCommandStrings.DigitalVideoDisc;
|
||||
case DICCommand.DriveSpeed:
|
||||
return DICCommandStrings.DriveSpeed;
|
||||
case DICCommand.Eject:
|
||||
return DICCommandStrings.Eject;
|
||||
case DICCommand.Floppy:
|
||||
return DICCommandStrings.Floppy;
|
||||
case DICCommand.GDROM:
|
||||
return DICCommandStrings.GDROM;
|
||||
case DICCommand.MDS:
|
||||
return DICCommandStrings.MDS;
|
||||
case DICCommand.Reset:
|
||||
return DICCommandStrings.Reset;
|
||||
case DICCommand.Start:
|
||||
return DICCommandStrings.Start;
|
||||
case DICCommand.Stop:
|
||||
return DICCommandStrings.Stop;
|
||||
case DICCommand.Sub:
|
||||
return DICCommandStrings.Sub;
|
||||
case DICCommand.Swap:
|
||||
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:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the string representation of the DICFlag enum values
|
||||
/// </summary>
|
||||
/// <param name="command">DICFlag value to convert</param>
|
||||
/// <returns>String representing the value, if possible</returns>
|
||||
public static string DICFlagToString(DICFlag flag)
|
||||
{
|
||||
switch (flag)
|
||||
{
|
||||
case DICFlag.AddOffset:
|
||||
return DICFlagStrings.AddOffset;
|
||||
case DICFlag.AMSF:
|
||||
return DICFlagStrings.AMSF;
|
||||
case DICFlag.BEOpcode:
|
||||
return DICFlagStrings.BEOpcode;
|
||||
case DICFlag.C2Opcode:
|
||||
return DICFlagStrings.C2Opcode;
|
||||
case DICFlag.CopyrightManagementInformation:
|
||||
return DICFlagStrings.CopyrightManagementInformation;
|
||||
case DICFlag.D8Opcode:
|
||||
return DICFlagStrings.D8Opcode;
|
||||
case DICFlag.DisableBeep:
|
||||
return DICFlagStrings.DisableBeep;
|
||||
case DICFlag.ForceUnitAccess:
|
||||
return DICFlagStrings.ForceUnitAccess;
|
||||
case DICFlag.MCN:
|
||||
return DICFlagStrings.MCN;
|
||||
case DICFlag.MultiSession:
|
||||
return DICFlagStrings.MultiSession;
|
||||
case DICFlag.NoFixSubP:
|
||||
return DICFlagStrings.NoFixSubP;
|
||||
case DICFlag.NoFixSubQ:
|
||||
return DICFlagStrings.NoFixSubQ;
|
||||
case DICFlag.NoFixSubQLibCrypt:
|
||||
return DICFlagStrings.NoFixSubQLibCrypt;
|
||||
case DICFlag.NoFixSubQSecuROM:
|
||||
return DICFlagStrings.NoFixSubQSecuROM;
|
||||
case DICFlag.NoFixSubRtoW:
|
||||
return DICFlagStrings.NoFixSubRtoW;
|
||||
case DICFlag.Raw:
|
||||
return DICFlagStrings.Raw;
|
||||
case DICFlag.Reverse:
|
||||
return DICFlagStrings.Reverse;
|
||||
case DICFlag.ScanAntiMod:
|
||||
return DICFlagStrings.ScanAntiMod;
|
||||
case DICFlag.ScanFileProtect:
|
||||
return DICFlagStrings.ScanFileProtect;
|
||||
case DICFlag.ScanSectorProtect:
|
||||
return DICFlagStrings.ScanSectorProtect;
|
||||
case DICFlag.SeventyFour:
|
||||
return DICFlagStrings.SeventyFour;
|
||||
case DICFlag.SubchannelReadLevel:
|
||||
return DICFlagStrings.SubchannelReadLevel;
|
||||
|
||||
case DICFlag.NONE:
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert IMAPI physical media type to a MediaType
|
||||
/// </summary>
|
||||
/// <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.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
|
||||
/// </summary>
|
||||
/// <param name="type">MediaType value to check</param>
|
||||
/// <returns>Valid extension (with leading '.'), null on error</returns>
|
||||
public static string MediaTypeToExtension(MediaType? type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
case MediaType.GDROM:
|
||||
case MediaType.Cartridge:
|
||||
return ".bin";
|
||||
case MediaType.DVD:
|
||||
case MediaType.HDDVD:
|
||||
case MediaType.BluRay:
|
||||
case MediaType.NintendoWiiOpticalDisc:
|
||||
case MediaType.UMD:
|
||||
return ".iso";
|
||||
case MediaType.LaserDisc:
|
||||
case MediaType.NintendoGameCube:
|
||||
return ".raw";
|
||||
case MediaType.NintendoWiiUOpticalDisc:
|
||||
return ".wud";
|
||||
case MediaType.FloppyDisk:
|
||||
return ".img";
|
||||
case MediaType.Cassette:
|
||||
return ".wav";
|
||||
case MediaType.NONE:
|
||||
case MediaType.CED:
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the string representation of the MediaType enum values
|
||||
/// </summary>
|
||||
/// <param name="type">MediaType value to convert</param>
|
||||
/// <returns>String representing the value, if possible</returns>
|
||||
public static string MediaTypeToString(MediaType? type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
#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-ROM";
|
||||
case MediaType.FloppyDisk:
|
||||
return "Floppy Disk";
|
||||
case MediaType.Floptical:
|
||||
return "Floptical";
|
||||
case MediaType.GDROM:
|
||||
return "GD-ROM";
|
||||
case MediaType.HDDVD:
|
||||
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 "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.CED:
|
||||
return "CED";
|
||||
|
||||
case MediaType.NONE:
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the string representation of the KnownSystem enum values
|
||||
/// </summary>
|
||||
/// <param name="sys">KnownSystem value to convert</param>
|
||||
/// <returns>String representing the value, if possible</returns>
|
||||
public static string KnownSystemToString(KnownSystem? sys)
|
||||
{
|
||||
switch (sys)
|
||||
{
|
||||
#region Consoles
|
||||
|
||||
case KnownSystem.BandaiPlaydiaQuickInteractiveSystem:
|
||||
return "Bandai Playdia Quick Interactive System";
|
||||
case KnownSystem.BandaiApplePippin:
|
||||
return "Bandai / Apple Pippin";
|
||||
case KnownSystem.CommodoreAmigaCD32:
|
||||
return "Commodore Amiga CD32";
|
||||
case KnownSystem.CommodoreAmigaCDTV:
|
||||
return "Commodore Amiga CDTV";
|
||||
case KnownSystem.MattelHyperscan:
|
||||
return "Mattel HyperScan";
|
||||
case KnownSystem.MicrosoftXBOX:
|
||||
return "Microsoft XBOX";
|
||||
case KnownSystem.MicrosoftXBOX360:
|
||||
return "Microsoft XBOX 360";
|
||||
case KnownSystem.MicrosoftXBOXOne:
|
||||
return "Microsoft XBOX One";
|
||||
case KnownSystem.NECPCEngineTurboGrafxCD:
|
||||
return "NEC PC-Engine / TurboGrafx CD";
|
||||
case KnownSystem.NECPCFX:
|
||||
return "NEC PC-FX / PC-FXGA";
|
||||
case KnownSystem.NintendoGameCube:
|
||||
return "Nintendo GameCube";
|
||||
case KnownSystem.NintendoWii:
|
||||
return "Nintendo Wii";
|
||||
case KnownSystem.NintendoWiiU:
|
||||
return "Nintendo Wii U";
|
||||
case KnownSystem.Panasonic3DOInteractiveMultiplayer:
|
||||
return "Panasonic 3DO Interactive Multiplayer";
|
||||
case KnownSystem.PhilipsCDi:
|
||||
return "Philips CD-i";
|
||||
case KnownSystem.SegaCDMegaCD:
|
||||
return "Sega CD / Mega CD";
|
||||
case KnownSystem.SegaDreamcast:
|
||||
return "Sega Dreamcast";
|
||||
case KnownSystem.SegaSaturn:
|
||||
return "Sega Saturn";
|
||||
case KnownSystem.SNKNeoGeoCD:
|
||||
return "SNK Neo Geo CD";
|
||||
case KnownSystem.SonyPlayStation:
|
||||
return "Sony PlayStation";
|
||||
case KnownSystem.SonyPlayStation2:
|
||||
return "Sony PlayStation 2";
|
||||
case KnownSystem.SonyPlayStation3:
|
||||
return "Sony PlayStation 3";
|
||||
case KnownSystem.SonyPlayStation4:
|
||||
return "Sony PlayStation 4";
|
||||
case KnownSystem.SonyPlayStationPortable:
|
||||
return "Sony PlayStation Portable";
|
||||
case KnownSystem.VMLabsNuon:
|
||||
return "VM Labs NUON";
|
||||
case KnownSystem.VTechVFlashVSmilePro:
|
||||
return "VTech V.Flash - V.Smile Pro";
|
||||
case KnownSystem.ZAPiTGamesGameWaveFamilyEntertainmentSystem:
|
||||
return "ZAPiT Games Game Wave Family Entertainment System";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Computers
|
||||
|
||||
case KnownSystem.AcornArchimedes:
|
||||
return "Acorn Archimedes";
|
||||
case KnownSystem.AppleMacintosh:
|
||||
return "Apple Macintosh";
|
||||
case KnownSystem.CommodoreAmigaCD:
|
||||
return "Commodore Amiga CD";
|
||||
case KnownSystem.FujitsuFMTowns:
|
||||
return "Fujitsu FM Towns series";
|
||||
case KnownSystem.IBMPCCompatible:
|
||||
return "IBM PC Compatible";
|
||||
case KnownSystem.NECPC88:
|
||||
return "NEC PC-88";
|
||||
case KnownSystem.NECPC98:
|
||||
return "NEC PC-98";
|
||||
case KnownSystem.SharpX68000:
|
||||
return "Sharp X68000";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Arcade
|
||||
|
||||
case KnownSystem.AmigaCUBOCD32:
|
||||
return "Amiga CUBO CD32";
|
||||
case KnownSystem.AmericanLaserGames3DO:
|
||||
return "American Laser Games 3DO";
|
||||
case KnownSystem.Atari3DO:
|
||||
return "Atari 3DO";
|
||||
case KnownSystem.Atronic:
|
||||
return "Atronic";
|
||||
case KnownSystem.AUSCOMSystem1:
|
||||
return "AUSCOM System 1";
|
||||
case KnownSystem.BallyGameMagic:
|
||||
return "Bally Game Magic";
|
||||
case KnownSystem.CapcomCPSystemIII:
|
||||
return "Capcom CP System III";
|
||||
case KnownSystem.GlobalVRVarious:
|
||||
return "Global VR PC-based Systems";
|
||||
case KnownSystem.GlobalVRVortek:
|
||||
return "Global VR Vortek";
|
||||
case KnownSystem.GlobalVRVortekV3:
|
||||
return "Global VR Vortek V3";
|
||||
case KnownSystem.ICEPCHardware:
|
||||
return "ICE PC-based Hardware";
|
||||
case KnownSystem.IncredibleTechnologiesEagle:
|
||||
return "Incredible Technologies Eagle";
|
||||
case KnownSystem.IncredibleTechnologiesVarious:
|
||||
return "Incredible Technologies PC-based Systems";
|
||||
case KnownSystem.KonamieAmusement:
|
||||
return "Konami e-Amusement";
|
||||
case KnownSystem.KonamiFirebeat:
|
||||
return "Konami Firebeat";
|
||||
case KnownSystem.KonamiGVSystem:
|
||||
return "Konami GV System";
|
||||
case KnownSystem.KonamiM2:
|
||||
return "Konami M2";
|
||||
case KnownSystem.KonamiPython:
|
||||
return "Konami Python";
|
||||
case KnownSystem.KonamiPython2:
|
||||
return "Konami Python 2";
|
||||
case KnownSystem.KonamiSystem573:
|
||||
return "Konami System 573";
|
||||
case KnownSystem.KonamiTwinkle:
|
||||
return "Konami Twinkle";
|
||||
case KnownSystem.KonamiVarious:
|
||||
return "Konami PC-based Systems";
|
||||
case KnownSystem.MeritIndustriesBoardwalk:
|
||||
return "Merit Industries Boardwalk";
|
||||
case KnownSystem.MeritIndustriesMegaTouchAurora:
|
||||
return "Merit Industries MegaTouch Aurora";
|
||||
case KnownSystem.MeritIndustriesMegaTouchForce:
|
||||
return "Merit Industries MegaTouch Force";
|
||||
case KnownSystem.MeritIndustriesMegaTouchION:
|
||||
return "Merit Industries MegaTouch ION";
|
||||
case KnownSystem.MeritIndustriesMegaTouchMaxx:
|
||||
return "Merit Industries MegaTouch Maxx";
|
||||
case KnownSystem.MeritIndustriesMegaTouchXL:
|
||||
return "Merit Industries MegaTouch XL";
|
||||
case KnownSystem.NamcoCapcomSystem256:
|
||||
return "Namco / Capcom System 256/Super System 256";
|
||||
case KnownSystem.NamcoCapcomTaitoSystem246:
|
||||
return "Namco / Capcom / Taito System 246";
|
||||
case KnownSystem.NamcoSegaNintendoTriforce:
|
||||
return "Namco / Sega / Nintendo Triforce";
|
||||
case KnownSystem.NamcoSystem12:
|
||||
return "Namco System 12";
|
||||
case KnownSystem.NamcoSystem357:
|
||||
return "Namco System 357";
|
||||
case KnownSystem.NewJatreCDi:
|
||||
return "New Jatre CD-i";
|
||||
case KnownSystem.NichibutsuHighRateSystem:
|
||||
return "Nichibutsu High Rate System";
|
||||
case KnownSystem.NichibutsuSuperCD:
|
||||
return "Nichibutsu Super CD";
|
||||
case KnownSystem.NichibutsuXRateSystem:
|
||||
return "NichibutsuX-Rate System";
|
||||
case KnownSystem.PhotoPlayVarious:
|
||||
return "PhotoPlay PC-based Systems";
|
||||
case KnownSystem.RawThrillsVarious:
|
||||
return "Raw Thrills PC-based Systems";
|
||||
case KnownSystem.SegaChihiro:
|
||||
return "Sega Chihiro";
|
||||
case KnownSystem.SegaEuropaR:
|
||||
return "Sega Europa-R";
|
||||
case KnownSystem.SegaLindbergh:
|
||||
return "Sega Lindbergh";
|
||||
case KnownSystem.SegaNaomi:
|
||||
return "Sega Naomi";
|
||||
case KnownSystem.SegaNaomi2:
|
||||
return "Sega Naomi 2";
|
||||
case KnownSystem.SegaNu:
|
||||
return "Sega Nu";
|
||||
case KnownSystem.SegaRingEdge:
|
||||
return "Sega RingEdge";
|
||||
case KnownSystem.SegaRingEdge2:
|
||||
return "Sega RingEdge 2";
|
||||
case KnownSystem.SegaRingWide:
|
||||
return "Sega RingWide";
|
||||
case KnownSystem.SegaTitanVideo:
|
||||
return "Sega Titan Video";
|
||||
case KnownSystem.SegaSystem32:
|
||||
return "Sega System 32";
|
||||
case KnownSystem.SeibuCATSSystem:
|
||||
return "Seibu CATS System";
|
||||
case KnownSystem.TABAustriaQuizard:
|
||||
return "TAB-Austria Quizard";
|
||||
case KnownSystem.TandyMemorexVisualInformationSystem:
|
||||
return "Tandy / Memorex Visual Information System";
|
||||
case KnownSystem.TsunamiTsuMoMultiGameMotionSystem:
|
||||
return "Tsunami TsuMo Multi-Game Motion System";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Others
|
||||
|
||||
case KnownSystem.AudioCD:
|
||||
return "Audio CD";
|
||||
case KnownSystem.BDVideo:
|
||||
return "BD-Video";
|
||||
case KnownSystem.DVDVideo:
|
||||
return "DVD-Video";
|
||||
case KnownSystem.EnhancedCD:
|
||||
return "Enhanced CD";
|
||||
case KnownSystem.EnhancedDVD:
|
||||
return "Enhanced DVD";
|
||||
case KnownSystem.EnhancedBD:
|
||||
return "Enhanced BD";
|
||||
case KnownSystem.HDDVDVideo:
|
||||
return "HD-DVD-Video";
|
||||
case KnownSystem.PalmOS:
|
||||
return "PalmOS";
|
||||
case KnownSystem.PhilipsCDiDigitalVideo:
|
||||
return "Philips CD-i Digital Video";
|
||||
case KnownSystem.PhotoCD:
|
||||
return "Photo CD";
|
||||
case KnownSystem.PlayStationGameSharkUpdates:
|
||||
return "PlayStation GameShark Updates";
|
||||
case KnownSystem.RainbowDisc:
|
||||
return "Rainbow Disc";
|
||||
case KnownSystem.TaoiKTV:
|
||||
return "Tao iKTV";
|
||||
case KnownSystem.TomyKissSite:
|
||||
return "Tomy Kiss-Site";
|
||||
case KnownSystem.VideoCD:
|
||||
return "Video CD";
|
||||
|
||||
#endregion
|
||||
|
||||
case KnownSystem.NONE:
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1652
DICUI.Library/Utilities/DumpEnvironment.cs
Normal file
1652
DICUI.Library/Utilities/DumpEnvironment.cs
Normal file
File diff suppressed because it is too large
Load Diff
126
DICUI.Library/Utilities/Extensions.cs
Normal file
126
DICUI.Library/Utilities/Extensions.cs
Normal file
@@ -0,0 +1,126 @@
|
||||
using DICUI.Data;
|
||||
|
||||
namespace DICUI.Utilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Extensions for DICCommand for easier calling
|
||||
/// </summary>
|
||||
public static class DICCommandExtensions
|
||||
{
|
||||
public static string Name(this DICCommand command)
|
||||
{
|
||||
return Converters.DICCommandToString(command);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extensions for DICFlag for easier calling
|
||||
/// </summary>
|
||||
public static class DICFlagExtensions
|
||||
{
|
||||
public static string Name(this DICFlag command)
|
||||
{
|
||||
return Converters.DICFlagToString(command);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extensions for MediaType? for easier calling
|
||||
/// </summary>
|
||||
public static class MediaTypeExtensions
|
||||
{
|
||||
public static string Name(this MediaType? type)
|
||||
{
|
||||
return Converters.MediaTypeToString(type);
|
||||
}
|
||||
|
||||
public static string Extension(this MediaType? type)
|
||||
{
|
||||
return Converters.MediaTypeToExtension(type);
|
||||
}
|
||||
|
||||
public static bool DoesSupportDriveSpeed(this MediaType? type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
case MediaType.DVD:
|
||||
case MediaType.GDROM:
|
||||
case MediaType.HDDVD:
|
||||
case MediaType.BluRay:
|
||||
case MediaType.NintendoGameCube:
|
||||
case MediaType.NintendoWiiOpticalDisc:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extensions for KnownSystem? for easier calling
|
||||
/// </summary>
|
||||
public static class KnownSystemExtensions
|
||||
{
|
||||
public static string Name(this KnownSystem? system)
|
||||
{
|
||||
return Converters.KnownSystemToString(system);
|
||||
}
|
||||
|
||||
public static KnownSystemCategory Category(this KnownSystem? system)
|
||||
{
|
||||
if (system < KnownSystem.MarkerConsoleEnd)
|
||||
return KnownSystemCategory.Console;
|
||||
else if (system < KnownSystem.MarkerComputerEnd)
|
||||
return KnownSystemCategory.Computer;
|
||||
else if (system < KnownSystem.MarkerArcadeEnd)
|
||||
return KnownSystemCategory.Arcade;
|
||||
else if (system < KnownSystem.MarkerOtherEnd)
|
||||
return KnownSystemCategory.Other;
|
||||
else
|
||||
return KnownSystemCategory.Custom;
|
||||
}
|
||||
|
||||
public static bool IsMarker(this KnownSystem? system)
|
||||
{
|
||||
switch (system)
|
||||
{
|
||||
case KnownSystem.MarkerArcadeEnd:
|
||||
case KnownSystem.MarkerComputerEnd:
|
||||
case KnownSystem.MarkerConsoleEnd:
|
||||
case KnownSystem.MarkerOtherEnd:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extensions for KnownSystemCategory?
|
||||
/// </summary>
|
||||
public static class KnownSystemCategoryExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the string representation of a KnownSystemCategory
|
||||
/// </summary>
|
||||
public static string Name(this KnownSystemCategory? category)
|
||||
{
|
||||
switch (category)
|
||||
{
|
||||
case KnownSystemCategory.Arcade:
|
||||
return "Arcade";
|
||||
case KnownSystemCategory.Computer:
|
||||
return "Computers";
|
||||
case KnownSystemCategory.Console:
|
||||
return "Consoles";
|
||||
case KnownSystemCategory.Other:
|
||||
return "Other";
|
||||
case KnownSystemCategory.Custom:
|
||||
return "Custom";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
1388
DICUI.Library/Utilities/Parameters.cs
Normal file
1388
DICUI.Library/Utilities/Parameters.cs
Normal file
File diff suppressed because it is too large
Load Diff
27
DICUI.Library/Utilities/Result.cs
Normal file
27
DICUI.Library/Utilities/Result.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
namespace DICUI.Utilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Generic success/failure result object, with optional message
|
||||
/// </summary>
|
||||
public class Result
|
||||
{
|
||||
private bool success;
|
||||
public string Message { get; private set; }
|
||||
|
||||
private Result(bool success, string message)
|
||||
{
|
||||
this.success = success;
|
||||
this.Message = message;
|
||||
}
|
||||
|
||||
public static Result Success() => new Result(true, "");
|
||||
public static Result Success(string message) => new Result(true, message);
|
||||
public static Result Success(string message, params object[] args) => new Result(true, string.Format(message, args));
|
||||
|
||||
public static Result Failure() => new Result(false, "");
|
||||
public static Result Failure(string message) => new Result(false, message);
|
||||
public static Result Failure(string message, params object[] args) => new Result(false, string.Format(message, args));
|
||||
|
||||
public static implicit operator bool(Result result) => result.success;
|
||||
}
|
||||
}
|
||||
588
DICUI.Library/Utilities/Validators.cs
Normal file
588
DICUI.Library/Utilities/Validators.cs
Normal file
@@ -0,0 +1,588 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Management;
|
||||
using System.Threading.Tasks;
|
||||
using BurnOutSharp;
|
||||
using IMAPI2;
|
||||
using DICUI.Data;
|
||||
|
||||
namespace DICUI.Utilities
|
||||
{
|
||||
public static class Validators
|
||||
{
|
||||
/// <summary>
|
||||
/// Get a list of valid MediaTypes for a given KnownSystem
|
||||
/// </summary>
|
||||
/// <param name="sys">KnownSystem value to check</param>
|
||||
/// <returns>MediaTypes, if possible</returns>
|
||||
public static List<MediaType?> GetValidMediaTypes(KnownSystem? sys)
|
||||
{
|
||||
var types = new List<MediaType?>();
|
||||
|
||||
switch (sys)
|
||||
{
|
||||
#region Consoles
|
||||
|
||||
case KnownSystem.BandaiPlaydiaQuickInteractiveSystem:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.BandaiApplePippin:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.CommodoreAmigaCD32:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.CommodoreAmigaCDTV:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.MattelHyperscan:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.MicrosoftXBOX:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
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.CDROM);
|
||||
break;
|
||||
case KnownSystem.NECPCFX:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.NintendoGameCube:
|
||||
types.Add(MediaType.NintendoGameCube);
|
||||
break;
|
||||
case KnownSystem.NintendoWii:
|
||||
types.Add(MediaType.NintendoWiiOpticalDisc);
|
||||
break;
|
||||
case KnownSystem.NintendoWiiU:
|
||||
types.Add(MediaType.NintendoWiiUOpticalDisc);
|
||||
break;
|
||||
case KnownSystem.Panasonic3DOInteractiveMultiplayer:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.PhilipsCDi:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.SegaCDMegaCD:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.SegaDreamcast:
|
||||
types.Add(MediaType.CDROM); // Low density partition
|
||||
types.Add(MediaType.GDROM); // Hight density partition
|
||||
break;
|
||||
case KnownSystem.SegaSaturn:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.SNKNeoGeoCD:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation2:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation3:
|
||||
types.Add(MediaType.BluRay);
|
||||
types.Add(MediaType.CDROM); // TODO: Confirm this
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation4:
|
||||
types.Add(MediaType.BluRay);
|
||||
break;
|
||||
case KnownSystem.SonyPlayStationPortable:
|
||||
types.Add(MediaType.UMD);
|
||||
types.Add(MediaType.DVD); // TODO: Confirm this
|
||||
break;
|
||||
case KnownSystem.VMLabsNuon:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.VTechVFlashVSmilePro:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.ZAPiTGamesGameWaveFamilyEntertainmentSystem:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Computers
|
||||
|
||||
case KnownSystem.AcornArchimedes:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.AppleMacintosh:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
types.Add(MediaType.FloppyDisk);
|
||||
break;
|
||||
case KnownSystem.CommodoreAmigaCD:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.FujitsuFMTowns:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.IBMPCCompatible:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
types.Add(MediaType.FloppyDisk);
|
||||
break;
|
||||
case KnownSystem.NECPC88:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.NECPC98:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.SharpX68000:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Arcade
|
||||
|
||||
case KnownSystem.AmigaCUBOCD32:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.AmericanLaserGames3DO:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.Atari3DO:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.Atronic:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.AUSCOMSystem1:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.BallyGameMagic:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.CapcomCPSystemIII:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.GlobalVRVarious:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.GlobalVRVortek:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.GlobalVRVortekV3:
|
||||
types.Add(MediaType.DVD); // TODO: Confirm
|
||||
break;
|
||||
case KnownSystem.ICEPCHardware:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.IncredibleTechnologiesEagle:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.IncredibleTechnologiesVarious:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.KonamieAmusement:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.KonamiFirebeat:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.KonamiGVSystem:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.KonamiM2:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.KonamiPython:
|
||||
types.Add(MediaType.DVD); // TODO: Confirm
|
||||
break;
|
||||
case KnownSystem.KonamiPython2:
|
||||
types.Add(MediaType.DVD); // TODO: Confirm
|
||||
break;
|
||||
case KnownSystem.KonamiSystem573:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.KonamiTwinkle:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.KonamiVarious:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.MeritIndustriesBoardwalk:
|
||||
types.Add(MediaType.CDROM); // TODO: Confirm
|
||||
break;
|
||||
case KnownSystem.MeritIndustriesMegaTouchAurora:
|
||||
types.Add(MediaType.CDROM); // TODO: Confirm
|
||||
break;
|
||||
case KnownSystem.MeritIndustriesMegaTouchForce:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.MeritIndustriesMegaTouchION:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.MeritIndustriesMegaTouchMaxx:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.MeritIndustriesMegaTouchXL:
|
||||
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.CDROM);
|
||||
break;
|
||||
case KnownSystem.NamcoSystem357:
|
||||
types.Add(MediaType.DVD);
|
||||
types.Add(MediaType.BluRay);
|
||||
break;
|
||||
case KnownSystem.NewJatreCDi:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.NichibutsuHighRateSystem:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.NichibutsuSuperCD:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.NichibutsuXRateSystem:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.PhotoPlayVarious:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.RawThrillsVarious:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.SegaChihiro:
|
||||
types.Add(MediaType.GDROM);
|
||||
break;
|
||||
case KnownSystem.SegaEuropaR:
|
||||
types.Add(MediaType.DVD); // TODO: Confirm
|
||||
break;
|
||||
case KnownSystem.SegaLindbergh:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.SegaNaomi:
|
||||
types.Add(MediaType.GDROM);
|
||||
break;
|
||||
case KnownSystem.SegaNaomi2:
|
||||
types.Add(MediaType.GDROM);
|
||||
break;
|
||||
case KnownSystem.SegaNu:
|
||||
types.Add(MediaType.DVD);
|
||||
types.Add(MediaType.BluRay);
|
||||
break;
|
||||
case KnownSystem.SegaRingEdge:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.SegaRingEdge2:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.SegaRingWide:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.SegaTitanVideo:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.SegaSystem32:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.SeibuCATSSystem:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.TABAustriaQuizard:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.TandyMemorexVisualInformationSystem:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.TsunamiTsuMoMultiGameMotionSystem:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Others
|
||||
|
||||
case KnownSystem.AudioCD:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.BDVideo:
|
||||
types.Add(MediaType.BluRay);
|
||||
break;
|
||||
case KnownSystem.DVDVideo:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.EnhancedCD:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.EnhancedDVD:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.EnhancedBD:
|
||||
types.Add(MediaType.BluRay);
|
||||
break;
|
||||
case KnownSystem.HDDVDVideo:
|
||||
types.Add(MediaType.HDDVD);
|
||||
break;
|
||||
case KnownSystem.PalmOS:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.PhilipsCDiDigitalVideo:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.PhotoCD:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.PlayStationGameSharkUpdates:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.RainbowDisc:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.TaoiKTV:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.TomyKissSite:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
case KnownSystem.VideoCD:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
#endregion
|
||||
|
||||
case KnownSystem.NONE:
|
||||
default:
|
||||
types.Add(MediaType.NONE);
|
||||
break;
|
||||
}
|
||||
|
||||
return types;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a list of systems
|
||||
/// </summary>
|
||||
/// <returns>KnownSystems, if possible</returns>
|
||||
public static List<KnownSystem?> CreateListOfSystems()
|
||||
{
|
||||
return Enum.GetValues(typeof(KnownSystem))
|
||||
.OfType<KnownSystem?>()
|
||||
.Where(s => !s.IsMarker() && s != KnownSystem.NONE)
|
||||
.ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a list of active drives matched to their volume labels
|
||||
/// </summary>
|
||||
/// <returns>Active drives, matched to labels, if possible</returns>
|
||||
/// <remarks>
|
||||
/// https://stackoverflow.com/questions/3060796/how-to-distinguish-between-usb-and-floppy-devices?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa
|
||||
/// https://msdn.microsoft.com/en-us/library/aa394173(v=vs.85).aspx
|
||||
/// </remarks>
|
||||
public static List<Drive> CreateListOfDrives()
|
||||
{
|
||||
var drives = new List<Drive>();
|
||||
|
||||
// Get the floppy drives
|
||||
try
|
||||
{
|
||||
ManagementObjectSearcher searcher =
|
||||
new ManagementObjectSearcher("root\\CIMV2",
|
||||
"SELECT * FROM Win32_LogicalDisk");
|
||||
|
||||
var collection = searcher.Get();
|
||||
foreach (ManagementObject queryObj in collection)
|
||||
{
|
||||
uint? mediaType = (uint?)queryObj["MediaType"];
|
||||
if (mediaType != null && ((mediaType > 0 && mediaType < 11) || (mediaType > 12 && mediaType < 22)))
|
||||
{
|
||||
char devId = queryObj["DeviceID"].ToString()[0];
|
||||
drives.Add(Drive.Floppy(devId));
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// No-op
|
||||
}
|
||||
|
||||
// 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 : Template.DiscNotDetected), d.IsReady))
|
||||
.ToList();
|
||||
|
||||
// Add the two lists together and order
|
||||
drives.AddRange(discDrives);
|
||||
drives = drives.OrderBy(i => i.Letter).ToList();
|
||||
|
||||
return drives;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the current disc type from drive letter
|
||||
/// </summary>
|
||||
/// <param name="driveLetter"></param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// https://stackoverflow.com/questions/11420365/detecting-if-disc-is-in-dvd-drive
|
||||
/// </remarks>
|
||||
public static MediaType? GetDiscType(char? driveLetter)
|
||||
{
|
||||
// Get the DeviceID from the current drive letter
|
||||
string deviceId = null;
|
||||
try
|
||||
{
|
||||
ManagementObjectSearcher searcher =
|
||||
new ManagementObjectSearcher("root\\CIMV2",
|
||||
"SELECT * FROM Win32_CDROMDrive WHERE Id = '" + driveLetter + ":\'");
|
||||
|
||||
var collection = searcher.Get();
|
||||
foreach (ManagementObject queryObj in collection)
|
||||
{
|
||||
deviceId = (string)queryObj["DeviceID"];
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the error was
|
||||
return null;
|
||||
}
|
||||
|
||||
// If we got no valid device, we don't care and just return
|
||||
if (deviceId == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Get all relevant disc information
|
||||
try
|
||||
{
|
||||
MsftDiscMaster2 discMaster = new MsftDiscMaster2();
|
||||
deviceId = deviceId.ToLower().Replace('\\', '#');
|
||||
string id = null;
|
||||
foreach (var disc in discMaster)
|
||||
{
|
||||
if (disc.ToString().Contains(deviceId))
|
||||
{
|
||||
id = disc.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
// If we couldn't find the drive, we don't care and return
|
||||
if (id == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Otherwise, we get the media type, if any
|
||||
MsftDiscRecorder2 recorder = new MsftDiscRecorder2();
|
||||
recorder.InitializeDiscRecorder(id);
|
||||
MsftDiscFormat2Data dataWriter = new MsftDiscFormat2Data();
|
||||
dataWriter.Recorder = recorder;
|
||||
var media = dataWriter.CurrentPhysicalMediaType;
|
||||
if (media != IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_UNKNOWN)
|
||||
{
|
||||
return Converters.IMAPIDiskTypeToMediaType(media);
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the error is
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verify that, given a system and a media type, they are correct
|
||||
/// </summary>
|
||||
public static Result GetSupportStatus(KnownSystem? system, MediaType? type)
|
||||
{
|
||||
// No system chosen, update status
|
||||
if (system == KnownSystem.NONE)
|
||||
return Result.Failure("Please select a valid system");
|
||||
|
||||
// If we're on an unsupported type, update the status accordingly
|
||||
switch (type)
|
||||
{
|
||||
// Fully supported types
|
||||
case MediaType.CDROM:
|
||||
case MediaType.DVD:
|
||||
case MediaType.HDDVD:
|
||||
case MediaType.BluRay:
|
||||
return Result.Success("{0} ready to dump", type.Name());
|
||||
|
||||
// Partially supported types
|
||||
case MediaType.GDROM:
|
||||
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.NintendoWiiUOpticalDisc:
|
||||
case MediaType.CED:
|
||||
case MediaType.Cartridge:
|
||||
case MediaType.Cassette:
|
||||
return Result.Failure("{0} discs are not supported for dumping", type.Name());
|
||||
|
||||
// Invalid or unknown types
|
||||
case MediaType.NONE:
|
||||
default:
|
||||
return Result.Failure("Please select a valid disc type");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Run protection scan on a given dump environment
|
||||
/// </summary>
|
||||
/// <param name="env">DumpEnvirionment containing all required information</param>
|
||||
/// <returns>Copy protection detected in the envirionment, if any</returns>
|
||||
public static async Task<string> RunProtectionScanOnPath(string path)
|
||||
{
|
||||
try
|
||||
{
|
||||
var found = await Task.Run(() =>
|
||||
{
|
||||
return ProtectionFind.Scan(path);
|
||||
});
|
||||
|
||||
if (found == null || found.Count == 0)
|
||||
return "None found";
|
||||
|
||||
return string.Join("\n", found.Select(kvp => kvp.Key + ": " + kvp.Value).ToArray());
|
||||
}
|
||||
catch
|
||||
{
|
||||
return "Disc could not be scanned!";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
DICUI.Library/mspack.dll
Normal file
BIN
DICUI.Library/mspack.dll
Normal file
Binary file not shown.
8
DICUI.Library/packages.config
Normal file
8
DICUI.Library/packages.config
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="BurnOutSharp" version="1.3.7.1" targetFramework="net461" />
|
||||
<package id="LessIO" version="0.5.0" targetFramework="net461" />
|
||||
<package id="libmspack4n" version="0.8.0" targetFramework="net461" />
|
||||
<package id="UnshieldSharp" version="1.4.2.2" targetFramework="net461" />
|
||||
<package id="zlib.net" version="1.0.4.0" targetFramework="net461" />
|
||||
</packages>
|
||||
111
DICUI.Test/DICUI.Test.csproj
Normal file
111
DICUI.Test/DICUI.Test.csproj
Normal file
@@ -0,0 +1,111 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="..\packages\Microsoft.NET.Test.Sdk.15.8.0\build\net45\Microsoft.Net.Test.Sdk.props" Condition="Exists('..\packages\Microsoft.NET.Test.Sdk.15.8.0\build\net45\Microsoft.Net.Test.Sdk.props')" />
|
||||
<Import Project="..\packages\Microsoft.CodeCoverage.15.8.0\build\netstandard1.0\Microsoft.CodeCoverage.props" Condition="Exists('..\packages\Microsoft.CodeCoverage.15.8.0\build\netstandard1.0\Microsoft.CodeCoverage.props')" />
|
||||
<Import Project="..\packages\xunit.runner.visualstudio.2.3.1\build\net20\xunit.runner.visualstudio.props" Condition="Exists('..\packages\xunit.runner.visualstudio.2.3.1\build\net20\xunit.runner.visualstudio.props')" />
|
||||
<Import Project="..\packages\xunit.runner.console.2.3.1\build\xunit.runner.console.props" Condition="Exists('..\packages\xunit.runner.console.2.3.1\build\xunit.runner.console.props')" />
|
||||
<Import Project="..\packages\xunit.core.2.3.1\build\xunit.core.props" Condition="Exists('..\packages\xunit.core.2.3.1\build\xunit.core.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{7CC064D2-38AB-4A05-8519-28660DE4562A}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>DICUI.Test</RootNamespace>
|
||||
<AssemblyName>DICUI.Test</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<VisualStudioVersion Condition="'$(VisualStudioVersion)' == ''">15.0</VisualStudioVersion>
|
||||
<VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
|
||||
<ReferencePath>$(ProgramFiles)\Common Files\microsoft shared\VSTT\$(VisualStudioVersion)\UITestExtensionPackages</ReferencePath>
|
||||
<IsCodedUITest>False</IsCodedUITest>
|
||||
<TestProjectType>UnitTest</TestProjectType>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</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="Microsoft.VisualStudio.CodeCoverage.Shim, Version=15.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.CodeCoverage.15.8.0\lib\net45\Microsoft.VisualStudio.CodeCoverage.Shim.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="xunit.abstractions, Version=2.0.0.0, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\xunit.abstractions.2.0.1\lib\net35\xunit.abstractions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="xunit.assert, Version=2.3.1.3858, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\xunit.assert.2.3.1\lib\netstandard1.1\xunit.assert.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="xunit.core, Version=2.3.1.3858, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\xunit.extensibility.core.2.3.1\lib\netstandard1.1\xunit.core.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="xunit.execution.desktop, Version=2.3.1.3858, Culture=neutral, PublicKeyToken=8d05b1bb7a6fdb6c, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\xunit.extensibility.execution.2.3.1\lib\net452\xunit.execution.desktop.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="UI\AllowedSpeedsTest.cs" />
|
||||
<Compile Include="Utilities\DICFlagExtensionsTest.cs" />
|
||||
<Compile Include="Utilities\DumpEnvironmentTest.cs" />
|
||||
<Compile Include="ResultTest.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="Utilities\DriveTest.cs" />
|
||||
<Compile Include="Utilities\ConvertersTest.cs" />
|
||||
<Compile Include="Utilities\DICCommandExtensionsTest.cs" />
|
||||
<Compile Include="Utilities\KnownSystemExtensionsTest.cs" />
|
||||
<Compile Include="Utilities\MediaTypeExtensionsTest.cs" />
|
||||
<Compile Include="Utilities\ParametersTest.cs" />
|
||||
<Compile Include="Utilities\ValidatorsTest.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<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>
|
||||
<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">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\xunit.core.2.3.1\build\xunit.core.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.3.1\build\xunit.core.props'))" />
|
||||
<Error Condition="!Exists('..\packages\xunit.core.2.3.1\build\xunit.core.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.core.2.3.1\build\xunit.core.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\xunit.runner.console.2.3.1\build\xunit.runner.console.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.console.2.3.1\build\xunit.runner.console.props'))" />
|
||||
<Error Condition="!Exists('..\packages\xunit.runner.visualstudio.2.3.1\build\net20\xunit.runner.visualstudio.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\xunit.runner.visualstudio.2.3.1\build\net20\xunit.runner.visualstudio.props'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.CodeCoverage.15.8.0\build\netstandard1.0\Microsoft.CodeCoverage.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeCoverage.15.8.0\build\netstandard1.0\Microsoft.CodeCoverage.props'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.CodeCoverage.15.8.0\build\netstandard1.0\Microsoft.CodeCoverage.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.CodeCoverage.15.8.0\build\netstandard1.0\Microsoft.CodeCoverage.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.NET.Test.Sdk.15.8.0\build\net45\Microsoft.Net.Test.Sdk.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.NET.Test.Sdk.15.8.0\build\net45\Microsoft.Net.Test.Sdk.props'))" />
|
||||
<Error Condition="!Exists('..\packages\Microsoft.NET.Test.Sdk.15.8.0\build\net45\Microsoft.Net.Test.Sdk.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Microsoft.NET.Test.Sdk.15.8.0\build\net45\Microsoft.Net.Test.Sdk.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\xunit.core.2.3.1\build\xunit.core.targets" Condition="Exists('..\packages\xunit.core.2.3.1\build\xunit.core.targets')" />
|
||||
<Import Project="..\packages\Microsoft.CodeCoverage.15.8.0\build\netstandard1.0\Microsoft.CodeCoverage.targets" Condition="Exists('..\packages\Microsoft.CodeCoverage.15.8.0\build\netstandard1.0\Microsoft.CodeCoverage.targets')" />
|
||||
<Import Project="..\packages\Microsoft.NET.Test.Sdk.15.8.0\build\net45\Microsoft.Net.Test.Sdk.targets" Condition="Exists('..\packages\Microsoft.NET.Test.Sdk.15.8.0\build\net45\Microsoft.Net.Test.Sdk.targets')" />
|
||||
</Project>
|
||||
20
DICUI.Test/Properties/AssemblyInfo.cs
Normal file
20
DICUI.Test/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
[assembly: AssemblyTitle("DICUI.Test")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("DICUI.Test")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
[assembly: Guid("7cc064d2-38ab-4a05-8519-28660de4562a")]
|
||||
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
40
DICUI.Test/ResultTest.cs
Normal file
40
DICUI.Test/ResultTest.cs
Normal file
@@ -0,0 +1,40 @@
|
||||
using DICUI.Utilities;
|
||||
using Xunit;
|
||||
|
||||
namespace DICUI.Test
|
||||
{
|
||||
public class ResultTest
|
||||
{
|
||||
[Fact]
|
||||
public void ResultSuccessTest()
|
||||
{
|
||||
Result actual = Result.Success();
|
||||
Assert.Empty(actual.Message);
|
||||
|
||||
string message = "Success!";
|
||||
actual = Result.Success(message);
|
||||
Assert.Equal(message, actual.Message);
|
||||
|
||||
message = "Success! {0}";
|
||||
string parameter = "Parameter";
|
||||
actual = Result.Success(message, parameter);
|
||||
Assert.Equal(string.Format(message, parameter), actual.Message);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ResultFailureTest()
|
||||
{
|
||||
Result actual = Result.Failure();
|
||||
Assert.Empty(actual.Message);
|
||||
|
||||
string message = "Failure!";
|
||||
actual = Result.Failure(message);
|
||||
Assert.Equal(message, actual.Message);
|
||||
|
||||
message = "Failure! {0}";
|
||||
string parameter = "Parameter";
|
||||
actual = Result.Failure(message, parameter);
|
||||
Assert.Equal(string.Format(message, parameter), actual.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
21
DICUI.Test/UI/AllowedSpeedsTest.cs
Normal file
21
DICUI.Test/UI/AllowedSpeedsTest.cs
Normal file
@@ -0,0 +1,21 @@
|
||||
using System.Linq;
|
||||
using DICUI.Data;
|
||||
using Xunit;
|
||||
|
||||
namespace DICUI.Test.Data
|
||||
{
|
||||
public class UIElementsTest
|
||||
{
|
||||
[Theory]
|
||||
[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 = Constants.GetSpeedsForMediaType(mediaType);
|
||||
Assert.Equal(maxExpected, actual.Last());
|
||||
}
|
||||
}
|
||||
}
|
||||
126
DICUI.Test/Utilities/ConvertersTest.cs
Normal file
126
DICUI.Test/Utilities/ConvertersTest.cs
Normal file
@@ -0,0 +1,126 @@
|
||||
using System;
|
||||
using DICUI.Data;
|
||||
using DICUI.Utilities;
|
||||
using Xunit;
|
||||
|
||||
namespace DICUI.Test.Utilities
|
||||
{
|
||||
public class ConvertersTest
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(DICCommand.Audio, MediaType.CDROM)]
|
||||
[InlineData(DICCommand.BluRay, MediaType.BluRay)]
|
||||
[InlineData(DICCommand.Close, null)]
|
||||
[InlineData(DICCommand.CompactDisc, MediaType.CDROM)]
|
||||
[InlineData(DICCommand.Data, MediaType.CDROM)]
|
||||
[InlineData(DICCommand.DigitalVideoDisc, MediaType.DVD)]
|
||||
[InlineData(DICCommand.Eject, null)]
|
||||
[InlineData(DICCommand.Floppy, MediaType.FloppyDisk)]
|
||||
[InlineData(DICCommand.GDROM, MediaType.GDROM)]
|
||||
[InlineData(DICCommand.MDS, null)]
|
||||
[InlineData(DICCommand.Reset, null)]
|
||||
[InlineData(DICCommand.Start, null)]
|
||||
[InlineData(DICCommand.Stop, null)]
|
||||
[InlineData(DICCommand.Sub, null)]
|
||||
[InlineData(DICCommand.Swap, MediaType.GDROM)]
|
||||
[InlineData(DICCommand.XBOX, MediaType.DVD)]
|
||||
public void BaseCommandToMediaTypeTest(DICCommand command, MediaType? expected)
|
||||
{
|
||||
MediaType? actual = Converters.BaseCommmandToMediaType(command);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(DICCommand.Audio, KnownSystem.AudioCD)]
|
||||
[InlineData(DICCommand.BluRay, KnownSystem.SonyPlayStation3)]
|
||||
[InlineData(DICCommand.Close, null)]
|
||||
[InlineData(DICCommand.CompactDisc, KnownSystem.IBMPCCompatible)]
|
||||
[InlineData(DICCommand.Data, KnownSystem.IBMPCCompatible)]
|
||||
[InlineData(DICCommand.DigitalVideoDisc, KnownSystem.IBMPCCompatible)]
|
||||
[InlineData(DICCommand.Eject, null)]
|
||||
[InlineData(DICCommand.Floppy, KnownSystem.IBMPCCompatible)]
|
||||
[InlineData(DICCommand.GDROM, KnownSystem.SegaDreamcast)]
|
||||
[InlineData(DICCommand.MDS, null)]
|
||||
[InlineData(DICCommand.Reset, null)]
|
||||
[InlineData(DICCommand.Start, null)]
|
||||
[InlineData(DICCommand.Stop, null)]
|
||||
[InlineData(DICCommand.Sub, null)]
|
||||
[InlineData(DICCommand.Swap, KnownSystem.SegaDreamcast)]
|
||||
[InlineData(DICCommand.XBOX, KnownSystem.MicrosoftXBOX)]
|
||||
public void BaseCommandToKnownSystemTest(DICCommand command, KnownSystem? expected)
|
||||
{
|
||||
KnownSystem? actual = Converters.BaseCommandToKnownSystem(command);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(MediaType.CDROM, ".bin")]
|
||||
[InlineData(MediaType.DVD, ".iso")]
|
||||
[InlineData(MediaType.LaserDisc, ".raw")]
|
||||
[InlineData(MediaType.NintendoWiiUOpticalDisc, ".wud")]
|
||||
[InlineData(MediaType.FloppyDisk, ".img")]
|
||||
[InlineData(MediaType.Cassette, ".wav")]
|
||||
[InlineData(MediaType.NONE, null)]
|
||||
public void MediaTypeToExtensionTest(MediaType? mediaType, string expected)
|
||||
{
|
||||
string actual = Converters.MediaTypeToExtension(mediaType);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(MediaType.CDROM, "CD-ROM")]
|
||||
[InlineData(MediaType.LaserDisc, "LD-ROM / LV-ROM")]
|
||||
[InlineData(MediaType.NONE, "Unknown")]
|
||||
public void MediaTypeToStringTest(MediaType? mediaType, string expected)
|
||||
{
|
||||
string actual = Converters.MediaTypeToString(mediaType);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(KnownSystem.MicrosoftXBOX, "Microsoft XBOX")]
|
||||
[InlineData(KnownSystem.NECPC88, "NEC PC-88")]
|
||||
[InlineData(KnownSystem.KonamiPython, "Konami Python")]
|
||||
[InlineData(KnownSystem.HDDVDVideo, "HD-DVD-Video")]
|
||||
[InlineData(KnownSystem.NONE, "Unknown")]
|
||||
public void KnownSystemToStringTest(KnownSystem? knownSystem, string expected)
|
||||
{
|
||||
string actual = Converters.KnownSystemToString(knownSystem);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void KnownSystemHasValidCategory()
|
||||
{
|
||||
var values = Validators.CreateListOfSystems();
|
||||
KnownSystem[] markers = { KnownSystem.MarkerArcadeEnd, KnownSystem.MarkerConsoleEnd, KnownSystem.MarkerComputerEnd, KnownSystem.MarkerOtherEnd };
|
||||
|
||||
values.ForEach(system => {
|
||||
if (system == KnownSystem.NONE)
|
||||
return;
|
||||
|
||||
// we check that the category is the first category value higher than the system
|
||||
KnownSystemCategory category = ((KnownSystem?)system).Category();
|
||||
KnownSystem marker = KnownSystem.NONE;
|
||||
|
||||
switch (category)
|
||||
{
|
||||
case KnownSystemCategory.Arcade: marker = KnownSystem.MarkerArcadeEnd; break;
|
||||
case KnownSystemCategory.Console: marker = KnownSystem.MarkerConsoleEnd; break;
|
||||
case KnownSystemCategory.Computer: marker = KnownSystem.MarkerComputerEnd; break;
|
||||
case KnownSystemCategory.Other: marker = KnownSystem.MarkerOtherEnd; break;
|
||||
}
|
||||
|
||||
Assert.NotEqual(KnownSystem.NONE, marker);
|
||||
Assert.True(marker > system);
|
||||
|
||||
Array.ForEach(markers, mmarker =>
|
||||
{
|
||||
// a marker can be the same of the found one, or one of a category before or a category after but never in the middle between
|
||||
// the system and the mapped category
|
||||
Assert.True(mmarker == marker || mmarker < system || mmarker > marker);
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
23
DICUI.Test/Utilities/DICCommandExtensionsTest.cs
Normal file
23
DICUI.Test/Utilities/DICCommandExtensionsTest.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using DICUI.Data;
|
||||
using DICUI.Utilities;
|
||||
using Xunit;
|
||||
|
||||
namespace DICUI.Test.Utilities
|
||||
{
|
||||
public class DICCommandExtensionsTest
|
||||
{
|
||||
[Fact]
|
||||
public void NameTest()
|
||||
{
|
||||
var values = (DICCommand[])Enum.GetValues(typeof(DICCommand));
|
||||
foreach(var command in values)
|
||||
{
|
||||
string expected = Converters.DICCommandToString(command);
|
||||
string actual = command.Name();
|
||||
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
23
DICUI.Test/Utilities/DICFlagExtensionsTest.cs
Normal file
23
DICUI.Test/Utilities/DICFlagExtensionsTest.cs
Normal file
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using DICUI.Data;
|
||||
using DICUI.Utilities;
|
||||
using Xunit;
|
||||
|
||||
namespace DICUI.Test.Utilities
|
||||
{
|
||||
public class DICFlagExtensionsTest
|
||||
{
|
||||
[Fact]
|
||||
public void NameTest()
|
||||
{
|
||||
var values = (DICFlag[])Enum.GetValues(typeof(DICFlag));
|
||||
foreach(var command in values)
|
||||
{
|
||||
string expected = Converters.DICFlagToString(command);
|
||||
string actual = command.Name();
|
||||
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
15
DICUI.Test/Utilities/DriveTest.cs
Normal file
15
DICUI.Test/Utilities/DriveTest.cs
Normal file
@@ -0,0 +1,15 @@
|
||||
using DICUI.Utilities;
|
||||
using Xunit;
|
||||
|
||||
namespace DICUI.Test.Utilities
|
||||
{
|
||||
public class DriveTest
|
||||
{
|
||||
[Fact]
|
||||
public void DriveConstructorsTest()
|
||||
{
|
||||
Assert.True(Drive.Floppy('a').IsFloppy);
|
||||
Assert.False(Drive.Optical('d', "test", true).IsFloppy);
|
||||
}
|
||||
}
|
||||
}
|
||||
126
DICUI.Test/Utilities/DumpEnvironmentTest.cs
Normal file
126
DICUI.Test/Utilities/DumpEnvironmentTest.cs
Normal file
@@ -0,0 +1,126 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using DICUI.Data;
|
||||
using DICUI.Utilities;
|
||||
using Xunit;
|
||||
|
||||
namespace DICUI.Test
|
||||
{
|
||||
public class DumpEnvironmentTest
|
||||
{
|
||||
[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.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)
|
||||
{
|
||||
var env = new DumpEnvironment
|
||||
{
|
||||
DICParameters = new Parameters(parameters),
|
||||
Drive = isFloppy ? Drive.Floppy(letter) : Drive.Optical(letter, "", true),
|
||||
Type = mediaType,
|
||||
};
|
||||
|
||||
bool actual = env.ParametersValid();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null, null, null, null)]
|
||||
[InlineData(" ", "", " ", "")]
|
||||
[InlineData("super", "blah.bin", "super", "blah.bin")]
|
||||
[InlineData("super\\hero", "blah.bin", "super\\hero", "blah.bin")]
|
||||
[InlineData("super.hero", "blah.bin", "super_hero", "blah.bin")]
|
||||
[InlineData("superhero", "blah.rev.bin", "superhero", "blah_rev.bin")]
|
||||
[InlineData("super&hero", "blah.bin", "super_hero", "blah.bin")]
|
||||
[InlineData("superhero", "blah&foo.bin", "superhero", "blah_foo.bin")]
|
||||
public void FixOutputPathsTest(string outputDirectory, string outputFilename, string expectedOutputDirectory, string expectedOutputFilename)
|
||||
{
|
||||
var env = new DumpEnvironment
|
||||
{
|
||||
OutputDirectory = outputDirectory,
|
||||
OutputFilename = outputFilename,
|
||||
};
|
||||
|
||||
env.FixOutputPaths();
|
||||
Assert.Equal(expectedOutputDirectory, env.OutputDirectory);
|
||||
Assert.Equal(expectedOutputFilename, env.OutputFilename);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetFirstTrackTest()
|
||||
{
|
||||
// TODO: Implement
|
||||
Assert.True(true);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(MediaType.CDROM)]
|
||||
[InlineData(MediaType.DVD)]
|
||||
[InlineData(MediaType.FloppyDisk)]
|
||||
[InlineData(MediaType.LaserDisc)]
|
||||
public void FoundAllFilesTest(MediaType? mediaType)
|
||||
{
|
||||
// TODO: Implement
|
||||
// TODO: Get sample output data for each of the major types
|
||||
Assert.True(true);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[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)]
|
||||
[InlineData(KnownSystem.SonyPlayStation2, MediaType.DVD)]
|
||||
[InlineData(KnownSystem.BDVideo, MediaType.BluRay)]
|
||||
[InlineData(KnownSystem.AUSCOMSystem1, MediaType.Cassette)]
|
||||
public void ExtractOutputInformation(KnownSystem? knownSystem, MediaType? mediaType)
|
||||
{
|
||||
// TODO: Implement
|
||||
// TODO: Get sample output data for each of the major types
|
||||
Assert.True(true);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void FormatOutputDataTest()
|
||||
{
|
||||
// TODO: Implement
|
||||
Assert.True(true);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WriteOutputDataTest()
|
||||
{
|
||||
// TODO: Implement
|
||||
Assert.True(true);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EjectDiscTest()
|
||||
{
|
||||
// TODO: Implement
|
||||
Assert.True(true);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CancelDumpingTest()
|
||||
{
|
||||
// TODO: Implement
|
||||
Assert.True(true);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void StartDumpingTest()
|
||||
{
|
||||
// TODO: Implement
|
||||
Assert.True(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
49
DICUI.Test/Utilities/KnownSystemExtensionsTest.cs
Normal file
49
DICUI.Test/Utilities/KnownSystemExtensionsTest.cs
Normal file
@@ -0,0 +1,49 @@
|
||||
using System;
|
||||
using DICUI.Data;
|
||||
using DICUI.Utilities;
|
||||
using Xunit;
|
||||
|
||||
namespace DICUI.Test.Utilities
|
||||
{
|
||||
public class KnownSystemExtensionsTest
|
||||
{
|
||||
[Fact]
|
||||
public void NameTest()
|
||||
{
|
||||
var values = (KnownSystem[])Enum.GetValues(typeof(KnownSystem));
|
||||
foreach(var system in values)
|
||||
{
|
||||
string expected = Converters.KnownSystemToString(system);
|
||||
string actual = ((KnownSystem?)system).Name();
|
||||
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IsMarkerTest()
|
||||
{
|
||||
var values = (KnownSystem[])Enum.GetValues(typeof(KnownSystem));
|
||||
foreach(var system in values)
|
||||
{
|
||||
bool expected = system == KnownSystem.MarkerArcadeEnd || system == KnownSystem.MarkerComputerEnd ||
|
||||
system == KnownSystem.MarkerOtherEnd || system == KnownSystem.MarkerConsoleEnd;
|
||||
|
||||
bool actual = ((KnownSystem?)system).IsMarker();
|
||||
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CategoryNameNotEmptyTest()
|
||||
{
|
||||
var values = (KnownSystemCategory[])Enum.GetValues(typeof(KnownSystemCategory));
|
||||
foreach (var system in values)
|
||||
{
|
||||
string actual = ((KnownSystem?)system).Name();
|
||||
Assert.NotEqual("", actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
48
DICUI.Test/Utilities/MediaTypeExtensionsTest.cs
Normal file
48
DICUI.Test/Utilities/MediaTypeExtensionsTest.cs
Normal file
@@ -0,0 +1,48 @@
|
||||
using DICUI.Data;
|
||||
using DICUI.Utilities;
|
||||
using Xunit;
|
||||
|
||||
namespace DICUI.Test.Utilities
|
||||
{
|
||||
public class MediaTypeExtensionsTest
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(MediaType.CDROM)]
|
||||
[InlineData(MediaType.LaserDisc)]
|
||||
[InlineData(MediaType.NONE)]
|
||||
public void NameTest(MediaType? mediaType)
|
||||
{
|
||||
string expected = Converters.MediaTypeToString(mediaType);
|
||||
string actual = mediaType.Name();
|
||||
|
||||
Assert.NotNull(actual);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(MediaType.CDROM)]
|
||||
[InlineData(MediaType.DVD)]
|
||||
[InlineData(MediaType.LaserDisc)]
|
||||
[InlineData(MediaType.FloppyDisk)]
|
||||
[InlineData(MediaType.NONE)]
|
||||
public void ExtensionTest(MediaType? mediaType)
|
||||
{
|
||||
string expected = Converters.MediaTypeToExtension(mediaType);
|
||||
string actual = mediaType.Extension();
|
||||
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(MediaType.CDROM, true)]
|
||||
[InlineData(MediaType.DVD, true)]
|
||||
[InlineData(MediaType.FloppyDisk, false)]
|
||||
[InlineData(MediaType.BluRay, true)]
|
||||
[InlineData(MediaType.LaserDisc, false)]
|
||||
public void DriveSpeedSupportedTest(MediaType? mediaType, bool expected)
|
||||
{
|
||||
bool actual = mediaType.DoesSupportDriveSpeed();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
85
DICUI.Test/Utilities/ParametersTest.cs
Normal file
85
DICUI.Test/Utilities/ParametersTest.cs
Normal file
@@ -0,0 +1,85 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using DICUI.Data;
|
||||
using DICUI.Utilities;
|
||||
using Xunit;
|
||||
|
||||
namespace DICUI.Test.Utilities
|
||||
{
|
||||
public class ParametersTest
|
||||
{
|
||||
[Theory]
|
||||
[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.FloppyDisk, DICCommand.Floppy)]
|
||||
[InlineData(KnownSystem.RawThrillsVarious, MediaType.GDROM, DICCommand.NONE)]
|
||||
public void ParametersFromSystemAndTypeTest(KnownSystem? knownSystem, MediaType? mediaType, DICCommand expected)
|
||||
{
|
||||
Parameters actual = new Parameters(knownSystem, mediaType, 'D', "disc.bin", 16, true, -1);
|
||||
Assert.Equal(expected, actual.Command);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(KnownSystem.AppleMacintosh, MediaType.LaserDisc, true, 20, null, null)]
|
||||
[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.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[] { })]
|
||||
[InlineData(KnownSystem.HDDVDVideo, MediaType.HDDVD, false, 500, null, new DICFlag[] { })]
|
||||
/* reread c2 */
|
||||
[InlineData(KnownSystem.SegaDreamcast, MediaType.GDROM, false, 1000, null, new DICFlag[] { DICFlag.C2Opcode })]
|
||||
[InlineData(KnownSystem.SegaDreamcast, MediaType.GDROM, false, -1, null, new DICFlag[] { DICFlag.C2Opcode })]
|
||||
|
||||
public void ParametersFromOptionsTest(KnownSystem? knownSystem, MediaType? mediaType, bool paranoid, int rereadC2, int? subchannelLevel, DICFlag[] expected)
|
||||
{
|
||||
Parameters actual = new Parameters(knownSystem, mediaType, 'D', "disc.bin", 16, paranoid, rereadC2);
|
||||
|
||||
HashSet<DICFlag> expectedSet = new HashSet<DICFlag>(expected ?? new DICFlag[0]);
|
||||
HashSet<DICFlag> actualSet = new HashSet<DICFlag>(actual.Keys ?? new DICFlag[0]);
|
||||
Assert.Equal(expectedSet, actualSet);
|
||||
if (rereadC2 == -1 || !Validators.GetValidMediaTypes(knownSystem).Contains(mediaType))
|
||||
Assert.Null(actual.C2OpcodeValue[0]);
|
||||
else
|
||||
Assert.Equal(rereadC2, actual.C2OpcodeValue[0]);
|
||||
Assert.Equal(subchannelLevel, actual.SubchannelReadLevelValue);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null, null, null, null, null)]
|
||||
[InlineData("", null, null, null, null)]
|
||||
[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)
|
||||
{
|
||||
Parameters actualParams = new Parameters(parameters);
|
||||
bool actual = actualParams.DetermineFlags(out MediaType? actualMediaType, out KnownSystem? actualKnownSystem, out string actualDriveLetter, out string actualPath);
|
||||
Assert.Equal(expectedMediaType, actualMediaType);
|
||||
Assert.Equal(expectedKnownSystem, actualKnownSystem);
|
||||
Assert.Equal(expectedDriveLetter, actualDriveLetter);
|
||||
Assert.Equal(expectedPath, actualPath);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null, false)]
|
||||
[InlineData("", false)]
|
||||
[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", true)]
|
||||
[InlineData("stop D", true)]
|
||||
[InlineData("ls", false)]
|
||||
public void ValidateParametersTest(string parameters, bool expected)
|
||||
{
|
||||
Parameters actual = new Parameters(parameters);
|
||||
Assert.Equal(expected, actual.IsValid());
|
||||
}
|
||||
}
|
||||
}
|
||||
45
DICUI.Test/Utilities/ValidatorsTest.cs
Normal file
45
DICUI.Test/Utilities/ValidatorsTest.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using System;
|
||||
using DICUI.Data;
|
||||
using DICUI.Utilities;
|
||||
using Xunit;
|
||||
|
||||
namespace DICUI.Test.Utilities
|
||||
{
|
||||
public class ValidatorsTest
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(KnownSystem.BandaiApplePippin, MediaType.CDROM)]
|
||||
[InlineData(KnownSystem.MicrosoftXBOX, MediaType.DVD)]
|
||||
[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)
|
||||
{
|
||||
var actual = Validators.GetValidMediaTypes(knownSystem);
|
||||
Assert.Contains(expected, actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CreateListOfSystemsTest()
|
||||
{
|
||||
int expected = Enum.GetValues(typeof(KnownSystem)).Length - 5; // - 4 -1 for markers categories and KnownSystem.NONE
|
||||
var actual = Validators.CreateListOfSystems();
|
||||
Assert.Equal(expected, actual.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void CreateListOfDrivesTest()
|
||||
{
|
||||
// TODO: Implement
|
||||
Assert.True(true);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void GetDiscTypeTest()
|
||||
{
|
||||
// TODO: Implement
|
||||
Assert.True(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
14
DICUI.Test/packages.config
Normal file
14
DICUI.Test/packages.config
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Microsoft.CodeCoverage" version="15.8.0" targetFramework="net461" />
|
||||
<package id="Microsoft.NET.Test.Sdk" version="15.8.0" targetFramework="net461" />
|
||||
<package id="xunit" version="2.3.1" targetFramework="net461" />
|
||||
<package id="xunit.abstractions" version="2.0.1" targetFramework="net461" />
|
||||
<package id="xunit.analyzers" version="0.10.0" targetFramework="net461" />
|
||||
<package id="xunit.assert" version="2.3.1" targetFramework="net461" />
|
||||
<package id="xunit.core" version="2.3.1" targetFramework="net461" />
|
||||
<package id="xunit.extensibility.core" version="2.3.1" targetFramework="net461" />
|
||||
<package id="xunit.extensibility.execution" version="2.3.1" targetFramework="net461" />
|
||||
<package id="xunit.runner.console" version="2.3.1" targetFramework="net461" developmentDependency="true" />
|
||||
<package id="xunit.runner.visualstudio" version="2.3.1" targetFramework="net461" developmentDependency="true" />
|
||||
</packages>
|
||||
20
DICUI.sln
20
DICUI.sln
@@ -3,7 +3,13 @@ Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27130.2036
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DICUI", "DICUI.csproj", "{7B1B75EB-8940-466F-BD51-76471A57F9BE}"
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DICUI", "DICUI\DICUI.csproj", "{7B1B75EB-8940-466F-BD51-76471A57F9BE}"
|
||||
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
|
||||
@@ -15,6 +21,18 @@ Global
|
||||
{7B1B75EB-8940-466F-BD51-76471A57F9BE}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7B1B75EB-8940-466F-BD51-76471A57F9BE}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7B1B75EB-8940-466F-BD51-76471A57F9BE}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{7CC064D2-38AB-4A05-8519-28660DE4562A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{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
|
||||
|
||||
14
DICUI/App.config
Normal file
14
DICUI/App.config
Normal file
@@ -0,0 +1,14 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<appSettings>
|
||||
<add key="DICPath" value="Programs\DiscImageCreator.exe"/>
|
||||
<add key="SubDumpPath" value="subdump.exe"/>
|
||||
<add key="DefaultOutputPath" value="ISO"/>
|
||||
<add key="preferredDumpSpeedCD" value="72"/>
|
||||
<add key="preferredDumpSpeedDVD" value="24"/>
|
||||
<add key="QuietMode" value="false"/>
|
||||
<add key="RereadAmountForC2" value="20"/>
|
||||
<add key="VerboseLogging" value="true"/>
|
||||
<add key="OpenLogWindowAtStartup" value="true"/>
|
||||
</appSettings>
|
||||
</configuration>
|
||||
@@ -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>
|
||||
11
DICUI/App.xaml.cs
Normal file
11
DICUI/App.xaml.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
using System.Windows;
|
||||
|
||||
namespace DICUI
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for App.xaml
|
||||
/// </summary>
|
||||
public partial class App : Application
|
||||
{
|
||||
}
|
||||
}
|
||||
56
DICUI/Constants.cs
Normal file
56
DICUI/Constants.cs
Normal 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());
|
||||
}
|
||||
}
|
||||
@@ -39,6 +39,7 @@
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
@@ -67,14 +68,13 @@
|
||||
<PropertyGroup />
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<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>
|
||||
@@ -87,7 +87,22 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<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="Windows\OptionsWindow.xaml.cs">
|
||||
<DependentUpon>OptionsWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="KnownSystemComboBoxItem.cs" />
|
||||
<Compile Include="ViewModels.cs" />
|
||||
<Page Include="Windows\LogWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="Windows\MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
@@ -95,33 +110,19 @@
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<Compile Include="Windows\MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="Windows\OptionsWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Settings.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DependentUpon>Settings.settings</DependentUpon>
|
||||
<DesignTimeSharedInput>True</DesignTimeSharedInput>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
<None Include="Properties\Settings.settings">
|
||||
<Generator>SettingsSingleFileGenerator</Generator>
|
||||
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
@@ -141,5 +142,11 @@
|
||||
<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>
|
||||
33
DICUI/EnumDescriptionConverter.cs
Normal file
33
DICUI/EnumDescriptionConverter.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
DICUI/Icon.ico
Normal file
BIN
DICUI/Icon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 71 KiB |
35
DICUI/KnownSystemComboBoxItem.cs
Normal file
35
DICUI/KnownSystemComboBoxItem.cs
Normal 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; }
|
||||
|
||||
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/Options.cs
Normal file
97
DICUI/Options.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -51,5 +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")]
|
||||
107
DICUI/ViewModels.cs
Normal file
107
DICUI/ViewModels.cs
Normal file
@@ -0,0 +1,107 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using DICUI.Windows;
|
||||
|
||||
namespace DICUI
|
||||
{
|
||||
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.IsVisible : false;
|
||||
set
|
||||
{
|
||||
if (value)
|
||||
{
|
||||
_logWindow.AdjustPositionToMainWindow();
|
||||
_logWindow.Show();
|
||||
}
|
||||
else
|
||||
_logWindow.Hide();
|
||||
}
|
||||
}
|
||||
|
||||
public void VerboseLog(string text)
|
||||
{
|
||||
if (ViewModels.OptionsViewModel.VerboseLogging)
|
||||
_logWindow.AppendToTextBox(text, Brushes.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();
|
||||
}
|
||||
}
|
||||
54
DICUI/Windows/LogWindow.xaml
Normal file
54
DICUI/Windows/LogWindow.xaml
Normal file
@@ -0,0 +1,54 @@
|
||||
<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:local="clr-namespace:DICUI"
|
||||
xmlns:diag="clr-namespace:System.Diagnostics;assembly=WindowsBase"
|
||||
Title="Log Window" Height="350" Width="600" Closed="OnWindowClosed" Loaded="OnWindowLoaded"
|
||||
>
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="40" />
|
||||
<RowDefinition Height="*" />
|
||||
<RowDefinition Height="40" />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid Grid.Row="0" Height="22" Margin="10 10 10 0">
|
||||
<ProgressBar x:Name="progressBar" />
|
||||
<TextBlock x:Name="progressLabel" Grid.Row="0" Height="22" HorizontalAlignment="Center" VerticalAlignment="Center" Padding="0 2 0 0" />
|
||||
</Grid>
|
||||
<Border Grid.Row="1" Background="White" BorderBrush="Gainsboro" BorderThickness="1" Margin="10">
|
||||
<ScrollViewer Name="outputViewer" SizeChanged="ScrollViewer_SizeChanged">
|
||||
<RichTextBox Name="output" FontFamily="Consolas" Background="#202020" IsReadOnly="true" TextChanged="OnTextChanged" />
|
||||
</ScrollViewer>
|
||||
</Border>
|
||||
|
||||
<Grid Grid.Row="2">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition Width="4*"/>
|
||||
<ColumnDefinition />
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<CheckBox Content="Verbose" Margin="10 0 0 10" Grid.Column="0" VerticalAlignment="Center"
|
||||
ToolTip="Enable verbose logging of tasks"
|
||||
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 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" />
|
||||
<Button Margin="0 0 10 10" Grid.Column="4" Height="22" Width="60" Content="Hide" HorizontalAlignment="Right" Click="OnHideButton" />
|
||||
<Button Visibility="Hidden" Name="AbortButton" Margin="0 0 10 10" Grid.Column="2" Height="22" Width="80" Content="Abort" HorizontalAlignment="Right" Click="OnAbortButton" />
|
||||
</Grid>
|
||||
|
||||
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
385
DICUI/Windows/LogWindow.xaml.cs
Normal file
385
DICUI/Windows/LogWindow.xaml.cs
Normal file
@@ -0,0 +1,385 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
|
||||
namespace DICUI.Windows
|
||||
{
|
||||
public partial class LogWindow : Window
|
||||
{
|
||||
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 FlowDocument _document;
|
||||
private Paragraph _paragraph;
|
||||
private List<Matcher> _matchers;
|
||||
|
||||
volatile Process _process;
|
||||
|
||||
public LogWindow(MainWindow mainWindow)
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this._mainWindow = mainWindow;
|
||||
|
||||
_document = new FlowDocument();
|
||||
_paragraph = new Paragraph();
|
||||
_document.Blocks.Add(_paragraph);
|
||||
output.Document = _document;
|
||||
|
||||
_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 = percentProgress;
|
||||
progressLabel.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 = percentProgress;
|
||||
progressLabel.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 = percentProgress;
|
||||
progressLabel.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 = percentProgress;
|
||||
progressLabel.Text = string.Format("Scanning sectors for protection.. ({0:##.##}%)", percentProgress);
|
||||
}
|
||||
}));
|
||||
}
|
||||
|
||||
public void StartDump(string args)
|
||||
{
|
||||
AppendToTextBox(string.Format("Launching DIC with args: {0}\r\n", args), Brushes.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.Invoke(() => UpdateConsole(text.Data, Brushes.Red));
|
||||
_process.Start();
|
||||
|
||||
var _1 = ConsumeOutput(_process.StandardOutput, s => Dispatcher.Invoke(() => UpdateConsole(s, stdoutState)));
|
||||
var _2 = ConsumeOutput(_process.StandardError, s => Dispatcher.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;
|
||||
}
|
||||
|
||||
private void GracefullyTerminateProcess()
|
||||
{
|
||||
if (_process != null)
|
||||
{
|
||||
_process.Exited -= OnProcessExit;
|
||||
bool isForced = !_process.HasExited;
|
||||
|
||||
if (isForced)
|
||||
{
|
||||
AppendToTextBox("\r\nForcefully Killing the process\r\n", Brushes.Red);
|
||||
_process.Kill();
|
||||
_process.WaitForExit();
|
||||
}
|
||||
|
||||
AppendToTextBox(string.Format("\r\nExit Code: {0}\r\n", _process.ExitCode), _process.ExitCode == 0 ? Brushes.Green : Brushes.Red);
|
||||
|
||||
if (_process.ExitCode == 0)
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
progressLabel.Text = "Done!";
|
||||
progressBar.Value = 100;
|
||||
progressBar.Foreground = Brushes.Green;
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
progressLabel.Text = isForced ? "Aborted by user" : "Error, please check log!";
|
||||
progressBar.Value = 100;
|
||||
progressBar.Foreground = Brushes.Red;
|
||||
});
|
||||
}
|
||||
|
||||
_process.Close();
|
||||
}
|
||||
|
||||
_process = null;
|
||||
}
|
||||
|
||||
private void ScrollViewer_SizeChanged(object sender, SizeChangedEventArgs e)
|
||||
{
|
||||
outputViewer.ScrollToBottom();
|
||||
}
|
||||
|
||||
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, Brush color)
|
||||
{
|
||||
if (Application.Current.Dispatcher.CheckAccess())
|
||||
{
|
||||
Run run = new Run(text) { Foreground = color };
|
||||
_paragraph.Inlines.Add(run);
|
||||
}
|
||||
else
|
||||
Dispatcher.Invoke(() =>
|
||||
{
|
||||
Run run = new Run(text) { Foreground = color };
|
||||
_paragraph.Inlines.Add(run);
|
||||
});
|
||||
}
|
||||
|
||||
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 ? Brushes.Red : Brushes.White);
|
||||
|
||||
if (!state.isError)
|
||||
ProcessStringForProgressBar(buffer);
|
||||
}
|
||||
_paragraph.Inlines.Add(new LineBreak());
|
||||
state.Clear();
|
||||
state.Set(StreamState.State.BEGIN);
|
||||
break;
|
||||
}
|
||||
|
||||
default:
|
||||
if (state.Is(StreamState.State.READ_CARRIAGE) && state.HasData())
|
||||
{
|
||||
if (!(_paragraph.Inlines.LastInline is LineBreak))
|
||||
_paragraph.Inlines.Remove(_paragraph.Inlines.LastInline);
|
||||
|
||||
string buffer = state.Fetch();
|
||||
|
||||
AppendToTextBox(buffer, state.isError ? Brushes.Red : Brushes.White);
|
||||
|
||||
if (!state.isError)
|
||||
ProcessStringForProgressBar(buffer);
|
||||
|
||||
state.Clear();
|
||||
}
|
||||
|
||||
state.Set(StreamState.State.BEGIN);
|
||||
state.Append(c);
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region EventHandlers
|
||||
|
||||
private void OnWindowClosed(object sender, EventArgs e)
|
||||
{
|
||||
GracefullyTerminateProcess();
|
||||
}
|
||||
|
||||
private void OnWindowLoaded(object sender, EventArgs e)
|
||||
{
|
||||
var hwnd = new WindowInteropHelper(this).Handle;
|
||||
SetWindowLong(hwnd, GWL_STYLE, GetWindowLong(hwnd, GWL_STYLE) & ~WS_SYSMENU);
|
||||
}
|
||||
|
||||
void OnProcessExit(object sender, EventArgs e)
|
||||
{
|
||||
Dispatcher.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.ShowLogMenuItem.IsChecked = false;
|
||||
}
|
||||
|
||||
private void OnClearButton(object sender, EventArgs e)
|
||||
{
|
||||
output.Document.Blocks.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, TextChangedEventArgs e)
|
||||
{
|
||||
outputViewer.ScrollToBottom();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
}
|
||||
}
|
||||
130
DICUI/Windows/MainWindow.xaml
Normal file
130
DICUI/Windows/MainWindow.xaml
Normal file
@@ -0,0 +1,130 @@
|
||||
<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"
|
||||
mc:Ignorable="d"
|
||||
Title="Disc Image Creator GUI" Height="450" Width="600" WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize"
|
||||
LocationChanged="MainWindowLocationChanged" Activated="MainWindowActivated" Closing="MainWindowClosing">
|
||||
|
||||
<Window.Resources>
|
||||
<local:EnumDescriptionConverter x:Key="enumConverter" />
|
||||
</Window.Resources>
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="4*"/>
|
||||
<ColumnDefinition Width="13*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="4*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel VerticalAlignment="Top" Grid.ColumnSpan="4">
|
||||
<Menu Width="Auto" Height="20" >
|
||||
<MenuItem Header="_File">
|
||||
<MenuItem x:Name="AppExit" Header="E_xit" HorizontalAlignment="Left" Width="140" Click="AppExitClick" />
|
||||
</MenuItem>
|
||||
<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 local:ViewModels.LoggerViewModel}}"
|
||||
IsChecked="{Binding Path=WindowVisible}"
|
||||
/>
|
||||
</MenuItem>
|
||||
<MenuItem Header="_Help">
|
||||
<MenuItem x:Name="About" Header="_About" HorizontalAlignment="Left" Width="140" Click="AboutClick"/>
|
||||
</MenuItem>
|
||||
</Menu>
|
||||
</StackPanel>
|
||||
<GroupBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,5,5.2,5.4" HorizontalAlignment="Stretch" Header="Settings"/>
|
||||
<GroupBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,4.6,5.2,4.8" HorizontalAlignment="Stretch" Header="Controls"/>
|
||||
<GroupBox Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,5.2,5.2,4.8" HorizontalAlignment="Stretch" Header="Status"/>
|
||||
|
||||
<Grid Grid.Row="1" Grid.Column="0" Margin="15,25,15.2,10.4" Grid.ColumnSpan="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="2.5*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</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.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.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Converter={StaticResource enumConverter}}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="0" VerticalAlignment="Center">Output Filename</Label>
|
||||
<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" />
|
||||
<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.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=Letter}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</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" />
|
||||
|
||||
<Label Grid.Row="5" Grid.Column="0" VerticalAlignment="Center">Parameters</Label>
|
||||
<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">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Button x:Name="StartStopButton" Grid.Row="0" Grid.Column="0" Height="22" Width="125" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Start Dumping" Click="StartStopButtonClick" IsEnabled="False" />
|
||||
<Button x:Name="DiskScanButton" Grid.Row="0" Grid.Column="1" Height="22" Width="125" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Scan for disks" Click="DiskScanButtonClick" />
|
||||
<Button x:Name="CopyProtectScanButton" Grid.Row="0" Grid.Column="2" Height="22" Width="125" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Scan for protection" Click="CopyProtectScanButtonClick" />
|
||||
<CheckBox x:Name="EjectWhenDoneCheckBox" Grid.Row="0" Grid.Column="3" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Eject When Done" IsChecked="False" />
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="3" Grid.Column="0" Margin="15,20.2,15.2,9.8" Grid.ColumnSpan="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label x:Name="StatusLabel" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Waiting for media..." />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
721
DICUI/Windows/MainWindow.xaml.cs
Normal file
721
DICUI/Windows/MainWindow.xaml.cs
Normal file
@@ -0,0 +1,721 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using WinForms = System.Windows.Forms;
|
||||
using DICUI.Data;
|
||||
using DICUI.Utilities;
|
||||
|
||||
namespace DICUI.Windows
|
||||
{
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
// 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.IsEnabled = false;
|
||||
DiskScanButton.IsEnabled = false;
|
||||
CopyProtectScanButton.IsEnabled = false;
|
||||
|
||||
if (_options.OpenLogWindowAtStartup)
|
||||
{
|
||||
this.WindowStartupLocation = WindowStartupLocation.Manual;
|
||||
double combinedHeight = this.Height + _logWindow.Height + Constants.LogWindowMarginFromMainWindow;
|
||||
Rectangle bounds = GetScaledCoordinates(WinForms.Screen.PrimaryScreen.WorkingArea);
|
||||
|
||||
this.Left = bounds.Left + (bounds.Width - this.Width) / 2;
|
||||
this.Top = bounds.Top + (bounds.Height - combinedHeight) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
#region Events
|
||||
|
||||
protected override void OnContentRendered(EventArgs e)
|
||||
{
|
||||
base.OnContentRendered(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
|
||||
ShowLogMenuItem.IsChecked = true;
|
||||
ViewModels.LoggerViewModel.WindowVisible = true;
|
||||
}
|
||||
|
||||
// Populate the list of systems
|
||||
StatusLabel.Content = "Creating system list, please wait!";
|
||||
PopulateSystems();
|
||||
|
||||
// Populate the list of drives
|
||||
StatusLabel.Content = "Creating drive list, please wait!";
|
||||
PopulateDrives();
|
||||
}
|
||||
|
||||
private void StartStopButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Dump or stop the dump
|
||||
if ((string)StartStopButton.Content == Constants.StartDumping)
|
||||
{
|
||||
StartDumping();
|
||||
}
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void OutputDirectoryBrowseButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
BrowseFolder();
|
||||
EnsureDiscInformation();
|
||||
}
|
||||
|
||||
private void DiskScanButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
PopulateDrives();
|
||||
}
|
||||
|
||||
private void CopyProtectScanButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ScanAndShowProtection();
|
||||
}
|
||||
|
||||
private void SystemTypeComboBoxSelectionChanged(object sender, SelectionChangedEventArgs 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, SelectionChangedEventArgs e)
|
||||
{
|
||||
// Only change the media type if the selection and not the list has changed
|
||||
if (e.RemovedItems.Count == 1 && e.AddedItems.Count == 1)
|
||||
{
|
||||
_currentMediaType = MediaTypeComboBox.SelectedItem as MediaType?;
|
||||
SetSupportedDriveSpeed();
|
||||
}
|
||||
|
||||
GetOutputNames();
|
||||
EnsureDiscInformation();
|
||||
}
|
||||
|
||||
private void DriveLetterComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
CacheCurrentDiscType();
|
||||
SetCurrentDiscType();
|
||||
GetOutputNames();
|
||||
SetSupportedDriveSpeed();
|
||||
}
|
||||
|
||||
private void DriveSpeedComboBoxSelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
EnsureDiscInformation();
|
||||
}
|
||||
|
||||
private void OutputFilenameTextBoxTextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
EnsureDiscInformation();
|
||||
}
|
||||
|
||||
private void OutputDirectoryTextBoxTextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
EnsureDiscInformation();
|
||||
}
|
||||
|
||||
private void ProgressUpdated(object sender, Result value)
|
||||
{
|
||||
StatusLabel.Content = value.Message;
|
||||
ViewModels.LoggerViewModel.VerboseLogLn(value.Message);
|
||||
}
|
||||
|
||||
private void MainWindowLocationChanged(object sender, EventArgs e)
|
||||
{
|
||||
if (_logWindow.IsVisible)
|
||||
_logWindow.AdjustPositionToMainWindow();
|
||||
}
|
||||
|
||||
private void MainWindowActivated(object sender, EventArgs e)
|
||||
{
|
||||
if (_logWindow.IsVisible && !this.Topmost)
|
||||
{
|
||||
_logWindow.Topmost = true;
|
||||
_logWindow.Topmost = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void MainWindowClosing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
if (_logWindow.IsVisible)
|
||||
_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)
|
||||
{
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
|
||||
private void AboutClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
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, RoutedEventArgs e)
|
||||
{
|
||||
// lazy initialization
|
||||
if (_optionsWindow == null)
|
||||
{
|
||||
_optionsWindow = new OptionsWindow(this, _options);
|
||||
_optionsWindow.Closed += delegate
|
||||
{
|
||||
_optionsWindow = null;
|
||||
};
|
||||
}
|
||||
|
||||
_optionsWindow.Owner = this;
|
||||
_optionsWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
||||
_optionsWindow.Refresh();
|
||||
_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.ItemsSource = _mediaTypes;
|
||||
|
||||
MediaTypeComboBox.IsEnabled = _mediaTypes.Count > 1;
|
||||
MediaTypeComboBox.SelectedIndex = (_mediaTypes.IndexOf(_currentMediaType) >= 0 ? _mediaTypes.IndexOf(_currentMediaType) : 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
MediaTypeComboBox.IsEnabled = false;
|
||||
MediaTypeComboBox.ItemsSource = 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.ItemsSource = comboBoxItems;
|
||||
SystemTypeComboBox.SelectedIndex = 0;
|
||||
|
||||
StartStopButton.IsEnabled = 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
|
||||
DiskScanButton.IsEnabled = true;
|
||||
|
||||
// Populate the list of drives and add it to the combo box
|
||||
_drives = Validators.CreateListOfDrives();
|
||||
DriveLetterComboBox.ItemsSource = _drives;
|
||||
|
||||
if (DriveLetterComboBox.Items.Count > 0)
|
||||
{
|
||||
int index = _drives.FindIndex(d => d.MarkedActive);
|
||||
DriveLetterComboBox.SelectedIndex = (index != -1 ? index : 0);
|
||||
StatusLabel.Content = "Valid drive found! Choose your Media Type";
|
||||
StartStopButton.IsEnabled = true;
|
||||
CopyProtectScanButton.IsEnabled = true;
|
||||
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Found {0} drives: {1}", _drives.Count, String.Join(", ", _drives.Select(d => d.Letter)));
|
||||
}
|
||||
else
|
||||
{
|
||||
DriveLetterComboBox.SelectedIndex = -1;
|
||||
StatusLabel.Content = "No valid drive found!";
|
||||
StartStopButton.IsEnabled = false;
|
||||
CopyProtectScanButton.IsEnabled = false;
|
||||
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Found no drives");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Browse for an output folder
|
||||
/// </summary>
|
||||
private void BrowseFolder()
|
||||
{
|
||||
WinForms.FolderBrowserDialog folderDialog = new WinForms.FolderBrowserDialog { ShowNewFolderButton = false, SelectedPath = System.AppDomain.CurrentDomain.BaseDirectory };
|
||||
WinForms.DialogResult result = folderDialog.ShowDialog();
|
||||
|
||||
if (result == WinForms.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.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
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
// 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;
|
||||
}
|
||||
}
|
||||
|
||||
// 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>
|
||||
/// 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.Content = result.Message;
|
||||
|
||||
// Set the index for the current disc type
|
||||
SetCurrentDiscType();
|
||||
|
||||
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();
|
||||
|
||||
// If input params are not enabled, generate the full parameters from the environment
|
||||
if (!ParametersTextBox.IsEnabled)
|
||||
{
|
||||
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.Content;
|
||||
StatusLabel.Content = "Scanning for copy protection... this might take a while!";
|
||||
StartStopButton.IsEnabled = false;
|
||||
DiskScanButton.IsEnabled = false;
|
||||
CopyProtectScanButton.IsEnabled = false;
|
||||
|
||||
string protections = await Validators.RunProtectionScanOnPath(_env.Drive.Letter + ":\\");
|
||||
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);
|
||||
|
||||
StatusLabel.Content = tempContent;
|
||||
StartStopButton.IsEnabled = true;
|
||||
DiskScanButton.IsEnabled = true;
|
||||
CopyProtectScanButton.IsEnabled = 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.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(),
|
||||
preferred
|
||||
);
|
||||
|
||||
// Set the selected speed
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Setting drive speed to: {0}", chosenSpeed);
|
||||
DriveSpeedComboBox.SelectedValue = 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.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
|
||||
|
||||
/// <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
|
||||
}
|
||||
}
|
||||
142
DICUI/Windows/OptionsWindow.xaml
Normal file
142
DICUI/Windows/OptionsWindow.xaml
Normal file
@@ -0,0 +1,142 @@
|
||||
<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:local="clr-namespace:DICUI"
|
||||
mc:Ignorable="d"
|
||||
Title="Options" Height="480" Width="515.132">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="150"/>
|
||||
<RowDefinition Height="100"/>
|
||||
<RowDefinition Height="40"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<GroupBox Grid.Column="0" Margin="5,5,5,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Header="Paths" />
|
||||
|
||||
<Grid Margin="10,15,10,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="2.0*" />
|
||||
<ColumnDefinition Width="0.2*" />
|
||||
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="DicImageCreator Path" />
|
||||
<TextBox x:Name="DICPathTextBox" Grid.Row="0" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
<Button x:Name="DICPathButton" Grid.Row="0" Grid.Column="2" Height="22" Width="22" Content="..." Click="BrowseForPathClick" />
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="subdump Path" />
|
||||
<TextBox x:Name="SubDumpPathTextBox" Grid.Row="1" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
<Button x:Name="SubDumpPathButton" Grid.Row="1" Grid.Column="2" Height="22" Width="22" Content="..." Click="BrowseForPathClick"/>
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Default Output Path" />
|
||||
<TextBox x:Name="DefaultOutputPathTextBox" Grid.Row="2" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
<Button x:Name="DefaultOutputPathButton" Grid.Row="2" Grid.Column="2" Height="22" Width="22" Content="..." Click="BrowseForPathClick" />
|
||||
</Grid>
|
||||
|
||||
<GroupBox Grid.Row="1" Margin="5,5,5,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Header="Preferred Dump Speed">
|
||||
<Grid Height="100">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="2.0*"/>
|
||||
<ColumnDefinition Width="40"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<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 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 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>
|
||||
|
||||
<GroupBox Grid.Row="2" Margin="5,5,5,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Header="Options" Padding="10">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
<CheckBox Grid.Column="0" VerticalAlignment="Center" Content="Quiet Mode"
|
||||
DataContext="{Binding Source={x:Static local:ViewModels.OptionsViewModel}}"
|
||||
IsChecked="{Binding Path=QuietMode}"
|
||||
ToolTip="Disable DiscImageCreator sounds"
|
||||
/>
|
||||
<CheckBox Grid.Column="1" VerticalAlignment="Center" Content="Paranoid Mode"
|
||||
DataContext="{Binding Source={x:Static local:ViewModels.OptionsViewModel}}"
|
||||
IsChecked="{Binding Path=ParanoidMode}"
|
||||
ToolTip="Enable pedandic and super-safe flags"
|
||||
/>
|
||||
<Grid Grid.Column="2" Grid.ColumnSpan="2" Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Label Grid.Column="0" Content="C2 Reread Tries:" />
|
||||
<TextBox Grid.Column="1" VerticalAlignment="Center"
|
||||
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 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 local:ViewModels.OptionsViewModel}}"
|
||||
IsChecked="{Binding Path=SkipMediaTypeDetection}"
|
||||
ToolTip="Disable trying to guess media type inserted (may improve performance at startup)"
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
</GroupBox>
|
||||
|
||||
<Grid Height="22" Grid.Row="3" Grid.Column="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Button x:Name="AcceptButton" Grid.Row="0" Grid.Column="1" Height="22" Width="80" Content="Accept" Click="OnAcceptClick" />
|
||||
<Button x:Name="CancelButton" Grid.Row="0" Grid.Column="2" Height="22" Width="80" Content="Cancel" Click="OnCancelClick" />
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
132
DICUI/Windows/OptionsWindow.xaml.cs
Normal file
132
DICUI/Windows/OptionsWindow.xaml.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Windows;
|
||||
using System.Windows.Forms;
|
||||
using Button = System.Windows.Controls.Button;
|
||||
using TextBox = System.Windows.Controls.TextBox;
|
||||
|
||||
namespace DICUI.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for OptionsWindow.xaml
|
||||
/// </summary>
|
||||
public partial class OptionsWindow : Window
|
||||
{
|
||||
private readonly MainWindow _mainWindow;
|
||||
private readonly Options _options;
|
||||
|
||||
public OptionsWindow(MainWindow mainWindow, Options options)
|
||||
{
|
||||
InitializeComponent();
|
||||
_mainWindow = mainWindow;
|
||||
_options = options;
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
return FindName(name + "TextBox") as TextBox;
|
||||
}
|
||||
|
||||
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 Refresh()
|
||||
{
|
||||
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 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.Save();
|
||||
Hide();
|
||||
|
||||
_mainWindow.OnOptionsUpdated();
|
||||
}
|
||||
|
||||
private void OnCancelClick(object sender, EventArgs e)
|
||||
{
|
||||
// just hide the window and don't care
|
||||
Hide();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
130
MainWindow.xaml
130
MainWindow.xaml
@@ -1,130 +0,0 @@
|
||||
<Window x:Class="DICUI.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"
|
||||
mc:Ignorable="d"
|
||||
Title="Disc Image Creator GUI" Height="350" Width="500">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="3*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
|
||||
<GroupBox Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="5" HorizontalAlignment="Stretch" Header="Informations Input"/>
|
||||
<GroupBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="5" HorizontalAlignment="Stretch" Header="Control"/>
|
||||
<GroupBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="5" HorizontalAlignment="Stretch" Header="Status"/>
|
||||
|
||||
|
||||
<Grid Grid.Row="0" Grid.Column="0" Margin="15,25,15,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="3*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" VerticalAlignment="Center">Disc Type</Label>
|
||||
<Label Grid.Row="1" Grid.Column="0" VerticalAlignment="Center">Output Filename</Label>
|
||||
<Label Grid.Row="2" Grid.Column="0" VerticalAlignment="Center">Output Directory</Label>
|
||||
<Label Grid.Row="3" Grid.Column="0" VerticalAlignment="Center">Drive Letter</Label>
|
||||
<Label Grid.Row="4" Grid.Column="0" VerticalAlignment="Center">Drive Speed</Label>
|
||||
|
||||
<ComboBox x:Name="CB_DiscType" Grid.Row="0" Grid.Column="1" Height="22" Text="Bandai Playdia Quick Interactive System" SelectionChanged="CB_DiscType_SelectionChanged">
|
||||
<ComboBoxItem Content="Unknown"/>
|
||||
<ComboBoxItem Content="---------- Consoles ----------" IsEnabled="False"/>
|
||||
<ComboBoxItem Content="Bandai Playdia Quick Interactive System"/>
|
||||
<ComboBoxItem Content="Bandai / Apple Pippin"/>
|
||||
<ComboBoxItem Content="Commodore Amiga CD / CD32 / CDTV"/>
|
||||
<ComboBoxItem Content="Mattel HyperScan"/>
|
||||
<ComboBoxItem Content="Microsoft XBOX One"/>
|
||||
<ComboBoxItem Content="NEC PC-Engine / TurboGrafx CD"/>
|
||||
<ComboBoxItem Content="NEC PC-FX / PC-FXGA"/>
|
||||
<ComboBoxItem Content="Panasonic 3DO"/>
|
||||
<ComboBoxItem Content="Philips CD-i"/>
|
||||
<ComboBoxItem Content="Sega CD / Mega CD"/>
|
||||
<ComboBoxItem Content="Sega Saturn"/>
|
||||
<ComboBoxItem Content="SNK Neo Geo CD"/>
|
||||
<ComboBoxItem Content="Sony PlayStation"/>
|
||||
<ComboBoxItem Content="Sony PlayStation 2 (CD-Rom)"/>
|
||||
<ComboBoxItem Content="Sony PlayStation 2 (DVD-Rom)"/>
|
||||
<ComboBoxItem Content="Sony PlayStation 4"/>
|
||||
<ComboBoxItem Content="VTech V.Flash - V.Smile Pro"/>
|
||||
<ComboBoxItem Content="---------- Computers ----------" IsEnabled="False"/>
|
||||
<ComboBoxItem Content="Apple Macintosh (CD-Rom)"/>
|
||||
<ComboBoxItem Content="Apple Macintosh (DVD-Rom)"/>
|
||||
<ComboBoxItem Content="Fujitsu FM Towns series"/>
|
||||
<ComboBoxItem Content="IBM PC Compatible (CD-Rom) No Copy Protection"/>
|
||||
<ComboBoxItem Content="IBM PC Compatible (CD-Rom) SecuROM"/>
|
||||
<ComboBoxItem Content="IBM PC Compatible (CD-Rom) Detectable Protection"/>
|
||||
<ComboBoxItem Content="IBM PC Compatible (CD-Rom) C2 Error Protection"/>
|
||||
<ComboBoxItem Content="IBM PC Compatible (DVD-Rom)"/>
|
||||
<ComboBoxItem Content="NEC PC-88"/>
|
||||
<ComboBoxItem Content="NEC PC-98"/>
|
||||
<ComboBoxItem Content="---------- Arcade ----------" IsEnabled="False"/>
|
||||
<ComboBoxItem Content="Sega Lindbergh"/>
|
||||
<ComboBoxItem Content="---------- Others ----------" IsEnabled="False"/>
|
||||
<ComboBoxItem Content="Audio CD"/>
|
||||
<ComboBoxItem Content="BD-Video"/>
|
||||
<ComboBoxItem Content="DVD-Video"/>
|
||||
<ComboBoxItem Content="PalmOS"/>
|
||||
<ComboBoxItem Content="Photo CD"/>
|
||||
<ComboBoxItem Content="PlayStation GameShark Updates"/>
|
||||
<ComboBoxItem Content="Tomy Kiss-Site"/>
|
||||
<ComboBoxItem Content="Video CD"/>
|
||||
</ComboBox>
|
||||
<TextBox x:Name="TXT_OutputFilename" Grid.Row="1" Grid.Column="1" Height="22"></TextBox>
|
||||
<TextBox x:Name="TXT_OutputDirectory" Grid.Row="2" Grid.Column="1" Height="22" Width="290" HorizontalAlignment="left" Text="ISO" ></TextBox>
|
||||
<Button x:Name="BTN_OutputDirectoryBrowse" Grid.Row="2" Grid.Column="1" Height="22" Width="50" HorizontalAlignment="Right" Content="Browse" Click="BTN_OutputDirectoryBrowse_Click" ></Button>
|
||||
<ComboBox x:Name="CB_DriveLetter" Grid.Row="3" Grid.Column="1" Height="22" Width="60" HorizontalAlignment="left">
|
||||
|
||||
</ComboBox>
|
||||
<ComboBox x:Name="CB_DriveSpeed" Grid.Row="4" Grid.Column="1" Height="22" Width="60" HorizontalAlignment="left" SelectionChanged="CB_DriveSpeed_SelectionChanged">
|
||||
<ComboBoxItem Content="4"/>
|
||||
<ComboBoxItem Content="8"/>
|
||||
<ComboBoxItem Content="16"/>
|
||||
<ComboBoxItem Content="48"/>
|
||||
<ComboBoxItem Content="Custom"/>
|
||||
</ComboBox>
|
||||
|
||||
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="1" Grid.Column="0" Margin="15,20,15,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Button x:Name="BTN_Start" Grid.Row="0" Grid.Column="0" Height="22" Width="150" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Start Dumping" Click="BTN_Start_Click" IsEnabled="False" />
|
||||
<Button x:Name="BTN_Search" Grid.Row="0" Grid.Column="1" Height="22" Width="150" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Scan for disks" Click="BTN_Search_Click" />
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="2" Grid.Column="0" Margin="15,20,15,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
<Label x:Name="LBL_Status" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Waiting for CD or DVD..." />
|
||||
|
||||
</Grid>
|
||||
</Grid>
|
||||
|
||||
</Window>
|
||||
@@ -1,388 +0,0 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using System.IO;
|
||||
using WinForms = System.Windows.Forms;
|
||||
using System.Diagnostics;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace DICUI
|
||||
{
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
public void ScanForDisk()
|
||||
{
|
||||
BTN_Search.IsEnabled = false;
|
||||
CB_DriveLetter.Items.Clear();
|
||||
foreach (var d in DriveInfo.GetDrives().Where(d => d.DriveType == DriveType.CDRom))
|
||||
{
|
||||
if (d.IsReady == true)
|
||||
{
|
||||
TXT_OutputFilename.Text = d.VolumeLabel;
|
||||
|
||||
if (TXT_OutputFilename.Text == "")
|
||||
{
|
||||
TXT_OutputFilename.Text = "unknown";
|
||||
}
|
||||
CB_DriveLetter.Items.Add(d.Name.Replace(":\\", ""));
|
||||
CB_DriveLetter.SelectedIndex = 0;
|
||||
TXT_OutputDirectory.Text = "ISO" + "\\" + TXT_OutputFilename.Text + "\\";
|
||||
LBL_Status.Content = "CD or DVD found ! Choose your Disc Type";
|
||||
BTN_Start.IsEnabled = true;
|
||||
CB_DriveSpeed.Text = "8";
|
||||
}
|
||||
else
|
||||
{
|
||||
LBL_Status.Content = "No CD or DVD found !";
|
||||
}
|
||||
BTN_Search.IsEnabled = true;
|
||||
}
|
||||
}
|
||||
|
||||
public void BrowseFolder()
|
||||
{
|
||||
WinForms.FolderBrowserDialog folderDialog = new WinForms.FolderBrowserDialog { ShowNewFolderButton = false, SelectedPath = System.AppDomain.CurrentDomain.BaseDirectory };
|
||||
WinForms.DialogResult result = folderDialog.ShowDialog();
|
||||
|
||||
if (result == WinForms.DialogResult.OK)
|
||||
{
|
||||
String sPath = folderDialog.SelectedPath;
|
||||
TXT_OutputDirectory.Text = sPath;
|
||||
}
|
||||
}
|
||||
|
||||
public async void StartDumping()
|
||||
{
|
||||
String VAR_Type = "";
|
||||
String VAR_Switches = "";
|
||||
String VAR_DriveLetter = CB_DriveLetter.Text;
|
||||
String VAR_OutputDirectory = TXT_OutputDirectory.Text;
|
||||
String VAR_OutputFilename = TXT_OutputFilename.Text;
|
||||
String VAR_DriveSpeed = CB_DriveSpeed.Text;
|
||||
Boolean VAR_IsPSX = false;
|
||||
Boolean VAR_IsXBOXorPS4 = false;
|
||||
BTN_Start.IsEnabled = false;
|
||||
|
||||
switch (Convert.ToString(CB_DiscType.Text))
|
||||
{
|
||||
#region Consoles
|
||||
|
||||
case "Bandai Playdia Quick Interactive System":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "Bandai / Apple Pippin":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "Commodore Amiga CD / CD32 / CDTV":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "Mattel HyperScan":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "Microsoft XBOX":
|
||||
// Placeholder for later use
|
||||
break;
|
||||
case "Microsoft XBOX 360":
|
||||
// Placeholder for later use
|
||||
break;
|
||||
case "Microsoft XBOX One":
|
||||
VAR_Type = "bd";
|
||||
VAR_Switches = "";
|
||||
VAR_IsXBOXorPS4 = true;
|
||||
break;
|
||||
case "NEC PC-Engine / TurboGrafx CD":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "NEC PC-FX / PC-FXGA":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "Nintendo GameCube":
|
||||
// Placeholder for later use
|
||||
break;
|
||||
case "Nintendo Wii":
|
||||
// Placeholder for later use
|
||||
break;
|
||||
case "Nintendo Wii U":
|
||||
// Placeholder for later use
|
||||
break;
|
||||
case "Panasonic 3DO":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "Philips CD-i":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "Sega CD / Mega CD":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "Sega Dreamcast":
|
||||
// Placeholder for later use
|
||||
break;
|
||||
case "Sega Saturn":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "SNK Neo Geo CD":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "Sony PlayStation":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
VAR_IsPSX = true;
|
||||
break;
|
||||
case "Sony PlayStation 2 (CD-Rom)":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "Sony PlayStation 2 (DVD-Rom)":
|
||||
VAR_Type = "dvd";
|
||||
VAR_Switches = "";
|
||||
break;
|
||||
case "Sony PlayStation 3":
|
||||
// Placeholder for later use
|
||||
break;
|
||||
case "Sony PlayStation 4":
|
||||
VAR_Type = "bd";
|
||||
VAR_Switches = "";
|
||||
VAR_IsXBOXorPS4 = true;
|
||||
break;
|
||||
case "Sony PlayStation Portable":
|
||||
// No-op - PSP can't be dumped with DIC
|
||||
break;
|
||||
case "VM Labs NUON":
|
||||
// Placeholder for later use
|
||||
break;
|
||||
case "VTech V.Flash - V.Smile Pro":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "ZAPiT Games Game Wave Family Entertainment System":
|
||||
// Placeholder for later use
|
||||
break;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Computers
|
||||
|
||||
case "Acorn Archimedes":
|
||||
// Placeholder for later use
|
||||
break;
|
||||
case "Apple Macintosh (CD-Rom)":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "Apple Macintosh (DVD-Rom)":
|
||||
VAR_Type = "dvd";
|
||||
VAR_Switches = "";
|
||||
break;
|
||||
case "Fujitsu FM Towns series":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
// TODO: Can protection be determined by a check automatically?
|
||||
case "IBM PC Compatible (CD-Rom) No Copy Protection":
|
||||
VAR_Type = "dvd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "IBM PC Compatible (CD-Rom) SecuROM":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2 /ns";
|
||||
break;
|
||||
case "IBM PC Compatible (CD-Rom) Detectable Protection":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2 /sf";
|
||||
break;
|
||||
case "IBM PC Compatible (CD-Rom) C2 Error Protection":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2 /ss";
|
||||
break;
|
||||
case "IBM PC Compatible (DVD-Rom)":
|
||||
VAR_Type = "dvd";
|
||||
VAR_Switches = "";
|
||||
break;
|
||||
case "NEC PC-88":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "NEC PC-98":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "Sharp X68000":
|
||||
// Placeholder for later use
|
||||
break;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Arcade
|
||||
|
||||
case "Namco / Sega / Nintendo Triforce":
|
||||
// Placeholder for later use
|
||||
break;
|
||||
case "Sega Chihiro":
|
||||
// Placeholder for later use
|
||||
break;
|
||||
case "Sega Lindbergh":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "Sega Naomi":
|
||||
// Placeholder for later use
|
||||
break;
|
||||
case "Sega Naomi 2":
|
||||
// Placeholder for later use
|
||||
break;
|
||||
case "TAB-Austria Quizard":
|
||||
// Placeholder for later use
|
||||
break;
|
||||
|
||||
case "Tandy / Memorex Visual Information System":
|
||||
// Placeholder for later use
|
||||
break;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Others
|
||||
|
||||
case "Audio CD":
|
||||
VAR_Type = "audio";
|
||||
break;
|
||||
case "IBM PC Compatible(CD - Rom) No Copy Protection":
|
||||
VAR_Type = "cd";
|
||||
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "BD-Video":
|
||||
VAR_Switches = "";
|
||||
break;
|
||||
case "DVD-Video":
|
||||
VAR_Type = "dvd";
|
||||
break;
|
||||
case "PalmOS":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "Philips CD-i Digital Video":
|
||||
// Placeholder for later use
|
||||
break;
|
||||
case "Photo CD":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "PlayStation GameShark Updates":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "Tao iKTV":
|
||||
// Placeholder for later use
|
||||
break;
|
||||
case "Tomy Kiss-Site":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
case "Video CD":
|
||||
VAR_Type = "cd";
|
||||
VAR_Switches = "/c2";
|
||||
break;
|
||||
|
||||
#endregion
|
||||
|
||||
case "Unknown":
|
||||
default:
|
||||
VAR_Type = "";
|
||||
VAR_Switches = "";
|
||||
break;
|
||||
}
|
||||
|
||||
await Task.Run(
|
||||
() =>
|
||||
{
|
||||
Process process = new Process();
|
||||
process.StartInfo.FileName = "Release_ANSI\\DiscImageCreator.exe";
|
||||
process.StartInfo.Arguments = VAR_Type + " " + VAR_DriveLetter + " \"" + VAR_OutputDirectory + "\\" + VAR_OutputFilename + "\" " + VAR_DriveSpeed + " " + VAR_Switches;
|
||||
Console.WriteLine(process.StartInfo.Arguments);
|
||||
process.Start();
|
||||
process.WaitForExit();
|
||||
});
|
||||
|
||||
if (VAR_IsXBOXorPS4 == true)
|
||||
{
|
||||
using (StreamWriter writetext = new StreamWriter("PS4orXBOXONE.bat"))
|
||||
{
|
||||
writetext.WriteLine("sg_raw.exe -v -r 4100 -R " + VAR_DriveLetter + ":" + "ad 01 00 00 00 00 00 00 10 04 00 00 -o \"PIC.bin\"");
|
||||
}
|
||||
Process processps4orxboxone = new Process();
|
||||
processps4orxboxone.StartInfo.FileName = "PS4orXBOXONE.bat";
|
||||
processps4orxboxone.Start();
|
||||
processps4orxboxone.WaitForExit();
|
||||
}
|
||||
if (VAR_IsPSX == true)
|
||||
{
|
||||
using (StreamWriter writetext = new StreamWriter("PSX.bat"))
|
||||
{
|
||||
writetext.WriteLine("edccchk" + " " + "\"" + VAR_OutputDirectory + "\\" + VAR_OutputFilename + ".bin" + "\" > " + "\"" + VAR_OutputDirectory + "\\" + "edccchk1.txt");
|
||||
writetext.WriteLine("edccchk" + " " + "\"" + VAR_OutputDirectory + "\\" + VAR_OutputFilename + " (Track 1).bin" + "\" > " + "\"" + VAR_OutputDirectory + "\\" + "edccchk1.txt");
|
||||
writetext.WriteLine("edccchk" + " " + "\"" + VAR_OutputDirectory + "\\" + VAR_OutputFilename + " (Track 01).bin" + "\" > " + "\"" + VAR_OutputDirectory + "\\" + "edccchk1.txt");
|
||||
writetext.WriteLine("psxt001z" + " " + "\"" + VAR_OutputDirectory + "\\" + VAR_OutputFilename + ".bin" + "\" > " + "\"" + VAR_OutputDirectory + "\\" + "psxt001z1.txt");
|
||||
writetext.WriteLine("psxt001z" + " " + "\"" + VAR_OutputDirectory + "\\" + VAR_OutputFilename + " (Track 1).bin" + "\" > " + "\"" + VAR_OutputDirectory + "\\" + "psxt001z2.txt");
|
||||
writetext.WriteLine("psxt001z" + " " + "\"" + VAR_OutputDirectory + "\\" + VAR_OutputFilename + " (Track 01).bin" + "\" > " + "\"" + VAR_OutputDirectory + "\\" + "psxt001z3.txt");
|
||||
writetext.WriteLine("psxt001z" + " " + "--libcrypt " + "\"" + VAR_OutputDirectory + "\\" + VAR_OutputFilename + ".sub\" > " + "\"" + VAR_OutputDirectory + "\\" + "libcrypt.txt");
|
||||
writetext.WriteLine("psxt001z" + " " + "--libcryptdrvfast " + VAR_DriveLetter + " > " + "\"" + VAR_OutputDirectory + "\\" + "libcryptdrv.log");
|
||||
}
|
||||
Process processpsx = new Process();
|
||||
processpsx.StartInfo.FileName = "PSX.bat";
|
||||
processpsx.Start();
|
||||
processpsx.WaitForExit();
|
||||
}
|
||||
BTN_Start.IsEnabled = true;
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
ScanForDisk();
|
||||
}
|
||||
|
||||
private void BTN_Start_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
StartDumping();
|
||||
}
|
||||
|
||||
private void BTN_OutputDirectoryBrowse_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
BrowseFolder();
|
||||
}
|
||||
|
||||
private void BTN_Search_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
ScanForDisk();
|
||||
}
|
||||
|
||||
private void CB_DiscType_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
||||
{
|
||||
LBL_Status.Content = "Ready to dump";
|
||||
}
|
||||
|
||||
private void CB_DriveSpeed_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
||||
{
|
||||
if (CB_DriveSpeed.SelectedIndex == 4)
|
||||
{
|
||||
CB_DriveSpeed.Items.Clear();
|
||||
CB_DriveSpeed.IsEditable = true;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
63
Properties/Resources.Designer.cs
generated
63
Properties/Resources.Designer.cs
generated
@@ -1,63 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <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.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DICUI.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +0,0 @@
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<SettingsFile xmlns="uri:settings" CurrentProfile="(Default)">
|
||||
<Profiles>
|
||||
<Profile Name="(Default)" />
|
||||
</Profiles>
|
||||
<Settings />
|
||||
</SettingsFile>
|
||||
61
README.md
61
README.md
@@ -1,26 +1,49 @@
|
||||
# DICUI
|
||||
This is my current progress on my C# Disc Image Creator UI.
|
||||
|
||||
I'm a hobbyist programmer, so this code might not be optimal, feel free to make your recommendation / Pull request.
|
||||
DiscImageCreator UI in C#
|
||||
|
||||
I would like this project to be a community project, so if you have some time and knowledge to give, I'll be glad to add you to the contributor of this project :)
|
||||
[](https://ci.appveyor.com/project/mnadareski/dicui/build/artifacts)
|
||||
|
||||
Currently working on the project:
|
||||
|
||||
ReignStumble - Lead Developer
|
||||
|
||||
Dizzzy - Concept/Ideas/Beta tester
|
||||
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 :)
|
||||
|
||||
|
||||
|
||||
2018-05-12
|
||||
|
||||
-----------Initial Build V.1.0-------------
|
||||
|
||||
Download here: https://github.com/reignstumble/DICUI/blob/master/Downloads/DICUI_1.0.zip
|
||||
We are using DiscImageCreator (DIC), created by Sarami, and we would like to thanks him for his great software. The latest release of DIC can be found on [the GitHub page](https://github.com/saramibreak/DiscImageCreator)
|
||||
|
||||
2018-05-13
|
||||
|
||||
-----------Latest Build V.1.01b-------------
|
||||
This project relies on two open-source code ports to help perform copy protection scanning: [BurnOutSharp](https://github.com/mnadareski/BurnOutSharp) and [UnshieldSharp](https://github.com/mnadareski/UnshieldSharp)
|
||||
|
||||
Download here: https://github.com/reignstumble/DICUI/blob/master/Downloads/DICUI_1.01b.zip
|
||||
## 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. 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
|
||||
- 128 MB of free RAM
|
||||
- As much hard drive space as amount of discs you will be dumping (20+ GB recommended)
|
||||
|
||||
Ensure that your operating system is as up-to-date as possible, since some features may rely on those updates.
|
||||
|
||||
## Releases
|
||||
|
||||
Download the latest release here:
|
||||
[https://github.com/reignstumble/DICUI/releases](https://github.com/reignstumble/DICUI/releases)
|
||||
|
||||
## Changelist
|
||||
|
||||
A list of all changes can now be found [here](https://github.com/reignstumble/DICUI/blob/master/CHANGELIST.md).
|
||||
|
||||
## Contributors
|
||||
|
||||
Here are the talented people who have contributed to the project so far:
|
||||
|
||||
- **ReignStumble** - Project Lead / UI Design
|
||||
- **darksabre76** - Project Co-Lead / Backend Design
|
||||
- **Jakz** - Primary Feature Contributor
|
||||
- **NHellFire** - Feature Contributor
|
||||
|
||||
## Notable Testers
|
||||
|
||||
These are the tireless individuals who have dedicated countless hours to help test the many features of DICUI and have worked with the development team closely:
|
||||
|
||||
- **Dizzzy/user7** - Concept, ideas, tester
|
||||
- **Kludge** - Primary stress tester
|
||||
- **ajshell1** - Tester
|
||||
- **eientei95** - Tester
|
||||
|
||||
51
appveyor.yml
Normal file
51
appveyor.yml
Normal file
@@ -0,0 +1,51 @@
|
||||
# version format
|
||||
version: 1.10-{build}
|
||||
|
||||
# pull request template
|
||||
pull_requests:
|
||||
do_not_increment_build_number: true
|
||||
|
||||
# vm template
|
||||
image: Visual Studio 2017
|
||||
|
||||
# environment variables
|
||||
environment:
|
||||
EnableNuGetPackageRestore: true
|
||||
|
||||
# msbuild configuration
|
||||
platform:
|
||||
- Any CPU
|
||||
configuration:
|
||||
- Debug
|
||||
|
||||
# install dependencies
|
||||
install:
|
||||
- ps: appveyor DownloadFile https://dist.nuget.org/win-x86-commandline/latest/nuget.exe
|
||||
|
||||
# pre-build script
|
||||
before_build:
|
||||
- nuget restore
|
||||
|
||||
# build step
|
||||
build:
|
||||
verbosity: minimal
|
||||
|
||||
# post-build step
|
||||
after_build:
|
||||
- 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
|
||||
- path: DICUI-Winforms.zip
|
||||
name: DICUI Winforms
|
||||
Reference in New Issue
Block a user