mirror of
https://github.com/SabreTools/MPF.git
synced 2026-02-04 05:35:52 +00:00
Compare commits
131 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fbc9d04782 | ||
|
|
24b08dd245 | ||
|
|
c7ebe69b05 | ||
|
|
22ffda4b5a | ||
|
|
b89c051d7d | ||
|
|
8b41f03472 | ||
|
|
700ff50eef | ||
|
|
95ac7236ff | ||
|
|
755f1b8e95 | ||
|
|
d431a4c87f | ||
|
|
04348d2d58 | ||
|
|
6f5214c1a4 | ||
|
|
1fe12be0b5 | ||
|
|
9c9ca16366 | ||
|
|
1702db71d1 | ||
|
|
0ba7ccdb9a | ||
|
|
3ccf65190e | ||
|
|
6b9ee3d5ed | ||
|
|
3ee0355034 | ||
|
|
7074fa1e2c | ||
|
|
44b91a6611 | ||
|
|
b2185dbed9 | ||
|
|
ec4b69b6e6 | ||
|
|
b6db873a00 | ||
|
|
db9222b737 | ||
|
|
b7bfa3ba28 | ||
|
|
ab25687119 | ||
|
|
9bfa0a01ad | ||
|
|
19c99fb7fe | ||
|
|
913244459e | ||
|
|
c66df99e22 | ||
|
|
03f4a6e2e4 | ||
|
|
31a243eeb4 | ||
|
|
043c0eff1c | ||
|
|
ff44313e13 | ||
|
|
e06ed31b21 | ||
|
|
aeaec9e805 | ||
|
|
6df0c76939 | ||
|
|
72efffcec4 | ||
|
|
930e4f7514 | ||
|
|
85f71032b5 | ||
|
|
ead530e2ec | ||
|
|
dc14b1ea52 | ||
|
|
4628be2855 | ||
|
|
1f24c08770 | ||
|
|
4889b9d0bf | ||
|
|
b3d7422a66 | ||
|
|
a0000528de | ||
|
|
2be46ec7a1 | ||
|
|
f2510a08a4 | ||
|
|
2787377250 | ||
|
|
e61ca31a3f | ||
|
|
1b735b5d06 | ||
|
|
ad3d26cdea | ||
|
|
f372ec4ccd | ||
|
|
44e75a50d7 | ||
|
|
6f0ea2de3e | ||
|
|
b4f0f7f4b3 | ||
|
|
5027d67731 | ||
|
|
6c8016345a | ||
|
|
7ba04e63c7 | ||
|
|
77dc1d0029 | ||
|
|
2b6538707f | ||
|
|
902e4e5715 | ||
|
|
28f6d50e5a | ||
|
|
d8ed7d6ad7 | ||
|
|
078d7d0ea3 | ||
|
|
5895a66c7a | ||
|
|
5ccff836e2 | ||
|
|
b2c2e8c4d9 | ||
|
|
890959cfe0 | ||
|
|
8729c7f20c | ||
|
|
74826909f4 | ||
|
|
eb4904afb4 | ||
|
|
06975316b9 | ||
|
|
e0be24e54f | ||
|
|
eb3cbc44a7 | ||
|
|
d6f39bfd4c | ||
|
|
576fa07a2c | ||
|
|
ae2b26f84e | ||
|
|
1d9a2c9be7 | ||
|
|
538c0bba09 | ||
|
|
57c31cad48 | ||
|
|
093db36f44 | ||
|
|
fd4db3f8f0 | ||
|
|
856a3161be | ||
|
|
dfafe9789a | ||
|
|
9f750d01c4 | ||
|
|
705ee82cbb | ||
|
|
d1f80efa41 | ||
|
|
f88e6617e5 | ||
|
|
1401422b08 | ||
|
|
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 |
@@ -1,3 +1,63 @@
|
||||
### 1.15 (2019-11-16)
|
||||
|
||||
- Updated to DIC version 20191116
|
||||
- Support non-optical, non-floppy stuff better
|
||||
- Update protection scanning and fix some things
|
||||
|
||||
### 1.14 (2019-10-01)
|
||||
|
||||
- Updated to DIC version 20191001
|
||||
- Added builds for .NET 4.6.2, .NET 4.7.2, and .NET Core 3.0
|
||||
- Updated and fixed a bunch of things related to Redump
|
||||
- Fixed path persistence when changing system and media type
|
||||
- Added more system autodetects
|
||||
- Added new, optional, disc information filling window (WIP)
|
||||
|
||||
### 1.13 (2019-07-02)
|
||||
|
||||
- Added new DIC commands and flags
|
||||
- Made DICUI Check more robust
|
||||
- Added and updated systems along with format cleanup
|
||||
- Created a new SubmissionInfo template (and internals)
|
||||
- Added automatic grabbing of Redump information, if possible
|
||||
- Better media format support (BD, UMD)
|
||||
- Initial disc type detection
|
||||
|
||||
### 1.12.2 (2019-04-19)
|
||||
|
||||
- Added DICUI Check, a new standalone tool for parsing DIC output from platforms unsupported by DICUI
|
||||
- Added a few machines/formats
|
||||
- Updated to DIC version 20190326
|
||||
- Added DMI data extraction for Xbox and X360
|
||||
|
||||
### 1.12.1 (2019-01-28)
|
||||
|
||||
- Fixed !submissionInfo.txt output for CD-ROM and GD-ROM
|
||||
|
||||
### 1.12 (2019-01-27)
|
||||
|
||||
- Added a few new systems and formats
|
||||
- Added new DIC commands and flags
|
||||
- Updated the `!submissionInfo.txt` file order
|
||||
- Fixed Audio CD handling
|
||||
- Added Sega CD / Mega CD header extraction
|
||||
- Readded Floppy Disk as a supported format
|
||||
- And more! See the full Git commit list for more details
|
||||
|
||||
### 1.11 (2018-09-20)
|
||||
|
||||
- Fix formatting of XBOX and XBOX 360 security sector output
|
||||
- Add new XBOX swap commands and outputs
|
||||
- Fixes for some PlayStation 2 and 4 outputs
|
||||
- Added external programs to AppVeyor builds
|
||||
- Fixed `.` in path issues with DIC; attempted to fix issues with `&`
|
||||
- Combined XBOX 360 XGD 2/3 due to new DIC support with Kreon drives
|
||||
- Fixed (semi-)longstanding bug with XBOX disc layer detection
|
||||
- Added DVD-Video protection output
|
||||
- Made custom parameters work a little more intuitively
|
||||
- Added *EXPERIMENTAL* Winforms-based UI
|
||||
- And more! See the full Git commit list for more details
|
||||
|
||||
### 1.10 (2018-07-29)
|
||||
|
||||
- Added many new options for user customization
|
||||
|
||||
6
DICUI.Check/App.config
Normal file
6
DICUI.Check/App.config
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/>
|
||||
</startup>
|
||||
</configuration>
|
||||
21
DICUI.Check/DICUI.Check.csproj
Normal file
21
DICUI.Check/DICUI.Check.csproj
Normal file
@@ -0,0 +1,21 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net462;net472;netcoreapp3.0</TargetFrameworks>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<OutputType>Exe</OutputType>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\DICUI.Library\DICUI.Library.csproj">
|
||||
<Project>{51ab0928-13f9-44bf-a407-b6957a43a056}</Project>
|
||||
<Name>DICUI.Library</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
180
DICUI.Check/Program.cs
Normal file
180
DICUI.Check/Program.cs
Normal file
@@ -0,0 +1,180 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using DICUI.Data;
|
||||
using DICUI.Utilities;
|
||||
|
||||
namespace DICUI.Check
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
{
|
||||
// Help options
|
||||
if (args.Length == 0
|
||||
|| args[0] == "/h" || args[0] == "/?"
|
||||
|| args[0] == "-h" || args[0] == "-?")
|
||||
{
|
||||
DisplayHelp();
|
||||
return;
|
||||
}
|
||||
|
||||
// List options
|
||||
if (args[0] == "/lm" || args[0] == "/listmedia"
|
||||
|| args[0] == "-lm" || args[0] == "--listmedia")
|
||||
{
|
||||
ListMediaTypes();
|
||||
Console.ReadLine();
|
||||
return;
|
||||
}
|
||||
else if (args[0] == "/ls" || args[0] == "/listsystems"
|
||||
|| args[0] == "-ls" || args[0] == "--listsystems")
|
||||
{
|
||||
ListKnownSystems();
|
||||
Console.ReadLine();
|
||||
return;
|
||||
}
|
||||
|
||||
// Normal operation check
|
||||
if (args.Length < 3)
|
||||
{
|
||||
DisplayHelp("Invalid number of arguments");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check the MediaType
|
||||
var mediaType = Converters.StringToMediaType(args[0].Trim('"'));
|
||||
if (mediaType == MediaType.NONE)
|
||||
{
|
||||
DisplayHelp($"{args[0]} is not a recognized media type");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check the KnownSystem
|
||||
var knownSystem = Converters.StringToKnownSystem(args[1].Trim('"'));
|
||||
if (knownSystem == KnownSystem.NONE)
|
||||
{
|
||||
DisplayHelp($"{args[1]} is not a recognized system");
|
||||
return;
|
||||
}
|
||||
|
||||
// Check for Redump login credentials
|
||||
string username = null, password = null;
|
||||
int startIndex = 2;
|
||||
if (args[2] == "-c" || args[2] == "--credentials")
|
||||
{
|
||||
username = args[3];
|
||||
password = args[4];
|
||||
startIndex = 5;
|
||||
}
|
||||
|
||||
// Make a new Progress object
|
||||
var progress = new Progress<Result>();
|
||||
progress.ProgressChanged += ProgressUpdated;
|
||||
|
||||
// Loop through all the rest of the args
|
||||
for (int i = startIndex; i < args.Length; i++)
|
||||
{
|
||||
// Check for a file
|
||||
if (!File.Exists(args[i]))
|
||||
{
|
||||
DisplayHelp($"{args[i]} does not exist");
|
||||
return;
|
||||
}
|
||||
|
||||
// Get the full file path
|
||||
string filepath = Path.GetFullPath(args[i]);
|
||||
|
||||
// Now populate an environment
|
||||
var env = new DumpEnvironment
|
||||
{
|
||||
OutputDirectory = "",
|
||||
OutputFilename = filepath,
|
||||
System = knownSystem,
|
||||
Type = mediaType,
|
||||
ScanForProtection = false,
|
||||
PromptForDiscInformation = false,
|
||||
|
||||
Username = username,
|
||||
Password = password,
|
||||
};
|
||||
env.FixOutputPaths();
|
||||
|
||||
// Finally, attempt to do the output dance
|
||||
var result = env.VerifyAndSaveDumpOutput(progress);
|
||||
Console.WriteLine(result.Message);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Display help for DICUI.Check
|
||||
/// </summary>
|
||||
/// <param name="error">Error string to prefix the help text with</param>
|
||||
private static void DisplayHelp(string error = null)
|
||||
{
|
||||
if (error != null)
|
||||
Console.WriteLine(error);
|
||||
|
||||
Console.WriteLine("Usage:");
|
||||
Console.WriteLine("DICUI.Check.exe <mediatype> <system> [-c username password] </path/to/output.bin> ...");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine(@"Common Media Types:\r\n
|
||||
bd / bluray - BD-ROM
|
||||
cd / cdrom - CD-ROM
|
||||
dvd - DVD-ROM
|
||||
fd / floppy - Floppy Disk
|
||||
gd / gdrom - GD-ROM
|
||||
umd - UMD");
|
||||
Console.WriteLine("Run 'DICUI.Check.exe [-lm|--listmedia' for more options");
|
||||
Console.WriteLine();
|
||||
Console.WriteLine(@"Common Systems:\r\n
|
||||
apple / mac - Apple Macintosh
|
||||
cdi - Philips CD-i
|
||||
ibm / ibmpc - IBM PC Compatible
|
||||
psx / ps1 - Sony PlayStation
|
||||
ps2 - Sony PlayStation 2
|
||||
psp - Sony PlayStation Portable
|
||||
saturn - Sega Saturn
|
||||
xbox - Microsoft XBOX
|
||||
x360 - Microsoft XBOX 360");
|
||||
Console.WriteLine("Run 'DICUI.Check.exe [-ls|--listsystems' for more options");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List all media types with their short usable names
|
||||
/// </summary>
|
||||
private static void ListMediaTypes()
|
||||
{
|
||||
Console.WriteLine("Supported Media Types:");
|
||||
foreach (var val in Enum.GetValues(typeof(MediaType)))
|
||||
{
|
||||
if (((MediaType)val) == MediaType.NONE)
|
||||
continue;
|
||||
|
||||
Console.WriteLine($"{((MediaType?)val).ShortName()} - {((MediaType?)val).LongName()}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List all known systems with their short usable names
|
||||
/// </summary>
|
||||
private static void ListKnownSystems()
|
||||
{
|
||||
Console.WriteLine("Supported Known Systems:");
|
||||
foreach (var val in Enum.GetValues(typeof(KnownSystem)))
|
||||
{
|
||||
if (((KnownSystem)val) == KnownSystem.NONE)
|
||||
continue;
|
||||
|
||||
Console.WriteLine($"{((KnownSystem?)val).ShortName()} - {((KnownSystem?)val).LongName()}");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Simple process counter to write to console
|
||||
/// </summary>
|
||||
private static void ProgressUpdated(object sender, Result value)
|
||||
{
|
||||
Console.WriteLine(value.Message);
|
||||
}
|
||||
}
|
||||
}
|
||||
36
DICUI.Check/Properties/AssemblyInfo.cs
Normal file
36
DICUI.Check/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.Check")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("DICUI.Check")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[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("8cfde289-e171-4d49-a40d-5293265c1253")]
|
||||
|
||||
// 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.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
40
DICUI.Library/DICUI.Library.csproj
Normal file
40
DICUI.Library/DICUI.Library.csproj
Normal file
@@ -0,0 +1,40 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>net462;net472;netcoreapp3.0</TargetFrameworks>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</PropertyGroup>
|
||||
|
||||
<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>
|
||||
<PackageReference Include="BurnOutSharp" Version="1.3.8.2" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />
|
||||
<PackageReference Include="System.Management" Version="4.6.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Reference Include="System.Management" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
@@ -1,17 +1,5 @@
|
||||
namespace DICUI.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Variables for UI elements
|
||||
/// </summary>
|
||||
public static class UIElements
|
||||
{
|
||||
public const string DiscNotDetected = "Disc Not Detected";
|
||||
public const string StartDumping = "Start Dumping";
|
||||
public const string StopDumping = "Stop Dumping";
|
||||
|
||||
public const int LogWindowMarginFromMainWindow = 10;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Top-level commands for DiscImageCreator
|
||||
/// </summary>
|
||||
@@ -23,17 +11,23 @@
|
||||
public const string CompactDisc = "cd";
|
||||
public const string Data = "data";
|
||||
public const string DigitalVideoDisc = "dvd";
|
||||
public const string Disk = "disk";
|
||||
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 Merge = "merge";
|
||||
public const string Reset = "reset";
|
||||
public const string SACD = "sacd";
|
||||
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>
|
||||
@@ -43,6 +37,7 @@
|
||||
{
|
||||
public const string AddOffset = "/a";
|
||||
public const string AMSF = "/p";
|
||||
public const string AtariJaguar = "/aj";
|
||||
public const string BEOpcode = "/be";
|
||||
public const string C2Opcode = "/c2";
|
||||
public const string CopyrightManagementInformation = "/c";
|
||||
@@ -54,15 +49,19 @@
|
||||
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 NoFixSubQSecuROM = "/ns";
|
||||
public const string NoSkipSS = "/nss";
|
||||
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 SkipSector = "/sk";
|
||||
public const string SubchannelReadLevel = "/s";
|
||||
public const string VideoNow = "/vn";
|
||||
public const string VideoNowColor = "/vnc";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -73,6 +72,7 @@
|
||||
// Manual information
|
||||
|
||||
public const string TitleField = "Title";
|
||||
public const string ForeignTitleField = "Foreign Title (Non-latin)";
|
||||
public const string DiscNumberField = "Disc Number / Letter";
|
||||
public const string DiscTitleField = "Disc Title";
|
||||
public const string SystemField = "System";
|
||||
@@ -80,45 +80,54 @@
|
||||
public const string CategoryField = "Category";
|
||||
public const string RegionField = "Region";
|
||||
public const string LanguagesField = "Languages";
|
||||
public const string PlaystationLanguageSelectionViaField = "Language Selection Via";
|
||||
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 PlayStation3WiiDiscKeyField = "Disc Key";
|
||||
public const string PlayStation3DiscIDField = "Disc ID";
|
||||
public const string GameCubeWiiBCAField = "BCA";
|
||||
public const string CopyProtectionField = "Copy Protection";
|
||||
public const string MasteringRingField = "Mastering Ring";
|
||||
public const string MasteringRingField = "Mastering Code (laser branded/etched)";
|
||||
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";
|
||||
public const string ToolstampField = "Toolstamp or Mastering Code (engraved/stamped)";
|
||||
|
||||
// Automatic Information
|
||||
|
||||
public const string PVDField = "Primary Volume Descriptor (PVD)";
|
||||
public const string DATField = "DAT";
|
||||
public const string SizeField = "Size";
|
||||
public const string CRC32Field = "CRC32";
|
||||
public const string MD5Field = "MD5";
|
||||
public const string SHA1Field = "SHA1";
|
||||
public const string MatchingIDsField = "Matching IDs";
|
||||
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 EXEDateBuildDate = "EXE/Build Date";
|
||||
public const string HeaderField = "Header";
|
||||
public const string PICField = "Permanent Information & Control (PIC)";
|
||||
public const string PlayStationEDCField = "EDC";
|
||||
public const string PlayStationAntiModchipField = "Anti-modchip";
|
||||
public const string PlayStationLibCryptField = "LibCrypt";
|
||||
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";
|
||||
}
|
||||
}
|
||||
601
DICUI.Library/Data/Enumerations.cs
Normal file
601
DICUI.Library/Data/Enumerations.cs
Normal file
@@ -0,0 +1,601 @@
|
||||
namespace DICUI.Data
|
||||
{
|
||||
/// <summary>
|
||||
/// Category for Redump
|
||||
/// </summary>
|
||||
public enum Category
|
||||
{
|
||||
Games = 1,
|
||||
Demos = 2,
|
||||
Video = 3,
|
||||
Audio = 4,
|
||||
Multimedia = 5,
|
||||
Applications = 6,
|
||||
Coverdiscs = 7,
|
||||
Educational = 8,
|
||||
BonusDiscs = 9,
|
||||
Preproduction = 10,
|
||||
AddOns = 11,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Supported DIC commands
|
||||
/// </summary>
|
||||
public enum DICCommand
|
||||
{
|
||||
NONE = 0,
|
||||
Audio,
|
||||
BluRay,
|
||||
Close,
|
||||
CompactDisc,
|
||||
Data,
|
||||
DigitalVideoDisc,
|
||||
Disk,
|
||||
DriveSpeed,
|
||||
Eject,
|
||||
Floppy,
|
||||
GDROM,
|
||||
MDS,
|
||||
Merge,
|
||||
Reset,
|
||||
SACD,
|
||||
Start,
|
||||
Stop,
|
||||
Sub,
|
||||
Swap,
|
||||
XBOX,
|
||||
XBOXSwap,
|
||||
XGD2Swap,
|
||||
XGD3Swap,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Supported DIC flags
|
||||
/// </summary>
|
||||
public enum DICFlag
|
||||
{
|
||||
NONE = 0,
|
||||
AddOffset,
|
||||
AMSF,
|
||||
AtariJaguar,
|
||||
BEOpcode,
|
||||
C2Opcode,
|
||||
CopyrightManagementInformation,
|
||||
D8Opcode,
|
||||
DisableBeep,
|
||||
ForceUnitAccess,
|
||||
MCN,
|
||||
MultiSession,
|
||||
NoFixSubP,
|
||||
NoFixSubQ,
|
||||
NoFixSubQLibCrypt,
|
||||
NoFixSubRtoW,
|
||||
NoFixSubQSecuROM,
|
||||
NoSkipSS,
|
||||
Raw,
|
||||
Reverse,
|
||||
ScanAntiMod,
|
||||
ScanFileProtect,
|
||||
ScanSectorProtect,
|
||||
SeventyFour,
|
||||
SkipSector,
|
||||
SubchannelReadLevel,
|
||||
VideoNow,
|
||||
VideoNowColor,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Drive type for dumping
|
||||
/// </summary>
|
||||
public enum InternalDriveType
|
||||
{
|
||||
Optical,
|
||||
Floppy,
|
||||
HardDisk,
|
||||
Removable,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dump status for Redump
|
||||
/// </summary>
|
||||
public enum DumpStatus
|
||||
{
|
||||
BadDumpRed = 2,
|
||||
PossibleBadDumpYellow = 3,
|
||||
OriginalMediaBlue = 4,
|
||||
TwoOrMoreDumpsGreen = 5,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Known systems
|
||||
/// </summary>
|
||||
public enum KnownSystem
|
||||
{
|
||||
NONE = 0,
|
||||
|
||||
#region Disc-Based Consoles
|
||||
|
||||
AtariJaguarCD,
|
||||
BandaiPlaydiaQuickInteractiveSystem,
|
||||
BandaiApplePippin,
|
||||
CommodoreAmigaCD32,
|
||||
CommodoreAmigaCDTV,
|
||||
EnvizionsEVOSmartConsole,
|
||||
FujitsuFMTownsMarty,
|
||||
HasbroVideoNow,
|
||||
HasbroVideoNowColor,
|
||||
HasbroVideoNowJr,
|
||||
HasbroVideoNowXP,
|
||||
MattelHyperscan,
|
||||
MicrosoftXBOX,
|
||||
MicrosoftXBOX360,
|
||||
MicrosoftXBOXOne,
|
||||
NECPCEngineTurboGrafxCD,
|
||||
NECPCFX,
|
||||
NintendoGameCube,
|
||||
NintendoSonySuperNESCDROMSystem,
|
||||
NintendoWii,
|
||||
NintendoWiiU,
|
||||
Panasonic3DOInteractiveMultiplayer, // The 3DO Company 3DO Interactive Multiplayer
|
||||
PhilipsCDi,
|
||||
PioneerLaserActive,
|
||||
SegaCDMegaCD,
|
||||
SegaDreamcast,
|
||||
SegaSaturn,
|
||||
SNKNeoGeoCD,
|
||||
SonyPlayStation,
|
||||
SonyPlayStation2,
|
||||
SonyPlayStation3,
|
||||
SonyPlayStation4,
|
||||
SonyPlayStationPortable,
|
||||
TandyMemorexVisualInformationSystem,
|
||||
VMLabsNuon,
|
||||
VTechVFlashVSmilePro,
|
||||
ZAPiTGamesGameWaveFamilyEntertainmentSystem,
|
||||
|
||||
MarkerDiscBasedConsoleEnd,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Cartridge-Based and Other Consoles
|
||||
|
||||
/*
|
||||
AmstradGX4000,
|
||||
APFMicrocomputerSystem,
|
||||
Atari2600VCS,
|
||||
Atari5200,
|
||||
Atari7800,
|
||||
AtariJaguar,
|
||||
AtariXEVideoGameSystem,
|
||||
Audiosonic1292AdvancedProgrammableVideoSystem,
|
||||
BallyAstrocade,
|
||||
BitCorporationDina,
|
||||
CasioLoopy,
|
||||
CasioPV1000,
|
||||
Commodore64GamesSystem,
|
||||
DaewooElectronicsZemmix,
|
||||
EmersonArcadia2001,
|
||||
EpochCassetteVision,
|
||||
EpochSuperCassetteVision,
|
||||
FairchildChannelF,
|
||||
FuntechSuperACan,
|
||||
GeneralConsumerElectricVectrex,
|
||||
HeberBBCBridgeCompanion,
|
||||
IntertonVC4000,
|
||||
JungleTacVii,
|
||||
LeapFrogClickStart,
|
||||
LJNVideoArt,
|
||||
MagnavoxOdyssey2,
|
||||
MattelIntellivision,
|
||||
NECPCEngineTurboGrafx16,
|
||||
NichibutsuMyVision,
|
||||
Nintendo64,
|
||||
Nintendo64DD,
|
||||
NintendoFamilyComputerNintendoEntertainmentSystem,
|
||||
NintendoFamilyComputerDiskSystem,
|
||||
NintendoSuperFamicomSuperNintendoEntertainmentSystem,
|
||||
NintendoSwitch,
|
||||
PhilipsVideopacPlusG7400,
|
||||
RCAStudioII,
|
||||
Sega32X,
|
||||
SegaMarkIIIMasterSystem,
|
||||
SegaMegaDriveGenesis,
|
||||
SegaSG1000,
|
||||
SNKNeoGeo,
|
||||
SSDCOMPANYLIMITEDXaviXPORT,
|
||||
ViewMasterInteractiveVision,
|
||||
VTechCreatiVision,
|
||||
VTechVSmile,
|
||||
VTechSocrates,
|
||||
WorldsOfWonderActionMax,
|
||||
|
||||
MarkerOtherConsoleEnd,
|
||||
*/
|
||||
|
||||
#endregion
|
||||
|
||||
#region Computers
|
||||
|
||||
AcornArchimedes,
|
||||
AppleMacintosh,
|
||||
CommodoreAmiga,
|
||||
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,
|
||||
MeritIndustriesMegaTouchForce,
|
||||
MeritIndustriesMegaTouchION,
|
||||
MeritIndustriesMegaTouchMaxx,
|
||||
MeritIndustriesMegaTouchXL,
|
||||
NamcoCapcomSystem256,
|
||||
NamcoCapcomTaitoSystem246,
|
||||
NamcoSegaNintendoTriforce,
|
||||
NamcoSystem12,
|
||||
NamcoSystem357,
|
||||
NewJatreCDi,
|
||||
NichibutsuHighRateSystem,
|
||||
NichibutsuSuperCD,
|
||||
NichibutsuXRateSystem,
|
||||
PanasonicM2,
|
||||
PhotoPlayVarious,
|
||||
RawThrillsVarious,
|
||||
SegaChihiro,
|
||||
SegaEuropaR,
|
||||
SegaLindbergh,
|
||||
SegaNaomi,
|
||||
SegaNaomi2,
|
||||
SegaNu,
|
||||
SegaRingEdge,
|
||||
SegaRingEdge2,
|
||||
SegaRingWide,
|
||||
SegaTitanVideo,
|
||||
SegaSystem32,
|
||||
SeibuCATSSystem,
|
||||
TABAustriaQuizard,
|
||||
TsunamiTsuMoMultiGameMotionSystem,
|
||||
|
||||
MarkerArcadeEnd,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Other
|
||||
|
||||
AudioCD,
|
||||
BDVideo,
|
||||
DVDVideo,
|
||||
EnhancedCD,
|
||||
HDDVDVideo,
|
||||
NavisoftNaviken21,
|
||||
PalmOS,
|
||||
PhilipsCDiDigitalVideo,
|
||||
PhotoCD,
|
||||
PlayStationGameSharkUpdates,
|
||||
RainbowDisc,
|
||||
SuperAudioCD,
|
||||
TaoiKTV,
|
||||
TomyKissSite,
|
||||
VideoCD,
|
||||
|
||||
MarkerOtherEnd,
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Known system category
|
||||
/// </summary>
|
||||
public enum KnownSystemCategory
|
||||
{
|
||||
DiscBasedConsole = 0,
|
||||
OtherConsole,
|
||||
Computer,
|
||||
Arcade,
|
||||
Other,
|
||||
Custom
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// List of all disc langauges
|
||||
/// </summary>
|
||||
public enum Language
|
||||
{
|
||||
Afrikaans,
|
||||
Arabic,
|
||||
Basque,
|
||||
Bulgarian,
|
||||
Catalan,
|
||||
Chinese,
|
||||
Croatian,
|
||||
Czech,
|
||||
Danish,
|
||||
Dutch,
|
||||
English,
|
||||
Finnish,
|
||||
French,
|
||||
Gaelic,
|
||||
German,
|
||||
Greek,
|
||||
Hebrew,
|
||||
Hindi,
|
||||
Hungarian,
|
||||
Italian,
|
||||
Japanese,
|
||||
Korean,
|
||||
Norwegian,
|
||||
Polish,
|
||||
Portuguese,
|
||||
Punjabi,
|
||||
Romanian,
|
||||
Russian,
|
||||
Slovak,
|
||||
Slovenian,
|
||||
Spanish,
|
||||
Swedish,
|
||||
Tamil,
|
||||
Thai,
|
||||
Turkish,
|
||||
Ukrainian,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// All possible language selections
|
||||
/// </summary>
|
||||
public enum LanguageSelection
|
||||
{
|
||||
BiosSettings,
|
||||
LanguageSelector,
|
||||
OptionsMenu,
|
||||
}
|
||||
|
||||
/// <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,
|
||||
NintendoGameCubeGameDisc,
|
||||
NintendoWiiOpticalDisc,
|
||||
NintendoWiiUOpticalDisc,
|
||||
UMD,
|
||||
|
||||
#endregion
|
||||
|
||||
// Unsorted Formats
|
||||
Cartridge,
|
||||
CED,
|
||||
CompactFlash,
|
||||
MMC,
|
||||
SDCard,
|
||||
FlashDrive,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of all known Redump systems
|
||||
/// </summary>
|
||||
public enum RedumpSystem
|
||||
{
|
||||
// Special BIOS sets
|
||||
MicrosoftXboxBIOS,
|
||||
NintendoGameCubeBIOS,
|
||||
SonyPlayStationBIOS,
|
||||
SonyPlayStation2BIOS,
|
||||
|
||||
// Regular systems
|
||||
AcornArchimedes,
|
||||
AppleMacintosh,
|
||||
AudioCD,
|
||||
BDVideo,
|
||||
BandaiPippin,
|
||||
BandaiPlaydiaQuickInteractiveSystem,
|
||||
CommodoreAmigaCD,
|
||||
CommodoreAmigaCD32,
|
||||
CommodoreAmigaCDTV,
|
||||
DVDVideo,
|
||||
FujitsuFMTownsseries,
|
||||
HasbroVideoNow,
|
||||
HasbroVideoNowColor,
|
||||
HasbroVideoNowJr,
|
||||
HasbroVideoNowXP,
|
||||
IBMPCcompatible,
|
||||
IncredibleTechnologiesEagle,
|
||||
KonamiFireBeat,
|
||||
KonamiM2,
|
||||
KonamiSystem573,
|
||||
KonamiSystemGV,
|
||||
KonamiTwinkle,
|
||||
KonamieAmusement,
|
||||
MattelHyperScan,
|
||||
MemorexVisualInformationSystem,
|
||||
MicrosoftXbox,
|
||||
MicrosoftXbox360,
|
||||
MicrosoftXboxOne,
|
||||
NECPC88series,
|
||||
NECPC98series,
|
||||
NECPCEngineCDTurboGrafxCD,
|
||||
NECPCFXPCFXGA,
|
||||
NamcoSystem12,
|
||||
NamcoSystem246,
|
||||
NavisoftNaviken21,
|
||||
NinendoGameCube,
|
||||
NintendoWii,
|
||||
NintendoWiiU,
|
||||
PalmOS,
|
||||
Panasonic3DOInteractiveMultiplayer,
|
||||
PanasonicM2,
|
||||
PhilipsCDi,
|
||||
PhilipsCDiDigitalVideo,
|
||||
PhotoCD,
|
||||
PlayStationGameSharkUpdates,
|
||||
SegaChihiro,
|
||||
SegaDreamcast,
|
||||
SegaLindbergh,
|
||||
SegaMegaCDSegaCD,
|
||||
SegaNaomi,
|
||||
SegaNaomi2,
|
||||
SegaRingEdge,
|
||||
SegaRingEdge2,
|
||||
SegaSaturn,
|
||||
SegaTitanVideo,
|
||||
SegaTriforce,
|
||||
SharpX68000,
|
||||
SNKNeoGeoCD,
|
||||
SonyPlayStation,
|
||||
SonyPlayStation2,
|
||||
SonyPlayStation3,
|
||||
SonyPlayStation4,
|
||||
SonyPlayStationPortable,
|
||||
TABAustriaQuizard,
|
||||
TaoiKTV,
|
||||
TomyKissSite,
|
||||
VideoCD,
|
||||
VMLabsNUON,
|
||||
VTechVFlashVSmilePro,
|
||||
ZAPiTGamesGameWaveFamilyEntertainmentSystem,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// List of all known Redump regions
|
||||
/// </summary>
|
||||
public enum Region
|
||||
{
|
||||
Argentina,
|
||||
Asia,
|
||||
AsiaEurope,
|
||||
AsiaUSA,
|
||||
Australia,
|
||||
Austria,
|
||||
AustriaSwitzerland,
|
||||
Belgium,
|
||||
BelgiumNetherlands,
|
||||
Brazil,
|
||||
Canada,
|
||||
China,
|
||||
Croatia,
|
||||
Czech,
|
||||
Denmark,
|
||||
Europe,
|
||||
EuropeAsia,
|
||||
EuropeAustralia,
|
||||
Finland,
|
||||
France,
|
||||
FranceSpain,
|
||||
Germany,
|
||||
GreaterChina,
|
||||
Greece,
|
||||
Hungary,
|
||||
India,
|
||||
Ireland,
|
||||
Israel,
|
||||
Italy,
|
||||
Japan,
|
||||
JapanAsia,
|
||||
JapanEurope,
|
||||
JapanKorea,
|
||||
JapanUSA,
|
||||
Korea,
|
||||
LatinAmerica,
|
||||
Netherlands,
|
||||
Norway,
|
||||
Poland,
|
||||
Portugal,
|
||||
Russia,
|
||||
Scandinavia,
|
||||
Singapore,
|
||||
Slovakia,
|
||||
SouthAfrica,
|
||||
Spain,
|
||||
Sweden,
|
||||
Switzerland,
|
||||
Taiwan,
|
||||
Thailand,
|
||||
Turkey,
|
||||
UnitedArabEmirates,
|
||||
UK,
|
||||
UKAustralia,
|
||||
Ukraine,
|
||||
USA,
|
||||
USAAsia,
|
||||
USABrazil,
|
||||
USACanada,
|
||||
USAEurope,
|
||||
USAJapan,
|
||||
World,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Generic yes/no values for Redump
|
||||
/// </summary>
|
||||
public enum YesNo
|
||||
{
|
||||
NULL = 0,
|
||||
No = 1,
|
||||
Yes = 2,
|
||||
}
|
||||
}
|
||||
500
DICUI.Library/Data/SubmissionInfo.cs
Normal file
500
DICUI.Library/Data/SubmissionInfo.cs
Normal file
@@ -0,0 +1,500 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Net;
|
||||
using DICUI.Utilities;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace DICUI.Data
|
||||
{
|
||||
public class SubmissionInfo
|
||||
{
|
||||
/// <summary>
|
||||
/// List of matched Redump IDs
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public List<int> MatchedIDs { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DateTime of when the disc was added
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public DateTime? Added { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DateTime of when the disc was last modified
|
||||
/// </summary>
|
||||
[JsonIgnore]
|
||||
public DateTime? LastModified { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "common_disc_info", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public CommonDiscInfoSection CommonDiscInfo { get; set; } = new CommonDiscInfoSection();
|
||||
|
||||
[JsonProperty(PropertyName = "versions_and_editions", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public VersionAndEditionsSection VersionAndEditions { get; set; } = new VersionAndEditionsSection();
|
||||
|
||||
[JsonProperty(PropertyName = "edc", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public EDCSection EDC { get; set; } = new EDCSection();
|
||||
|
||||
[JsonProperty(PropertyName = "parent_clone_relationship", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public ParentCloneRelationshipSection ParentCloneRelationship { get; set; } = new ParentCloneRelationshipSection();
|
||||
|
||||
[JsonProperty(PropertyName = "extras", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public ExtrasSection Extras { get; set; } = new ExtrasSection();
|
||||
|
||||
[JsonProperty(PropertyName = "copy_protection", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public CopyProtectionSection CopyProtection { get; set; } = new CopyProtectionSection();
|
||||
|
||||
[JsonProperty(PropertyName = "dumpers_and_status", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public DumpersAndStatusSection DumpersAndStatus { get; set; } = new DumpersAndStatusSection();
|
||||
|
||||
[JsonProperty(PropertyName = "tracks_and_write_offsets", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public TracksAndWriteOffsetsSection TracksAndWriteOffsets { get; set; } = new TracksAndWriteOffsetsSection();
|
||||
|
||||
[JsonProperty(PropertyName = "size_and_checksums", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public SizeAndChecksumsSection SizeAndChecksums { get; set; } = new SizeAndChecksumsSection();
|
||||
|
||||
#region Regexes
|
||||
|
||||
private readonly Regex addedRegex = new Regex(@"<tr><th>Added</th><td>(.*?)</td></tr>");
|
||||
private readonly Regex barcodeRegex = new Regex(@"<tr><th>Barcode</th></tr><tr><td>(.*?)</td></tr>");
|
||||
private readonly Regex bcaRegex = new Regex(@"<h3>BCA .*?/></h3></td><td .*?></td></tr>"
|
||||
+ "<tr><th>Row</th><th>Contents</th><th>ASCII</th></tr>"
|
||||
+ "<tr><td>(?<row1number>.*?)</td><td>(?<row1contents>.*?)</td><td>(?<row1ascii>.*?)</td></tr>"
|
||||
+ "<tr><td>(?<row2number>.*?)</td><td>(?<row2contents>.*?)</td><td>(?<row2ascii>.*?)</td></tr>"
|
||||
+ "<tr><td>(?<row3number>.*?)</td><td>(?<row3contents>.*?)</td><td>(?<row3ascii>.*?)</td></tr>"
|
||||
+ "<tr><td>(?<row4number>.*?)</td><td>(?<row4contents>.*?)</td><td>(?<row4ascii>.*?)</td></tr>");
|
||||
private readonly Regex categoryRegex = new Regex(@"<tr><th>Category</th><td>(.*?)</td></tr>");
|
||||
private readonly Regex commentsRegex = new Regex(@"<tr><th>Comments</th></tr><tr><td>(.*?)</td></tr>");
|
||||
private readonly Regex contentsRegex = new Regex(@"<tr><th>Contents</th></tr><tr .*?><td>(.*?)</td></tr>");
|
||||
private readonly Regex discNumberLetterRegex = new Regex(@"\((.*?)\)");
|
||||
private readonly Regex dumpersRegex = new Regex(@"<a href=""/discs/dumper/(.*?)/"">");
|
||||
private readonly Regex editionRegex = new Regex(@"<tr><th>Edition</th><td>(.*?)</td></tr>");
|
||||
private readonly Regex errorCountRegex = new Regex(@"<tr><th>Errors count</th><td>(.*?)</td></tr>");
|
||||
private readonly Regex foreignTitleRegex = new Regex(@"<h2>(.*?)</h2>");
|
||||
private readonly Regex fullMatchRegex = new Regex(@"<td class=""static"">full match ids: (.*?)</td>");
|
||||
private readonly Regex languagesRegex = new Regex(@"<img src=""/images/languages/(.*?)\.png"" alt="".*?"" title="".*?"" />\s*");
|
||||
private readonly Regex lastModifiedRegex = new Regex(@"<tr><th>Last modified</th><td>(.*?)</td></tr>");
|
||||
private readonly Regex mediaRegex = new Regex(@"<tr><th>Media</th><td>(.*?)</td></tr>");
|
||||
private readonly Regex partialMatchRegex = new Regex(@"<td class=""static"">partial match ids: (.*?)</td>");
|
||||
private readonly Regex pvdRegex = new Regex(@"<h3>Primary Volume Descriptor (PVD) <img .*?/></h3></td><td .*?></td></tr>"
|
||||
+ @"<tr><th>Record / Entry</th><th>Contents</th><th>Date</th><th>Time</th><th>GMT</th></tr>"
|
||||
+ @"<tr><td>Creation</td><td>(?<creationbytes>.*?)</td><td>(?<creationdate>.*?)</td><td>(?<creationtime>.*?)</td><td>(?<creationtimezone>.*?)</td></tr>"
|
||||
+ @"<tr><td>Modification</td><td>(?<modificationbytes>.*?)</td><td>(?<modificationdate>.*?)</td><td>(?<modificationtime>.*?)</td><td>(?<modificationtimezone>.*?)</td></tr>"
|
||||
+ @"<tr><td>Expiration</td><td>(?<expirationbytes>.*?)</td><td>(?<expirationdate>.*?)</td><td>(?<expirationtime>.*?)</td><td>(?<expirationtimezone>.*?)</td></tr>"
|
||||
+ @"<tr><td>Effective</td><td>(?<effectivebytes>.*?)</td><td>(?<effectivedate>.*?)</td><td>(?<effectivetime>.*?)</td><td>(?<effectivetimezone>.*?)</td></tr>");
|
||||
private readonly Regex regionRegex = new Regex(@"<tr><th>Region</th><td><a href=""/discs/region/(.*?)/"">");
|
||||
private readonly Regex ringCodeDoubleRegex = new Regex(@""); // Varies based on available fields, like Addtional Mould
|
||||
private readonly Regex ringCodeSingleRegex = new Regex(@""); // Varies based on available fields, like Addtional Mould
|
||||
private readonly Regex serialRegex = new Regex(@"<tr><th>Serial</th><td>(.*?)</td></tr>");
|
||||
private readonly Regex systemRegex = new Regex(@"<tr><th>System</th><td><a href=""/discs/system/(.*?)/"">");
|
||||
private readonly Regex titleRegex = new Regex(@"<h1>(.*?)</h1>");
|
||||
private readonly Regex trackRegex = new Regex(@"<tr><td>(?<number>.*?)</td><td>(?<type>.*?)</td><td>(?<pregap>.*?)</td><td>(?<length>.*?)</td><td>(?<sectors>.*?)</td><td>(?<size>.*?)</td><td>(?<crc32>.*?)</td><td>(?<md5>.*?)</td><td>(?<sha1>.*?)</td></tr>");
|
||||
private readonly Regex trackCountRegex = new Regex(@"<tr><th>Number of tracks</th><td>(.*?)</td></tr>");
|
||||
private readonly Regex versionRegex = new Regex(@"<tr><th>Version</th><td>(.*?)</td></tr>");
|
||||
private readonly Regex writeOffsetRegex = new Regex(@"<tr><th>Write offset</th><td>(.*?)</td></tr>");
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Fill in information from a Redump disc page
|
||||
/// </summary>
|
||||
/// <param name="discData">String representation of the disc page</param>
|
||||
public void FillFromDiscPage(string discData)
|
||||
{
|
||||
// Title, Disc Number/Letter, Disc Title
|
||||
var match = titleRegex.Match(discData);
|
||||
if (match.Success)
|
||||
{
|
||||
string title = WebUtility.HtmlDecode(match.Groups[1].Value);
|
||||
|
||||
// If we have parenthesis, title is everything before the first one
|
||||
int firstParenLocation = title.IndexOf(" (");
|
||||
if (firstParenLocation >= 0)
|
||||
{
|
||||
this.CommonDiscInfo.Title = title.Substring(0, firstParenLocation);
|
||||
var subMatches = discNumberLetterRegex.Match(title);
|
||||
for (int i = 1; i < subMatches.Groups.Count; i++)
|
||||
{
|
||||
string subMatch = subMatches.Groups[i].Value;
|
||||
|
||||
// Disc number or letter
|
||||
if (subMatch.StartsWith("Disc"))
|
||||
this.CommonDiscInfo.DiscNumberLetter = subMatch.Remove(0, "Disc ".Length);
|
||||
|
||||
// Disc title
|
||||
else
|
||||
this.CommonDiscInfo.DiscTitle = subMatch;
|
||||
}
|
||||
}
|
||||
// Otherwise, leave the title as-is
|
||||
else
|
||||
{
|
||||
this.CommonDiscInfo.Title = title;
|
||||
}
|
||||
}
|
||||
|
||||
// Foreign Title
|
||||
match = foreignTitleRegex.Match(discData);
|
||||
if (match.Success)
|
||||
this.CommonDiscInfo.ForeignTitleNonLatin = WebUtility.HtmlDecode(match.Groups[1].Value);
|
||||
else
|
||||
this.CommonDiscInfo.ForeignTitleNonLatin = null;
|
||||
|
||||
// Category
|
||||
match = categoryRegex.Match(discData);
|
||||
if (match.Success)
|
||||
this.CommonDiscInfo.Category = Converters.StringToCategory(match.Groups[1].Value);
|
||||
else
|
||||
this.CommonDiscInfo.Category = Data.Category.Games;
|
||||
|
||||
// Region
|
||||
match = regionRegex.Match(discData);
|
||||
if (match.Success)
|
||||
this.CommonDiscInfo.Region = Converters.StringToRegion(match.Groups[1].Value);
|
||||
|
||||
// Languages
|
||||
var matches = languagesRegex.Matches(discData);
|
||||
if (matches.Count > 0)
|
||||
{
|
||||
List<Language?> tempLanguages = new List<Language?>();
|
||||
foreach (Match submatch in matches)
|
||||
tempLanguages.Add(Converters.StringToLanguage(submatch.Groups[1].Value));
|
||||
|
||||
this.CommonDiscInfo.Languages = tempLanguages.ToArray();
|
||||
}
|
||||
|
||||
// Serial
|
||||
match = serialRegex.Match(discData);
|
||||
if (match.Success)
|
||||
this.CommonDiscInfo.Serial = WebUtility.HtmlDecode(match.Groups[1].Value);
|
||||
|
||||
// Error count
|
||||
match = errorCountRegex.Match(discData);
|
||||
if (match.Success)
|
||||
{
|
||||
// If the error counts don't match, then use the one from the disc page
|
||||
if (!string.IsNullOrEmpty(this.CommonDiscInfo.ErrorsCount) && match.Groups[1].Value != this.CommonDiscInfo.ErrorsCount)
|
||||
this.CommonDiscInfo.ErrorsCount = match.Groups[1].Value;
|
||||
}
|
||||
|
||||
// Version
|
||||
match = versionRegex.Match(discData);
|
||||
if (match.Success)
|
||||
this.VersionAndEditions.Version = WebUtility.HtmlDecode(match.Groups[1].Value);
|
||||
|
||||
// Edition
|
||||
match = editionRegex.Match(discData);
|
||||
if (match.Success)
|
||||
this.VersionAndEditions.OtherEditions = WebUtility.HtmlDecode(match.Groups[1].Value);
|
||||
|
||||
// Dumpers
|
||||
matches = dumpersRegex.Matches(discData);
|
||||
if (matches.Count > 0)
|
||||
{
|
||||
// Start with any currently listed dumpers
|
||||
List<string> tempDumpers = new List<string>();
|
||||
if (this.DumpersAndStatus.Dumpers.Length > 0)
|
||||
{
|
||||
foreach (string dumper in this.DumpersAndStatus.Dumpers)
|
||||
tempDumpers.Add(dumper);
|
||||
}
|
||||
|
||||
foreach (Match submatch in matches)
|
||||
tempDumpers.Add(WebUtility.HtmlDecode(submatch.Groups[1].Value));
|
||||
|
||||
this.DumpersAndStatus.Dumpers = tempDumpers.ToArray();
|
||||
}
|
||||
|
||||
// Barcode
|
||||
match = barcodeRegex.Match(discData);
|
||||
if (match.Success)
|
||||
this.CommonDiscInfo.Barcode = WebUtility.HtmlDecode(match.Groups[1].Value);
|
||||
|
||||
// Comments
|
||||
match = commentsRegex.Match(discData);
|
||||
if (match.Success)
|
||||
{
|
||||
this.CommonDiscInfo.Comments = WebUtility.HtmlDecode(match.Groups[1].Value)
|
||||
.Replace("<br />", "\n")
|
||||
.Replace("<b>ISBN</b>", "[T:ISBN]") + "\n";
|
||||
}
|
||||
|
||||
// Contents
|
||||
match = contentsRegex.Match(discData);
|
||||
if (match.Success)
|
||||
{
|
||||
this.CommonDiscInfo.Contents = WebUtility.HtmlDecode(match.Groups[1].Value)
|
||||
.Replace("<br />", "\n")
|
||||
.Replace("</div>", "");
|
||||
this.CommonDiscInfo.Contents = Regex.Replace(this.CommonDiscInfo.Contents, @"<div .*?>", "");
|
||||
}
|
||||
|
||||
// Added
|
||||
match = addedRegex.Match(discData);
|
||||
if (match.Success)
|
||||
this.Added = DateTime.Parse(match.Groups[1].Value);
|
||||
|
||||
// Last Modified
|
||||
match = lastModifiedRegex.Match(discData);
|
||||
if (match.Success)
|
||||
this.LastModified = DateTime.Parse(match.Groups[1].Value);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Common disc info section of New Disc Form
|
||||
/// </summary>
|
||||
public class CommonDiscInfoSection
|
||||
{
|
||||
// TODO: Name not defined
|
||||
[JsonProperty(PropertyName = "d_system", Required = Required.AllowNull)]
|
||||
[JsonConverter(typeof(KnownSystemConverter))]
|
||||
public KnownSystem? System { get; set; }
|
||||
|
||||
// TODO: Name not defined
|
||||
// TODO: Have this convert to a new `RedumpMedia?` if possible, for submission
|
||||
[JsonProperty(PropertyName = "d_media", Required = Required.AllowNull)]
|
||||
[JsonConverter(typeof(MediaTypeConverter))]
|
||||
public MediaType? Media { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_title", Required = Required.AllowNull)]
|
||||
public string Title { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_title_foreign", DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
public string ForeignTitleNonLatin { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_number", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string DiscNumberLetter { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_label", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string DiscTitle { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_category", Required = Required.AllowNull)]
|
||||
public Category? Category { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_region", Required = Required.AllowNull)]
|
||||
[JsonConverter(typeof(RegionConverter))]
|
||||
public Region? Region { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_languages", Required = Required.AllowNull)]
|
||||
[JsonConverter(typeof(LanguagesConverter))]
|
||||
public Language?[] Languages { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_languages_selection", NullValueHandling = NullValueHandling.Ignore, DefaultValueHandling = DefaultValueHandling.Ignore)]
|
||||
[JsonConverter(typeof(LanguageSelectionConverter))]
|
||||
public LanguageSelection?[] LanguageSelection { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_serial", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Serial { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_ring", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Ring { get; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_ring_0_id", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string RingId { get; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_ring_0_ma1", Required = Required.AllowNull)]
|
||||
public string MasteringRingFirstLayerDataSide { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_ring_0_ma1_sid", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string MasteringSIDCodeFirstLayerDataSide { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_ring_0_ts1", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string ToolstampMasteringCodeFirstLayerDataSide { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_ring_0_mo1_sid", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string MouldSIDCodeFirstLayerDataSide { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "dr_ring_0_mo1", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string AdditionalMouldFirstLayerDataSide { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_ring_0_ma2", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string MasteringRingSecondLayerLabelSide { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_ring_0_ma2_sid", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string MasteringSIDCodeSecondLayerLabelSide { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_ring_0_ts2", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string ToolstampMasteringCodeSecondLayerLabelSide { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_ring_0_mo2_sid", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string MouldSIDCodeSecondLayerLabelSide { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "dr_ring_0_mo2", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string AdditionalMouldSecondLayerLabelSide { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_ring_0_offsets", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string RingOffsetsHidden { get { return "1"; } }
|
||||
|
||||
[JsonProperty(PropertyName = "d_ring_0_0_id", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string RingZeroId { get; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_ring_0_0_density", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string RingZeroDensity { get; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_ring_0_0_value", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string RingWriteOffset { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_ring_count", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string RingCount { get { return "1"; } }
|
||||
|
||||
[JsonProperty(PropertyName = "d_barcode", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Barcode { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_date", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string EXEDateBuildDate { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_errors", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string ErrorsCount { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_comments", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Comments { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_contents", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Contents { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Version and editions section of New Disc form
|
||||
/// </summary>
|
||||
public class VersionAndEditionsSection
|
||||
{
|
||||
[JsonProperty(PropertyName = "d_version", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Version { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_version_datfile", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string VersionDatfile { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_editions", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string[] CommonEditions { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_editions_text", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string OtherEditions { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// EDC section of New Disc form (PSX only)
|
||||
/// </summary>
|
||||
public class EDCSection
|
||||
{
|
||||
[JsonProperty(PropertyName = "d_edc", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public YesNo EDC { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Parent/Clone relationship section of New Disc form
|
||||
/// </summary>
|
||||
public class ParentCloneRelationshipSection
|
||||
{
|
||||
[JsonProperty(PropertyName = "d_parent_id", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string ParentID { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_is_regional_parent", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public bool RegionalParent { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extras section of New Disc form
|
||||
/// </summary>
|
||||
public class ExtrasSection
|
||||
{
|
||||
[JsonProperty(PropertyName = "d_pvd", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string PVD { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_d1_key", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string DiscKey { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_d2_key", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string DiscID { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_pic_data", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string PIC { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_header", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Header { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_bca", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string BCA { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_ssranges", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string SecuritySectorRanges { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Copy protection section of New Disc form
|
||||
/// </summary>
|
||||
public class CopyProtectionSection
|
||||
{
|
||||
[JsonProperty(PropertyName = "d_protection_a", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public YesNo AntiModchip { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_protection_1", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public YesNo LibCrypt { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_libcrypt", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string LibCryptData { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_protection", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Protection { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_securom", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string SecuROMData { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dumpers and status section of New Disc form (Moderator only)
|
||||
/// </summary>
|
||||
public class DumpersAndStatusSection
|
||||
{
|
||||
[JsonProperty(PropertyName = "d_status", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public DumpStatus Status { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_dumpers", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string[] Dumpers { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_dumpers_text", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string OtherDumpers { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Tracks and write offsets section of New Disc form (CD/GD-based)
|
||||
/// </summary>
|
||||
public class TracksAndWriteOffsetsSection
|
||||
{
|
||||
[JsonProperty(PropertyName = "d_tracks", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string ClrMameProData { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_cue", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string Cuesheet { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_offset", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public int[] CommonWriteOffsets { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_offset_text", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string OtherWriteOffsets { get; set; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Size & checksums section of New Disc form (DVD/BD/UMD-based)
|
||||
/// </summary>
|
||||
public class SizeAndChecksumsSection
|
||||
{
|
||||
[JsonProperty(PropertyName = "d_layerbreak", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public long Layerbreak { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_size", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public long Size { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_crc32", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string CRC32 { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_md5", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string MD5 { get; set; }
|
||||
|
||||
[JsonProperty(PropertyName = "d_sha1", NullValueHandling = NullValueHandling.Ignore)]
|
||||
public string SHA1 { get; set; }
|
||||
}
|
||||
}
|
||||
37
DICUI.Library/Properties/AssemblyInfo.cs
Normal file
37
DICUI.Library/Properties/AssemblyInfo.cs
Normal file
@@ -0,0 +1,37 @@
|
||||
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 © 2019")]
|
||||
[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.13")]
|
||||
[assembly: AssemblyFileVersion("1.13.0.0")]
|
||||
[assembly: InternalsVisibleTo("DICUI.Test")]
|
||||
3486
DICUI.Library/Utilities/Converters.cs
Normal file
3486
DICUI.Library/Utilities/Converters.cs
Normal file
File diff suppressed because it is too large
Load Diff
63
DICUI.Library/Utilities/Drive.cs
Normal file
63
DICUI.Library/Utilities/Drive.cs
Normal file
@@ -0,0 +1,63 @@
|
||||
using System.IO;
|
||||
using DICUI.Data;
|
||||
|
||||
namespace DICUI.Utilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents information for a single drive
|
||||
/// </summary>
|
||||
public class Drive
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents drive type
|
||||
/// </summary>
|
||||
public InternalDriveType? InternalDriveType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// DriveInfo object representing the drive, if possible
|
||||
/// </summary>
|
||||
public DriveInfo DriveInfo { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Windows drive letter
|
||||
/// </summary>
|
||||
public char Letter { get { return DriveInfo?.Name[0] ?? '\0'; } }
|
||||
|
||||
/// <summary>
|
||||
/// Media label as read by Windows
|
||||
/// </summary>
|
||||
public string VolumeLabel
|
||||
{
|
||||
get
|
||||
{
|
||||
if (DriveInfo.IsReady)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(DriveInfo.VolumeLabel))
|
||||
return "track";
|
||||
else
|
||||
return DriveInfo.VolumeLabel;
|
||||
}
|
||||
else
|
||||
{
|
||||
return Template.DiscNotDetected;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Drive partition format
|
||||
/// </summary>
|
||||
public string DriveFormat { get { return DriveInfo.DriveFormat; } }
|
||||
|
||||
/// <summary>
|
||||
/// Represents if Windows has marked the drive as active
|
||||
/// </summary>
|
||||
public bool MarkedActive { get { return DriveInfo.IsReady; } }
|
||||
|
||||
public Drive(InternalDriveType? driveType, DriveInfo driveInfo)
|
||||
{
|
||||
this.InternalDriveType = driveType;
|
||||
this.DriveInfo = driveInfo;
|
||||
}
|
||||
}
|
||||
}
|
||||
2275
DICUI.Library/Utilities/DumpEnvironment.cs
Normal file
2275
DICUI.Library/Utilities/DumpEnvironment.cs
Normal file
File diff suppressed because it is too large
Load Diff
252
DICUI.Library/Utilities/Extensions.cs
Normal file
252
DICUI.Library/Utilities/Extensions.cs
Normal file
@@ -0,0 +1,252 @@
|
||||
using DICUI.Data;
|
||||
|
||||
namespace DICUI.Utilities
|
||||
{
|
||||
public static class Extensions
|
||||
{
|
||||
#region Redump Information Lists
|
||||
|
||||
/// <summary>
|
||||
/// List of systems that are not publically accessible
|
||||
/// </summary>
|
||||
public static readonly RedumpSystem[] BannedSystems = new RedumpSystem[]
|
||||
{
|
||||
RedumpSystem.AudioCD,
|
||||
RedumpSystem.BDVideo,
|
||||
RedumpSystem.DVDVideo,
|
||||
RedumpSystem.HasbroVideoNow,
|
||||
RedumpSystem.HasbroVideoNowColor,
|
||||
RedumpSystem.HasbroVideoNowJr,
|
||||
RedumpSystem.HasbroVideoNowXP,
|
||||
RedumpSystem.KonamiM2,
|
||||
RedumpSystem.MicrosoftXbox360,
|
||||
RedumpSystem.MicrosoftXboxOne,
|
||||
RedumpSystem.NavisoftNaviken21,
|
||||
RedumpSystem.NintendoWii,
|
||||
RedumpSystem.NintendoWiiU,
|
||||
RedumpSystem.PanasonicM2,
|
||||
RedumpSystem.PhilipsCDiDigitalVideo,
|
||||
RedumpSystem.SegaRingEdge,
|
||||
RedumpSystem.SegaRingEdge2,
|
||||
RedumpSystem.SonyPlayStation3,
|
||||
RedumpSystem.SonyPlayStation4,
|
||||
RedumpSystem.VideoCD,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// List of systems that have a Cues pack
|
||||
/// </summary>
|
||||
public static readonly RedumpSystem[] HasCues = new RedumpSystem[]
|
||||
{
|
||||
RedumpSystem.AppleMacintosh,
|
||||
RedumpSystem.AudioCD,
|
||||
RedumpSystem.BandaiPippin,
|
||||
RedumpSystem.BandaiPlaydiaQuickInteractiveSystem,
|
||||
RedumpSystem.CommodoreAmigaCD,
|
||||
RedumpSystem.CommodoreAmigaCD32,
|
||||
RedumpSystem.CommodoreAmigaCDTV,
|
||||
RedumpSystem.FujitsuFMTownsseries,
|
||||
RedumpSystem.HasbroVideoNow,
|
||||
RedumpSystem.HasbroVideoNowJr,
|
||||
RedumpSystem.IBMPCcompatible,
|
||||
RedumpSystem.IncredibleTechnologiesEagle,
|
||||
RedumpSystem.KonamieAmusement,
|
||||
RedumpSystem.KonamiFireBeat,
|
||||
RedumpSystem.KonamiM2,
|
||||
RedumpSystem.KonamiSystemGV,
|
||||
RedumpSystem.MattelHyperScan,
|
||||
RedumpSystem.MicrosoftXbox,
|
||||
RedumpSystem.MicrosoftXbox360,
|
||||
RedumpSystem.NamcoSystem246,
|
||||
RedumpSystem.NavisoftNaviken21,
|
||||
RedumpSystem.NECPC88series,
|
||||
RedumpSystem.NECPC98series,
|
||||
RedumpSystem.NECPCEngineCDTurboGrafxCD,
|
||||
RedumpSystem.NECPCFXPCFXGA,
|
||||
RedumpSystem.PalmOS,
|
||||
RedumpSystem.Panasonic3DOInteractiveMultiplayer,
|
||||
RedumpSystem.PanasonicM2,
|
||||
RedumpSystem.PhilipsCDi,
|
||||
RedumpSystem.PhilipsCDiDigitalVideo,
|
||||
RedumpSystem.PhotoCD,
|
||||
RedumpSystem.PlayStationGameSharkUpdates,
|
||||
RedumpSystem.SegaChihiro,
|
||||
RedumpSystem.SegaDreamcast,
|
||||
RedumpSystem.SegaMegaCDSegaCD,
|
||||
RedumpSystem.SegaNaomi,
|
||||
RedumpSystem.SegaNaomi2,
|
||||
RedumpSystem.SegaSaturn,
|
||||
RedumpSystem.SegaTriforce,
|
||||
RedumpSystem.SNKNeoGeoCD,
|
||||
RedumpSystem.SonyPlayStation,
|
||||
RedumpSystem.SonyPlayStation2,
|
||||
RedumpSystem.SonyPlayStation3,
|
||||
RedumpSystem.TABAustriaQuizard,
|
||||
RedumpSystem.TomyKissSite,
|
||||
RedumpSystem.VideoCD,
|
||||
RedumpSystem.VTechVFlashVSmilePro,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// List of systems that has a Dat pack
|
||||
/// </summary>
|
||||
public static readonly RedumpSystem[] HasDat = new RedumpSystem[]
|
||||
{
|
||||
RedumpSystem.MicrosoftXboxBIOS,
|
||||
RedumpSystem.NintendoGameCubeBIOS,
|
||||
RedumpSystem.SonyPlayStationBIOS,
|
||||
RedumpSystem.SonyPlayStation2BIOS,
|
||||
|
||||
RedumpSystem.AppleMacintosh,
|
||||
RedumpSystem.AudioCD,
|
||||
RedumpSystem.BDVideo,
|
||||
RedumpSystem.BandaiPippin,
|
||||
RedumpSystem.BandaiPlaydiaQuickInteractiveSystem,
|
||||
RedumpSystem.CommodoreAmigaCD,
|
||||
RedumpSystem.CommodoreAmigaCD32,
|
||||
RedumpSystem.CommodoreAmigaCDTV,
|
||||
RedumpSystem.DVDVideo,
|
||||
RedumpSystem.FujitsuFMTownsseries,
|
||||
RedumpSystem.HasbroVideoNow,
|
||||
RedumpSystem.HasbroVideoNowJr,
|
||||
RedumpSystem.IBMPCcompatible,
|
||||
RedumpSystem.IncredibleTechnologiesEagle,
|
||||
RedumpSystem.KonamiFireBeat,
|
||||
RedumpSystem.KonamiM2,
|
||||
RedumpSystem.KonamiSystemGV,
|
||||
RedumpSystem.KonamieAmusement,
|
||||
RedumpSystem.MattelHyperScan,
|
||||
RedumpSystem.MicrosoftXbox,
|
||||
RedumpSystem.MicrosoftXbox360,
|
||||
RedumpSystem.MicrosoftXboxOne,
|
||||
RedumpSystem.NamcoSystem246,
|
||||
RedumpSystem.NavisoftNaviken21,
|
||||
RedumpSystem.NECPC88series,
|
||||
RedumpSystem.NECPC98series,
|
||||
RedumpSystem.NECPCEngineCDTurboGrafxCD,
|
||||
RedumpSystem.NECPCFXPCFXGA,
|
||||
RedumpSystem.NinendoGameCube,
|
||||
RedumpSystem.NintendoWii,
|
||||
RedumpSystem.NintendoWiiU,
|
||||
RedumpSystem.PalmOS,
|
||||
RedumpSystem.Panasonic3DOInteractiveMultiplayer,
|
||||
RedumpSystem.PanasonicM2,
|
||||
RedumpSystem.PhilipsCDi,
|
||||
RedumpSystem.PhilipsCDiDigitalVideo,
|
||||
RedumpSystem.PhotoCD,
|
||||
RedumpSystem.PlayStationGameSharkUpdates,
|
||||
RedumpSystem.SegaChihiro,
|
||||
RedumpSystem.SegaDreamcast,
|
||||
RedumpSystem.SegaLindbergh,
|
||||
RedumpSystem.SegaMegaCDSegaCD,
|
||||
RedumpSystem.SegaNaomi,
|
||||
RedumpSystem.SegaNaomi2,
|
||||
RedumpSystem.SegaRingEdge,
|
||||
RedumpSystem.SegaRingEdge2,
|
||||
RedumpSystem.SegaSaturn,
|
||||
RedumpSystem.SegaTriforce,
|
||||
RedumpSystem.SNKNeoGeoCD,
|
||||
RedumpSystem.SonyPlayStation,
|
||||
RedumpSystem.SonyPlayStation2,
|
||||
RedumpSystem.SonyPlayStation3,
|
||||
RedumpSystem.SonyPlayStation4,
|
||||
RedumpSystem.SonyPlayStationPortable,
|
||||
RedumpSystem.TABAustriaQuizard,
|
||||
RedumpSystem.TomyKissSite,
|
||||
RedumpSystem.VideoCD,
|
||||
RedumpSystem.VMLabsNUON,
|
||||
RedumpSystem.VTechVFlashVSmilePro,
|
||||
RedumpSystem.ZAPiTGamesGameWaveFamilyEntertainmentSystem,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// List of systems that has a Decrypted Keys pack
|
||||
/// </summary>
|
||||
public static readonly RedumpSystem[] HasDkeys = new RedumpSystem[]
|
||||
{
|
||||
RedumpSystem.SonyPlayStation3,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// List of systems that has a GDI pack
|
||||
/// </summary>
|
||||
public static readonly RedumpSystem[] HasGdi = new RedumpSystem[]
|
||||
{
|
||||
RedumpSystem.SegaChihiro,
|
||||
RedumpSystem.SegaDreamcast,
|
||||
RedumpSystem.SegaNaomi,
|
||||
RedumpSystem.SegaNaomi2,
|
||||
RedumpSystem.SegaTriforce,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// List of systems that has a Keys pack
|
||||
/// </summary>
|
||||
public static readonly RedumpSystem[] HasKeys = new RedumpSystem[]
|
||||
{
|
||||
RedumpSystem.NintendoWiiU,
|
||||
RedumpSystem.SonyPlayStation3,
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// List of systems that has an SBI pack
|
||||
/// </summary>
|
||||
public static readonly RedumpSystem[] HasSbi = new RedumpSystem[]
|
||||
{
|
||||
RedumpSystem.IBMPCcompatible,
|
||||
RedumpSystem.SonyPlayStation,
|
||||
};
|
||||
|
||||
#endregion
|
||||
|
||||
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.NintendoGameCubeGameDisc:
|
||||
case MediaType.NintendoWiiOpticalDisc:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static KnownSystemCategory Category(this KnownSystem? system)
|
||||
{
|
||||
if (system < KnownSystem.MarkerDiscBasedConsoleEnd)
|
||||
return KnownSystemCategory.DiscBasedConsole;
|
||||
/*
|
||||
else if (system < KnownSystem.MarkerOtherConsoleEnd)
|
||||
return KnownSystemCategory.OtherConsole;
|
||||
*/
|
||||
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.MarkerDiscBasedConsoleEnd:
|
||||
// case KnownSystem.MarkerOtherConsoleEnd:
|
||||
case KnownSystem.MarkerOtherEnd:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,25 +8,48 @@ using DICUI.Data;
|
||||
namespace DICUI.Utilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a generic set of DIC parameters
|
||||
/// Represents a generic set of DiscImageCreator parameters
|
||||
/// </summary>
|
||||
public class Parameters
|
||||
{
|
||||
// DIC Command
|
||||
public DICCommand Command;
|
||||
/// <summary>
|
||||
/// Base DiscImageCreator command to run
|
||||
/// </summary>
|
||||
public DICCommand Command { get; set; }
|
||||
|
||||
// Drive Information
|
||||
public string DriveLetter;
|
||||
int? DriveSpeed;
|
||||
/// <summary>
|
||||
/// Drive letter or path to pass to DiscImageCreator
|
||||
/// </summary>
|
||||
public string DriveLetter { get; set; }
|
||||
|
||||
// Path Information
|
||||
public string Filename;
|
||||
/// <summary>
|
||||
/// Drive speed to set, if applicable
|
||||
/// </summary>
|
||||
public int? DriveSpeed { get; set; }
|
||||
|
||||
// Sector Information
|
||||
public int? StartLBAValue;
|
||||
public int? EndLBAValue;
|
||||
/// <summary>
|
||||
/// Destination filename for DiscImageCreator output
|
||||
/// </summary>
|
||||
public string Filename { get; set; }
|
||||
|
||||
// DIC Flags
|
||||
/// <summary>
|
||||
/// Optiarc drive output filename for merging
|
||||
/// </summary>
|
||||
public string OptiarcFilename { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Start LBA value for dumping specific sectors
|
||||
/// </summary>
|
||||
public int? StartLBAValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// End LBA value for dumping specific sectors
|
||||
/// </summary>
|
||||
public int? EndLBAValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set of flags to pass to DiscImageCreator
|
||||
/// </summary>
|
||||
private Dictionary<DICFlag, bool> _flags = new Dictionary<DICFlag, bool>();
|
||||
public bool this[DICFlag key]
|
||||
{
|
||||
@@ -41,25 +64,62 @@ namespace DICUI.Utilities
|
||||
_flags[key] = value;
|
||||
}
|
||||
}
|
||||
public IEnumerable<DICFlag> Keys => _flags.Keys;
|
||||
internal IEnumerable<DICFlag> Keys => _flags.Keys;
|
||||
|
||||
// DIC Flag Values
|
||||
public int? AddOffsetValue;
|
||||
public string BEOpcodeValue; // raw (default), pack
|
||||
public int?[] C2OpcodeValue = new int?[4]; // Reread Value;
|
||||
//public int? C2OpcodeValue2; // 0 reread issue sector (default), 1 reread all
|
||||
//public int? C2OpcodeValue3; // First LBA to reread (default 0)
|
||||
//public int? C2OpcodeValue4; // Last LBA to reread (default EOS)
|
||||
public int? ForceUnitAccessValue; // Delete per specified (default 1)
|
||||
public int? ScanFileProtectValue; // Timeout value (default 60)
|
||||
public int? SubchannelReadLevelValue; // 0 no next sub, 1 next sub (default), 2 next and next next
|
||||
#region DIC Flag Values
|
||||
|
||||
/// <summary>
|
||||
/// Generic empty constructor for adding things individually
|
||||
/// Manual offset for Audio CD
|
||||
/// </summary>
|
||||
public Parameters()
|
||||
{
|
||||
}
|
||||
public int? AddOffsetValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 0xbe opcode value for dumping
|
||||
/// Possible values: raw (default), pack
|
||||
/// </summary>
|
||||
public string BEOpcodeValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// C2 reread options for dumping
|
||||
/// [0] - Reread value
|
||||
/// [1] - 0 reread issue sector (default), 1 reread all
|
||||
/// [2] - First LBA to reread (default 0)
|
||||
/// [3] - Last LBA to reread (default EOS)
|
||||
/// </summary>
|
||||
public int?[] C2OpcodeValue { get; set; } = new int?[4];
|
||||
|
||||
/// <summary>
|
||||
/// Set the force unit access flag value (default 1)
|
||||
/// </summary>
|
||||
public int? ForceUnitAccessValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set the no skip security sector flag value (default 100)
|
||||
/// </summary>
|
||||
public int? NoSkipSecuritySectorValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set scan file timeout value (default 60)
|
||||
/// </summary>
|
||||
public int? ScanFileProtectValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Beginning and ending sectors to skip for physical protection
|
||||
/// </summary>
|
||||
public int?[] SkipSectorValue { get; set; } = new int?[2];
|
||||
|
||||
/// <summary>
|
||||
/// Set the subchanel read level
|
||||
/// Possible values: 0 no next sub, 1 next sub (default), 2 next and next next
|
||||
/// </summary>
|
||||
public int? SubchannelReadLevelValue { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Set number of empty bytes to insert at the head of first track for VideoNow
|
||||
/// </summary>
|
||||
public int? VideoNowValue { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Populate a Parameters object from a param string
|
||||
@@ -86,8 +146,10 @@ namespace DICUI.Utilities
|
||||
BEOpcodeValue = null;
|
||||
C2OpcodeValue = new int?[4];
|
||||
ForceUnitAccessValue = null;
|
||||
NoSkipSecuritySectorValue = null;
|
||||
ScanFileProtectValue = null;
|
||||
SubchannelReadLevelValue = null;
|
||||
VideoNowValue = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -113,7 +175,6 @@ namespace DICUI.Utilities
|
||||
/// <summary>
|
||||
/// Determine the base flags to use for checking a commandline
|
||||
/// </summary>
|
||||
/// <param name="parameters">Parameters as a string to check</param>
|
||||
/// <param name="type">Output nullable MediaType containing the found MediaType, if possible</param>
|
||||
/// <param name="system">Output nullable KnownSystem containing the found KnownSystem, if possible</param>
|
||||
/// <param name="letter">Output string containing the found drive letter</param>
|
||||
@@ -129,8 +190,8 @@ namespace DICUI.Utilities
|
||||
return false;
|
||||
|
||||
// Set the default outputs
|
||||
type = Converters.BaseCommmandToMediaType(Command);
|
||||
system = Converters.BaseCommandToKnownSystem(Command);
|
||||
type = Converters.ToMediaType(Command);
|
||||
system = Converters.ToKnownSystem(Command);
|
||||
letter = DriveLetter;
|
||||
path = Filename;
|
||||
|
||||
@@ -146,22 +207,22 @@ namespace DICUI.Utilities
|
||||
// GameCube and Wii
|
||||
if (this[DICFlag.Raw])
|
||||
{
|
||||
type = MediaType.GameCubeGameDisc;
|
||||
type = MediaType.NintendoGameCubeGameDisc;
|
||||
system = KnownSystem.NintendoGameCube;
|
||||
}
|
||||
|
||||
// PlaySTation
|
||||
// PlayStation
|
||||
else if (this[DICFlag.NoFixSubQLibCrypt]
|
||||
|| this[DICFlag.ScanAntiMod])
|
||||
{
|
||||
type = MediaType.CD;
|
||||
type = MediaType.CDROM;
|
||||
system = KnownSystem.SonyPlayStation;
|
||||
}
|
||||
|
||||
// Saturn
|
||||
else if (this[DICFlag.SeventyFour])
|
||||
{
|
||||
type = MediaType.CD;
|
||||
type = MediaType.CDROM;
|
||||
system = KnownSystem.SegaSaturn;
|
||||
}
|
||||
|
||||
@@ -180,7 +241,7 @@ namespace DICUI.Utilities
|
||||
List<string> parameters = new List<string>();
|
||||
|
||||
if (Command != DICCommand.NONE)
|
||||
parameters.Add(Command.Name());
|
||||
parameters.Add(Command.LongName());
|
||||
else
|
||||
return null;
|
||||
|
||||
@@ -191,15 +252,20 @@ namespace DICUI.Utilities
|
||||
|| Command == DICCommand.CompactDisc
|
||||
|| Command == DICCommand.Data
|
||||
|| Command == DICCommand.DigitalVideoDisc
|
||||
|| Command == DICCommand.Disk
|
||||
|| Command == DICCommand.DriveSpeed
|
||||
|| Command == DICCommand.Eject
|
||||
|| Command == DICCommand.Floppy
|
||||
|| Command == DICCommand.GDROM
|
||||
|| Command == DICCommand.Reset
|
||||
|| Command == DICCommand.SACD
|
||||
|| Command == DICCommand.Start
|
||||
|| Command == DICCommand.Stop
|
||||
|| Command == DICCommand.Swap
|
||||
|| Command == DICCommand.XBOX)
|
||||
|| Command == DICCommand.XBOX
|
||||
|| Command == DICCommand.XBOXSwap
|
||||
|| Command == DICCommand.XGD2Swap
|
||||
|| Command == DICCommand.XGD3Swap)
|
||||
{
|
||||
if (DriveLetter != null)
|
||||
parameters.Add(DriveLetter);
|
||||
@@ -213,12 +279,18 @@ namespace DICUI.Utilities
|
||||
|| Command == DICCommand.CompactDisc
|
||||
|| Command == DICCommand.Data
|
||||
|| Command == DICCommand.DigitalVideoDisc
|
||||
|| Command == DICCommand.Disk
|
||||
|| Command == DICCommand.Floppy
|
||||
|| Command == DICCommand.GDROM
|
||||
|| Command == DICCommand.MDS
|
||||
|| Command == DICCommand.Merge
|
||||
|| Command == DICCommand.SACD
|
||||
|| Command == DICCommand.Swap
|
||||
|| Command == DICCommand.Sub
|
||||
|| Command == DICCommand.XBOX)
|
||||
|| Command == DICCommand.XBOX
|
||||
|| Command == DICCommand.XBOXSwap
|
||||
|| Command == DICCommand.XGD2Swap
|
||||
|| Command == DICCommand.XGD3Swap)
|
||||
{
|
||||
if (Filename != null)
|
||||
parameters.Add("\"" + Filename.Trim('"') + "\"");
|
||||
@@ -226,13 +298,28 @@ namespace DICUI.Utilities
|
||||
return null;
|
||||
}
|
||||
|
||||
// Optiarc Filename
|
||||
if (Command == DICCommand.Merge)
|
||||
{
|
||||
if (OptiarcFilename != null)
|
||||
parameters.Add("\"" + OptiarcFilename.Trim('"') + "\"");
|
||||
else
|
||||
return null;
|
||||
}
|
||||
|
||||
// Drive Speed
|
||||
if (Command == DICCommand.Audio
|
||||
|| Command == DICCommand.BluRay
|
||||
|| Command == DICCommand.CompactDisc
|
||||
|| Command == DICCommand.Data
|
||||
|| Command == DICCommand.DigitalVideoDisc
|
||||
|| Command == DICCommand.GDROM
|
||||
|| Command == DICCommand.Swap)
|
||||
|| Command == DICCommand.SACD
|
||||
|| Command == DICCommand.Swap
|
||||
|| Command == DICCommand.XBOX
|
||||
|| Command == DICCommand.XBOXSwap
|
||||
|| Command == DICCommand.XGD2Swap
|
||||
|| Command == DICCommand.XGD3Swap)
|
||||
{
|
||||
if (DriveSpeed != null)
|
||||
parameters.Add(DriveSpeed.ToString());
|
||||
@@ -260,7 +347,7 @@ namespace DICUI.Utilities
|
||||
{
|
||||
if (this[DICFlag.AddOffset])
|
||||
{
|
||||
parameters.Add(DICFlag.AddOffset.Name());
|
||||
parameters.Add(DICFlag.AddOffset.LongName());
|
||||
if (AddOffsetValue != null)
|
||||
parameters.Add(AddOffsetValue.ToString());
|
||||
else
|
||||
@@ -272,7 +359,14 @@ namespace DICUI.Utilities
|
||||
if (Command == DICCommand.CompactDisc)
|
||||
{
|
||||
if (this[DICFlag.AMSF])
|
||||
parameters.Add(DICFlag.AMSF.Name());
|
||||
parameters.Add(DICFlag.AMSF.LongName());
|
||||
}
|
||||
|
||||
// Atari Jaguar CD
|
||||
if (Command == DICCommand.CompactDisc)
|
||||
{
|
||||
if (this[DICFlag.AtariJaguar])
|
||||
parameters.Add(DICFlag.AtariJaguar.LongName());
|
||||
}
|
||||
|
||||
// BE Opcode
|
||||
@@ -284,7 +378,7 @@ namespace DICUI.Utilities
|
||||
{
|
||||
if (this[DICFlag.BEOpcode] && !this[DICFlag.D8Opcode])
|
||||
{
|
||||
parameters.Add(DICFlag.BEOpcode.Name());
|
||||
parameters.Add(DICFlag.BEOpcode.LongName());
|
||||
if (BEOpcodeValue != null
|
||||
&& (BEOpcodeValue == "raw" || BEOpcodeValue == "pack"))
|
||||
parameters.Add(BEOpcodeValue);
|
||||
@@ -300,7 +394,7 @@ namespace DICUI.Utilities
|
||||
{
|
||||
if (this[DICFlag.C2Opcode])
|
||||
{
|
||||
parameters.Add(DICFlag.C2Opcode.Name());
|
||||
parameters.Add(DICFlag.C2Opcode.LongName());
|
||||
if (C2OpcodeValue[0] != null)
|
||||
{
|
||||
if (C2OpcodeValue[0] > 0)
|
||||
@@ -336,7 +430,7 @@ namespace DICUI.Utilities
|
||||
if (Command == DICCommand.DigitalVideoDisc)
|
||||
{
|
||||
if (this[DICFlag.CopyrightManagementInformation])
|
||||
parameters.Add(DICFlag.CopyrightManagementInformation.Name());
|
||||
parameters.Add(DICFlag.CopyrightManagementInformation.LongName());
|
||||
}
|
||||
|
||||
// D8 Opcode
|
||||
@@ -347,7 +441,7 @@ namespace DICUI.Utilities
|
||||
|| Command == DICCommand.Swap)
|
||||
{
|
||||
if (this[DICFlag.D8Opcode])
|
||||
parameters.Add(DICFlag.D8Opcode.Name());
|
||||
parameters.Add(DICFlag.D8Opcode.LongName());
|
||||
}
|
||||
|
||||
// Disable Beep
|
||||
@@ -361,19 +455,21 @@ namespace DICUI.Utilities
|
||||
|| Command == DICCommand.XBOX)
|
||||
{
|
||||
if (this[DICFlag.DisableBeep])
|
||||
parameters.Add(DICFlag.DisableBeep.Name());
|
||||
parameters.Add(DICFlag.DisableBeep.LongName());
|
||||
}
|
||||
|
||||
// Force Unit Access
|
||||
if (Command == DICCommand.BluRay
|
||||
if (Command == DICCommand.Audio
|
||||
|| Command == DICCommand.BluRay
|
||||
|| Command == DICCommand.CompactDisc
|
||||
|| Command == DICCommand.Data
|
||||
|| Command == DICCommand.DigitalVideoDisc
|
||||
|| Command == DICCommand.Swap
|
||||
|| Command == DICCommand.XBOX)
|
||||
{
|
||||
if (this[DICFlag.ForceUnitAccess])
|
||||
{
|
||||
parameters.Add(DICFlag.ForceUnitAccess.Name());
|
||||
parameters.Add(DICFlag.ForceUnitAccess.LongName());
|
||||
if (ForceUnitAccessValue != null)
|
||||
parameters.Add(ForceUnitAccessValue.ToString());
|
||||
}
|
||||
@@ -383,14 +479,14 @@ namespace DICUI.Utilities
|
||||
if (Command == DICCommand.CompactDisc)
|
||||
{
|
||||
if (this[DICFlag.MCN])
|
||||
parameters.Add(DICFlag.MCN.Name());
|
||||
parameters.Add(DICFlag.MCN.LongName());
|
||||
}
|
||||
|
||||
// Multi-Session
|
||||
if (Command == DICCommand.CompactDisc)
|
||||
{
|
||||
if (this[DICFlag.MultiSession])
|
||||
parameters.Add(DICFlag.MultiSession.Name());
|
||||
parameters.Add(DICFlag.MultiSession.LongName());
|
||||
}
|
||||
|
||||
// Not fix SubP
|
||||
@@ -401,7 +497,7 @@ namespace DICUI.Utilities
|
||||
|| Command == DICCommand.Swap)
|
||||
{
|
||||
if (this[DICFlag.NoFixSubP])
|
||||
parameters.Add(DICFlag.NoFixSubP.Name());
|
||||
parameters.Add(DICFlag.NoFixSubP.LongName());
|
||||
}
|
||||
|
||||
// Not fix SubQ
|
||||
@@ -412,7 +508,7 @@ namespace DICUI.Utilities
|
||||
|| Command == DICCommand.Swap)
|
||||
{
|
||||
if (this[DICFlag.NoFixSubQ])
|
||||
parameters.Add(DICFlag.NoFixSubQ.Name());
|
||||
parameters.Add(DICFlag.NoFixSubQ.LongName());
|
||||
}
|
||||
|
||||
// Not fix SubQ (PlayStation LibCrypt)
|
||||
@@ -423,7 +519,7 @@ namespace DICUI.Utilities
|
||||
|| Command == DICCommand.Swap)
|
||||
{
|
||||
if (this[DICFlag.NoFixSubQLibCrypt])
|
||||
parameters.Add(DICFlag.NoFixSubQLibCrypt.Name());
|
||||
parameters.Add(DICFlag.NoFixSubQLibCrypt.LongName());
|
||||
}
|
||||
|
||||
// Not fix SubQ (SecuROM)
|
||||
@@ -434,7 +530,7 @@ namespace DICUI.Utilities
|
||||
|| Command == DICCommand.Swap)
|
||||
{
|
||||
if (this[DICFlag.NoFixSubQSecuROM])
|
||||
parameters.Add(DICFlag.NoFixSubQSecuROM.Name());
|
||||
parameters.Add(DICFlag.NoFixSubQSecuROM.LongName());
|
||||
}
|
||||
|
||||
// Not fix SubRtoW
|
||||
@@ -445,22 +541,37 @@ namespace DICUI.Utilities
|
||||
|| Command == DICCommand.Swap)
|
||||
{
|
||||
if (this[DICFlag.NoFixSubRtoW])
|
||||
parameters.Add(DICFlag.NoFixSubRtoW.Name());
|
||||
parameters.Add(DICFlag.NoFixSubRtoW.LongName());
|
||||
}
|
||||
|
||||
// Not skip security sectors
|
||||
if (Command == DICCommand.XBOX
|
||||
|| Command == DICCommand.XBOXSwap
|
||||
|| Command == DICCommand.XGD2Swap
|
||||
|| Command == DICCommand.XGD3Swap)
|
||||
{
|
||||
if (this[DICFlag.NoSkipSS])
|
||||
{
|
||||
parameters.Add(DICFlag.NoSkipSS.LongName());
|
||||
if (NoSkipSecuritySectorValue != null)
|
||||
parameters.Add(NoSkipSecuritySectorValue.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
// Raw read (2064 byte/sector)
|
||||
if (Command == DICCommand.DigitalVideoDisc)
|
||||
{
|
||||
if (this[DICFlag.Raw])
|
||||
parameters.Add(DICFlag.Raw.Name());
|
||||
parameters.Add(DICFlag.Raw.LongName());
|
||||
}
|
||||
|
||||
// Reverse read
|
||||
if (Command == DICCommand.CompactDisc
|
||||
|| Command == DICCommand.Data)
|
||||
|| Command == DICCommand.Data
|
||||
|| Command == DICCommand.DigitalVideoDisc)
|
||||
{
|
||||
if (this[DICFlag.Reverse])
|
||||
parameters.Add(DICFlag.Reverse.Name());
|
||||
parameters.Add(DICFlag.Reverse.LongName());
|
||||
}
|
||||
|
||||
// Scan PlayStation anti-mod strings
|
||||
@@ -468,18 +579,19 @@ namespace DICUI.Utilities
|
||||
|| Command == DICCommand.Data)
|
||||
{
|
||||
if (this[DICFlag.ScanAntiMod])
|
||||
parameters.Add(DICFlag.ScanAntiMod.Name());
|
||||
parameters.Add(DICFlag.ScanAntiMod.LongName());
|
||||
}
|
||||
|
||||
// Scan file to detect protect
|
||||
if (Command == DICCommand.Audio
|
||||
|| Command == DICCommand.CompactDisc
|
||||
|| Command == DICCommand.Data
|
||||
|| Command == DICCommand.DigitalVideoDisc
|
||||
|| Command == DICCommand.Swap)
|
||||
{
|
||||
if (this[DICFlag.ScanFileProtect])
|
||||
{
|
||||
parameters.Add(DICFlag.ScanFileProtect.Name());
|
||||
parameters.Add(DICFlag.ScanFileProtect.LongName());
|
||||
if (ScanFileProtectValue != null)
|
||||
{
|
||||
if (ScanFileProtectValue > 0)
|
||||
@@ -496,14 +608,35 @@ namespace DICUI.Utilities
|
||||
|| Command == DICCommand.Swap)
|
||||
{
|
||||
if (this[DICFlag.ScanSectorProtect])
|
||||
parameters.Add(DICFlag.ScanSectorProtect.Name());
|
||||
parameters.Add(DICFlag.ScanSectorProtect.LongName());
|
||||
}
|
||||
|
||||
// Scan 74:00:00 (Saturn)
|
||||
if (Command == DICCommand.Swap)
|
||||
{
|
||||
if (this[DICFlag.SeventyFour])
|
||||
parameters.Add(DICFlag.SeventyFour.Name());
|
||||
parameters.Add(DICFlag.SeventyFour.LongName());
|
||||
}
|
||||
|
||||
// Skip sectors
|
||||
if (Command == DICCommand.Data)
|
||||
{
|
||||
if (this[DICFlag.SkipSector])
|
||||
{
|
||||
if (SkipSectorValue[0] != null && SkipSectorValue[1] != null)
|
||||
{
|
||||
parameters.Add(DICFlag.SkipSector.LongName());
|
||||
if (SkipSectorValue[0] >= 0 && SkipSectorValue[1] >= 0)
|
||||
{
|
||||
parameters.Add(SkipSectorValue[0].ToString());
|
||||
parameters.Add(SkipSectorValue[1].ToString());
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
// Set Subchannel read level
|
||||
@@ -515,7 +648,7 @@ namespace DICUI.Utilities
|
||||
{
|
||||
if (this[DICFlag.SubchannelReadLevel])
|
||||
{
|
||||
parameters.Add(DICFlag.SubchannelReadLevel.Name());
|
||||
parameters.Add(DICFlag.SubchannelReadLevel.LongName());
|
||||
if (SubchannelReadLevelValue != null)
|
||||
{
|
||||
if (SubchannelReadLevelValue >= 0 && SubchannelReadLevelValue <= 2)
|
||||
@@ -526,6 +659,29 @@ namespace DICUI.Utilities
|
||||
}
|
||||
}
|
||||
|
||||
// VideoNow
|
||||
if (Command == DICCommand.CompactDisc)
|
||||
{
|
||||
if (this[DICFlag.VideoNow])
|
||||
{
|
||||
parameters.Add(DICFlag.VideoNow.LongName());
|
||||
if (VideoNowValue != null)
|
||||
{
|
||||
if (VideoNowValue >= 0)
|
||||
parameters.Add(VideoNowValue.ToString());
|
||||
else
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// VideoNow Color
|
||||
if (Command == DICCommand.CompactDisc)
|
||||
{
|
||||
if (this[DICFlag.VideoNowColor])
|
||||
parameters.Add(DICFlag.VideoNowColor.LongName());
|
||||
}
|
||||
|
||||
return string.Join(" ", parameters);
|
||||
}
|
||||
|
||||
@@ -546,10 +702,8 @@ namespace DICUI.Utilities
|
||||
private bool ValidateAndSetParameters(string parameters)
|
||||
{
|
||||
// The string has to be valid by itself first
|
||||
if (String.IsNullOrWhiteSpace(parameters))
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(parameters))
|
||||
return false;
|
||||
}
|
||||
|
||||
// Now split the string into parts for easier validation
|
||||
// https://stackoverflow.com/questions/14655023/split-a-string-that-has-white-spaces-unless-they-are-enclosed-within-quotes
|
||||
@@ -604,8 +758,13 @@ namespace DICUI.Utilities
|
||||
else
|
||||
Filename = parts[2];
|
||||
|
||||
if (!DoesExist(parts, 3) || !IsValidNumber(parts[3], lowerBound: 0, upperBound: 72))
|
||||
return false;
|
||||
else
|
||||
DriveSpeed = Int32.Parse(parts[3]);
|
||||
|
||||
Command = DICCommand.BluRay;
|
||||
index = 3;
|
||||
index = 4;
|
||||
break;
|
||||
|
||||
case DICCommandStrings.Close:
|
||||
@@ -690,6 +849,23 @@ namespace DICUI.Utilities
|
||||
index = 4;
|
||||
break;
|
||||
|
||||
case DICCommandStrings.Disk:
|
||||
if (!DoesExist(parts, 1) || !IsValidDriveLetter(parts[1]))
|
||||
return false;
|
||||
else
|
||||
DriveLetter = parts[1];
|
||||
|
||||
if (!DoesExist(parts, 2) || IsFlag(parts[2]))
|
||||
return false;
|
||||
else
|
||||
Filename = parts[2];
|
||||
|
||||
if (parts.Count > 3)
|
||||
return false;
|
||||
|
||||
Command = DICCommand.Disk;
|
||||
break;
|
||||
|
||||
case DICCommandStrings.DriveSpeed:
|
||||
if (!DoesExist(parts, 1) || !IsValidDriveLetter(parts[1]))
|
||||
return false;
|
||||
@@ -763,6 +939,23 @@ namespace DICUI.Utilities
|
||||
Command = DICCommand.MDS;
|
||||
break;
|
||||
|
||||
case DICCommandStrings.Merge:
|
||||
if (!DoesExist(parts, 1) || IsFlag(parts[1]) || !File.Exists(parts[1]))
|
||||
return false;
|
||||
else
|
||||
Filename = parts[1];
|
||||
|
||||
if (!DoesExist(parts, 2) || IsFlag(parts[2]) || !File.Exists(parts[2]))
|
||||
return false;
|
||||
else
|
||||
OptiarcFilename = parts[2];
|
||||
|
||||
if (parts.Count > 3)
|
||||
return false;
|
||||
|
||||
Command = DICCommand.Merge;
|
||||
break;
|
||||
|
||||
case DICCommandStrings.Reset:
|
||||
if (!DoesExist(parts, 1) || !IsValidDriveLetter(parts[1]))
|
||||
return false;
|
||||
@@ -775,6 +968,28 @@ namespace DICUI.Utilities
|
||||
Command = DICCommand.Reset;
|
||||
break;
|
||||
|
||||
case DICCommandStrings.SACD:
|
||||
if (!DoesExist(parts, 1) || !IsValidDriveLetter(parts[1]))
|
||||
return false;
|
||||
else
|
||||
DriveLetter = parts[1];
|
||||
|
||||
if (!DoesExist(parts, 2) || IsFlag(parts[2]))
|
||||
return false;
|
||||
else
|
||||
Filename = parts[2];
|
||||
|
||||
if (!DoesExist(parts, 3) || !IsValidNumber(parts[3], lowerBound: 0, upperBound: 16))
|
||||
return false;
|
||||
else
|
||||
DriveSpeed = Int32.Parse(parts[3]);
|
||||
|
||||
if (parts.Count > 4)
|
||||
return false;
|
||||
|
||||
Command = DICCommand.SACD;
|
||||
break;
|
||||
|
||||
case DICCommandStrings.Start:
|
||||
if (!DoesExist(parts, 1) || !IsValidDriveLetter(parts[1]))
|
||||
return false;
|
||||
@@ -842,10 +1057,40 @@ namespace DICUI.Utilities
|
||||
else
|
||||
Filename = parts[2];
|
||||
|
||||
if (!DoesExist(parts, 3) || !IsValidNumber(parts[3], lowerBound: 0, upperBound: 72))
|
||||
return false;
|
||||
else
|
||||
DriveSpeed = Int32.Parse(parts[3]);
|
||||
|
||||
Command = DICCommand.XBOX;
|
||||
index = 3;
|
||||
index = 4;
|
||||
break;
|
||||
|
||||
case DICCommandStrings.XBOXSwap:
|
||||
case DICCommandStrings.XGD2Swap:
|
||||
case DICCommandStrings.XGD3Swap:
|
||||
if (!DoesExist(parts, 1) || !IsValidDriveLetter(parts[1]))
|
||||
return false;
|
||||
else
|
||||
DriveLetter = parts[1];
|
||||
|
||||
if (!DoesExist(parts, 2) || IsFlag(parts[2]))
|
||||
return false;
|
||||
else
|
||||
Filename = parts[2];
|
||||
|
||||
if (!DoesExist(parts, 3) || !IsValidNumber(parts[3], lowerBound: 0, upperBound: 72))
|
||||
return false;
|
||||
else
|
||||
DriveSpeed = Int32.Parse(parts[3]);
|
||||
|
||||
for (int i = 4; i < parts.Count; i++)
|
||||
{
|
||||
if (!Int64.TryParse(parts[i], out long temp))
|
||||
return false;
|
||||
}
|
||||
|
||||
break;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -878,6 +1123,13 @@ namespace DICUI.Utilities
|
||||
this[DICFlag.AMSF] = true;
|
||||
break;
|
||||
|
||||
case DICFlagStrings.AtariJaguar:
|
||||
if (parts[0] != DICCommandStrings.CompactDisc)
|
||||
return false;
|
||||
|
||||
this[DICFlag.AtariJaguar] = true;
|
||||
break;
|
||||
|
||||
case DICFlagStrings.BEOpcode:
|
||||
if (parts[0] != DICCommandStrings.Audio
|
||||
&& parts[0] != DICCommandStrings.CompactDisc
|
||||
@@ -959,12 +1211,12 @@ namespace DICUI.Utilities
|
||||
|
||||
case DICFlagStrings.ForceUnitAccess:
|
||||
if (parts[0] != DICCommandStrings.Audio
|
||||
&& parts[0] != DICCommandStrings.BluRay
|
||||
&& parts[0] != DICCommandStrings.CompactDisc
|
||||
&& parts[0] != DICCommandStrings.DigitalVideoDisc
|
||||
&& parts[0] != DICCommandStrings.Data
|
||||
&& parts[0] != DICCommandStrings.GDROM
|
||||
&& parts[0] != DICCommandStrings.XBOX)
|
||||
&& parts[0] != DICCommandStrings.BluRay
|
||||
&& parts[0] != DICCommandStrings.CompactDisc
|
||||
&& parts[0] != DICCommandStrings.DigitalVideoDisc
|
||||
&& parts[0] != DICCommandStrings.Data
|
||||
&& parts[0] != DICCommandStrings.GDROM
|
||||
&& parts[0] != DICCommandStrings.XBOX)
|
||||
return false;
|
||||
else if (!DoesExist(parts, i + 1))
|
||||
{
|
||||
@@ -1025,6 +1277,16 @@ namespace DICUI.Utilities
|
||||
this[DICFlag.NoFixSubQLibCrypt] = true;
|
||||
break;
|
||||
|
||||
case DICFlagStrings.NoFixSubRtoW:
|
||||
if (parts[0] != DICCommandStrings.Audio
|
||||
&& parts[0] != DICCommandStrings.CompactDisc
|
||||
&& parts[0] != DICCommandStrings.Data
|
||||
&& parts[0] != DICCommandStrings.GDROM)
|
||||
return false;
|
||||
|
||||
this[DICFlag.NoFixSubRtoW] = true;
|
||||
break;
|
||||
|
||||
case DICFlagStrings.NoFixSubQSecuROM:
|
||||
if (parts[0] != DICCommandStrings.Audio
|
||||
&& parts[0] != DICCommandStrings.CompactDisc
|
||||
@@ -1035,14 +1297,28 @@ namespace DICUI.Utilities
|
||||
this[DICFlag.NoFixSubQSecuROM] = true;
|
||||
break;
|
||||
|
||||
case DICFlagStrings.NoFixSubRtoW:
|
||||
if (parts[0] != DICCommandStrings.Audio
|
||||
&& parts[0] != DICCommandStrings.CompactDisc
|
||||
&& parts[0] != DICCommandStrings.Data
|
||||
&& parts[0] != DICCommandStrings.GDROM)
|
||||
case DICFlagStrings.NoSkipSS:
|
||||
if (parts[0] != DICCommandStrings.XBOX
|
||||
&& parts[0] != DICCommandStrings.XBOXSwap
|
||||
&& parts[0] != DICCommandStrings.XGD2Swap
|
||||
&& parts[0] != DICCommandStrings.XGD3Swap)
|
||||
return false;
|
||||
else if (!DoesExist(parts, i + 1))
|
||||
{
|
||||
this[DICFlag.NoSkipSS] = true;
|
||||
break;
|
||||
}
|
||||
else if (IsFlag(parts[i + 1]))
|
||||
{
|
||||
this[DICFlag.NoSkipSS] = true;
|
||||
break;
|
||||
}
|
||||
else if (!IsValidNumber(parts[i + 1], lowerBound: 0))
|
||||
return false;
|
||||
|
||||
this[DICFlag.NoFixSubRtoW] = true;
|
||||
this[DICFlag.NoSkipSS] = true;
|
||||
ForceUnitAccessValue = Int32.Parse(parts[i + 1]);
|
||||
i++;
|
||||
break;
|
||||
|
||||
case DICFlagStrings.Raw:
|
||||
@@ -1054,7 +1330,8 @@ namespace DICUI.Utilities
|
||||
|
||||
case DICFlagStrings.Reverse:
|
||||
if (parts[0] != DICCommandStrings.CompactDisc
|
||||
&& parts[0] != DICCommandStrings.Data)
|
||||
&& parts[0] != DICCommandStrings.Data
|
||||
&& parts[0] != DICCommandStrings.DigitalVideoDisc)
|
||||
return false;
|
||||
|
||||
this[DICFlag.Reverse] = true;
|
||||
@@ -1069,7 +1346,8 @@ namespace DICUI.Utilities
|
||||
|
||||
case DICFlagStrings.ScanFileProtect:
|
||||
if (parts[0] != DICCommandStrings.CompactDisc
|
||||
&& parts[0] != DICCommandStrings.Data)
|
||||
&& parts[0] != DICCommandStrings.Data
|
||||
&& parts[0] != DICCommandStrings.DigitalVideoDisc)
|
||||
return false;
|
||||
else if (!DoesExist(parts, i + 1))
|
||||
{
|
||||
@@ -1104,13 +1382,29 @@ namespace DICUI.Utilities
|
||||
this[DICFlag.SeventyFour] = true;
|
||||
break;
|
||||
|
||||
case DICFlagStrings.SkipSector:
|
||||
if (parts[0] != DICCommandStrings.Data)
|
||||
return false;
|
||||
else if (!DoesExist(parts, i + 1) || !DoesExist(parts, i + 2))
|
||||
return false;
|
||||
else if (IsFlag(parts[i + 1]) || IsFlag(parts[i + 2]))
|
||||
return false;
|
||||
else if (!IsValidNumber(parts[i + 1], lowerBound: 0) || !IsValidNumber(parts[i + 2], lowerBound: 0))
|
||||
return false;
|
||||
|
||||
this[DICFlag.SkipSector] = true;
|
||||
SkipSectorValue[0] = Int32.Parse(parts[i + 1]);
|
||||
SkipSectorValue[1] = Int32.Parse(parts[i + 2]);
|
||||
i += 2;
|
||||
break;
|
||||
|
||||
case DICFlagStrings.SubchannelReadLevel:
|
||||
if (parts[0] != DICCommandStrings.Audio
|
||||
&& parts[0] != DICCommandStrings.CompactDisc
|
||||
&& parts[0] != DICCommandStrings.Data
|
||||
&& parts[0] != DICCommandStrings.GDROM)
|
||||
return false;
|
||||
else if (DoesExist(parts, i + 1))
|
||||
else if (!DoesExist(parts, i + 1))
|
||||
{
|
||||
this[DICFlag.SubchannelReadLevel] = true;
|
||||
break;
|
||||
@@ -1128,6 +1422,34 @@ namespace DICUI.Utilities
|
||||
i++;
|
||||
break;
|
||||
|
||||
case DICFlagStrings.VideoNow:
|
||||
if (parts[0] != DICCommandStrings.CompactDisc)
|
||||
return false;
|
||||
else if (!DoesExist(parts, i + 1))
|
||||
{
|
||||
this[DICFlag.VideoNow] = true;
|
||||
break;
|
||||
}
|
||||
else if (IsFlag(parts[i + 1]))
|
||||
{
|
||||
this[DICFlag.VideoNow] = true;
|
||||
break;
|
||||
}
|
||||
else if (!IsValidNumber(parts[i + 1], lowerBound: 0))
|
||||
return false;
|
||||
|
||||
this[DICFlag.VideoNow] = true;
|
||||
VideoNowValue = Int32.Parse(parts[i + 1]);
|
||||
i++;
|
||||
break;
|
||||
|
||||
case DICFlagStrings.VideoNowColor:
|
||||
if (parts[0] != DICCommandStrings.CompactDisc)
|
||||
return false;
|
||||
|
||||
this[DICFlag.VideoNowColor] = true;
|
||||
break;
|
||||
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
@@ -1212,18 +1534,15 @@ namespace DICUI.Utilities
|
||||
|
||||
switch (type)
|
||||
{
|
||||
case MediaType.CD:
|
||||
if (system == KnownSystem.MicrosoftXBOX)
|
||||
{
|
||||
Command = DICCommand.XBOX;
|
||||
return;
|
||||
}
|
||||
Command = DICCommand.CompactDisc;
|
||||
case MediaType.CDROM:
|
||||
if (system == KnownSystem.SuperAudioCD)
|
||||
Command = DICCommand.SACD;
|
||||
else
|
||||
Command = DICCommand.CompactDisc;
|
||||
return;
|
||||
case MediaType.DVD:
|
||||
if (system == KnownSystem.MicrosoftXBOX
|
||||
|| system == KnownSystem.MicrosoftXBOX360XDG2
|
||||
|| system == KnownSystem.MicrosoftXBOX360XDG3)
|
||||
|| system == KnownSystem.MicrosoftXBOX360)
|
||||
{
|
||||
Command = DICCommand.XBOX;
|
||||
return;
|
||||
@@ -1239,15 +1558,18 @@ namespace DICUI.Utilities
|
||||
case MediaType.BluRay:
|
||||
Command = DICCommand.BluRay;
|
||||
return;
|
||||
case MediaType.GameCubeGameDisc:
|
||||
case MediaType.NintendoGameCubeGameDisc:
|
||||
Command = DICCommand.DigitalVideoDisc;
|
||||
return;
|
||||
case MediaType.WiiOpticalDisc:
|
||||
case MediaType.NintendoWiiOpticalDisc:
|
||||
Command = DICCommand.DigitalVideoDisc;
|
||||
return;
|
||||
case MediaType.Floppy:
|
||||
case MediaType.FloppyDisk:
|
||||
Command = DICCommand.Floppy;
|
||||
return;
|
||||
case MediaType.HardDisk:
|
||||
Command = DICCommand.Disk;
|
||||
return;
|
||||
|
||||
default:
|
||||
Command = DICCommand.NONE;
|
||||
@@ -1267,9 +1589,7 @@ namespace DICUI.Utilities
|
||||
// First check to see if the combination of system and MediaType is valid
|
||||
var validTypes = Validators.GetValidMediaTypes(system);
|
||||
if (!validTypes.Contains(type))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
// Set the C2 reread count
|
||||
switch (rereadCount)
|
||||
@@ -1286,10 +1606,9 @@ namespace DICUI.Utilities
|
||||
}
|
||||
|
||||
// Now sort based on disc type
|
||||
List<string> parameters = new List<string>();
|
||||
switch (type)
|
||||
{
|
||||
case MediaType.CD:
|
||||
case MediaType.CDROM:
|
||||
this[DICFlag.C2Opcode] = true;
|
||||
|
||||
switch (system)
|
||||
@@ -1306,6 +1625,21 @@ namespace DICUI.Utilities
|
||||
SubchannelReadLevelValue = 2;
|
||||
}
|
||||
break;
|
||||
case KnownSystem.AtariJaguarCD:
|
||||
this[DICFlag.AtariJaguar] = true;
|
||||
break;
|
||||
case KnownSystem.HasbroVideoNow:
|
||||
case KnownSystem.HasbroVideoNowJr:
|
||||
this[DICFlag.VideoNow] = true;
|
||||
this.VideoNowValue = 18032;
|
||||
break;
|
||||
case KnownSystem.HasbroVideoNowColor:
|
||||
this[DICFlag.VideoNowColor] = true;
|
||||
break;
|
||||
case KnownSystem.HasbroVideoNowXP:
|
||||
this[DICFlag.VideoNow] = true;
|
||||
this.VideoNowValue = 20832;
|
||||
break;
|
||||
case KnownSystem.NECPCEngineTurboGrafxCD:
|
||||
this[DICFlag.MCN] = true;
|
||||
break;
|
||||
@@ -1317,7 +1651,10 @@ namespace DICUI.Utilities
|
||||
break;
|
||||
case MediaType.DVD:
|
||||
if (paranoid)
|
||||
{
|
||||
this[DICFlag.CopyrightManagementInformation] = true;
|
||||
this[DICFlag.ScanFileProtect] = true;
|
||||
}
|
||||
break;
|
||||
case MediaType.GDROM:
|
||||
this[DICFlag.C2Opcode] = true;
|
||||
@@ -1331,15 +1668,15 @@ namespace DICUI.Utilities
|
||||
break;
|
||||
|
||||
// Special Formats
|
||||
case MediaType.GameCubeGameDisc:
|
||||
case MediaType.NintendoGameCubeGameDisc:
|
||||
this[DICFlag.Raw] = true;
|
||||
break;
|
||||
case MediaType.WiiOpticalDisc:
|
||||
case MediaType.NintendoWiiOpticalDisc:
|
||||
this[DICFlag.Raw] = true;
|
||||
break;
|
||||
|
||||
// Non-optical
|
||||
case MediaType.Floppy:
|
||||
case MediaType.FloppyDisk:
|
||||
// Currently no defaults set
|
||||
break;
|
||||
}
|
||||
66
DICUI.Library/Utilities/Result.cs
Normal file
66
DICUI.Library/Utilities/Result.cs
Normal file
@@ -0,0 +1,66 @@
|
||||
namespace DICUI.Utilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Generic success/failure result object, with optional message
|
||||
/// </summary>
|
||||
public class Result
|
||||
{
|
||||
/// <summary>
|
||||
/// Internal representation of success
|
||||
/// </summary>
|
||||
private readonly bool success;
|
||||
|
||||
/// <summary>
|
||||
/// Optional message for the result
|
||||
/// </summary>
|
||||
public string Message { get; private set; }
|
||||
|
||||
private Result(bool success, string message)
|
||||
{
|
||||
this.success = success;
|
||||
this.Message = message;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a default success result with no message
|
||||
/// </summary>
|
||||
public static Result Success() => new Result(true, "");
|
||||
|
||||
/// <summary>
|
||||
/// Create a success result with a custom message
|
||||
/// </summary>
|
||||
/// <param name="message">String to add as a message</param>
|
||||
public static Result Success(string message) => new Result(true, message);
|
||||
|
||||
/// <summary>
|
||||
/// Create a success result with a custom message with format parameters
|
||||
/// </summary>
|
||||
/// <param name="message">String to add as a message</param>
|
||||
/// <param name="args">Formatting parameters for the string</param>
|
||||
public static Result Success(string message, params object[] args) => new Result(true, string.Format(message, args));
|
||||
|
||||
/// <summary>
|
||||
/// Create a default failure result with no message
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public static Result Failure() => new Result(false, "");
|
||||
|
||||
/// <summary>
|
||||
/// Create a failure result with a custom message
|
||||
/// </summary>
|
||||
/// <param name="message">String to add as a message</param>
|
||||
public static Result Failure(string message) => new Result(false, message);
|
||||
|
||||
/// <summary>
|
||||
/// Create a failure result with a custom message with format parameters
|
||||
/// </summary>
|
||||
/// <param name="message">String to add as a message</param>
|
||||
/// <param name="args">Formatting parameters for the string</param>
|
||||
public static Result Failure(string message, params object[] args) => new Result(false, string.Format(message, args));
|
||||
|
||||
/// <summary>
|
||||
/// Results can be compared to boolean values based on the success value
|
||||
/// </summary>
|
||||
public static implicit operator bool(Result result) => result.success;
|
||||
}
|
||||
}
|
||||
956
DICUI.Library/Utilities/Validators.cs
Normal file
956
DICUI.Library/Utilities/Validators.cs
Normal file
@@ -0,0 +1,956 @@
|
||||
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
|
||||
|
||||
// https://en.wikipedia.org/wiki/Atari_Jaguar_CD
|
||||
case KnownSystem.AtariJaguarCD:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Playdia
|
||||
case KnownSystem.BandaiPlaydiaQuickInteractiveSystem:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Apple_Bandai_Pippin
|
||||
case KnownSystem.BandaiApplePippin:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Amiga_CD32
|
||||
case KnownSystem.CommodoreAmigaCD32:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Commodore_CDTV
|
||||
case KnownSystem.CommodoreAmigaCDTV:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/EVO_Smart_Console
|
||||
case KnownSystem.EnvizionsEVOSmartConsole:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/FM_Towns_Marty
|
||||
case KnownSystem.FujitsuFMTownsMarty:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.FloppyDisk);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/VideoNow
|
||||
case KnownSystem.HasbroVideoNow:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/VideoNow
|
||||
case KnownSystem.HasbroVideoNowColor:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/VideoNow
|
||||
case KnownSystem.HasbroVideoNowJr:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/VideoNow
|
||||
case KnownSystem.HasbroVideoNowXP:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/HyperScan
|
||||
case KnownSystem.MattelHyperscan:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Xbox_(console)
|
||||
case KnownSystem.MicrosoftXBOX:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Xbox_360
|
||||
case KnownSystem.MicrosoftXBOX360:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Xbox_One
|
||||
case KnownSystem.MicrosoftXBOXOne:
|
||||
types.Add(MediaType.BluRay);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/TurboGrafx-16
|
||||
case KnownSystem.NECPCEngineTurboGrafxCD:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/PC-FX
|
||||
case KnownSystem.NECPCFX:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/GameCube
|
||||
case KnownSystem.NintendoGameCube:
|
||||
types.Add(MediaType.NintendoGameCubeGameDisc);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Super_NES_CD-ROM
|
||||
case KnownSystem.NintendoSonySuperNESCDROMSystem:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Wii
|
||||
case KnownSystem.NintendoWii:
|
||||
types.Add(MediaType.NintendoWiiOpticalDisc);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Wii_U
|
||||
case KnownSystem.NintendoWiiU:
|
||||
types.Add(MediaType.NintendoWiiUOpticalDisc);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/3DO_Interactive_Multiplayer
|
||||
case KnownSystem.Panasonic3DOInteractiveMultiplayer:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Philips_CD-i
|
||||
case KnownSystem.PhilipsCDi:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/LaserActive
|
||||
case KnownSystem.PioneerLaserActive:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.LaserDisc);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Sega_CD
|
||||
case KnownSystem.SegaCDMegaCD:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Dreamcast
|
||||
case KnownSystem.SegaDreamcast:
|
||||
types.Add(MediaType.CDROM); // Low density partition, MIL-CD
|
||||
types.Add(MediaType.GDROM); // High density partition
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Sega_Saturn
|
||||
case KnownSystem.SegaSaturn:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Neo_Geo_CD
|
||||
case KnownSystem.SNKNeoGeoCD:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/PlayStation_(console)
|
||||
case KnownSystem.SonyPlayStation:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/PlayStation_2
|
||||
case KnownSystem.SonyPlayStation2:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/PlayStation_3
|
||||
case KnownSystem.SonyPlayStation3:
|
||||
types.Add(MediaType.BluRay);
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/PlayStation_4
|
||||
case KnownSystem.SonyPlayStation4:
|
||||
types.Add(MediaType.BluRay);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/PlayStation_Portable
|
||||
case KnownSystem.SonyPlayStationPortable:
|
||||
types.Add(MediaType.UMD);
|
||||
types.Add(MediaType.CDROM); // Development discs only
|
||||
types.Add(MediaType.DVD); // Development discs only
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Tandy_Video_Information_System
|
||||
case KnownSystem.TandyMemorexVisualInformationSystem:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Nuon_(DVD_technology)
|
||||
case KnownSystem.VMLabsNuon:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/V.Flash
|
||||
case KnownSystem.VTechVFlashVSmilePro:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Game_Wave_Family_Entertainment_System
|
||||
case KnownSystem.ZAPiTGamesGameWaveFamilyEntertainmentSystem:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Computers
|
||||
|
||||
// https://en.wikipedia.org/wiki/Acorn_Archimedes
|
||||
case KnownSystem.AcornArchimedes:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.FloppyDisk);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Macintosh
|
||||
case KnownSystem.AppleMacintosh:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
types.Add(MediaType.FloppyDisk);
|
||||
types.Add(MediaType.HardDisk);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Amiga
|
||||
case KnownSystem.CommodoreAmiga:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.FloppyDisk);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/FM_Towns
|
||||
case KnownSystem.FujitsuFMTowns:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/IBM_PC_compatible
|
||||
case KnownSystem.IBMPCCompatible:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
types.Add(MediaType.FloppyDisk);
|
||||
types.Add(MediaType.HardDisk);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/PC-8800_series
|
||||
case KnownSystem.NECPC88:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.FloppyDisk);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/PC-9800_series
|
||||
case KnownSystem.NECPC98:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
types.Add(MediaType.FloppyDisk);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/X68000
|
||||
case KnownSystem.SharpX68000:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.FloppyDisk);
|
||||
break;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Arcade
|
||||
|
||||
// https://www.bigbookofamigahardware.com/bboah/product.aspx?id=36
|
||||
case KnownSystem.AmigaCUBOCD32:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Orbatak
|
||||
case KnownSystem.AmericanLaserGames3DO:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=779
|
||||
case KnownSystem.Atari3DO:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// http://newlifegames.net/nlg/index.php?topic=22003.0
|
||||
// http://newlifegames.net/nlg/index.php?topic=5486.msg119440
|
||||
case KnownSystem.Atronic:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// https://www.arcade-museum.com/members/member_detail.php?member_id=406530
|
||||
case KnownSystem.AUSCOMSystem1:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// http://newlifegames.net/nlg/index.php?topic=285.0
|
||||
case KnownSystem.BallyGameMagic:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/CP_System_III
|
||||
case KnownSystem.CapcomCPSystemIII:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// UNKNOWN
|
||||
case KnownSystem.GlobalVRVarious:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://service.globalvr.com/troubleshooting/vortek.html
|
||||
case KnownSystem.GlobalVRVortek:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://service.globalvr.com/downloads/v3/040-1001-01c-V3-System-Manual.pdf
|
||||
case KnownSystem.GlobalVRVortekV3:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://www.icegame.com/games
|
||||
case KnownSystem.ICEPCHardware:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// https://github.com/mamedev/mame/blob/master/src/mame/drivers/iteagle.cpp
|
||||
case KnownSystem.IncredibleTechnologiesEagle:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// UNKNOWN
|
||||
case KnownSystem.IncredibleTechnologiesVarious:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/E-Amusement
|
||||
case KnownSystem.KonamieAmusement:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=828
|
||||
case KnownSystem.KonamiFirebeat:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=577
|
||||
case KnownSystem.KonamiGVSystem:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=575
|
||||
case KnownSystem.KonamiM2:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=586
|
||||
// http://system16.com/hardware.php?id=977
|
||||
case KnownSystem.KonamiPython:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=976
|
||||
// http://system16.com/hardware.php?id=831
|
||||
case KnownSystem.KonamiPython2:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=582
|
||||
// http://system16.com/hardware.php?id=822
|
||||
// http://system16.com/hardware.php?id=823
|
||||
case KnownSystem.KonamiSystem573:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=827
|
||||
case KnownSystem.KonamiTwinkle:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// UNKNOWN
|
||||
case KnownSystem.KonamiVarious:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// http://www.meritgames.com/Support_Center/manuals/PM0591-01.pdf
|
||||
case KnownSystem.MeritIndustriesBoardwalk:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// http://www.meritgames.com/Support_Center/Force%20Elite/PM0380-09.pdf
|
||||
// http://www.meritgames.com/Support_Center/Force%20Upright/PM0382-07%20FORCE%20Upright%20manual.pdf
|
||||
// http://www.meritgames.com/Support_Center/Force%20Upright/PM0383-07%20FORCE%20Upright%20manual.pdf
|
||||
case KnownSystem.MeritIndustriesMegaTouchForce:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// http://www.meritgames.com/Service%20Center/Ion%20Troubleshooting.pdf
|
||||
case KnownSystem.MeritIndustriesMegaTouchION:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// http://www.meritgames.com/Support_Center/EZ%20Maxx/Manuals/MAXX%20Elite%20with%20coin.pdf
|
||||
// http://www.meritgames.com/Support_Center/EZ%20Maxx/Manuals/MAXX%20Elite.pdf
|
||||
// http://www.meritgames.com/Support_Center/manuals/90003010%20Maxx%20TSM_Rev%20C.pdf
|
||||
case KnownSystem.MeritIndustriesMegaTouchMaxx:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// http://www.meritgames.com/Support_Center/manuals/pm0076_OA_Megatouch%20XL%20Trouble%20Shooting%20Manual.pdf
|
||||
// http://www.meritgames.com/Support_Center/MEGA%20XL/manuals/Megatouch_XL_pm0109-0D.pdf
|
||||
// http://www.meritgames.com/Support_Center/MEGA%20XL/manuals/Megatouch_XL_Super_5000_manual.pdf
|
||||
case KnownSystem.MeritIndustriesMegaTouchXL:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=546
|
||||
// http://system16.com/hardware.php?id=872
|
||||
case KnownSystem.NamcoCapcomSystem256:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=543
|
||||
case KnownSystem.NamcoCapcomTaitoSystem246:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=545
|
||||
case KnownSystem.NamcoSegaNintendoTriforce:
|
||||
types.Add(MediaType.CDROM); // Low density partition
|
||||
types.Add(MediaType.GDROM); // High density partition
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=535
|
||||
case KnownSystem.NamcoSystem12:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=900
|
||||
case KnownSystem.NamcoSystem357:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
types.Add(MediaType.BluRay);
|
||||
break;
|
||||
|
||||
// https://www.arcade-history.com/?n=the-yakyuuken-part-1&page=detail&id=33049
|
||||
case KnownSystem.NewJatreCDi:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// http://blog.system11.org/?p=2499
|
||||
case KnownSystem.NichibutsuHighRateSystem:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// http://blog.system11.org/?p=2514
|
||||
case KnownSystem.NichibutsuSuperCD:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// http://collectedit.com/collectors/shou-time-213/arcade-pcbs-281/x-rate-dvd-series-17-newlywed-life-japan-by-nichibutsu-32245
|
||||
case KnownSystem.NichibutsuXRateSystem:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Panasonic_M2
|
||||
case KnownSystem.PanasonicM2:
|
||||
types.Add(MediaType.CDROM);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// https://github.com/mamedev/mame/blob/master/src/mame/drivers/photoply.cpp
|
||||
case KnownSystem.PhotoPlayVarious:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// UNKNOWN
|
||||
case KnownSystem.RawThrillsVarious:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=729
|
||||
case KnownSystem.SegaChihiro:
|
||||
types.Add(MediaType.CDROM); // Low density partition
|
||||
types.Add(MediaType.GDROM); // High density partition
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=907
|
||||
case KnownSystem.SegaEuropaR:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=985
|
||||
// http://system16.com/hardware.php?id=731
|
||||
// http://system16.com/hardware.php?id=984
|
||||
// http://system16.com/hardware.php?id=986
|
||||
case KnownSystem.SegaLindbergh:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=721
|
||||
// http://system16.com/hardware.php?id=723
|
||||
// http://system16.com/hardware.php?id=906
|
||||
// http://system16.com/hardware.php?id=722
|
||||
case KnownSystem.SegaNaomi:
|
||||
types.Add(MediaType.CDROM); // Low density partition
|
||||
types.Add(MediaType.GDROM); // High density partition
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=725
|
||||
// http://system16.com/hardware.php?id=726
|
||||
// http://system16.com/hardware.php?id=727
|
||||
case KnownSystem.SegaNaomi2:
|
||||
types.Add(MediaType.CDROM); // Low density partition
|
||||
types.Add(MediaType.GDROM); // High density partition
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=975
|
||||
// https://en.wikipedia.org/wiki/List_of_Sega_arcade_system_boards#Sega_Nu
|
||||
case KnownSystem.SegaNu:
|
||||
types.Add(MediaType.BluRay);
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=910
|
||||
// https://en.wikipedia.org/wiki/List_of_Sega_arcade_system_boards#Sega_Ring_series
|
||||
case KnownSystem.SegaRingEdge:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=982
|
||||
// https://en.wikipedia.org/wiki/List_of_Sega_arcade_system_boards#Sega_Ring_series
|
||||
case KnownSystem.SegaRingEdge2:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=911
|
||||
// https://en.wikipedia.org/wiki/List_of_Sega_arcade_system_boards#Sega_Ring_series
|
||||
case KnownSystem.SegaRingWide:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=711
|
||||
case KnownSystem.SegaTitanVideo:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// http://system16.com/hardware.php?id=709
|
||||
// http://system16.com/hardware.php?id=710
|
||||
case KnownSystem.SegaSystem32:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://github.com/mamedev/mame/blob/master/src/mame/drivers/seibucats.cpp
|
||||
case KnownSystem.SeibuCATSSystem:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// https://www.tab.at/en/support/support/downloads
|
||||
case KnownSystem.TABAustriaQuizard:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://primetimeamusements.com/product/tsumo-multi-game-motion-system/
|
||||
// https://www.highwaygames.com/arcade-machines/tsumo-tsunami-motion-8117/
|
||||
case KnownSystem.TsunamiTsuMoMultiGameMotionSystem:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Others
|
||||
|
||||
// https://en.wikipedia.org/wiki/Audio_CD
|
||||
case KnownSystem.AudioCD:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Blu-ray#Player_profiles
|
||||
case KnownSystem.BDVideo:
|
||||
types.Add(MediaType.BluRay);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/DVD-Video
|
||||
case KnownSystem.DVDVideo:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Blue_Book_(CD_standard)
|
||||
case KnownSystem.EnhancedCD:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/HD_DVD
|
||||
case KnownSystem.HDDVDVideo:
|
||||
types.Add(MediaType.HDDVD);
|
||||
break;
|
||||
|
||||
// UNKNOWN
|
||||
case KnownSystem.NavisoftNaviken21:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// UNKNOWN
|
||||
case KnownSystem.PalmOS:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// UNKNOWN
|
||||
case KnownSystem.PhilipsCDiDigitalVideo:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Photo_CD
|
||||
case KnownSystem.PhotoCD:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// UNKNOWN
|
||||
case KnownSystem.PlayStationGameSharkUpdates:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Doors_and_Windows_(EP)
|
||||
case KnownSystem.RainbowDisc:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Super_Audio_CD
|
||||
case KnownSystem.SuperAudioCD:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://www.cnet.com/products/tao-music-iktv-karaoke-station-karaoke-system-series/
|
||||
case KnownSystem.TaoiKTV:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// http://ultimateconsoledatabase.com/golden/kiss_site.htm
|
||||
case KnownSystem.TomyKissSite:
|
||||
types.Add(MediaType.CDROM);
|
||||
break;
|
||||
|
||||
// https://en.wikipedia.org/wiki/Video_CD
|
||||
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()
|
||||
{
|
||||
// Get all supported drive types
|
||||
var drives = DriveInfo.GetDrives()
|
||||
.Where(d => d.DriveType == DriveType.CDRom || d.DriveType == DriveType.Fixed || d.DriveType == DriveType.Removable)
|
||||
.Select(d => new Drive(Converters.ToInternalDriveType(d.DriveType), d))
|
||||
.ToList();
|
||||
|
||||
// Get the floppy drives and set the flag from removable
|
||||
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.ForEach(d => { if (d.Letter == devId) { d.InternalDriveType = InternalDriveType.Floppy; } });
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// No-op
|
||||
}
|
||||
|
||||
// Order the drives by drive letter
|
||||
drives = drives.OrderBy(i => i.Letter).ToList();
|
||||
|
||||
return drives;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the current media type from drive letter
|
||||
/// </summary>
|
||||
/// <param name="drive"></param>
|
||||
/// <returns></returns>
|
||||
/// <remarks>
|
||||
/// https://stackoverflow.com/questions/11420365/detecting-if-disc-is-in-dvd-drive
|
||||
/// </remarks>
|
||||
public static MediaType? GetMediaType(Drive drive)
|
||||
{
|
||||
// Take care of the non-optical stuff first
|
||||
// TODO: See if any of these can be more granular, like Optical is
|
||||
if (drive.InternalDriveType == InternalDriveType.Floppy)
|
||||
return MediaType.FloppyDisk;
|
||||
else if (drive.InternalDriveType == InternalDriveType.HardDisk)
|
||||
return MediaType.HardDisk;
|
||||
else if (drive.InternalDriveType == InternalDriveType.Removable)
|
||||
return MediaType.FlashDrive;
|
||||
|
||||
// Get the DeviceID from the current drive letter
|
||||
string deviceId = null;
|
||||
try
|
||||
{
|
||||
ManagementObjectSearcher searcher =
|
||||
new ManagementObjectSearcher("root\\CIMV2",
|
||||
"SELECT * FROM Win32_CDROMDrive WHERE Id = '" + drive.Letter + ":\'");
|
||||
|
||||
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.ToMediaType(media);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the error is
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the current system from drive
|
||||
/// </summary>
|
||||
/// <param name="drive"></param>
|
||||
/// <returns></returns>
|
||||
public static KnownSystem? GetKnownSystem(Drive drive)
|
||||
{
|
||||
// If drive or drive letter are provided, we can't do anything
|
||||
if (drive?.Letter == null)
|
||||
return null;
|
||||
|
||||
string drivePath = $"{drive.Letter}:\\";
|
||||
|
||||
// If we can't read the media in that drive, we can't do anything
|
||||
if (!Directory.Exists(drivePath))
|
||||
return null;
|
||||
|
||||
// We're going to assume for floppies, HDDs, and removable drives
|
||||
// TODO: Try to be smarter about this
|
||||
if (drive.InternalDriveType != InternalDriveType.Optical)
|
||||
return KnownSystem.IBMPCCompatible;
|
||||
|
||||
// Sega Dreamcast
|
||||
if (File.Exists(Path.Combine(drivePath, "IP.BIN")))
|
||||
{
|
||||
return KnownSystem.SegaDreamcast;
|
||||
}
|
||||
|
||||
// Sega Mega-CD / Sega-CD
|
||||
if (File.Exists(Path.Combine(drivePath, "_BOOT", "IP.BIN"))
|
||||
|| File.Exists(Path.Combine(drivePath, "_BOOT", "SP.BIN"))
|
||||
|| File.Exists(Path.Combine(drivePath, "_BOOT", "SP_AS.BIN"))
|
||||
|| File.Exists(Path.Combine(drivePath, "FILESYSTEM.BIN")))
|
||||
{
|
||||
return KnownSystem.SegaCDMegaCD;
|
||||
}
|
||||
|
||||
// Sony PlayStation and Sony PlayStation 2
|
||||
if (File.Exists(Path.Combine(drivePath, "SYSTEM.CNF")))
|
||||
{
|
||||
// Check for either BOOT or BOOT2
|
||||
using (StreamReader reader = File.OpenText(Path.Combine(drivePath, "SYSTEM.CNF")))
|
||||
{
|
||||
while (!reader.EndOfStream)
|
||||
{
|
||||
string line = reader.ReadLine();
|
||||
if (line.Contains("BOOT2"))
|
||||
return KnownSystem.SonyPlayStation2;
|
||||
else if (line.Contains("BOOT"))
|
||||
return KnownSystem.SonyPlayStation;
|
||||
}
|
||||
}
|
||||
|
||||
// If we have a weird disc, just assume PS1
|
||||
return KnownSystem.SonyPlayStation;
|
||||
}
|
||||
|
||||
// Sony PlayStation 4
|
||||
if (drive.VolumeLabel.Equals("PS4VOLUME", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return KnownSystem.SonyPlayStation4;
|
||||
}
|
||||
|
||||
// V.Tech V.Flash / V.Smile Pro
|
||||
if (File.Exists(Path.Combine(drivePath, "0SYSTEM")))
|
||||
{
|
||||
return KnownSystem.VTechVFlashVSmilePro;
|
||||
}
|
||||
|
||||
// Default return
|
||||
return KnownSystem.NONE;
|
||||
}
|
||||
|
||||
/// <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.BluRay:
|
||||
case MediaType.CDROM:
|
||||
case MediaType.DVD:
|
||||
case MediaType.FloppyDisk:
|
||||
case MediaType.HardDisk:
|
||||
case MediaType.CompactFlash:
|
||||
case MediaType.SDCard:
|
||||
case MediaType.FlashDrive:
|
||||
case MediaType.HDDVD:
|
||||
return Result.Success("{0} ready to dump", type.LongName());
|
||||
|
||||
// Partially supported types
|
||||
case MediaType.GDROM:
|
||||
case MediaType.NintendoGameCubeGameDisc:
|
||||
case MediaType.NintendoWiiOpticalDisc:
|
||||
return Result.Success("{0} partially supported for dumping", type.LongName());
|
||||
|
||||
// Special case for other supported tools
|
||||
case MediaType.UMD:
|
||||
return Result.Success("{0} supported for submission info parsing", type.LongName());
|
||||
|
||||
// Specifically unknown type
|
||||
case MediaType.NONE:
|
||||
return Result.Failure("Please select a valid media type");
|
||||
|
||||
// Undumpable but recognized types
|
||||
default:
|
||||
return Result.Failure("{0} media are not supported for dumping", type.LongName());
|
||||
}
|
||||
}
|
||||
|
||||
/// <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 (Exception ex)
|
||||
{
|
||||
return $"Path could not be scanned! {ex}";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
36
DICUI.Library/Web/CookieAwareWebClient.cs
Normal file
36
DICUI.Library/Web/CookieAwareWebClient.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Net;
|
||||
|
||||
namespace DICUI.Web
|
||||
{
|
||||
// https://stackoverflow.com/questions/1777221/using-cookiecontainer-with-webclient-class
|
||||
public class CookieAwareWebClient : WebClient
|
||||
{
|
||||
private readonly CookieContainer m_container = new CookieContainer();
|
||||
|
||||
protected override WebRequest GetWebRequest(Uri address)
|
||||
{
|
||||
WebRequest request = base.GetWebRequest(address);
|
||||
HttpWebRequest webRequest = request as HttpWebRequest;
|
||||
if (webRequest != null)
|
||||
{
|
||||
webRequest.CookieContainer = m_container;
|
||||
}
|
||||
|
||||
return request;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the last downloaded filename, if possible
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
public string GetLastFilename()
|
||||
{
|
||||
// Try to extract the filename from the Content-Disposition header
|
||||
if (!string.IsNullOrEmpty(this.ResponseHeaders["Content-Disposition"]))
|
||||
return this.ResponseHeaders["Content-Disposition"].Substring(this.ResponseHeaders["Content-Disposition"].IndexOf("filename=") + 9).Replace("\"", "");
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
385
DICUI.Library/Web/RedumpAccess.cs
Normal file
385
DICUI.Library/Web/RedumpAccess.cs
Normal file
@@ -0,0 +1,385 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using DICUI.Data;
|
||||
using DICUI.Utilities;
|
||||
|
||||
namespace DICUI.Web
|
||||
{
|
||||
public class RedumpAccess
|
||||
{
|
||||
#region Base URLs
|
||||
|
||||
private const string loginUrl = "http://forum.redump.org/login/";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Disc URLs and Extensions
|
||||
|
||||
private const string discPageUrl = @"http://redump.org/disc/{0}/";
|
||||
private const string wipDiscPageUrl = @"http://redump.org/newdisc/{0}/";
|
||||
|
||||
private const string changesExt = "/changes/";
|
||||
private const string cueExt = "cue/";
|
||||
private const string gdiExt = "gdi/";
|
||||
private const string keyExt = "key/";
|
||||
private const string md5Ext = "md5/";
|
||||
private const string sbiExt = "sbi/";
|
||||
private const string sfvExt = "sfv/";
|
||||
private const string sha1Ext = "sha1/";
|
||||
|
||||
#endregion
|
||||
|
||||
#region List URLs
|
||||
|
||||
private const string lastModifiedUrl = @"http://redump.org/discs/sort/modified/dir/desc?page={0}";
|
||||
private const string quickSearchUrl = @"http://redump.org/discs/quicksearch/{0}/?page={1}";
|
||||
private const string userDumpsUrl = @"http://redump.org/discs/dumper/{0}/?page={1}";
|
||||
private const string wipDumpsUrl = @"http://redump.org/discs-wip/";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Pack URLs
|
||||
|
||||
private const string packCuesUrl = @"http://redump.org/cues/{0}/";
|
||||
private const string packDatfileUrl = @"http://redump.org/datfile/{0}/";
|
||||
private const string packDkeysUrl = @"http://redump.org/dkeys/{0}/";
|
||||
private const string packGdiUrl = @"http://redump.org/gdi/{0}/";
|
||||
private const string packKeysUrl = @"http://redump.org/keys/{0}/";
|
||||
private const string packSbiUrl = @"http://redump.org/sbi/{0}/";
|
||||
|
||||
#endregion
|
||||
|
||||
#region Regexes
|
||||
|
||||
private readonly Regex discRegex = new Regex(@"<a href=""/disc/(\d+)/"">");
|
||||
private readonly Regex newDiscRegex = new Regex(@"<a href=""/newdisc/(\d+)/"">");
|
||||
private readonly Regex tokenRegex = new Regex(@"<input type=""hidden"" name=""csrf_token"" value=""(.*?)"" />");
|
||||
|
||||
#endregion
|
||||
|
||||
/// <summary>
|
||||
/// Login to Redump, if possible
|
||||
/// </summary>
|
||||
/// <param name="wc">CookieAwareWebClient to hold the login state</param>
|
||||
/// <param name="username">Redump username to log in for protected systems</param>
|
||||
/// <param name="password">Redump password to log in for protected systems</param>
|
||||
/// <returns>True login was successful, false otherwise</returns>
|
||||
public bool RedumpLogin(CookieAwareWebClient wc, string username, string password)
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(username) || string.IsNullOrWhiteSpace(password))
|
||||
return false;
|
||||
|
||||
var loginPage = wc.DownloadString(loginUrl);
|
||||
string token = this.tokenRegex.Match(loginPage).Groups[1].Value;
|
||||
|
||||
wc.Headers[HttpRequestHeader.ContentType] = "application/x-www-form-urlencoded";
|
||||
wc.Encoding = Encoding.UTF8;
|
||||
var response = wc.UploadString(loginUrl, $"form_sent=1&redirect_url=&csrf_token={token}&req_username={username}&req_password={password}&save_pass=0");
|
||||
|
||||
if (response.Contains("Incorrect username and/or password."))
|
||||
return false;
|
||||
else
|
||||
return true;
|
||||
}
|
||||
|
||||
#region Process IDs and Pages
|
||||
|
||||
/// <summary>
|
||||
/// Get the list of the last modified IDs, in order of appearance
|
||||
/// </summary>
|
||||
/// <param name="wc">CookieAwareWebClient to hold the login state</param>
|
||||
/// <param name="pageCount">Number of pages to grab until stopping; -1 means continue until end</param>
|
||||
/// <returns>A list of IDs in order of last modified</returns>
|
||||
private List<int> ProcessLastModified(CookieAwareWebClient wc, int pageCount = -1)
|
||||
{
|
||||
List<int> ids = new List<int>();
|
||||
|
||||
// If we have a -1 page count, set the maximum page limit
|
||||
if (pageCount == -1)
|
||||
pageCount = Int32.MaxValue;
|
||||
|
||||
// Keep getting last modified pages until there are none left
|
||||
int pageNumber = 1;
|
||||
while (pageNumber < pageCount)
|
||||
{
|
||||
List<int> pageIds = CheckSingleSitePage(wc, string.Format(lastModifiedUrl, pageNumber++));
|
||||
ids.AddRange(pageIds);
|
||||
if (pageIds.Count < 2)
|
||||
break;
|
||||
}
|
||||
|
||||
return ids;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve premade packs from Redump
|
||||
/// </summary>
|
||||
/// <param name="wc">CookieAwareWebClient to hold the login state</param>
|
||||
private void ProcessAllPacks(CookieAwareWebClient wc)
|
||||
{
|
||||
var cuesPacks = this.DownloadPacks(wc, packCuesUrl, Extensions.HasCues, "CUEs");
|
||||
var datPacks = this.DownloadPacks(wc, packDatfileUrl, Extensions.HasDat, "DATs");
|
||||
var dkeyPacks = this.DownloadPacks(wc, packDkeysUrl, Extensions.HasDkeys, "Decrypted KEYS");
|
||||
var gdiPacks = this.DownloadPacks(wc, packGdiUrl, Extensions.HasGdi, "GDIs");
|
||||
var keysPacks = this.DownloadPacks(wc, packKeysUrl, Extensions.HasKeys, "KEYS");
|
||||
var sbiPacks = this.DownloadPacks(wc, packSbiUrl, Extensions.HasSbi, "SBIs");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Retrieve premade packs from Redump
|
||||
/// </summary>
|
||||
/// <param name="wc">CookieAwareWebClient to hold the login state</param>
|
||||
/// <param name="system">RedumpSystem to get all possible packs for</param>
|
||||
private void ProcessPacksForSystem(CookieAwareWebClient wc, RedumpSystem system)
|
||||
{
|
||||
var packs = new Dictionary<string, byte[]>();
|
||||
|
||||
if (Extensions.HasCues.Contains(system))
|
||||
packs.Add("cues", this.DownloadPack(wc, packCuesUrl, system, "CUEs"));
|
||||
|
||||
if (Extensions.HasDat.Contains(system))
|
||||
packs.Add("dat", this.DownloadPack(wc, packDatfileUrl, system, "DATs"));
|
||||
|
||||
if (Extensions.HasDkeys.Contains(system))
|
||||
packs.Add("dkeys", this.DownloadPack(wc, packDkeysUrl, system, "Decrypted KEYS"));
|
||||
|
||||
if (Extensions.HasGdi.Contains(system))
|
||||
packs.Add("gdi", this.DownloadPack(wc, packGdiUrl, system, "GDIs"));
|
||||
|
||||
if (Extensions.HasKeys.Contains(system))
|
||||
packs.Add("keys", this.DownloadPack(wc, packKeysUrl, system, "KEYS"));
|
||||
|
||||
if (Extensions.HasSbi.Contains(system))
|
||||
packs.Add("sbi", this.DownloadPack(wc, packSbiUrl, system, "SBIs"));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the list of IDs that associate with a given string
|
||||
/// </summary>
|
||||
/// <param name="wc">CookieAwareWebClient to hold the login state</param>
|
||||
/// <param name="query">Value to search for in Redump</param>
|
||||
/// <returns>A list of IDs associated with that value</returns>
|
||||
public List<int> ProcessSearch(CookieAwareWebClient wc, string query)
|
||||
{
|
||||
List<int> ids = new List<int>();
|
||||
|
||||
// Keep getting quicksearch pages until there are none left
|
||||
int pageNumber = 1;
|
||||
while (true)
|
||||
{
|
||||
List<int> pageIds = CheckSingleSitePage(wc, string.Format(quickSearchUrl, query, pageNumber++));
|
||||
ids.AddRange(pageIds);
|
||||
if (pageIds.Count < 2)
|
||||
break;
|
||||
}
|
||||
|
||||
return ids;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the list of IDs associated with the given user
|
||||
/// </summary>
|
||||
/// <param name="wc">CookieAwareWebClient to hold the login state</param>
|
||||
/// <param name="username">Redump username to get the list of IDs for</param>
|
||||
/// <returns>A list of IDs associated with that user</returns>
|
||||
private List<int> ProcessUser(CookieAwareWebClient wc, string username)
|
||||
{
|
||||
List<int> ids = new List<int>();
|
||||
|
||||
// Keep getting user pages until there are none left
|
||||
int pageNumber = 1;
|
||||
while (true)
|
||||
{
|
||||
List<int> pageIds = CheckSingleSitePage(wc, string.Format(userDumpsUrl, username, pageNumber++));
|
||||
ids.AddRange(pageIds);
|
||||
if (pageIds.Count < 2)
|
||||
break;
|
||||
}
|
||||
|
||||
return ids;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Single item processing
|
||||
|
||||
/// <summary>
|
||||
/// Process a Redump site page as a list of possible IDs or disc page
|
||||
/// </summary>
|
||||
/// <param name="wc">CookieAwareWebClient to access the pages</param>
|
||||
/// <param name="url">Page URL to check and parse</param>
|
||||
/// <returns>List of matching IDs</returns>
|
||||
private List<int> CheckSingleSitePage(CookieAwareWebClient wc, string url)
|
||||
{
|
||||
List<int> ids = new List<int>();
|
||||
|
||||
var dumpsPage = wc.DownloadString(url);
|
||||
|
||||
// If we have no dumps left
|
||||
if (dumpsPage.Contains("No discs found."))
|
||||
return ids;
|
||||
|
||||
// If we have a single disc page already
|
||||
if (dumpsPage.Contains("<b>Download:</b>"))
|
||||
{
|
||||
var value = Regex.Match(dumpsPage, @"/disc/(\d+)/sfv/").Groups[1].Value;
|
||||
if (Int32.TryParse(value, out int id))
|
||||
ids.Add(id);
|
||||
|
||||
return ids;
|
||||
}
|
||||
|
||||
// Otherwise, traverse each dump on the page
|
||||
var matches = discRegex.Matches(dumpsPage);
|
||||
foreach (Match match in matches)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Int32.TryParse(match.Groups[1].Value, out int value))
|
||||
ids.Add(value);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"An exception has occurred: {ex}");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return ids;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Process a Redump WIP page as a list of possible IDs or disc page
|
||||
/// </summary>
|
||||
/// <param name="wc">CookieAwareWebClient to access the pages</param>
|
||||
/// <param name="url">Page URL to check and parse</param>
|
||||
/// <returns>List of matching IDs</returns>
|
||||
private List<int> CheckSingleWIPPage(CookieAwareWebClient wc, string url)
|
||||
{
|
||||
List<int> ids = new List<int>();
|
||||
|
||||
var wipDumpsPage = wc.DownloadString(url);
|
||||
|
||||
// If we have no WIP dumps left
|
||||
if (wipDumpsPage.Contains("No WIP discs found."))
|
||||
return ids;
|
||||
|
||||
// Otherwise, traverse each dump on the page
|
||||
var matches = newDiscRegex.Matches(wipDumpsPage);
|
||||
foreach (Match match in matches)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (Int32.TryParse(match.Groups[1].Value, out int value))
|
||||
ids.Add(value);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"An exception has occurred: {ex}");
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return ids;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Download an individual pack
|
||||
/// </summary>
|
||||
/// <param name="wc">CookieAwareWebClient to access the packs</param>
|
||||
/// <param name="url">Base URL to download using</param>
|
||||
/// <param name="system">System to download packs for</param>
|
||||
/// <param name="title">Name of the pack that is downloading</param>
|
||||
private byte[] DownloadPack(CookieAwareWebClient wc, string url, RedumpSystem system, string title)
|
||||
{
|
||||
Console.WriteLine($"Downloading {title}");
|
||||
Console.Write($"\r{system.LongName()}{new string(' ', Console.BufferWidth - system.LongName().Length - 1)}");
|
||||
var pack = wc.DownloadData(string.Format(url, system.ShortName()));
|
||||
|
||||
Console.Write($"\rComplete!{new string(' ', Console.BufferWidth - 10)}");
|
||||
Console.WriteLine();
|
||||
|
||||
return pack;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Download a set of packs
|
||||
/// </summary>
|
||||
/// <param name="wc">CookieAwareWebClient to access the packs</param>
|
||||
/// <param name="url">Base URL to download using</param>
|
||||
/// <param name="systems">List of systems to download packs for</param>
|
||||
/// <param name="title">Name of the pack that is downloading</param>
|
||||
private Dictionary<RedumpSystem, byte[]> DownloadPacks(CookieAwareWebClient wc, string url, RedumpSystem[] systems, string title)
|
||||
{
|
||||
var dict = new Dictionary<RedumpSystem, byte[]>();
|
||||
|
||||
Console.WriteLine($"Downloading {title}");
|
||||
foreach (var system in systems)
|
||||
{
|
||||
Console.Write($"\r{system.LongName()}{new string(' ', Console.BufferWidth - system.LongName().Length - 1)}");
|
||||
dict.Add(system, wc.DownloadData(string.Format(url, system.ShortName())));
|
||||
}
|
||||
|
||||
Console.Write($"\rComplete!{new string(' ', Console.BufferWidth - 10)}");
|
||||
Console.WriteLine();
|
||||
|
||||
return dict;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Download an individual site ID page as a string, if possible
|
||||
/// </summary>
|
||||
/// <param name="wc">CookieAwareWebClient to access the pages</param>
|
||||
/// <param name="id">Redump disc ID to retrieve</param>
|
||||
/// <returns>Disc page as a string, null on error</returns>
|
||||
public string DownloadSingleSiteID(CookieAwareWebClient wc, int id)
|
||||
{
|
||||
string paddedId = id.ToString().PadLeft(5, '0');
|
||||
Console.WriteLine($"Processing ID: {paddedId}");
|
||||
try
|
||||
{
|
||||
string discPage = wc.DownloadString(string.Format(discPageUrl, +id));
|
||||
if (discPage.Contains($"Disc with ID \"{id}\" doesn't exist"))
|
||||
return null;
|
||||
else
|
||||
return discPage;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"An exception has occurred: {ex}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Download an individual WIP ID page as a string, if possible
|
||||
/// </summary>
|
||||
/// <param name="wc">CookieAwareWebClient to access the pages</param>
|
||||
/// <param name="id">Redump disc ID to retrieve</param>
|
||||
/// <returns>WIP disc page as a string, null on error</returns>
|
||||
private string DownloadSingleWIPID(CookieAwareWebClient wc, int id)
|
||||
{
|
||||
string paddedId = id.ToString().PadLeft(5, '0');
|
||||
Console.WriteLine($"Processing WIP ID: {paddedId}");
|
||||
try
|
||||
{
|
||||
string discPage = wc.DownloadString(string.Format(wipDiscPageUrl, +id));
|
||||
if (discPage.Contains($"WIP Disc with ID \"{id}\" doesn't exist"))
|
||||
return null;
|
||||
else
|
||||
return discPage;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Console.WriteLine($"An exception has occurred: {ex}");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,107 +1,33 @@
|
||||
<?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')" />
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<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>
|
||||
<TargetFrameworks>net462;net472;netcoreapp3.0</TargetFrameworks>
|
||||
<IsPackable>false</IsPackable>
|
||||
</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>
|
||||
<ProjectReference Include="..\DICUI.Library\DICUI.Library.csproj">
|
||||
<Project>{51ab0928-13f9-44bf-a407-b6957a43a056}</Project>
|
||||
<Name>DICUI.Library</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\DICUI\DICUI.csproj">
|
||||
<Project>{7b1b75eb-8940-466f-bd51-76471a57f9be}</Project>
|
||||
<Name>DICUI</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Analyzer Include="..\packages\xunit.analyzers.0.10.0\analyzers\dotnet\cs\xunit.analyzers.dll" />
|
||||
<PackageReference Include="Microsoft.CodeCoverage" Version="16.3.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.3.0" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.abstractions" Version="2.0.3" />
|
||||
<PackageReference Include="xunit.analyzers" Version="0.10.0" />
|
||||
<PackageReference Include="xunit.assert" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.core" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.extensibility.core" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.extensibility.execution" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.console" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
|
||||
</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>
|
||||
|
||||
</Project>
|
||||
|
||||
@@ -1,20 +0,0 @@
|
||||
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")]
|
||||
@@ -1,6 +1,5 @@
|
||||
using System.Linq;
|
||||
using DICUI.Data;
|
||||
using DICUI.UI;
|
||||
using Xunit;
|
||||
|
||||
namespace DICUI.Test.Data
|
||||
@@ -8,14 +7,14 @@ namespace DICUI.Test.Data
|
||||
public class UIElementsTest
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(MediaType.CD, 72)]
|
||||
[InlineData(MediaType.CDROM, 72)]
|
||||
[InlineData(MediaType.DVD, 24)]
|
||||
[InlineData(MediaType.BluRay, 16)]
|
||||
[InlineData(MediaType.LaserDisc, 72)] // TODO: Update when fully determined
|
||||
[InlineData(null, 72)] // TODO: Update when fully determined
|
||||
public void GetAllowedDriveSpeedForMediaTypeTest(MediaType? mediaType, int maxExpected)
|
||||
{
|
||||
var actual = AllowedSpeeds.GetForMediaType(mediaType);
|
||||
var actual = Constants.GetSpeedsForMediaType(mediaType);
|
||||
Assert.Equal(maxExpected, actual.Last());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,17 +8,18 @@ namespace DICUI.Test.Utilities
|
||||
public class ConvertersTest
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(DICCommand.Audio, MediaType.CD)]
|
||||
[InlineData(DICCommand.Audio, MediaType.CDROM)]
|
||||
[InlineData(DICCommand.BluRay, MediaType.BluRay)]
|
||||
[InlineData(DICCommand.Close, null)]
|
||||
[InlineData(DICCommand.CompactDisc, MediaType.CD)]
|
||||
[InlineData(DICCommand.Data, MediaType.CD)]
|
||||
[InlineData(DICCommand.CompactDisc, MediaType.CDROM)]
|
||||
[InlineData(DICCommand.Data, MediaType.CDROM)]
|
||||
[InlineData(DICCommand.DigitalVideoDisc, MediaType.DVD)]
|
||||
[InlineData(DICCommand.Eject, null)]
|
||||
[InlineData(DICCommand.Floppy, MediaType.Floppy)]
|
||||
[InlineData(DICCommand.Floppy, MediaType.FloppyDisk)]
|
||||
[InlineData(DICCommand.GDROM, MediaType.GDROM)]
|
||||
[InlineData(DICCommand.MDS, null)]
|
||||
[InlineData(DICCommand.Reset, null)]
|
||||
[InlineData(DICCommand.SACD, MediaType.CDROM)]
|
||||
[InlineData(DICCommand.Start, null)]
|
||||
[InlineData(DICCommand.Stop, null)]
|
||||
[InlineData(DICCommand.Sub, null)]
|
||||
@@ -26,7 +27,7 @@ namespace DICUI.Test.Utilities
|
||||
[InlineData(DICCommand.XBOX, MediaType.DVD)]
|
||||
public void BaseCommandToMediaTypeTest(DICCommand command, MediaType? expected)
|
||||
{
|
||||
MediaType? actual = Converters.BaseCommmandToMediaType(command);
|
||||
MediaType? actual = command.ToMediaType();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -42,6 +43,7 @@ namespace DICUI.Test.Utilities
|
||||
[InlineData(DICCommand.GDROM, KnownSystem.SegaDreamcast)]
|
||||
[InlineData(DICCommand.MDS, null)]
|
||||
[InlineData(DICCommand.Reset, null)]
|
||||
[InlineData(DICCommand.SACD, KnownSystem.SuperAudioCD)]
|
||||
[InlineData(DICCommand.Start, null)]
|
||||
[InlineData(DICCommand.Stop, null)]
|
||||
[InlineData(DICCommand.Sub, null)]
|
||||
@@ -49,31 +51,31 @@ namespace DICUI.Test.Utilities
|
||||
[InlineData(DICCommand.XBOX, KnownSystem.MicrosoftXBOX)]
|
||||
public void BaseCommandToKnownSystemTest(DICCommand command, KnownSystem? expected)
|
||||
{
|
||||
KnownSystem? actual = Converters.BaseCommandToKnownSystem(command);
|
||||
KnownSystem? actual = Converters.ToKnownSystem(command);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(MediaType.CD, ".bin")]
|
||||
[InlineData(MediaType.CDROM, ".bin")]
|
||||
[InlineData(MediaType.DVD, ".iso")]
|
||||
[InlineData(MediaType.LaserDisc, ".raw")]
|
||||
[InlineData(MediaType.WiiUOpticalDisc, ".wud")]
|
||||
[InlineData(MediaType.Floppy, ".img")]
|
||||
[InlineData(MediaType.NintendoWiiUOpticalDisc, ".wud")]
|
||||
[InlineData(MediaType.FloppyDisk, ".img")]
|
||||
[InlineData(MediaType.Cassette, ".wav")]
|
||||
[InlineData(MediaType.NONE, null)]
|
||||
public void MediaTypeToExtensionTest(MediaType? mediaType, string expected)
|
||||
{
|
||||
string actual = Converters.MediaTypeToExtension(mediaType);
|
||||
string actual = Converters.Extension(mediaType);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(MediaType.CD, "CD-ROM")]
|
||||
[InlineData(MediaType.LaserDisc, "LaserDisc")]
|
||||
[InlineData(MediaType.CDROM, "CD-ROM")]
|
||||
[InlineData(MediaType.LaserDisc, "LD-ROM / LV-ROM")]
|
||||
[InlineData(MediaType.NONE, "Unknown")]
|
||||
public void MediaTypeToStringTest(MediaType? mediaType, string expected)
|
||||
{
|
||||
string actual = Converters.MediaTypeToString(mediaType);
|
||||
string actual = Converters.LongName(mediaType);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -82,11 +84,10 @@ namespace DICUI.Test.Utilities
|
||||
[InlineData(KnownSystem.NECPC88, "NEC PC-88")]
|
||||
[InlineData(KnownSystem.KonamiPython, "Konami Python")]
|
||||
[InlineData(KnownSystem.HDDVDVideo, "HD-DVD-Video")]
|
||||
[InlineData(KnownSystem.Custom, "Custom Input")]
|
||||
[InlineData(KnownSystem.NONE, "Unknown")]
|
||||
public void KnownSystemToStringTest(KnownSystem? knownSystem, string expected)
|
||||
{
|
||||
string actual = Converters.KnownSystemToString(knownSystem);
|
||||
string actual = Converters.LongName(knownSystem);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -94,10 +95,10 @@ namespace DICUI.Test.Utilities
|
||||
public void KnownSystemHasValidCategory()
|
||||
{
|
||||
var values = Validators.CreateListOfSystems();
|
||||
KnownSystem[] markers = { KnownSystem.MarkerArcadeEnd, KnownSystem.MarkerConsoleEnd, KnownSystem.MarkerComputerEnd, KnownSystem.MarkerOtherEnd };
|
||||
KnownSystem[] markers = { KnownSystem.MarkerArcadeEnd, KnownSystem.MarkerDiscBasedConsoleEnd, /* KnownSystem.MarkerOtherConsoleEnd, */ KnownSystem.MarkerComputerEnd, KnownSystem.MarkerOtherEnd };
|
||||
|
||||
values.ForEach(system => {
|
||||
if (system == KnownSystem.NONE || system == KnownSystem.Custom)
|
||||
if (system == KnownSystem.NONE)
|
||||
return;
|
||||
|
||||
// we check that the category is the first category value higher than the system
|
||||
@@ -107,7 +108,8 @@ namespace DICUI.Test.Utilities
|
||||
switch (category)
|
||||
{
|
||||
case KnownSystemCategory.Arcade: marker = KnownSystem.MarkerArcadeEnd; break;
|
||||
case KnownSystemCategory.Console: marker = KnownSystem.MarkerConsoleEnd; break;
|
||||
case KnownSystemCategory.DiscBasedConsole: marker = KnownSystem.MarkerDiscBasedConsoleEnd; break;
|
||||
/* case KnownSystemCategory.OtherConsole: marker = KnownSystem.MarkerOtherConsoleEnd; break; */
|
||||
case KnownSystemCategory.Computer: marker = KnownSystem.MarkerComputerEnd; break;
|
||||
case KnownSystemCategory.Other: marker = KnownSystem.MarkerOtherEnd; break;
|
||||
}
|
||||
|
||||
@@ -1,23 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,23 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using DICUI.Data;
|
||||
using DICUI.Utilities;
|
||||
using Xunit;
|
||||
@@ -11,16 +10,18 @@ namespace DICUI.Test
|
||||
[Theory]
|
||||
[InlineData(null, 'D', false, MediaType.NONE, false)]
|
||||
[InlineData("", 'D', false, MediaType.NONE, false)]
|
||||
[InlineData("cd F test.bin 8 /c2 20", 'F', false, MediaType.CD, true)]
|
||||
[InlineData("fd A test.img", 'A', true, MediaType.Floppy, true)]
|
||||
[InlineData("dvd X test.iso 8 /raw", 'X', false, MediaType.Floppy, false)]
|
||||
[InlineData("cd F test.bin 8 /c2 20", 'F', false, MediaType.CDROM, true)]
|
||||
[InlineData("fd A test.img", 'A', true, MediaType.FloppyDisk, true)]
|
||||
[InlineData("dvd X test.iso 8 /raw", 'X', false, MediaType.FloppyDisk, false)]
|
||||
[InlineData("stop D", 'D', false, MediaType.DVD, true)]
|
||||
public void ParametersValidTest(string parameters, char letter, bool isFloppy, MediaType? mediaType, bool expected)
|
||||
{
|
||||
var env = new DumpEnvironment
|
||||
{
|
||||
DICParameters = new Parameters(parameters),
|
||||
Drive = isFloppy ? Drive.Floppy(letter) : Drive.Optical(letter, "", true),
|
||||
Drive = isFloppy
|
||||
? new Drive(InternalDriveType.Floppy, new DriveInfo(letter.ToString()))
|
||||
: new Drive(InternalDriveType.Optical, new DriveInfo(letter.ToString())),
|
||||
Type = mediaType,
|
||||
};
|
||||
|
||||
@@ -28,36 +29,13 @@ namespace DICUI.Test
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null, null, null, new char(), null, null)]
|
||||
[InlineData("", null, null, new char(), null, null)]
|
||||
[InlineData("cd F test.bin 8 /c2 20", MediaType.CD, KnownSystem.IBMPCCompatible, 'F', "", "test.bin")]
|
||||
[InlineData("fd A blah\\test.img", MediaType.Floppy, KnownSystem.IBMPCCompatible, 'A', "blah", "test.img")]
|
||||
[InlineData("dvd X super\\blah\\test.iso 8 /raw", MediaType.GameCubeGameDisc, KnownSystem.NintendoGameCube, 'X', "super\\blah", "test.iso")]
|
||||
[InlineData("stop D", null, null, 'D', null, null)]
|
||||
public void AdjustForCustomConfigurationTest(string parameters, MediaType? expectedMediaType, KnownSystem? expectedKnownSystem, char expectedDriveLetter, string expectedOutputDirectory, string expectedOutputFilename)
|
||||
{
|
||||
var env = new DumpEnvironment
|
||||
{
|
||||
DICParameters = new Parameters(parameters),
|
||||
System = KnownSystem.Custom,
|
||||
};
|
||||
|
||||
env.AdjustForCustomConfiguration();
|
||||
Assert.Equal(expectedMediaType, env.Type);
|
||||
Assert.Equal(expectedKnownSystem, env.System);
|
||||
Assert.Equal(expectedDriveLetter, env.Drive.Letter);
|
||||
Assert.Equal(expectedOutputDirectory, env.OutputDirectory);
|
||||
Assert.Equal(expectedOutputFilename, env.OutputFilename);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(null, null, null, null)]
|
||||
[InlineData(" ", "", " ", "")]
|
||||
[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.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)
|
||||
@@ -80,37 +58,6 @@ namespace DICUI.Test
|
||||
Assert.True(true);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(MediaType.CD)]
|
||||
[InlineData(MediaType.DVD)]
|
||||
[InlineData(MediaType.Floppy)]
|
||||
[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.CD)]
|
||||
[InlineData(KnownSystem.PhilipsCDi, MediaType.CD)]
|
||||
[InlineData(KnownSystem.SegaSaturn, MediaType.CD)]
|
||||
[InlineData(KnownSystem.SonyPlayStation, MediaType.CD)]
|
||||
[InlineData(KnownSystem.SonyPlayStation2, MediaType.CD)]
|
||||
[InlineData(KnownSystem.AppleMacintosh, MediaType.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()
|
||||
{
|
||||
|
||||
@@ -7,31 +7,6 @@ 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);
|
||||
}
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(KnownSystem.AppleMacintosh, true)]
|
||||
[InlineData(KnownSystem.MicrosoftXBOX, false)]
|
||||
[InlineData(KnownSystem.MicrosoftXBOX360XDG2, false)]
|
||||
[InlineData(KnownSystem.MicrosoftXBOX360XDG3, false)]
|
||||
[InlineData(KnownSystem.SonyPlayStation3, true)]
|
||||
public void DriveSpeedSupportedTest(KnownSystem? knownSystem, bool expected)
|
||||
{
|
||||
bool actual = knownSystem.DoesSupportDriveSpeed();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IsMarkerTest()
|
||||
{
|
||||
@@ -39,7 +14,8 @@ namespace DICUI.Test.Utilities
|
||||
foreach(var system in values)
|
||||
{
|
||||
bool expected = system == KnownSystem.MarkerArcadeEnd || system == KnownSystem.MarkerComputerEnd ||
|
||||
system == KnownSystem.MarkerOtherEnd || system == KnownSystem.MarkerConsoleEnd;
|
||||
system == KnownSystem.MarkerOtherEnd || system == KnownSystem.MarkerDiscBasedConsoleEnd;
|
||||
// || system == KnownSystem.MarkerOtherConsoleEnd;
|
||||
|
||||
bool actual = ((KnownSystem?)system).IsMarker();
|
||||
|
||||
@@ -53,7 +29,7 @@ namespace DICUI.Test.Utilities
|
||||
var values = (KnownSystemCategory[])Enum.GetValues(typeof(KnownSystemCategory));
|
||||
foreach (var system in values)
|
||||
{
|
||||
string actual = ((KnownSystem?)system).Name();
|
||||
string actual = ((KnownSystem?)system).LongName();
|
||||
Assert.NotEqual("", actual);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,37 +7,35 @@ namespace DICUI.Test.Utilities
|
||||
public class MediaTypeExtensionsTest
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(MediaType.CD)]
|
||||
[InlineData(MediaType.LaserDisc)]
|
||||
[InlineData(MediaType.NONE)]
|
||||
public void NameTest(MediaType? mediaType)
|
||||
[InlineData(MediaType.CDROM, "CD-ROM")]
|
||||
[InlineData(MediaType.LaserDisc, "LD-ROM / LV-ROM")]
|
||||
[InlineData(MediaType.NONE, "Unknown")]
|
||||
public void NameTest(MediaType? mediaType, string expected)
|
||||
{
|
||||
string expected = Converters.MediaTypeToString(mediaType);
|
||||
string actual = mediaType.Name();
|
||||
string actual = mediaType.LongName();
|
||||
|
||||
Assert.NotNull(actual);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(MediaType.CD)]
|
||||
[InlineData(MediaType.DVD)]
|
||||
[InlineData(MediaType.LaserDisc)]
|
||||
[InlineData(MediaType.Floppy)]
|
||||
[InlineData(MediaType.NONE)]
|
||||
public void ExtensionTest(MediaType? mediaType)
|
||||
[InlineData(MediaType.CDROM, ".bin")]
|
||||
[InlineData(MediaType.DVD, ".iso")]
|
||||
[InlineData(MediaType.LaserDisc, ".raw")]
|
||||
[InlineData(MediaType.FloppyDisk, ".img")]
|
||||
[InlineData(MediaType.NONE, null)]
|
||||
public void ExtensionTest(MediaType? mediaType, string expected)
|
||||
{
|
||||
string expected = Converters.MediaTypeToExtension(mediaType);
|
||||
string actual = mediaType.Extension();
|
||||
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(MediaType.CD, true)]
|
||||
[InlineData(MediaType.CDROM, true)]
|
||||
[InlineData(MediaType.DVD, true)]
|
||||
[InlineData(MediaType.Floppy, false)]
|
||||
[InlineData(MediaType.BluRay, false)]
|
||||
[InlineData(MediaType.FloppyDisk, false)]
|
||||
[InlineData(MediaType.BluRay, true)]
|
||||
[InlineData(MediaType.LaserDisc, false)]
|
||||
public void DriveSpeedSupportedTest(MediaType? mediaType, bool expected)
|
||||
{
|
||||
|
||||
@@ -9,11 +9,11 @@ namespace DICUI.Test.Utilities
|
||||
public class ParametersTest
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(KnownSystem.MicrosoftXBOX, MediaType.CD, DICCommand.XBOX)]
|
||||
[InlineData(KnownSystem.MicrosoftXBOX, MediaType.CDROM, DICCommand.CompactDisc)]
|
||||
[InlineData(KnownSystem.MicrosoftXBOX, MediaType.DVD, DICCommand.XBOX)]
|
||||
[InlineData(KnownSystem.MicrosoftXBOX, MediaType.LaserDisc, DICCommand.NONE)]
|
||||
[InlineData(KnownSystem.SegaNu, MediaType.BluRay, DICCommand.BluRay)]
|
||||
[InlineData(KnownSystem.AppleMacintosh, MediaType.Floppy, DICCommand.Floppy)]
|
||||
[InlineData(KnownSystem.AppleMacintosh, MediaType.FloppyDisk, DICCommand.Floppy)]
|
||||
[InlineData(KnownSystem.RawThrillsVarious, MediaType.GDROM, DICCommand.NONE)]
|
||||
public void ParametersFromSystemAndTypeTest(KnownSystem? knownSystem, MediaType? mediaType, DICCommand expected)
|
||||
{
|
||||
@@ -23,12 +23,12 @@ namespace DICUI.Test.Utilities
|
||||
|
||||
[Theory]
|
||||
[InlineData(KnownSystem.AppleMacintosh, MediaType.LaserDisc, true, 20, null, null)]
|
||||
[InlineData(KnownSystem.NintendoGameCube, MediaType.GameCubeGameDisc, false, 20, null, new DICFlag[] { DICFlag.Raw })]
|
||||
[InlineData(KnownSystem.NintendoGameCube, MediaType.NintendoGameCubeGameDisc, false, 20, null, new DICFlag[] { DICFlag.Raw })]
|
||||
[InlineData(KnownSystem.IBMPCCompatible, MediaType.DVD, false, 20, null, new DICFlag[] { })]
|
||||
/* paranoid mode tests */
|
||||
[InlineData(KnownSystem.IBMPCCompatible, MediaType.CD, true, 1000, 2, new DICFlag[] { DICFlag.C2Opcode, DICFlag.NoFixSubQSecuROM, DICFlag.ScanFileProtect, DICFlag.ScanSectorProtect, DICFlag.SubchannelReadLevel })]
|
||||
[InlineData(KnownSystem.AppleMacintosh, MediaType.CD, false, 20, null, new DICFlag[] { DICFlag.C2Opcode, DICFlag.NoFixSubQSecuROM, DICFlag.ScanFileProtect })]
|
||||
[InlineData(KnownSystem.IBMPCCompatible, MediaType.DVD, true, 500, null, new DICFlag[] { DICFlag.CopyrightManagementInformation })]
|
||||
[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, DICFlag.ScanFileProtect })]
|
||||
[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[] { })]
|
||||
@@ -53,9 +53,9 @@ namespace DICUI.Test.Utilities
|
||||
[Theory]
|
||||
[InlineData(null, null, null, null, null)]
|
||||
[InlineData("", null, null, null, null)]
|
||||
[InlineData("cd F test.bin 8 /c2 20", MediaType.CD, KnownSystem.IBMPCCompatible, "F", "test.bin")]
|
||||
[InlineData("fd A blah\\test.img", MediaType.Floppy, KnownSystem.IBMPCCompatible, "A", "blah\\test.img")]
|
||||
[InlineData("dvd X super\\blah\\test.iso 8 /raw", MediaType.GameCubeGameDisc, KnownSystem.NintendoGameCube, "X", "super\\blah\\test.iso")]
|
||||
[InlineData("cd F test.bin 8 /c2 20", MediaType.CDROM, KnownSystem.IBMPCCompatible, "F", "test.bin")]
|
||||
[InlineData("fd A blah\\test.img", MediaType.FloppyDisk, KnownSystem.IBMPCCompatible, "A", "blah\\test.img")]
|
||||
[InlineData("dvd X super\\blah\\test.iso 8 /raw", MediaType.NintendoGameCubeGameDisc, KnownSystem.NintendoGameCube, "X", "super\\blah\\test.iso")]
|
||||
[InlineData("stop D", null, null, "D", null)]
|
||||
public void DetermineFlagsTest(string parameters, MediaType? expectedMediaType, KnownSystem? expectedKnownSystem, string expectedDriveLetter, string expectedPath)
|
||||
{
|
||||
@@ -73,7 +73,7 @@ namespace DICUI.Test.Utilities
|
||||
[InlineData("cd F test.bin 8 /c2 20", true)]
|
||||
[InlineData("fd A test.img", true)]
|
||||
[InlineData("dvd X super\\test.iso 8 /raw", true)]
|
||||
[InlineData("bd D longer\\path_test.iso 16", false)]
|
||||
[InlineData("bd D longer\\path_test.iso 16", true)]
|
||||
[InlineData("stop D", true)]
|
||||
[InlineData("ls", false)]
|
||||
public void ValidateParametersTest(string parameters, bool expected)
|
||||
|
||||
@@ -8,11 +8,11 @@ namespace DICUI.Test.Utilities
|
||||
public class ValidatorsTest
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(KnownSystem.BandaiApplePippin, MediaType.CD)]
|
||||
[InlineData(KnownSystem.BandaiApplePippin, MediaType.CDROM)]
|
||||
[InlineData(KnownSystem.MicrosoftXBOX, MediaType.DVD)]
|
||||
[InlineData(KnownSystem.NintendoGameCube, MediaType.GameCubeGameDisc)]
|
||||
[InlineData(KnownSystem.NintendoWii, MediaType.WiiOpticalDisc)]
|
||||
[InlineData(KnownSystem.NintendoWiiU, MediaType.WiiUOpticalDisc)]
|
||||
[InlineData(KnownSystem.NintendoGameCube, MediaType.NintendoGameCubeGameDisc)]
|
||||
[InlineData(KnownSystem.NintendoWii, MediaType.NintendoWiiOpticalDisc)]
|
||||
[InlineData(KnownSystem.NintendoWiiU, MediaType.NintendoWiiUOpticalDisc)]
|
||||
[InlineData(KnownSystem.SonyPlayStationPortable, MediaType.UMD)]
|
||||
public void GetValidMediaTypesTest(KnownSystem? knownSystem, MediaType? expected)
|
||||
{
|
||||
|
||||
@@ -1,14 +0,0 @@
|
||||
<?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>
|
||||
23
DICUI.sln
23
DICUI.sln
@@ -1,12 +1,23 @@
|
||||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.27130.2036
|
||||
# Visual Studio Version 16
|
||||
VisualStudioVersion = 16.0.28803.156
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
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.Check", "DICUI.Check\DICUI.Check.csproj", "{8CFDE289-E171-4D49-A40D-5293265C1253}"
|
||||
EndProject
|
||||
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4D1DCF5A-F0B0-4E81-A05B-F1A7D37C9D9D}"
|
||||
ProjectSection(SolutionItems) = preProject
|
||||
appveyor.yml = appveyor.yml
|
||||
CHANGELIST.md = CHANGELIST.md
|
||||
README.md = README.md
|
||||
EndProjectSection
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
@@ -21,6 +32,14 @@ Global
|
||||
{7CC064D2-38AB-4A05-8519-28660DE4562A}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{7CC064D2-38AB-4A05-8519-28660DE4562A}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{7CC064D2-38AB-4A05-8519-28660DE4562A}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{51AB0928-13F9-44BF-A407-B6957A43A056}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{51AB0928-13F9-44BF-A407-B6957A43A056}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{51AB0928-13F9-44BF-A407-B6957A43A056}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{51AB0928-13F9-44BF-A407-B6957A43A056}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{8CFDE289-E171-4D49-A40D-5293265C1253}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{8CFDE289-E171-4D49-A40D-5293265C1253}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{8CFDE289-E171-4D49-A40D-5293265C1253}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{8CFDE289-E171-4D49-A40D-5293265C1253}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
|
||||
@@ -1,14 +1,22 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<?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="PreferredDumpSpeedCD" value="72"/>
|
||||
<add key="PreferredDumpSpeedDVD" value="24"/>
|
||||
<add key="PreferredDumpSpeedBD" value="16"/>
|
||||
<add key="QuietMode" value="false"/>
|
||||
<add key="ParanoidMode" value="false"/>
|
||||
<add key="ScanForProtection" value="true"/>
|
||||
<add key="SkipMediaTypeDetection" value="false"/>
|
||||
<add key="SkipSystemDetection" value="false"/>
|
||||
<add key="RereadAmountForC2" value="20"/>
|
||||
<add key="VerboseLogging" value="true"/>
|
||||
<add key="OpenLogWindowAtStartup" value="true"/>
|
||||
<add key="AddPlaceholders" value="true"/>
|
||||
<add key="Username" value=""/>
|
||||
<add key="Password" value=""/>
|
||||
</appSettings>
|
||||
</configuration>
|
||||
<startup><supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.2"/></startup></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>
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Data;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows;
|
||||
|
||||
namespace DICUI
|
||||
{
|
||||
|
||||
29
DICUI/ComboBoxItems/CategoryComboBoxItem.cs
Normal file
29
DICUI/ComboBoxItems/CategoryComboBoxItem.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using DICUI.Data;
|
||||
using DICUI.Utilities;
|
||||
|
||||
namespace DICUI
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a single item in the Category combo box
|
||||
/// </summary>
|
||||
public class CategoryComboBoxItem
|
||||
{
|
||||
private object data;
|
||||
|
||||
public CategoryComboBoxItem(Category? category) => data = category;
|
||||
|
||||
public static implicit operator Category? (CategoryComboBoxItem item) => item.data as Category?;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return (data as Category?).LongName(); }
|
||||
}
|
||||
|
||||
public bool IsChecked { get; set; }
|
||||
|
||||
public Category? Value
|
||||
{
|
||||
get { return data as Category?; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,7 +2,7 @@
|
||||
using DICUI.Data;
|
||||
using DICUI.Utilities;
|
||||
|
||||
namespace DICUI.UI
|
||||
namespace DICUI
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a single item in the System combo box
|
||||
@@ -26,9 +26,9 @@ namespace DICUI.UI
|
||||
get
|
||||
{
|
||||
if (IsHeader())
|
||||
return "---------- " + (data as KnownSystemCategory?).Name() + " ----------";
|
||||
return "---------- " + (data as KnownSystemCategory?).LongName() + " ----------";
|
||||
else
|
||||
return (data as KnownSystem?).Name();
|
||||
return (data as KnownSystem?).LongName();
|
||||
}
|
||||
}
|
||||
}
|
||||
29
DICUI/ComboBoxItems/LanguageComboBoxItem.cs
Normal file
29
DICUI/ComboBoxItems/LanguageComboBoxItem.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using DICUI.Data;
|
||||
using DICUI.Utilities;
|
||||
|
||||
namespace DICUI
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a single item in the Language combo box
|
||||
/// </summary>
|
||||
public class LanguageComboBoxItem
|
||||
{
|
||||
private object data;
|
||||
|
||||
public LanguageComboBoxItem(Language? region) => data = region;
|
||||
|
||||
public static implicit operator Language? (LanguageComboBoxItem item) => item.data as Language?;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get { return (data as Language?).LongName(); }
|
||||
}
|
||||
|
||||
public bool IsChecked { get; set; }
|
||||
|
||||
public Language? Value
|
||||
{
|
||||
get { return data as Language?; }
|
||||
}
|
||||
}
|
||||
}
|
||||
20
DICUI/ComboBoxItems/MediaTypeComboBoxItem.cs
Normal file
20
DICUI/ComboBoxItems/MediaTypeComboBoxItem.cs
Normal file
@@ -0,0 +1,20 @@
|
||||
using DICUI.Data;
|
||||
using DICUI.Utilities;
|
||||
|
||||
namespace DICUI
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a single item in the MediaType combo box
|
||||
/// </summary>
|
||||
public class MediaTypeComboBoxItem
|
||||
{
|
||||
private MediaType? data;
|
||||
|
||||
public MediaTypeComboBoxItem(MediaType? mediaType) => data = mediaType;
|
||||
|
||||
public static implicit operator MediaType? (MediaTypeComboBoxItem item) => item.data;
|
||||
|
||||
public string Name { get { return data.LongName(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
30
DICUI/ComboBoxItems/RegionComboBoxItem.cs
Normal file
30
DICUI/ComboBoxItems/RegionComboBoxItem.cs
Normal file
@@ -0,0 +1,30 @@
|
||||
using DICUI.Data;
|
||||
using DICUI.Utilities;
|
||||
|
||||
namespace DICUI
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents a single item in the Region combo box
|
||||
/// </summary>
|
||||
public class RegionComboBoxItem
|
||||
{
|
||||
private object data;
|
||||
|
||||
public RegionComboBoxItem(Region? region) => data = region;
|
||||
|
||||
public static implicit operator Region? (RegionComboBoxItem item) => item.data as Region?;
|
||||
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return (data as Region?).LongName();
|
||||
}
|
||||
}
|
||||
|
||||
public Region? Value
|
||||
{
|
||||
get { return data as Region?; }
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,13 +4,18 @@ using System.Linq;
|
||||
using System.Windows.Media;
|
||||
using DICUI.Data;
|
||||
|
||||
namespace DICUI.UI
|
||||
namespace DICUI
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets allowed drive speeds for a given media type
|
||||
/// Variables for UI elements
|
||||
/// </summary>
|
||||
public static class AllowedSpeeds
|
||||
public static class Constants
|
||||
{
|
||||
public const string StartDumping = "Start Dumping";
|
||||
public const string StopDumping = "Stop Dumping";
|
||||
|
||||
public const int LogWindowMarginFromMainWindow = 10;
|
||||
|
||||
// Private lists of known drive speed ranges
|
||||
private static IReadOnlyList<int> cd { get; } = new List<int> { 1, 2, 3, 4, 6, 8, 12, 16, 20, 24, 32, 40, 44, 48, 52, 56, 72 };
|
||||
private static IReadOnlyList<int> dvd { get; } = cd.Where(s => s <= 24).ToList();
|
||||
@@ -22,17 +27,17 @@ namespace DICUI.UI
|
||||
/// </summary>
|
||||
/// <param name="type">MediaType? that represents the current item</param>
|
||||
/// <returns>Read-only list of drive speeds</returns>
|
||||
public static IReadOnlyList<int> GetForMediaType(MediaType? type)
|
||||
public static IReadOnlyList<int> GetSpeedsForMediaType(MediaType? type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MediaType.CD:
|
||||
case MediaType.CDROM:
|
||||
case MediaType.GDROM:
|
||||
return cd;
|
||||
case MediaType.DVD:
|
||||
case MediaType.HDDVD:
|
||||
case MediaType.GameCubeGameDisc:
|
||||
case MediaType.WiiOpticalDisc:
|
||||
case MediaType.NintendoGameCubeGameDisc:
|
||||
case MediaType.NintendoWiiOpticalDisc:
|
||||
return dvd;
|
||||
case MediaType.BluRay:
|
||||
return bd;
|
||||
@@ -42,9 +47,9 @@ namespace DICUI.UI
|
||||
}
|
||||
|
||||
// Create collections for UI based on known drive speeds
|
||||
public static DoubleCollection ForCDAsCollection { get; } = GetDoubleCollectionFromIntList(cd);
|
||||
public static DoubleCollection ForDVDAsCollection { get; } = GetDoubleCollectionFromIntList(dvd);
|
||||
public static DoubleCollection ForBDAsCollection { get; } = GetDoubleCollectionFromIntList(bd);
|
||||
public static DoubleCollection SpeedsForCDAsCollection { get; } = GetDoubleCollectionFromIntList(cd);
|
||||
public static DoubleCollection SpeedsForDVDAsCollection { get; } = GetDoubleCollectionFromIntList(dvd);
|
||||
public static DoubleCollection SpeedsForBDAsCollection { get; } = GetDoubleCollectionFromIntList(bd);
|
||||
private static DoubleCollection GetDoubleCollectionFromIntList(IReadOnlyList<int> list)
|
||||
=> new DoubleCollection(list.Select(i => Convert.ToDouble(i)).ToList());
|
||||
}
|
||||
@@ -1,199 +1,28 @@
|
||||
<?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')" />
|
||||
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">
|
||||
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{7B1B75EB-8940-466F-BD51-76471A57F9BE}</ProjectGuid>
|
||||
<TargetFrameworks>net462;net472;netcoreapp3.0</TargetFrameworks>
|
||||
<GenerateAssemblyInfo>false</GenerateAssemblyInfo>
|
||||
<OutputType>WinExe</OutputType>
|
||||
<RootNamespace>DICUI</RootNamespace>
|
||||
<AssemblyName>DICUI</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<IsWebBootstrapper>false</IsWebBootstrapper>
|
||||
<PublishUrl>C:\Users\admin\Desktop\</PublishUrl>
|
||||
<Install>true</Install>
|
||||
<InstallFrom>Disk</InstallFrom>
|
||||
<UpdateEnabled>false</UpdateEnabled>
|
||||
<UpdateMode>Foreground</UpdateMode>
|
||||
<UpdateInterval>7</UpdateInterval>
|
||||
<UpdateIntervalUnits>Days</UpdateIntervalUnits>
|
||||
<UpdatePeriodically>false</UpdatePeriodically>
|
||||
<UpdateRequired>false</UpdateRequired>
|
||||
<MapFileExtensions>true</MapFileExtensions>
|
||||
<ApplicationRevision>1</ApplicationRevision>
|
||||
<ApplicationVersion>1.0.0.%2a</ApplicationVersion>
|
||||
<UseApplicationTrust>false</UseApplicationTrust>
|
||||
<PublishWizardCompleted>true</PublishWizardCompleted>
|
||||
<BootstrapperEnabled>true</BootstrapperEnabled>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>x86</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
|
||||
</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>
|
||||
<UseWindowsForms>true</UseWindowsForms>
|
||||
<UseWPF>true</UseWPF>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
<ApplicationIcon>Icon.ico</ApplicationIcon>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestCertificateThumbprint>654CEE5FEAF46C8C1C369D7ED34DA157828A8D2F</ManifestCertificateThumbprint>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<ManifestKeyFile>WpfApp1_TemporaryKey.pfx</ManifestKeyFile>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<GenerateManifests>true</GenerateManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup>
|
||||
<SignManifests>false</SignManifests>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup />
|
||||
<ItemGroup>
|
||||
<Reference Include="BurnOutSharp, Version=1.3.7.1, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\BurnOutSharp.1.3.7.1\lib\net461\BurnOutSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="LessIO, Version=0.5.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\LessIO.0.5.0\lib\net40\LessIO.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="libmspackn, Version=0.8.0.0, Culture=neutral, processorArchitecture=x86">
|
||||
<HintPath>..\packages\libmspack4n.0.8.0\lib\net40\libmspackn.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Management.Instrumentation" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xaml">
|
||||
<RequiredTargetFramework>4.0</RequiredTargetFramework>
|
||||
</Reference>
|
||||
<Reference Include="UnshieldSharp, Version=1.4.2.2, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\UnshieldSharp.1.4.2.2\lib\net461\UnshieldSharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="zlib.net, Version=1.0.3.0, Culture=neutral, PublicKeyToken=47d7877cb3620160">
|
||||
<HintPath>..\packages\zlib.net.1.0.4.0\lib\zlib.net.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ApplicationDefinition Include="App.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="LogWindow.xaml.cs">
|
||||
<DependentUpon>LogWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="Data\Constants.cs" />
|
||||
<Compile Include="Options.cs" />
|
||||
<Compile Include="UI\KnownSystemComboBoxItem.cs" />
|
||||
<Compile Include="UI\AllowedSpeeds.cs" />
|
||||
<Compile Include="UI\ViewModels.cs" />
|
||||
<Compile Include="Utilities\DumpEnvironment.cs" />
|
||||
<Compile Include="Utilities\Extensions.cs" />
|
||||
<Compile Include="Utilities\Parameters.cs" />
|
||||
<Compile Include="Utilities\Result.cs" />
|
||||
<Compile Include="Utilities\Validators.cs" />
|
||||
<Compile Include="Utilities\Converters.cs" />
|
||||
<Compile Include="OptionsWindow.xaml.cs">
|
||||
<DependentUpon>OptionsWindow.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Page Include="LogWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Compile Include="App.xaml.cs">
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Data\Enumerations.cs" />
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Page Include="OptionsWindow.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<BootstrapperPackage Include=".NETFramework,Version=v4.6.1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>Microsoft .NET Framework 4.6.1 %28x86 and x64%29</ProductName>
|
||||
<Install>true</Install>
|
||||
</BootstrapperPackage>
|
||||
<BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
|
||||
<Visible>False</Visible>
|
||||
<ProductName>.NET Framework 3.5 SP1</ProductName>
|
||||
<Install>false</Install>
|
||||
</BootstrapperPackage>
|
||||
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.6.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Resource Include="Icon.ico" />
|
||||
<ProjectReference Include="..\DICUI.Library\DICUI.Library.csproj">
|
||||
<Project>{51ab0928-13f9-44bf-a407-b6957a43a056}</Project>
|
||||
<Name>DICUI.Library</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<COMReference Include="IMAPI2">
|
||||
<Guid>{2735412F-7F64-5B0F-8F00-5D77AFBE261E}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
<COMReference Include="IMAPI2FS">
|
||||
<Guid>{2C941FD0-975B-59BE-A960-9A2A262853A5}</Guid>
|
||||
<VersionMajor>1</VersionMajor>
|
||||
<VersionMinor>0</VersionMinor>
|
||||
<Lcid>0</Lcid>
|
||||
<WrapperTool>tlbimp</WrapperTool>
|
||||
<Isolated>False</Isolated>
|
||||
<EmbedInteropTypes>True</EmbedInteropTypes>
|
||||
</COMReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Content Include="mspack.dll">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</Content>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
|
||||
</Project>
|
||||
@@ -1,239 +0,0 @@
|
||||
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,
|
||||
}
|
||||
|
||||
/// <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,
|
||||
MicrosoftXBOX360XDG2,
|
||||
MicrosoftXBOX360XDG3,
|
||||
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,
|
||||
SegaSTV,
|
||||
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
|
||||
|
||||
Custom,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Known system category
|
||||
/// </summary>
|
||||
public enum KnownSystemCategory
|
||||
{
|
||||
Console = 0,
|
||||
Computer,
|
||||
Arcade,
|
||||
Other,
|
||||
Custom
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Known media types
|
||||
/// </summary>
|
||||
public enum MediaType
|
||||
{
|
||||
// Generic Optical Formats
|
||||
NONE = 0,
|
||||
CD,
|
||||
DVD,
|
||||
GDROM,
|
||||
HDDVD,
|
||||
BluRay,
|
||||
LaserDisc,
|
||||
|
||||
// Special Optical Formats
|
||||
GameCubeGameDisc,
|
||||
WiiOpticalDisc,
|
||||
WiiUOpticalDisc,
|
||||
UMD,
|
||||
|
||||
// Non-Optical Formats
|
||||
Floppy,
|
||||
Cartridge,
|
||||
Cassette,
|
||||
CED,
|
||||
}
|
||||
}
|
||||
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).LongName();
|
||||
else if (value is DICFlag)
|
||||
return ((DICFlag)value).LongName();
|
||||
else if (value is MediaType?)
|
||||
return ((MediaType?)value).LongName();
|
||||
else if (value is KnownSystem?)
|
||||
return ((KnownSystem?)value).LongName();
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
}
|
||||
147
DICUI/Options.cs
147
DICUI/Options.cs
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Configuration;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using DICUI.Data;
|
||||
|
||||
@@ -11,19 +12,26 @@ namespace DICUI
|
||||
public string DICPath { get; private set; }
|
||||
public string SubDumpPath { get; private set; }
|
||||
|
||||
public int preferredDumpSpeedCD { get; set; }
|
||||
public int preferredDumpSpeedDVD { get; 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 AddPlaceholders { get; set; }
|
||||
public bool PromptForDiscInformation { get; set; }
|
||||
|
||||
public bool SkipMediaTypeDetection { get; set; }
|
||||
public bool SkipSystemDetection { get; set; }
|
||||
|
||||
public bool VerboseLogging { get; set; }
|
||||
public bool OpenLogWindowAtStartup { get; set; }
|
||||
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
|
||||
public void Save()
|
||||
{
|
||||
Configuration configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
||||
@@ -43,23 +51,119 @@ namespace DICUI
|
||||
|
||||
public void Load()
|
||||
{
|
||||
Configuration configFile = ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None);
|
||||
|
||||
//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.DICPath = GetStringSetting(configFile, "DICPath", "Programs\\DiscImageCreator.exe");
|
||||
this.SubDumpPath = GetStringSetting(configFile, "SubDumpPath", "subdump.exe");
|
||||
this.DefaultOutputPath = GetStringSetting(configFile, "DefaultOutputPath", "ISO");
|
||||
|
||||
this.preferredDumpSpeedCD = Int32.TryParse(ConfigurationManager.AppSettings["preferredDumpSpeedCD"], out int maxDumpSpeedCD) ? maxDumpSpeedCD : 72;
|
||||
this.preferredDumpSpeedDVD = Int32.TryParse(ConfigurationManager.AppSettings["preferredDumpSpeedDVD"], out int maxDumpSpeedDVD) ? maxDumpSpeedDVD : 72;
|
||||
this.PreferredDumpSpeedCD = GetInt32Setting(configFile, "PreferredDumpSpeedCD", 72);
|
||||
this.PreferredDumpSpeedDVD = GetInt32Setting(configFile, "PreferredDumpSpeedDVD", 24);
|
||||
this.PreferredDumpSpeedBD = GetInt32Setting(configFile, "PreferredDumpSpeedBD", 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;
|
||||
this.QuietMode = GetBooleanSetting(configFile, "QuietMode", false);
|
||||
this.ParanoidMode = GetBooleanSetting(configFile, "ParanoidMode", false);
|
||||
this.ScanForProtection = GetBooleanSetting(configFile, "ScanForProtection", true);
|
||||
this.SkipMediaTypeDetection = GetBooleanSetting(configFile, "SkipMediaTypeDetection", false);
|
||||
this.SkipSystemDetection = GetBooleanSetting(configFile, "SkipSystemDetection", false);
|
||||
this.RereadAmountForC2 = GetInt32Setting(configFile, "RereadAmountForC2", 20);
|
||||
this.VerboseLogging = GetBooleanSetting(configFile, "VerboseLogging", true);
|
||||
this.OpenLogWindowAtStartup = GetBooleanSetting(configFile, "OpenLogWindowAtStartup", true);
|
||||
this.AddPlaceholders = GetBooleanSetting(configFile, "AddPlaceholders", true);
|
||||
this.PromptForDiscInformation = GetBooleanSetting(configFile, "PromptForDiscInformation", true);
|
||||
|
||||
this.Username = GetStringSetting(configFile, "Username", "");
|
||||
this.Password = GetStringSetting(configFile, "Password", "");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a boolean setting from a configuration
|
||||
/// </summary>
|
||||
/// <param name="configFile">Current configuration file</param>
|
||||
/// <param name="key">Setting key to get a value for</param>
|
||||
/// <param name="defaultValue">Default value to return if no value is found</param>
|
||||
/// <returns>Setting value if possible, default value otherwise</returns>
|
||||
public bool GetBooleanSetting(Configuration configFile, string key, bool defaultValue)
|
||||
{
|
||||
var settings = configFile.AppSettings.Settings;
|
||||
if (settings.AllKeys.Contains(key))
|
||||
{
|
||||
if (Boolean.TryParse(settings[key].Value, out bool value))
|
||||
return value;
|
||||
else
|
||||
return defaultValue;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a boolean setting from a configuration
|
||||
/// </summary>
|
||||
/// <param name="configFile">Current configuration file</param>
|
||||
/// <param name="key">Setting key to get a value for</param>
|
||||
/// <param name="defaultValue">Default value to return if no value is found</param>
|
||||
/// <returns>Setting value if possible, default value otherwise</returns>
|
||||
public int GetInt32Setting(Configuration configFile, string key, int defaultValue)
|
||||
{
|
||||
var settings = configFile.AppSettings.Settings;
|
||||
if (settings.AllKeys.Contains(key))
|
||||
{
|
||||
if (Int32.TryParse(settings[key].Value, out int value))
|
||||
return value;
|
||||
else
|
||||
return defaultValue;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a boolean setting from a configuration
|
||||
/// </summary>
|
||||
/// <param name="configFile">Current configuration file</param>
|
||||
/// <param name="key">Setting key to get a value for</param>
|
||||
/// <param name="defaultValue">Default value to return if no value is found</param>
|
||||
/// <returns>Setting value if possible, default value otherwise</returns>
|
||||
public long GetInt64Setting(Configuration configFile, string key, long defaultValue)
|
||||
{
|
||||
var settings = configFile.AppSettings.Settings;
|
||||
if (settings.AllKeys.Contains(key))
|
||||
{
|
||||
if (Int64.TryParse(settings[key].Value, out long value))
|
||||
return value;
|
||||
else
|
||||
return defaultValue;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
return defaultValue;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a boolean setting from a configuration
|
||||
/// </summary>
|
||||
/// <param name="configFile">Current configuration file</param>
|
||||
/// <param name="key">Setting key to get a value for</param>
|
||||
/// <param name="defaultValue">Default value to return if no value is found</param>
|
||||
/// <returns>Setting value if possible, default value otherwise</returns>
|
||||
public string GetStringSetting(Configuration configFile, string key, string defaultValue)
|
||||
{
|
||||
var settings = configFile.AppSettings.Settings;
|
||||
if (settings.AllKeys.Contains(key))
|
||||
return settings[key].Value;
|
||||
else
|
||||
return defaultValue;
|
||||
}
|
||||
|
||||
//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
|
||||
@@ -77,9 +181,18 @@ namespace DICUI
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MediaType.CD: return preferredDumpSpeedCD;
|
||||
case MediaType.DVD: return preferredDumpSpeedDVD;
|
||||
default: return 8;
|
||||
case MediaType.CDROM:
|
||||
case MediaType.GDROM:
|
||||
return PreferredDumpSpeedCD;
|
||||
case MediaType.DVD:
|
||||
case MediaType.HDDVD:
|
||||
case MediaType.NintendoGameCubeGameDisc:
|
||||
case MediaType.NintendoWiiOpticalDisc:
|
||||
return PreferredDumpSpeedDVD;
|
||||
case MediaType.BluRay:
|
||||
return PreferredDumpSpeedBD;
|
||||
default:
|
||||
return 8;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ using System.Windows;
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("DICUI")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2018")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
@@ -51,8 +51,8 @@ using System.Windows;
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
||||
[assembly: AssemblyVersion("1.15")]
|
||||
[assembly: AssemblyFileVersion("1.15.0.0")]
|
||||
|
||||
// Anything marked as internal can be used by the test methods
|
||||
[assembly: InternalsVisibleTo("DICUI.Test")]
|
||||
@@ -1,573 +0,0 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Windows.Data;
|
||||
using IMAPI2;
|
||||
using DICUI.Data;
|
||||
|
||||
namespace DICUI.Utilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Used to provide a converter to XAML files to render comboboxes with enum values
|
||||
/// </summary>
|
||||
public class EnumDescriptionConverter : IValueConverter
|
||||
{
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is DICCommand)
|
||||
return ((DICCommand)value).Name();
|
||||
else if (value is DICFlag)
|
||||
return ((DICFlag)value).Name();
|
||||
else if (value is MediaType?)
|
||||
return ((MediaType?)value).Name();
|
||||
else if (value is KnownSystem?)
|
||||
return ((KnownSystem?)value).Name();
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
}
|
||||
|
||||
public static class Converters
|
||||
{
|
||||
/// <summary>
|
||||
/// 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.CD;
|
||||
case DICCommand.GDROM:
|
||||
case DICCommand.Swap:
|
||||
return MediaType.GDROM;
|
||||
case DICCommand.DigitalVideoDisc:
|
||||
case DICCommand.XBOX:
|
||||
return MediaType.DVD;
|
||||
case DICCommand.BluRay:
|
||||
return MediaType.BluRay;
|
||||
|
||||
// Non-optical
|
||||
case DICCommand.Floppy:
|
||||
return MediaType.Floppy;
|
||||
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:
|
||||
return KnownSystem.MicrosoftXBOX;
|
||||
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.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.CD;
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDROM:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDRAM:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDPLUSR:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDPLUSRW:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDPLUSR_DUALLAYER:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDDASHR:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDDASHRW:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDDASHR_DUALLAYER:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DISK:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDPLUSRW_DUALLAYER:
|
||||
return MediaType.DVD;
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_HDDVDROM:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_HDDVDR:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_HDDVDRAM:
|
||||
return MediaType.HDDVD;
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_BDROM:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_BDR:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_BDRE:
|
||||
return MediaType.BluRay;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <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.CD:
|
||||
case MediaType.GDROM:
|
||||
case MediaType.Cartridge:
|
||||
return ".bin";
|
||||
case MediaType.DVD:
|
||||
case MediaType.HDDVD:
|
||||
case MediaType.BluRay:
|
||||
case MediaType.WiiOpticalDisc:
|
||||
case MediaType.UMD:
|
||||
return ".iso";
|
||||
case MediaType.LaserDisc:
|
||||
case MediaType.GameCubeGameDisc:
|
||||
return ".raw";
|
||||
case MediaType.WiiUOpticalDisc:
|
||||
return ".wud";
|
||||
case MediaType.Floppy:
|
||||
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)
|
||||
{
|
||||
case MediaType.CD:
|
||||
return "CD-ROM";
|
||||
case MediaType.DVD:
|
||||
return "DVD";
|
||||
case MediaType.GDROM:
|
||||
return "GD-ROM";
|
||||
case MediaType.HDDVD:
|
||||
return "HD-DVD";
|
||||
case MediaType.BluRay:
|
||||
return "BluRay";
|
||||
case MediaType.LaserDisc:
|
||||
return "LaserDisc";
|
||||
|
||||
case MediaType.CED:
|
||||
return "CED";
|
||||
case MediaType.GameCubeGameDisc:
|
||||
return "GameCube Game";
|
||||
case MediaType.WiiOpticalDisc:
|
||||
return "Wii Optical";
|
||||
case MediaType.WiiUOpticalDisc:
|
||||
return "Wii U Optical";
|
||||
case MediaType.UMD:
|
||||
return "UMD";
|
||||
|
||||
case MediaType.Cartridge:
|
||||
return "Cartridge";
|
||||
case MediaType.Cassette:
|
||||
return "Cassette Tape";
|
||||
case MediaType.Floppy:
|
||||
return "Floppy Disk";
|
||||
|
||||
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.MicrosoftXBOX360XDG2:
|
||||
return "Microsoft XBOX 360 (XDG2)";
|
||||
case KnownSystem.MicrosoftXBOX360XDG3:
|
||||
return "Microsoft XBOX 360 (XDG3)";
|
||||
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.SegaSTV:
|
||||
return "Sega STV";
|
||||
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.Custom:
|
||||
return "Custom Input";
|
||||
|
||||
case KnownSystem.NONE:
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,138 +0,0 @@
|
||||
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.CD:
|
||||
case MediaType.DVD:
|
||||
case MediaType.GDROM:
|
||||
case MediaType.HDDVD:
|
||||
case MediaType.GameCubeGameDisc:
|
||||
case MediaType.WiiOpticalDisc:
|
||||
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 bool DoesSupportDriveSpeed(this KnownSystem? system)
|
||||
{
|
||||
switch (system)
|
||||
{
|
||||
case KnownSystem.MicrosoftXBOX:
|
||||
case KnownSystem.MicrosoftXBOX360XDG2:
|
||||
case KnownSystem.MicrosoftXBOX360XDG3:
|
||||
return false;
|
||||
default:
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
public static KnownSystemCategory Category(this KnownSystem? system)
|
||||
{
|
||||
if (system < KnownSystem.MarkerConsoleEnd)
|
||||
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 "";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -1,587 +0,0 @@
|
||||
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.CD);
|
||||
break;
|
||||
case KnownSystem.BandaiApplePippin:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.CommodoreAmigaCD32:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.CommodoreAmigaCDTV:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.MattelHyperscan:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.MicrosoftXBOX:
|
||||
types.Add(MediaType.CD);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.MicrosoftXBOX360XDG2:
|
||||
types.Add(MediaType.CD);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.MicrosoftXBOX360XDG3:
|
||||
types.Add(MediaType.CD);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.MicrosoftXBOXOne:
|
||||
types.Add(MediaType.BluRay);
|
||||
break;
|
||||
case KnownSystem.NECPCEngineTurboGrafxCD:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.NECPCFX:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.NintendoGameCube:
|
||||
types.Add(MediaType.GameCubeGameDisc);
|
||||
break;
|
||||
case KnownSystem.NintendoWii:
|
||||
types.Add(MediaType.WiiOpticalDisc);
|
||||
break;
|
||||
case KnownSystem.NintendoWiiU:
|
||||
types.Add(MediaType.WiiUOpticalDisc);
|
||||
break;
|
||||
case KnownSystem.Panasonic3DOInteractiveMultiplayer:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.PhilipsCDi:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.SegaCDMegaCD:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.SegaDreamcast:
|
||||
types.Add(MediaType.GDROM);
|
||||
break;
|
||||
case KnownSystem.SegaSaturn:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.SNKNeoGeoCD:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation2:
|
||||
types.Add(MediaType.CD);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation3:
|
||||
types.Add(MediaType.BluRay);
|
||||
types.Add(MediaType.CD); // 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.CD);
|
||||
break;
|
||||
case KnownSystem.ZAPiTGamesGameWaveFamilyEntertainmentSystem:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Computers
|
||||
|
||||
case KnownSystem.AcornArchimedes:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.AppleMacintosh:
|
||||
types.Add(MediaType.CD);
|
||||
types.Add(MediaType.DVD);
|
||||
types.Add(MediaType.Floppy);
|
||||
break;
|
||||
case KnownSystem.CommodoreAmigaCD:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.FujitsuFMTowns:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.IBMPCCompatible:
|
||||
types.Add(MediaType.CD);
|
||||
types.Add(MediaType.DVD);
|
||||
types.Add(MediaType.Floppy);
|
||||
break;
|
||||
case KnownSystem.NECPC88:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.NECPC98:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.SharpX68000:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Arcade
|
||||
|
||||
case KnownSystem.AmigaCUBOCD32:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.AmericanLaserGames3DO:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.Atari3DO:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.Atronic:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.AUSCOMSystem1:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.BallyGameMagic:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.CapcomCPSystemIII:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.GlobalVRVarious:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.GlobalVRVortek:
|
||||
types.Add(MediaType.CD);
|
||||
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.CD);
|
||||
break;
|
||||
case KnownSystem.IncredibleTechnologiesVarious:
|
||||
types.Add(MediaType.CD);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.KonamieAmusement:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.KonamiFirebeat:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.KonamiGVSystem:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.KonamiM2:
|
||||
types.Add(MediaType.CD);
|
||||
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.CD);
|
||||
break;
|
||||
case KnownSystem.KonamiTwinkle:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.KonamiVarious:
|
||||
types.Add(MediaType.CD);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.MeritIndustriesBoardwalk:
|
||||
types.Add(MediaType.CD); // TODO: Confirm
|
||||
break;
|
||||
case KnownSystem.MeritIndustriesMegaTouchAurora:
|
||||
types.Add(MediaType.CD); // TODO: Confirm
|
||||
break;
|
||||
case KnownSystem.MeritIndustriesMegaTouchForce:
|
||||
types.Add(MediaType.CD);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.MeritIndustriesMegaTouchION:
|
||||
types.Add(MediaType.CD);
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.MeritIndustriesMegaTouchMaxx:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.MeritIndustriesMegaTouchXL:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.NamcoCapcomSystem256:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.NamcoCapcomTaitoSystem246:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.NamcoSegaNintendoTriforce:
|
||||
types.Add(MediaType.GDROM);
|
||||
break;
|
||||
case KnownSystem.NamcoSystem12:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.NamcoSystem357:
|
||||
types.Add(MediaType.DVD);
|
||||
types.Add(MediaType.BluRay);
|
||||
break;
|
||||
case KnownSystem.NewJatreCDi:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.NichibutsuHighRateSystem:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.NichibutsuSuperCD:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.NichibutsuXRateSystem:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.PhotoPlayVarious:
|
||||
types.Add(MediaType.CD);
|
||||
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.SegaSTV:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.SegaSystem32:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.SeibuCATSSystem:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.TABAustriaQuizard:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.TandyMemorexVisualInformationSystem:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.TsunamiTsuMoMultiGameMotionSystem:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Others
|
||||
|
||||
case KnownSystem.AudioCD:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.BDVideo:
|
||||
types.Add(MediaType.BluRay);
|
||||
break;
|
||||
case KnownSystem.DVDVideo:
|
||||
types.Add(MediaType.DVD);
|
||||
break;
|
||||
case KnownSystem.EnhancedCD:
|
||||
types.Add(MediaType.CD);
|
||||
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.CD);
|
||||
break;
|
||||
case KnownSystem.PhilipsCDiDigitalVideo:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.PhotoCD:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.PlayStationGameSharkUpdates:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.RainbowDisc:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.TaoiKTV:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.TomyKissSite:
|
||||
types.Add(MediaType.CD);
|
||||
break;
|
||||
case KnownSystem.VideoCD:
|
||||
types.Add(MediaType.CD);
|
||||
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 : UIElements.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");
|
||||
// custom system chosen, then don't check anything
|
||||
else if (system == KnownSystem.Custom)
|
||||
return Result.Success("{0} ready to dump", type.Name());
|
||||
|
||||
// If we're on an unsupported type, update the status accordingly
|
||||
switch (type)
|
||||
{
|
||||
// Fully supported types
|
||||
case MediaType.CD:
|
||||
case MediaType.DVD:
|
||||
case MediaType.HDDVD:
|
||||
case MediaType.BluRay:
|
||||
if (system == KnownSystem.MicrosoftXBOX360XDG3)
|
||||
{
|
||||
return Result.Failure("{0} discs are not currently supported by DIC", type.Name());
|
||||
}
|
||||
return Result.Success("{0} ready to dump", type.Name());
|
||||
|
||||
// Partially supported types
|
||||
case MediaType.GDROM:
|
||||
case MediaType.GameCubeGameDisc:
|
||||
case MediaType.WiiOpticalDisc:
|
||||
return Result.Success("{0} discs are partially supported by DIC", type.Name());
|
||||
|
||||
// Undumpable but recognized types
|
||||
case MediaType.LaserDisc:
|
||||
case MediaType.WiiUOpticalDisc:
|
||||
case MediaType.CED:
|
||||
case MediaType.UMD:
|
||||
case MediaType.Cartridge:
|
||||
case MediaType.Cassette:
|
||||
return Result.Failure("{0} discs are not currently supported by DIC", type.Name());
|
||||
|
||||
// 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)
|
||||
{
|
||||
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());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,8 @@
|
||||
using System;
|
||||
using System.Windows.Media;
|
||||
using DICUI.Windows;
|
||||
|
||||
namespace DICUI.UI
|
||||
namespace DICUI
|
||||
{
|
||||
public class OptionsViewModel
|
||||
{
|
||||
@@ -36,6 +37,12 @@ namespace DICUI.UI
|
||||
set { _options.SkipMediaTypeDetection = value; }
|
||||
}
|
||||
|
||||
public bool SkipSystemDetection
|
||||
{
|
||||
get { return _options.SkipSystemDetection; }
|
||||
set { _options.SkipSystemDetection = value; }
|
||||
}
|
||||
|
||||
public string RereadAmountForC2
|
||||
{
|
||||
get { return Convert.ToString(_options.RereadAmountForC2); }
|
||||
156
DICUI/Windows/DiscInformationWindow.xaml
Normal file
156
DICUI/Windows/DiscInformationWindow.xaml
Normal file
@@ -0,0 +1,156 @@
|
||||
<Window x:Class="DICUI.Windows.DiscInformationWindow"
|
||||
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 Information" Height="705" Width="515.132" ResizeMode="NoResize"
|
||||
Closed="OnClosed">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="585"/>
|
||||
<RowDefinition Height="80"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<GroupBox Grid.Row="0" Margin="5,5,5,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Header="Common Disc Information">
|
||||
<Grid Margin="10,15,10,10">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
<RowDefinition Height="25"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Title" />
|
||||
<TextBox x:Name="TitleTextBox" Grid.Row="0" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Foreign Title (Non-Latin)" />
|
||||
<TextBox x:Name="ForeignTitleTextBox" Grid.Row="1" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Disc Number / Letter" />
|
||||
<TextBox x:Name="DiscNumberLetterTextBox" Grid.Row="2" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
|
||||
<Label Grid.Row="3" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Disc Title" />
|
||||
<TextBox x:Name="DiscTitleTextBox" Grid.Row="3" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
|
||||
<Label Grid.Row="4" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Category" />
|
||||
<ComboBox x:Name="CategoryComboBox" Grid.Row="4" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" >
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=Name}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
<Label Grid.Row="5" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Region" />
|
||||
<ComboBox x:Name="RegionComboBox" Grid.Row="5" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" >
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=Name}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
|
||||
<Label Grid.Row="6" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Languages" />
|
||||
<ListBox x:Name="LanguagesComboBox" Grid.Row="6" Grid.Column="1" Height="24" HorizontalAlignment="Stretch" SelectionMode="Multiple">
|
||||
<ListBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<CheckBox IsChecked="{Binding IsChecked}" Content="{Binding Path=Name}" />
|
||||
</DataTemplate>
|
||||
</ListBox.ItemTemplate>
|
||||
</ListBox>
|
||||
|
||||
<Label Grid.Row="7" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Serial" />
|
||||
<TextBox x:Name="SerialTextBox" Grid.Row="7" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
|
||||
<!-- Layer 0 / Data Side -->
|
||||
<Label Grid.Row="8" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Data/L0 Mastering Ring" />
|
||||
<TextBox x:Name="L0MasteringRingTextBox" Grid.Row="8" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" AcceptsTab="True" />
|
||||
|
||||
<Label Grid.Row="9" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Data/L0 Mastering SID" />
|
||||
<TextBox x:Name="L0MasteringSIDTextBox" Grid.Row="9" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
|
||||
<Label Grid.Row="10" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Data/L0 Toolstamp/Mastering Code" />
|
||||
<TextBox x:Name="L0ToolstampTextBox" Grid.Row="10" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
|
||||
<Label Grid.Row="11" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Data/L0 Mould SID" />
|
||||
<TextBox x:Name="L0MouldSIDTextBox" Grid.Row="11" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
|
||||
<Label Grid.Row="12" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Data/L0 Additional Mould" />
|
||||
<TextBox x:Name="L0AdditionalMouldTextBox" Grid.Row="12" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
|
||||
<!-- Layer 1 / Label Side -->
|
||||
<Label Grid.Row="13" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Label/L1 Mastering Ring" />
|
||||
<TextBox x:Name="L1MasteringRingTextBox" Grid.Row="13" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" AcceptsTab="True" />
|
||||
|
||||
<Label Grid.Row="14" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Label/L1 Mastering SID" />
|
||||
<TextBox x:Name="L1MasteringSIDTextBox" Grid.Row="14" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
|
||||
<Label Grid.Row="15" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Label/L1 Toolstamp/Mastering Code" />
|
||||
<TextBox x:Name="L1ToolstampTextBox" Grid.Row="15" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
|
||||
<Label Grid.Row="16" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Label/L1 Mould SID" />
|
||||
<TextBox x:Name="L1MouldSIDTextBox" Grid.Row="16" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
|
||||
<Label Grid.Row="17" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Label/L1 Additional Mould" />
|
||||
<TextBox x:Name="L1AdditionalMouldTextBox" Grid.Row="17" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
|
||||
<Label Grid.Row="18" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Barcode" />
|
||||
<TextBox x:Name="BarcodeTextBox" Grid.Row="18" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
|
||||
<!-- This needs to be a multiline textbox -->
|
||||
<Label Grid.Row="19" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Comments" />
|
||||
<TextBox x:Name="CommentsTextBox" Grid.Row="19" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" AcceptsReturn="True" AcceptsTab="True" />
|
||||
|
||||
<!-- This needs to be a multiline textbox -->
|
||||
<Label Grid.Row="20" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Contents" />
|
||||
<TextBox x:Name="ContentsTextBox" Grid.Row="20" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" AcceptsReturn="True" AcceptsTab="True"/>
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
<GroupBox Grid.Row="1" Margin="5,5,5,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Header="Version and Editions">
|
||||
<Grid Height="60">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="24"/>
|
||||
<RowDefinition Height="24"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Version" />
|
||||
<TextBox x:Name="VersionTextBox" Grid.Row="0" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Edition" />
|
||||
<TextBox x:Name="EditionTextBox" Grid.Row="1" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
</Grid>
|
||||
</Window>
|
||||
163
DICUI/Windows/DiscInformationWindow.xaml.cs
Normal file
163
DICUI/Windows/DiscInformationWindow.xaml.cs
Normal file
@@ -0,0 +1,163 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Windows;
|
||||
using DICUI.Data;
|
||||
|
||||
namespace DICUI.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for DiscInformationWindow.xaml
|
||||
/// </summary>
|
||||
public partial class DiscInformationWindow : Window
|
||||
{
|
||||
private readonly MainWindow _mainWindow;
|
||||
private readonly SubmissionInfo _submissionInfo;
|
||||
|
||||
private List<CategoryComboBoxItem> _categories;
|
||||
private List<RegionComboBoxItem> _regions;
|
||||
private List<LanguageComboBoxItem> _languages;
|
||||
|
||||
public DiscInformationWindow(MainWindow mainWindow, SubmissionInfo submissionInfo)
|
||||
{
|
||||
InitializeComponent();
|
||||
_mainWindow = mainWindow;
|
||||
_submissionInfo = submissionInfo;
|
||||
|
||||
PopulateCategories();
|
||||
PopulateRegions();
|
||||
PopulateLanguages();
|
||||
}
|
||||
|
||||
public void Refresh()
|
||||
{
|
||||
TitleTextBox.Text = _submissionInfo.CommonDiscInfo.Title ?? "";
|
||||
ForeignTitleTextBox.Text = _submissionInfo.CommonDiscInfo.ForeignTitleNonLatin ?? "";
|
||||
DiscNumberLetterTextBox.Text = _submissionInfo.CommonDiscInfo.DiscNumberLetter ?? "";
|
||||
DiscTitleTextBox.Text = _submissionInfo.CommonDiscInfo.DiscTitle ?? "";
|
||||
CategoryComboBox.SelectedIndex = _categories.FindIndex(r => r == _submissionInfo.CommonDiscInfo.Category);
|
||||
RegionComboBox.SelectedIndex = _regions.FindIndex(r => r == _submissionInfo.CommonDiscInfo.Region);
|
||||
if (_submissionInfo.CommonDiscInfo.Languages != null)
|
||||
{
|
||||
foreach (var language in _submissionInfo.CommonDiscInfo.Languages)
|
||||
_languages.Find(l => l == language).IsChecked = true;
|
||||
}
|
||||
SerialTextBox.Text = _submissionInfo.CommonDiscInfo.Serial ?? "";
|
||||
L0MasteringRingTextBox.Text = _submissionInfo.CommonDiscInfo.MasteringRingFirstLayerDataSide ?? "";
|
||||
L0MasteringSIDTextBox.Text = _submissionInfo.CommonDiscInfo.MasteringSIDCodeFirstLayerDataSide ?? "";
|
||||
L0ToolstampTextBox.Text = _submissionInfo.CommonDiscInfo.ToolstampMasteringCodeFirstLayerDataSide ?? "";
|
||||
L0MouldSIDTextBox.Text = _submissionInfo.CommonDiscInfo.MouldSIDCodeFirstLayerDataSide ?? "";
|
||||
L0AdditionalMouldTextBox.Text = _submissionInfo.CommonDiscInfo.AdditionalMouldFirstLayerDataSide ?? "";
|
||||
L1MasteringRingTextBox.Text = _submissionInfo.CommonDiscInfo.MasteringRingSecondLayerLabelSide ?? "";
|
||||
L1MasteringSIDTextBox.Text = _submissionInfo.CommonDiscInfo.MasteringSIDCodeSecondLayerLabelSide ?? "";
|
||||
L1ToolstampTextBox.Text = _submissionInfo.CommonDiscInfo.ToolstampMasteringCodeSecondLayerLabelSide ?? "";
|
||||
L1MouldSIDTextBox.Text = _submissionInfo.CommonDiscInfo.MouldSIDCodeSecondLayerLabelSide ?? "";
|
||||
L1AdditionalMouldTextBox.Text = _submissionInfo.CommonDiscInfo.AdditionalMouldSecondLayerLabelSide ?? "";
|
||||
BarcodeTextBox.Text = _submissionInfo.CommonDiscInfo.Barcode ?? "";
|
||||
CommentsTextBox.Text = _submissionInfo.CommonDiscInfo.Comments ?? "";
|
||||
ContentsTextBox.Text = _submissionInfo.CommonDiscInfo.Contents ?? "";
|
||||
|
||||
VersionTextBox.Text = _submissionInfo.VersionAndEditions.Version ?? "";
|
||||
EditionTextBox.Text = _submissionInfo.VersionAndEditions.OtherEditions ?? "";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a complete list of categories and fill the combo box
|
||||
/// </summary>
|
||||
private void PopulateCategories()
|
||||
{
|
||||
var categories = Enum.GetValues(typeof(Category)).OfType<Category?>().ToList();
|
||||
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Populating categories, {0} categories found.", categories.Count);
|
||||
|
||||
_categories = new List<CategoryComboBoxItem>();
|
||||
foreach (var category in categories)
|
||||
{
|
||||
_categories.Add(new CategoryComboBoxItem(category));
|
||||
}
|
||||
|
||||
CategoryComboBox.ItemsSource = _categories;
|
||||
CategoryComboBox.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a complete list of regions and fill the combo box
|
||||
/// </summary>
|
||||
private void PopulateRegions()
|
||||
{
|
||||
var regions = Enum.GetValues(typeof(Region)).OfType<Region?>().ToList();
|
||||
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Populating regions, {0} regions found.", regions.Count);
|
||||
|
||||
_regions = new List<RegionComboBoxItem>();
|
||||
foreach (var region in regions)
|
||||
{
|
||||
_regions.Add(new RegionComboBoxItem(region));
|
||||
}
|
||||
|
||||
RegionComboBox.ItemsSource = _regions;
|
||||
RegionComboBox.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a complete list of languages and fill the combo box
|
||||
/// </summary>
|
||||
private void PopulateLanguages()
|
||||
{
|
||||
var languages = Enum.GetValues(typeof(Language)).OfType<Language?>().ToList();
|
||||
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Populating languages, {0} languages found.", languages.Count);
|
||||
|
||||
_languages = new List<LanguageComboBoxItem>();
|
||||
foreach (var language in languages)
|
||||
{
|
||||
_languages.Add(new LanguageComboBoxItem(language));
|
||||
}
|
||||
|
||||
LanguagesComboBox.ItemsSource = _languages;
|
||||
LanguagesComboBox.SelectedIndex = 0;
|
||||
}
|
||||
|
||||
#region Event Handlers
|
||||
|
||||
private void OnClosed(object sender, EventArgs e)
|
||||
{
|
||||
_submissionInfo.CommonDiscInfo.Title = TitleTextBox.Text ?? "";
|
||||
_submissionInfo.CommonDiscInfo.ForeignTitleNonLatin = ForeignTitleTextBox.Text ?? "";
|
||||
_submissionInfo.CommonDiscInfo.DiscNumberLetter = DiscNumberLetterTextBox.Text ?? "";
|
||||
_submissionInfo.CommonDiscInfo.DiscTitle = DiscTitleTextBox.Text ?? "";
|
||||
_submissionInfo.CommonDiscInfo.Category = (CategoryComboBox.SelectedItem as CategoryComboBoxItem)?.Value ?? Category.Games;
|
||||
_submissionInfo.CommonDiscInfo.Region = (RegionComboBox.SelectedItem as RegionComboBoxItem)?.Value ?? Region.World;
|
||||
var languages = new List<Language?>();
|
||||
foreach (var language in _languages)
|
||||
{
|
||||
if (language.IsChecked)
|
||||
languages.Add(language.Value);
|
||||
}
|
||||
if (languages.Count == 0)
|
||||
languages.Add(null);
|
||||
_submissionInfo.CommonDiscInfo.Languages = languages.ToArray();
|
||||
_submissionInfo.CommonDiscInfo.Serial = SerialTextBox.Text ?? "";
|
||||
_submissionInfo.CommonDiscInfo.MasteringRingFirstLayerDataSide = L0MasteringRingTextBox.Text ?? "";
|
||||
_submissionInfo.CommonDiscInfo.MasteringSIDCodeFirstLayerDataSide = L0MasteringSIDTextBox.Text ?? "";
|
||||
_submissionInfo.CommonDiscInfo.ToolstampMasteringCodeFirstLayerDataSide = L0ToolstampTextBox.Text ?? "";
|
||||
_submissionInfo.CommonDiscInfo.MouldSIDCodeFirstLayerDataSide = L0MouldSIDTextBox.Text ?? "";
|
||||
_submissionInfo.CommonDiscInfo.AdditionalMouldFirstLayerDataSide = L0AdditionalMouldTextBox.Text ?? "";
|
||||
_submissionInfo.CommonDiscInfo.MasteringRingSecondLayerLabelSide = L1MasteringRingTextBox.Text ?? "";
|
||||
_submissionInfo.CommonDiscInfo.MasteringSIDCodeSecondLayerLabelSide = L1MasteringSIDTextBox.Text ?? "";
|
||||
_submissionInfo.CommonDiscInfo.ToolstampMasteringCodeSecondLayerLabelSide = L1ToolstampTextBox.Text ?? "";
|
||||
_submissionInfo.CommonDiscInfo.MouldSIDCodeSecondLayerLabelSide = L1MouldSIDTextBox.Text ?? "";
|
||||
_submissionInfo.CommonDiscInfo.AdditionalMouldSecondLayerLabelSide = L1AdditionalMouldTextBox.Text ?? "";
|
||||
_submissionInfo.CommonDiscInfo.Barcode = BarcodeTextBox.Text ?? "";
|
||||
_submissionInfo.CommonDiscInfo.Comments = CommentsTextBox.Text ?? "";
|
||||
_submissionInfo.CommonDiscInfo.Contents = ContentsTextBox.Text ?? "";
|
||||
|
||||
_submissionInfo.VersionAndEditions.Version = VersionTextBox.Text ?? "";
|
||||
_submissionInfo.VersionAndEditions.OtherEditions = EditionTextBox.Text ?? "";
|
||||
|
||||
Hide();
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
<Window x:Class="DICUI.LogWindow"
|
||||
<Window x:Class="DICUI.Windows.LogWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:lui="clr-namespace:DICUI.UI"
|
||||
xmlns:local="clr-namespace:DICUI"
|
||||
xmlns:diag="clr-namespace:System.Diagnostics;assembly=WindowsBase"
|
||||
Title="Log Window" Height="350" Width="600" Closed="OnWindowClosed" Loaded="OnWindowLoaded"
|
||||
>
|
||||
@@ -35,12 +35,12 @@
|
||||
|
||||
<CheckBox Content="Verbose" Margin="10 0 0 10" Grid.Column="0" VerticalAlignment="Center"
|
||||
ToolTip="Enable verbose logging of tasks"
|
||||
DataContext="{Binding Source={x:Static lui:ViewModels.OptionsViewModel}}"
|
||||
DataContext="{Binding Source={x:Static local:ViewModels.OptionsViewModel}}"
|
||||
IsChecked="{Binding Path=VerboseLogging}"
|
||||
/>
|
||||
<CheckBox Content="Open at startup" Margin="10 0 0 10" Grid.Column="1" Grid.ColumnSpan="2" VerticalAlignment="Center"
|
||||
ToolTip="Open this window at startup"
|
||||
DataContext="{Binding Source={x:Static lui:ViewModels.OptionsViewModel}}"
|
||||
DataContext="{Binding Source={x:Static local:ViewModels.OptionsViewModel}}"
|
||||
IsChecked="{Binding Path=OpenLogWindowAtStartup}"
|
||||
/>
|
||||
<Button Margin="0 0 10 10" Grid.Column="3" Height="22" Width="60" Content="Clear" HorizontalAlignment="Right" Click="OnClearButton" />
|
||||
@@ -11,10 +11,8 @@ using System.Windows.Controls;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Interop;
|
||||
using System.Windows.Media;
|
||||
using DICUI.Data;
|
||||
using DICUI.UI;
|
||||
|
||||
namespace DICUI
|
||||
namespace DICUI.Windows
|
||||
{
|
||||
public partial class LogWindow : Window
|
||||
{
|
||||
@@ -131,7 +129,7 @@ namespace DICUI
|
||||
public void AdjustPositionToMainWindow()
|
||||
{
|
||||
this.Left = _mainWindow.Left;
|
||||
this.Top = _mainWindow.Top + _mainWindow.Height + UIElements.LogWindowMarginFromMainWindow;
|
||||
this.Top = _mainWindow.Top + _mainWindow.Height + Constants.LogWindowMarginFromMainWindow;
|
||||
}
|
||||
|
||||
private void GracefullyTerminateProcess()
|
||||
@@ -194,12 +192,12 @@ namespace DICUI
|
||||
// this is used to optimize the work since we need to process A LOT of text
|
||||
struct Matcher
|
||||
{
|
||||
private readonly String prefix;
|
||||
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)
|
||||
public Matcher(string prefix, string regex, Action<Match> lambda)
|
||||
{
|
||||
this.prefix = prefix;
|
||||
this.regex = new Regex(regex);
|
||||
@@ -1,17 +1,15 @@
|
||||
<Window x:Class="DICUI.MainWindow"
|
||||
<Window x:Class="DICUI.Windows.MainWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:DICUI"
|
||||
xmlns:lui="clr-namespace:DICUI.UI"
|
||||
xmlns:utilities="clr-namespace:DICUI.Utilities"
|
||||
mc:Ignorable="d"
|
||||
Title="Disc Image Creator GUI" Height="450" Width="600" WindowStartupLocation="CenterScreen" ResizeMode="CanMinimize"
|
||||
LocationChanged="MainWindowLocationChanged" Activated="MainWindowActivated" Closing="MainWindowClosing">
|
||||
|
||||
<Window.Resources>
|
||||
<utilities:EnumDescriptionConverter x:Key="enumConverter" />
|
||||
<local:EnumDescriptionConverter x:Key="enumConverter" />
|
||||
</Window.Resources>
|
||||
|
||||
<Grid>
|
||||
@@ -34,7 +32,7 @@
|
||||
<MenuItem Header="_Tools">
|
||||
<MenuItem x:Name="OptionsMenuItem" Header="_Options" HorizontalAlignment="Left" Width="140" Click="OptionsClick"/>
|
||||
<MenuItem x:Name="ShowLogMenuItem" Header="Show _Log Window" IsCheckable="true" HorizontalAlignment="Left"
|
||||
DataContext="{Binding Source={x:Static lui:ViewModels.LoggerViewModel}}"
|
||||
DataContext="{Binding Source={x:Static local:ViewModels.LoggerViewModel}}"
|
||||
IsChecked="{Binding Path=WindowVisible}"
|
||||
/>
|
||||
</MenuItem>
|
||||
@@ -62,14 +60,14 @@
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" Content="System/Media Type" />
|
||||
<ComboBox x:Name="SystemTypeComboBox" Grid.Row="0" Grid.Column="1" Height="22" Width="250" HorizontalAlignment="left" SelectionChanged="SystemTypeComboBoxSelectionChanged">
|
||||
<ComboBox x:Name="SystemTypeComboBox" Grid.Row="0" Grid.Column="1" Height="22" Width="250" HorizontalAlignment="Left" SelectionChanged="SystemTypeComboBoxSelectionChanged">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=Name}" Foreground="{Binding Path=Foreground}" />
|
||||
</DataTemplate>
|
||||
</ComboBox.ItemTemplate>
|
||||
</ComboBox>
|
||||
<ComboBox x:Name="MediaTypeComboBox" Grid.Row="0" Grid.Column="1" Height="22" Width="140" HorizontalAlignment="right" SelectionChanged="MediaTypeComboBoxSelectionChanged">
|
||||
<ComboBox x:Name="MediaTypeComboBox" Grid.Row="0" Grid.Column="1" Height="22" Width="140" HorizontalAlignment="Right" SelectionChanged="MediaTypeComboBoxSelectionChanged">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Converter={StaticResource enumConverter}}" />
|
||||
@@ -81,11 +79,11 @@
|
||||
<TextBox x:Name="OutputFilenameTextBox" Grid.Row="1" Grid.Column="1" Height="22" TextChanged="OutputFilenameTextBoxTextChanged" />
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="0" VerticalAlignment="Center">Output Directory</Label>
|
||||
<TextBox x:Name="OutputDirectoryTextBox" Grid.Row="2" Grid.Column="1" Height="22" Width="345" HorizontalAlignment="left" TextChanged="OutputDirectoryTextBoxTextChanged" />
|
||||
<TextBox x:Name="OutputDirectoryTextBox" Grid.Row="2" Grid.Column="1" Height="22" Width="345" HorizontalAlignment="Left" TextChanged="OutputDirectoryTextBoxTextChanged" />
|
||||
<Button x:Name="OutputDirectoryBrowseButton" Grid.Row="2" Grid.Column="1" Height="22" Width="50" HorizontalAlignment="Right" Content="Browse" Click="OutputDirectoryBrowseButtonClick"/>
|
||||
|
||||
<Label Grid.Row="3" Grid.Column="0" VerticalAlignment="Center">Drive Letter</Label>
|
||||
<ComboBox x:Name="DriveLetterComboBox" Grid.Row="3" Grid.Column="1" Height="22" Width="60" HorizontalAlignment="left" SelectionChanged="DriveLetterComboBoxSelectionChanged">
|
||||
<ComboBox x:Name="DriveLetterComboBox" Grid.Row="3" Grid.Column="1" Height="22" Width="60" HorizontalAlignment="Left" SelectionChanged="DriveLetterComboBoxSelectionChanged">
|
||||
<ComboBox.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<TextBlock Text="{Binding Path=Letter}" />
|
||||
@@ -94,10 +92,11 @@
|
||||
</ComboBox>
|
||||
|
||||
<Label Grid.Row="4" Grid.Column="0" VerticalAlignment="Center">Drive Speed</Label>
|
||||
<ComboBox x:Name="DriveSpeedComboBox" Grid.Row="4" Grid.Column="1" Height="22" Width="60" HorizontalAlignment="left" SelectionChanged="DriveSpeedComboBoxSelectionChanged" />
|
||||
<ComboBox x:Name="DriveSpeedComboBox" Grid.Row="4" Grid.Column="1" Height="22" Width="60" HorizontalAlignment="Left" SelectionChanged="DriveSpeedComboBoxSelectionChanged" />
|
||||
|
||||
<Label Grid.Row="5" Grid.Column="0" VerticalAlignment="Center">Parameters</Label>
|
||||
<TextBox x:Name="ParametersTextBox" Grid.Row="5" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" IsEnabled="False" />
|
||||
<TextBox x:Name="ParametersTextBox" Grid.Row="5" Grid.Column="1" Height="22" Width="370" HorizontalAlignment="Left" IsEnabled="False" />
|
||||
<CheckBox x:Name="EnableParametersCheckBox" Grid.Row="5" Grid.Column="1" Height="22" HorizontalAlignment="Right" IsChecked="False" Click="EnableParametersCheckBoxClick" />
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="2" Grid.Column="0" Margin="15,19.6,15.2,9.8" Grid.ColumnSpan="2">
|
||||
@@ -125,7 +124,7 @@
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label x:Name="StatusLabel" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Waiting for CD or DVD..." />
|
||||
<Label x:Name="StatusLabel" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Waiting for media..." />
|
||||
</Grid>
|
||||
</Grid>
|
||||
</Window>
|
||||
@@ -3,22 +3,21 @@ using System.Collections.Generic;
|
||||
using System.Drawing;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using WinForms = System.Windows.Forms;
|
||||
using DICUI.Data;
|
||||
using DICUI.Utilities;
|
||||
using DICUI.UI;
|
||||
|
||||
namespace DICUI
|
||||
namespace DICUI.Windows
|
||||
{
|
||||
|
||||
public partial class MainWindow : Window
|
||||
{
|
||||
// Private UI-related variables
|
||||
private List<Drive> _drives;
|
||||
private MediaType? _currentMediaType;
|
||||
private List<KnownSystem?> _systems;
|
||||
private List<KnownSystemComboBoxItem> _systems;
|
||||
private List<MediaType?> _mediaTypes;
|
||||
private bool _alreadyShown;
|
||||
|
||||
@@ -28,6 +27,9 @@ namespace DICUI
|
||||
private Options _options;
|
||||
private OptionsWindow _optionsWindow;
|
||||
|
||||
// User input related
|
||||
private DiscInformationWindow _discInformationWindow;
|
||||
|
||||
private LogWindow _logWindow;
|
||||
|
||||
public MainWindow()
|
||||
@@ -50,7 +52,7 @@ namespace DICUI
|
||||
if (_options.OpenLogWindowAtStartup)
|
||||
{
|
||||
this.WindowStartupLocation = WindowStartupLocation.Manual;
|
||||
double combinedHeight = this.Height + _logWindow.Height + UIElements.LogWindowMarginFromMainWindow;
|
||||
double combinedHeight = this.Height + _logWindow.Height + Constants.LogWindowMarginFromMainWindow;
|
||||
Rectangle bounds = GetScaledCoordinates(WinForms.Screen.PrimaryScreen.WorkingArea);
|
||||
|
||||
this.Left = bounds.Left + (bounds.Width - this.Width) / 2;
|
||||
@@ -89,17 +91,21 @@ namespace DICUI
|
||||
private void StartStopButtonClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
// Dump or stop the dump
|
||||
if ((string)StartStopButton.Content == UIElements.StartDumping)
|
||||
if ((string)StartStopButton.Content == Constants.StartDumping)
|
||||
{
|
||||
StartDumping();
|
||||
}
|
||||
else if ((string)StartStopButton.Content == UIElements.StopDumping)
|
||||
else if ((string)StartStopButton.Content == Constants.StopDumping)
|
||||
{
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Canceling dumping process...");
|
||||
_env.CancelDumping();
|
||||
CopyProtectScanButton.IsEnabled = true;
|
||||
|
||||
if (EjectWhenDoneCheckBox.IsChecked == true)
|
||||
{
|
||||
ViewModels.LoggerViewModel.VerboseLogLn($"Ejecting disc in drive {_env.Drive.Letter}");
|
||||
_env.EjectDisc();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -130,6 +136,7 @@ namespace DICUI
|
||||
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Changed system to: {0}", (SystemTypeComboBox.SelectedItem as KnownSystemComboBoxItem).Name);
|
||||
PopulateMediaType();
|
||||
GetOutputNames(false);
|
||||
EnsureDiscInformation();
|
||||
}
|
||||
|
||||
@@ -142,7 +149,7 @@ namespace DICUI
|
||||
SetSupportedDriveSpeed();
|
||||
}
|
||||
|
||||
GetOutputNames();
|
||||
GetOutputNames(false);
|
||||
EnsureDiscInformation();
|
||||
}
|
||||
|
||||
@@ -150,7 +157,7 @@ namespace DICUI
|
||||
{
|
||||
CacheCurrentDiscType();
|
||||
SetCurrentDiscType();
|
||||
GetOutputNames();
|
||||
GetOutputNames(true);
|
||||
SetSupportedDriveSpeed();
|
||||
}
|
||||
|
||||
@@ -196,6 +203,17 @@ namespace DICUI
|
||||
_logWindow.Close();
|
||||
}
|
||||
|
||||
private void EnableParametersCheckBoxClick(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (EnableParametersCheckBox.IsChecked == true)
|
||||
ParametersTextBox.IsEnabled = true;
|
||||
else
|
||||
{
|
||||
ParametersTextBox.IsEnabled = false;
|
||||
ProcessCustomParameters();
|
||||
}
|
||||
}
|
||||
|
||||
// Toolbar Events
|
||||
|
||||
private void AppExitClick(object sender, RoutedEventArgs e)
|
||||
@@ -232,7 +250,7 @@ namespace DICUI
|
||||
|
||||
public void OnOptionsUpdated()
|
||||
{
|
||||
GetOutputNames();
|
||||
GetOutputNames(false);
|
||||
SetSupportedDriveSpeed();
|
||||
EnsureDiscInformation();
|
||||
}
|
||||
@@ -250,7 +268,7 @@ namespace DICUI
|
||||
|
||||
if (currentSystem != null)
|
||||
{
|
||||
_mediaTypes = Validators.GetValidMediaTypes(currentSystem).ToList();
|
||||
_mediaTypes = Validators.GetValidMediaTypes(currentSystem);
|
||||
MediaTypeComboBox.ItemsSource = _mediaTypes;
|
||||
|
||||
MediaTypeComboBox.IsEnabled = _mediaTypes.Count > 1;
|
||||
@@ -269,30 +287,29 @@ namespace DICUI
|
||||
/// </summary>
|
||||
private void PopulateSystems()
|
||||
{
|
||||
_systems = Validators.CreateListOfSystems();
|
||||
var knownSystems = Validators.CreateListOfSystems();
|
||||
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Populating systems, {0} systems found.", _systems.Count);
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Populating systems, {0} systems found.", knownSystems.Count);
|
||||
|
||||
Dictionary<KnownSystemCategory, List<KnownSystem?>> mapping = _systems
|
||||
Dictionary<KnownSystemCategory, List<KnownSystem?>> mapping = knownSystems
|
||||
.GroupBy(s => s.Category())
|
||||
.ToDictionary(
|
||||
k => k.Key,
|
||||
v => v
|
||||
.OrderBy(s => s.Name())
|
||||
.OrderBy(s => s.LongName())
|
||||
.ToList()
|
||||
);
|
||||
|
||||
List<KnownSystemComboBoxItem> comboBoxItems = new List<KnownSystemComboBoxItem>();
|
||||
|
||||
comboBoxItems.Add(new KnownSystemComboBoxItem(KnownSystem.NONE));
|
||||
_systems = new List<KnownSystemComboBoxItem>();
|
||||
_systems.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)));
|
||||
_systems.Add(new KnownSystemComboBoxItem(group.Key));
|
||||
group.Value.ForEach(system => _systems.Add(new KnownSystemComboBoxItem(system)));
|
||||
}
|
||||
|
||||
SystemTypeComboBox.ItemsSource = comboBoxItems;
|
||||
SystemTypeComboBox.ItemsSource = _systems;
|
||||
SystemTypeComboBox.SelectedIndex = 0;
|
||||
|
||||
StartStopButton.IsEnabled = false;
|
||||
@@ -315,13 +332,40 @@ namespace DICUI
|
||||
|
||||
if (DriveLetterComboBox.Items.Count > 0)
|
||||
{
|
||||
int index = _drives.FindIndex(d => d.MarkedActive);
|
||||
// Check for active optical drives first
|
||||
int index = _drives.FindIndex(d => d.MarkedActive && d.InternalDriveType == InternalDriveType.Optical);
|
||||
|
||||
// Then we check for floppy drives
|
||||
if (index == -1)
|
||||
index = _drives.FindIndex(d => d.MarkedActive && d.InternalDriveType == InternalDriveType.Floppy);
|
||||
|
||||
// Then we try all other drive types
|
||||
if (index == -1)
|
||||
index = _drives.FindIndex(d => d.MarkedActive);
|
||||
|
||||
// Set the selected index
|
||||
DriveLetterComboBox.SelectedIndex = (index != -1 ? index : 0);
|
||||
StatusLabel.Content = "Valid drive found! Choose your Media Type";
|
||||
StartStopButton.IsEnabled = true;
|
||||
CopyProtectScanButton.IsEnabled = true;
|
||||
CopyProtectScanButton.IsEnabled = true;
|
||||
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Found {0} drives: {1}", _drives.Count, String.Join(", ", _drives.Select(d => d.Letter)));
|
||||
// Get the current media type
|
||||
if (!_options.SkipSystemDetection && index != -1)
|
||||
{
|
||||
ViewModels.LoggerViewModel.VerboseLog("Trying to detect system for drive {0}.. ", _drives[index].Letter);
|
||||
var currentSystem = Validators.GetKnownSystem(_drives[index]);
|
||||
ViewModels.LoggerViewModel.VerboseLogLn(currentSystem == null || currentSystem == KnownSystem.NONE ? "unable to detect." : ("detected " + currentSystem.LongName() + "."));
|
||||
|
||||
if (currentSystem != null && currentSystem != KnownSystem.NONE)
|
||||
{
|
||||
int sysIndex = _systems.FindIndex(s => s == currentSystem);
|
||||
SystemTypeComboBox.SelectedIndex = sysIndex;
|
||||
}
|
||||
}
|
||||
|
||||
// Only enable the start/stop if we don't have the default selected
|
||||
StartStopButton.IsEnabled = (SystemTypeComboBox.SelectedItem as KnownSystemComboBoxItem) != KnownSystem.NONE;
|
||||
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Found {0} drives: {1}", _drives.Count, string.Join(", ", _drives.Select(d => d.Letter)));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -354,7 +398,8 @@ namespace DICUI
|
||||
/// <returns>Filled DumpEnvironment instance</returns>
|
||||
private DumpEnvironment DetermineEnvironment()
|
||||
{
|
||||
return new DumpEnvironment()
|
||||
// Populate the new environment
|
||||
var env = new DumpEnvironment()
|
||||
{
|
||||
// Paths to tools
|
||||
SubdumpPath = _options.SubDumpPath,
|
||||
@@ -372,10 +417,30 @@ namespace DICUI
|
||||
ParanoidMode = _options.ParanoidMode,
|
||||
ScanForProtection = _options.ScanForProtection,
|
||||
RereadAmountC2 = _options.RereadAmountForC2,
|
||||
AddPlaceholders = _options.AddPlaceholders,
|
||||
PromptForDiscInformation = _options.PromptForDiscInformation,
|
||||
|
||||
Username = _options.Username,
|
||||
Password = _options.Password,
|
||||
|
||||
System = SystemTypeComboBox.SelectedItem as KnownSystemComboBoxItem,
|
||||
Type = MediaTypeComboBox.SelectedItem as MediaType?
|
||||
Type = MediaTypeComboBox.SelectedItem as MediaType?,
|
||||
};
|
||||
|
||||
// Fix the output paths
|
||||
env.FixOutputPaths();
|
||||
|
||||
// Disable automatic reprocessing of the textboxes until we're done
|
||||
OutputDirectoryTextBox.TextChanged -= OutputDirectoryTextBoxTextChanged;
|
||||
OutputFilenameTextBox.TextChanged -= OutputFilenameTextBoxTextChanged;
|
||||
|
||||
OutputDirectoryTextBox.Text = env.OutputDirectory;
|
||||
OutputFilenameTextBox.Text = env.OutputFilename;
|
||||
|
||||
OutputDirectoryTextBox.TextChanged += OutputDirectoryTextBoxTextChanged;
|
||||
OutputFilenameTextBox.TextChanged += OutputFilenameTextBoxTextChanged;
|
||||
|
||||
return env;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -383,29 +448,107 @@ namespace DICUI
|
||||
/// </summary>
|
||||
private async void StartDumping()
|
||||
{
|
||||
_env = DetermineEnvironment();
|
||||
if (_env == null)
|
||||
_env = DetermineEnvironment();
|
||||
|
||||
// Check for the firmware first
|
||||
// TODO: Remove this (and method) once DIC end-to-end logging becomes a thing
|
||||
if (!await _env.DriveHasLatestFimrware())
|
||||
return;
|
||||
// If still in custom parameter mode, check that users meant to continue or not
|
||||
if (EnableParametersCheckBox.IsChecked == true)
|
||||
{
|
||||
MessageBoxResult result = MessageBox.Show("It looks like you have custom parameters that have not been saved. Would you like to apply those changes before starting to dump?", "Custom Changes", MessageBoxButton.YesNoCancel, MessageBoxImage.Question);
|
||||
if (result == MessageBoxResult.Yes)
|
||||
{
|
||||
EnableParametersCheckBox.IsChecked = false;
|
||||
ParametersTextBox.IsEnabled = false;
|
||||
ProcessCustomParameters();
|
||||
}
|
||||
else if (result == MessageBoxResult.Cancel)
|
||||
return;
|
||||
// If "No", then we continue with the current known environment
|
||||
}
|
||||
|
||||
StartStopButton.Content = UIElements.StopDumping;
|
||||
CopyProtectScanButton.IsEnabled = false;
|
||||
StatusLabel.Content = "Beginning dumping process";
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Starting dumping process..");
|
||||
try
|
||||
{
|
||||
// Check for the firmware first
|
||||
// TODO: Remove this (and method) once DIC end-to-end logging becomes a thing
|
||||
if (!await _env.DriveHasLatestFimrware())
|
||||
{
|
||||
MessageBox.Show($"DiscImageCreator has reported that drive {_env.Drive.Letter} is not updated to the most recent firmware. Please update the firmware for your drive and try again.", "Outdated Firmware", MessageBoxButton.OK, MessageBoxImage.Error);
|
||||
return;
|
||||
}
|
||||
|
||||
var progress = new Progress<Result>();
|
||||
progress.ProgressChanged += ProgressUpdated;
|
||||
Result result = await _env.StartDumping(progress);
|
||||
// Validate that the user explicitly wants an inactive drive to be considered for dumping
|
||||
if (!_env.Drive.MarkedActive)
|
||||
{
|
||||
MessageBoxResult mbresult = MessageBox.Show("The currently selected drive does not appear to contain a disc! Are you sure you want to continue?", "Missing Disc", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
|
||||
if (mbresult == MessageBoxResult.No || mbresult == MessageBoxResult.Cancel || mbresult == MessageBoxResult.None)
|
||||
{
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Dumping aborted!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
StatusLabel.Content = result ? "Dumping complete!" : result.Message;
|
||||
ViewModels.LoggerViewModel.VerboseLogLn(result ? "Dumping complete!" : result.Message);
|
||||
StartStopButton.Content = UIElements.StartDumping;
|
||||
CopyProtectScanButton.IsEnabled = true;
|
||||
// If a complete dump already exists
|
||||
if (_env.FoundAllFiles())
|
||||
{
|
||||
MessageBoxResult mbresult = MessageBox.Show("A complete dump already exists! Are you sure you want to overwrite?", "Overwrite?", MessageBoxButton.YesNo, MessageBoxImage.Exclamation);
|
||||
if (mbresult == MessageBoxResult.No || mbresult == MessageBoxResult.Cancel || mbresult == MessageBoxResult.None)
|
||||
{
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Dumping aborted!");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
StartStopButton.Content = Constants.StopDumping;
|
||||
CopyProtectScanButton.IsEnabled = false;
|
||||
StatusLabel.Content = "Beginning dumping process";
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Starting dumping process..");
|
||||
|
||||
var progress = new Progress<Result>();
|
||||
progress.ProgressChanged += ProgressUpdated;
|
||||
Result result = await _env.StartDumping(progress);
|
||||
|
||||
if (result)
|
||||
{
|
||||
// Verify dump output and save it
|
||||
result = _env.VerifyAndSaveDumpOutput(progress,
|
||||
(si) =>
|
||||
{
|
||||
// lazy initialization
|
||||
if (_discInformationWindow == null)
|
||||
{
|
||||
_discInformationWindow = new DiscInformationWindow(this, si);
|
||||
_discInformationWindow.Closed += delegate
|
||||
{
|
||||
_discInformationWindow = null;
|
||||
};
|
||||
}
|
||||
|
||||
_discInformationWindow.Owner = this;
|
||||
_discInformationWindow.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
||||
_discInformationWindow.Refresh();
|
||||
return _discInformationWindow.ShowDialog();
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
StatusLabel.Content = result ? "Dumping complete!" : result.Message;
|
||||
ViewModels.LoggerViewModel.VerboseLogLn(result ? "Dumping complete!" : result.Message);
|
||||
}
|
||||
catch
|
||||
{
|
||||
// No-op, we don't care what it was
|
||||
}
|
||||
finally
|
||||
{
|
||||
StartStopButton.Content = Constants.StartDumping;
|
||||
CopyProtectScanButton.IsEnabled = true;
|
||||
}
|
||||
|
||||
if (EjectWhenDoneCheckBox.IsChecked == true)
|
||||
{
|
||||
ViewModels.LoggerViewModel.VerboseLogLn($"Ejecting disc in drive {_env.Drive.Letter}");
|
||||
_env.EjectDisc();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -432,29 +575,11 @@ namespace DICUI
|
||||
StartStopButton.IsEnabled = result && (_drives != null && _drives.Count > 0 ? true : false);
|
||||
|
||||
// If we're in a type that doesn't support drive speeds
|
||||
DriveSpeedComboBox.IsEnabled = _env.Type.DoesSupportDriveSpeed() && _env.System.DoesSupportDriveSpeed();
|
||||
DriveSpeedComboBox.IsEnabled = _env.Type.DoesSupportDriveSpeed();
|
||||
|
||||
// Special case for Custom input
|
||||
if (_env.System == KnownSystem.Custom)
|
||||
// If input params are not enabled, generate the full parameters from the environment
|
||||
if (!ParametersTextBox.IsEnabled)
|
||||
{
|
||||
ParametersTextBox.IsEnabled = true;
|
||||
OutputFilenameTextBox.IsEnabled = false;
|
||||
OutputDirectoryTextBox.IsEnabled = false;
|
||||
OutputDirectoryBrowseButton.IsEnabled = false;
|
||||
DriveLetterComboBox.IsEnabled = false;
|
||||
DriveSpeedComboBox.IsEnabled = false;
|
||||
StartStopButton.IsEnabled = (_drives.Count > 0 ? true : false);
|
||||
StatusLabel.Content = "User input mode";
|
||||
}
|
||||
else
|
||||
{
|
||||
ParametersTextBox.IsEnabled = false;
|
||||
OutputFilenameTextBox.IsEnabled = true;
|
||||
OutputDirectoryTextBox.IsEnabled = true;
|
||||
OutputDirectoryBrowseButton.IsEnabled = true;
|
||||
DriveLetterComboBox.IsEnabled = true;
|
||||
|
||||
// Generate the full parameters from the environment
|
||||
string generated = _env.GetFullParameters((int?)DriveSpeedComboBox.SelectedItem);
|
||||
if (generated != null)
|
||||
ParametersTextBox.Text = generated;
|
||||
@@ -464,14 +589,24 @@ namespace DICUI
|
||||
/// <summary>
|
||||
/// Get the default output directory name from the currently selected drive
|
||||
/// </summary>
|
||||
private void GetOutputNames()
|
||||
/// <param name="driveChanged">Force an updated name if the drive letter changes</param>
|
||||
private void GetOutputNames(bool driveChanged)
|
||||
{
|
||||
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");
|
||||
// Set the output directory, if we changed drives or it's not already
|
||||
if (driveChanged || string.IsNullOrEmpty(OutputDirectoryTextBox.Text))
|
||||
OutputDirectoryTextBox.Text = Path.Combine(_options.DefaultOutputPath, drive?.VolumeLabel ?? string.Empty);
|
||||
|
||||
// Set the output filename, if we changed drives or it's not already
|
||||
if (driveChanged || string.IsNullOrEmpty(OutputFilenameTextBox.Text))
|
||||
OutputFilenameTextBox.Text = (drive?.VolumeLabel ?? systemType.LongName()) + (mediaType.Extension() ?? ".bin");
|
||||
|
||||
// If the extension for the file changed, update that automatically
|
||||
else if (Path.GetExtension(OutputFilenameTextBox.Text) != mediaType.Extension())
|
||||
OutputFilenameTextBox.Text = Path.GetFileNameWithoutExtension(OutputFilenameTextBox.Text) + (mediaType.Extension() ?? ".bin");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -479,8 +614,10 @@ namespace DICUI
|
||||
/// </summary>
|
||||
private async void ScanAndShowProtection()
|
||||
{
|
||||
var env = DetermineEnvironment();
|
||||
if (env.Drive.Letter != default(char))
|
||||
if (_env == null)
|
||||
_env = DetermineEnvironment();
|
||||
|
||||
if (_env.Drive.Letter != default(char))
|
||||
{
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Scanning for copy protection in {0}", _env.Drive.Letter);
|
||||
|
||||
@@ -490,10 +627,10 @@ namespace DICUI
|
||||
DiskScanButton.IsEnabled = false;
|
||||
CopyProtectScanButton.IsEnabled = false;
|
||||
|
||||
string protections = await Validators.RunProtectionScanOnPath(env.Drive.Letter + ":\\");
|
||||
string protections = await Validators.RunProtectionScanOnPath(_env.Drive.Letter + ":\\");
|
||||
if (!ViewModels.LoggerViewModel.WindowVisible)
|
||||
MessageBox.Show(protections, "Detected Protection", MessageBoxButton.OK, MessageBoxImage.Information);
|
||||
ViewModels.LoggerViewModel.VerboseLog("Detected the following protections in {0}:\r\n\r\n{1}", env.Drive.Letter, protections);
|
||||
ViewModels.LoggerViewModel.VerboseLog("Detected the following protections in {0}:\r\n\r\n{1}", _env.Drive.Letter, protections);
|
||||
|
||||
StatusLabel.Content = tempContent;
|
||||
StartStopButton.IsEnabled = true;
|
||||
@@ -508,14 +645,37 @@ namespace DICUI
|
||||
private void SetSupportedDriveSpeed()
|
||||
{
|
||||
// Set the drive speed list that's appropriate
|
||||
var values = AllowedSpeeds.GetForMediaType(_currentMediaType);
|
||||
var values = Constants.GetSpeedsForMediaType(_currentMediaType);
|
||||
DriveSpeedComboBox.ItemsSource = values;
|
||||
ViewModels.LoggerViewModel.VerboseLogLn("Supported media speeds: {0}", string.Join(",", values));
|
||||
|
||||
// Find the minimum set to compare against
|
||||
int preferred = 100;
|
||||
switch (_currentMediaType)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
case MediaType.GDROM:
|
||||
preferred = _options.PreferredDumpSpeedCD;
|
||||
break;
|
||||
case MediaType.DVD:
|
||||
case MediaType.HDDVD:
|
||||
case MediaType.NintendoGameCubeGameDisc:
|
||||
case MediaType.NintendoWiiOpticalDisc:
|
||||
preferred = _options.PreferredDumpSpeedDVD;
|
||||
break;
|
||||
case MediaType.BluRay:
|
||||
preferred = _options.PreferredDumpSpeedBD;
|
||||
break;
|
||||
default:
|
||||
preferred = _options.PreferredDumpSpeedCD;
|
||||
break;
|
||||
}
|
||||
|
||||
// Choose the lower of the two speeds between the allowed speeds and the user-defined one
|
||||
// TODO: Inform more users about setting preferences in the settings so this comparison doesn't need to happen
|
||||
int chosenSpeed = Math.Min(
|
||||
values.Where(s => s <= values[values.Count / 2]).Last(),
|
||||
_options.preferredDumpSpeedCD
|
||||
preferred
|
||||
);
|
||||
|
||||
// Set the selected speed
|
||||
@@ -530,15 +690,15 @@ namespace DICUI
|
||||
{
|
||||
// Get the drive letter from the selected item
|
||||
Drive drive = DriveLetterComboBox.SelectedItem as Drive;
|
||||
if (drive == null || drive.IsFloppy)
|
||||
if (drive == null)
|
||||
return;
|
||||
|
||||
// Get the current optical disc type
|
||||
// Get the current media 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() + "."));
|
||||
_currentMediaType = Validators.GetMediaType(drive);
|
||||
ViewModels.LoggerViewModel.VerboseLogLn(_currentMediaType == null ? "unable to detect." : ("detected " + _currentMediaType.LongName() + "."));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -556,7 +716,42 @@ namespace DICUI
|
||||
if (index != -1)
|
||||
MediaTypeComboBox.SelectedIndex = index;
|
||||
else
|
||||
StatusLabel.Content = $"Disc of type '{Converters.MediaTypeToString(_currentMediaType)}' found, but the current system does not support it!";
|
||||
StatusLabel.Content = $"Disc of type '{Converters.LongName(_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 = _env.DICParameters.Command.ToMediaType();
|
||||
int mediaTypeIndex = _mediaTypes.IndexOf(mediaType);
|
||||
if (mediaTypeIndex > -1)
|
||||
MediaTypeComboBox.SelectedIndex = mediaTypeIndex;
|
||||
}
|
||||
|
||||
#endregion
|
||||
@@ -1,18 +1,18 @@
|
||||
<Window x:Class="DICUI.OptionsWindow"
|
||||
<Window x:Class="DICUI.Windows.OptionsWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:lui="clr-namespace:DICUI.UI"
|
||||
xmlns:l="clr-namespace:DICUI"
|
||||
xmlns:local="clr-namespace:DICUI"
|
||||
mc:Ignorable="d"
|
||||
Title="Options" Height="400" Width="515.132">
|
||||
Title="Options" Height="580" Width="515.132">
|
||||
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="150"/>
|
||||
<RowDefinition Height="100"/>
|
||||
<RowDefinition Height="100"/>
|
||||
<RowDefinition Height="80"/>
|
||||
<RowDefinition Height="40"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="DicImageCreator Path" />
|
||||
<Label Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="DiscImageCreator 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" />
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
</Grid>
|
||||
|
||||
<GroupBox Grid.Row="1" Margin="5,5,5,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Header="Preferred Dump Speed">
|
||||
<Grid Height="60">
|
||||
<Grid Height="100">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="80"/>
|
||||
<ColumnDefinition Width="2.0*"/>
|
||||
@@ -55,16 +55,21 @@
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" Content="CD-ROM" />
|
||||
<Slider x:Name="DumpSpeedCDSlider" Grid.Row="0" Grid.Column="1" Minimum="1" Maximum="72" IsSnapToTickEnabled="True" TickPlacement="BottomRight" Ticks="{Binding Source={x:Static lui:AllowedSpeeds.ForCDAsCollection}}" />
|
||||
<Slider x:Name="DumpSpeedCDSlider" Grid.Row="0" Grid.Column="1" Minimum="1" Maximum="72" IsSnapToTickEnabled="True" TickPlacement="BottomRight" Ticks="{Binding Source={x:Static local:Constants.SpeedsForCDAsCollection}}" />
|
||||
<TextBox x:Name="DumpSpeedCDTextBox" Grid.Row="0" Grid.Column="2" Width="22" Height="22" TextAlignment="Center" IsReadOnly="True" IsReadOnlyCaretVisible="False" VerticalAlignment="Center" Text="{Binding ElementName=DumpSpeedCDSlider, Path=Value, UpdateSourceTrigger=PropertyChanged}" Background="LightGray" Foreground="Gray"/>
|
||||
|
||||
<Label Grid.Row="1" Grid.Column="0" Content="DVD-ROM" />
|
||||
<Slider x:Name="DumpSpeedDVDSlider" Grid.Row="1" Grid.Column="1" Minimum="1" Maximum="24" IsSnapToTickEnabled="True" TickPlacement="BottomRight" Ticks="{Binding Source={x:Static lui:AllowedSpeeds.ForDVDAsCollection}}" />
|
||||
<Slider x:Name="DumpSpeedDVDSlider" Grid.Row="1" Grid.Column="1" Minimum="1" Maximum="24" IsSnapToTickEnabled="True" TickPlacement="BottomRight" Ticks="{Binding Source={x:Static local:Constants.SpeedsForDVDAsCollection}}" />
|
||||
<TextBox x:Name="DumpSpeedDVDTextBox" Grid.Row="1" Grid.Column="2" Width="22" Height="22" TextAlignment="Center" IsReadOnly="True" IsReadOnlyCaretVisible="False" VerticalAlignment="Center" Text="{Binding ElementName=DumpSpeedDVDSlider, Path=Value, UpdateSourceTrigger=PropertyChanged}" Background="LightGray" Foreground="Gray"/>
|
||||
|
||||
<Label Grid.Row="2" Grid.Column="0" Content="BD-ROM" />
|
||||
<Slider x:Name="DumpSpeedBDSlider" Grid.Row="2" Grid.Column="1" Minimum="1" Maximum="16" IsSnapToTickEnabled="True" TickPlacement="BottomRight" Ticks="{Binding Source={x:Static local:Constants.SpeedsForBDAsCollection}}" />
|
||||
<TextBox x:Name="DumpSpeedBDTextBox" Grid.Row="2" Grid.Column="2" Width="22" Height="22" TextAlignment="Center" IsReadOnly="True" IsReadOnlyCaretVisible="False" VerticalAlignment="Center" Text="{Binding ElementName=DumpSpeedBDSlider, Path=Value, UpdateSourceTrigger=PropertyChanged}" Background="LightGray" Foreground="Gray"/>
|
||||
|
||||
</Grid>
|
||||
|
||||
</GroupBox>
|
||||
@@ -79,20 +84,21 @@
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="24*" />
|
||||
<RowDefinition Height="13*" />
|
||||
<RowDefinition Height="11*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
|
||||
<CheckBox Grid.Column="0" VerticalAlignment="Center" Content="Quiet Mode"
|
||||
DataContext="{Binding Source={x:Static lui:ViewModels.OptionsViewModel}}"
|
||||
DataContext="{Binding Source={x:Static local:ViewModels.OptionsViewModel}}"
|
||||
IsChecked="{Binding Path=QuietMode}"
|
||||
ToolTip="Disable DiskImageCreator sounds"
|
||||
ToolTip="Disable DiscImageCreator sounds" Margin="0,4"
|
||||
/>
|
||||
<CheckBox Grid.Column="1" VerticalAlignment="Center" Content="Paranoid Mode"
|
||||
DataContext="{Binding Source={x:Static lui:ViewModels.OptionsViewModel}}"
|
||||
DataContext="{Binding Source={x:Static local:ViewModels.OptionsViewModel}}"
|
||||
IsChecked="{Binding Path=ParanoidMode}"
|
||||
ToolTip="Enable pedandic and super-safe flags"
|
||||
ToolTip="Enable pedantic and super-safe flags" Margin="0,4"
|
||||
/>
|
||||
<Grid Grid.Column="2" Grid.ColumnSpan="2" Grid.Row="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -102,28 +108,61 @@
|
||||
|
||||
<Label Grid.Column="0" Content="C2 Reread Tries:" />
|
||||
<TextBox Grid.Column="1" VerticalAlignment="Center"
|
||||
DataContext="{Binding Source={x:Static lui:ViewModels.OptionsViewModel}}"
|
||||
DataContext="{Binding Source={x:Static local:ViewModels.OptionsViewModel}}"
|
||||
Text="{Binding Path=RereadAmountForC2}"
|
||||
ToolTip="Specifies how many rereads are attempted on C2 error"
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
<CheckBox Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" VerticalAlignment="Top" Content="Automatically Scan for Protection"
|
||||
DataContext="{Binding Source={x:Static lui:ViewModels.OptionsViewModel}}"
|
||||
<CheckBox Grid.Column="0" Grid.Row="1" Grid.ColumnSpan="2" VerticalAlignment="Top" Content="Protection Scan"
|
||||
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"
|
||||
ToolTip="Enable automatic checking for copy protection on dumped media" Margin="0,4,0,0" Grid.RowSpan="2"
|
||||
/>
|
||||
|
||||
<CheckBox Grid.Column="2" Grid.Row="1" Grid.ColumnSpan="2" VerticalAlignment="Center" Content="Skip Media Type Detection"
|
||||
DataContext="{Binding Source={x:Static lui:ViewModels.OptionsViewModel}}"
|
||||
<CheckBox Grid.Column="1" Grid.Row="1" VerticalAlignment="Center" Content="Skip Type Detect"
|
||||
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)"
|
||||
ToolTip="Disable trying to guess media type inserted (may improve performance at startup)" Margin="0,4" Grid.RowSpan="2"
|
||||
/>
|
||||
|
||||
<CheckBox Grid.Column="2" Grid.Row="1" VerticalAlignment="Center" Content="Add Placeholders"
|
||||
DataContext="{Binding Source={x:Static local:ViewModels.OptionsViewModel}}"
|
||||
IsChecked="{Binding Path=AddPlaceholders}"
|
||||
ToolTip="Enable adding placeholder text in the submissioninfo output for required and optional fields" Margin="0,4" Grid.RowSpan="2"
|
||||
/>
|
||||
|
||||
<CheckBox Grid.Column="3" Grid.Row="1" VerticalAlignment="Center" Content="Show Disc Info"
|
||||
DataContext="{Binding Source={x:Static local:ViewModels.OptionsViewModel}}"
|
||||
IsChecked="{Binding Path=PromptForDiscInformation}"
|
||||
ToolTip="Enable showing the disc information output after dumping" Margin="0,4" Grid.RowSpan="2"
|
||||
/>
|
||||
</Grid>
|
||||
|
||||
</GroupBox>
|
||||
|
||||
<Grid Height="22" Grid.Row="3" Grid.Column="0">
|
||||
<GroupBox Grid.Row="3" Margin="5,5,5,5" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Header="Redump Login" Padding="10">
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
<ColumnDefinition Width="1*" />
|
||||
</Grid.ColumnDefinitions>
|
||||
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Username" />
|
||||
<TextBox x:Name="RedumpUsernameTextBox" Grid.Row="0" Grid.Column="1" Height="22" HorizontalAlignment="Stretch" />
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Right" Content="Password" />
|
||||
<TextBox x:Name="RedumpPasswordTextBox" Grid.Row="0" Grid.Column="3" Height="22" HorizontalAlignment="Stretch" />
|
||||
</Grid>
|
||||
</GroupBox>
|
||||
|
||||
<Grid Height="22" Grid.Row="4" Grid.Column="0">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="2*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
@@ -5,7 +5,7 @@ using System.Windows.Forms;
|
||||
using Button = System.Windows.Controls.Button;
|
||||
using TextBox = System.Windows.Controls.TextBox;
|
||||
|
||||
namespace DICUI
|
||||
namespace DICUI.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaction logic for OptionsWindow.xaml
|
||||
@@ -100,8 +100,12 @@ namespace DICUI
|
||||
{
|
||||
Array.ForEach(PathSettings(), setting => TextBoxForPathSetting(setting).Text = _options.Get(setting));
|
||||
|
||||
DumpSpeedCDSlider.Value = _options.preferredDumpSpeedCD;
|
||||
DumpSpeedDVDSlider.Value = _options.preferredDumpSpeedDVD;
|
||||
DumpSpeedCDSlider.Value = _options.PreferredDumpSpeedCD;
|
||||
DumpSpeedDVDSlider.Value = _options.PreferredDumpSpeedDVD;
|
||||
DumpSpeedBDSlider.Value = _options.PreferredDumpSpeedBD;
|
||||
|
||||
RedumpUsernameTextBox.Text = _options.Username;
|
||||
RedumpPasswordTextBox.Text = _options.Password;
|
||||
}
|
||||
|
||||
#region Event Handlers
|
||||
@@ -110,8 +114,12 @@ namespace DICUI
|
||||
{
|
||||
Array.ForEach(PathSettings(), setting => _options.Set(setting, TextBoxForPathSetting(setting).Text));
|
||||
|
||||
_options.preferredDumpSpeedCD = Convert.ToInt32(DumpSpeedCDSlider.Value);
|
||||
_options.preferredDumpSpeedDVD = Convert.ToInt32(DumpSpeedDVDSlider.Value);
|
||||
_options.PreferredDumpSpeedCD = Convert.ToInt32(DumpSpeedCDSlider.Value);
|
||||
_options.PreferredDumpSpeedDVD = Convert.ToInt32(DumpSpeedDVDSlider.Value);
|
||||
_options.PreferredDumpSpeedBD = Convert.ToInt32(DumpSpeedBDSlider.Value);
|
||||
|
||||
_options.Username = RedumpUsernameTextBox.Text;
|
||||
_options.Password = RedumpPasswordTextBox.Text;
|
||||
|
||||
_options.Save();
|
||||
Hide();
|
||||
BIN
DICUI/mspack.dll
BIN
DICUI/mspack.dll
Binary file not shown.
@@ -1,8 +0,0 @@
|
||||
<?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>
|
||||
18
README.md
18
README.md
@@ -2,7 +2,7 @@
|
||||
|
||||
DiscImageCreator UI in C#
|
||||
|
||||
[](https://ci.appveyor.com/project/mnadareski/dicui)
|
||||
[](https://ci.appveyor.com/project/mnadareski/dicui/build/artifacts)
|
||||
|
||||
This is a community project, so if you have some time and knowledge to give, we'll be glad to add you to the contributor of this project :)
|
||||
|
||||
@@ -12,10 +12,10 @@ This project relies on two open-source code ports to help perform copy protectio
|
||||
|
||||
## System Requirements
|
||||
|
||||
Even though this is written in C#, this program can only be used on Windows systems due to the base program, DiscImageCreator, being Windows-only.
|
||||
Even though this is written in C#, this program can only be used on Windows systems due to the base program, DiscImageCreator, being Windows-only. There is some preliminary support for Linux underway, and we will try to integrate with that when the time comes.
|
||||
|
||||
- Windows 7 (newest version of Windows recommended)
|
||||
- .NET Framework 4.6.1 Runtimes
|
||||
- .NET Framework 4.6.2, .NET Framework 4.7.2, or .NET Core 3.0 Runtimes
|
||||
- 128 MB of free RAM
|
||||
- As much hard drive space as amount of discs you will be dumping (20+ GB recommended)
|
||||
|
||||
@@ -23,19 +23,21 @@ Ensure that your operating system is as up-to-date as possible, since some featu
|
||||
|
||||
## Releases
|
||||
|
||||
Download the latest release here:
|
||||
[https://github.com/reignstumble/DICUI/releases](https://github.com/reignstumble/DICUI/releases)
|
||||
For those who would rather the most recently stable build, ownload the latest release here:
|
||||
[Releases Page](https://github.com/SabreTools/DICUI/releases)
|
||||
|
||||
For those who like to test the newest features, download the latest AppVeyor WIP build here: [AppVeyor](https://ci.appveyor.com/project/mnadareski/dicui/build/artifacts)
|
||||
|
||||
## Changelist
|
||||
|
||||
A list of all changes can now be found [here](https://github.com/reignstumble/DICUI/blob/master/CHANGELIST.md).
|
||||
A list of all changes can now be found [here](https://github.com/SabreTools/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
|
||||
- **darksabre76** - Project Lead / Backend Design
|
||||
- **ReignStumble** - Former Project Lead / UI Design
|
||||
- **Jakz** - Primary Feature Contributor
|
||||
- **NHellFire** - Feature Contributor
|
||||
|
||||
|
||||
26
appveyor.yml
26
appveyor.yml
@@ -1,8 +1,12 @@
|
||||
# version format
|
||||
version: 1.06_{build}
|
||||
version: 1.15-{build}
|
||||
|
||||
# pull request template
|
||||
pull_requests:
|
||||
do_not_increment_build_number: true
|
||||
|
||||
# vm template
|
||||
image: Visual Studio 2017
|
||||
image: Visual Studio 2019
|
||||
|
||||
# environment variables
|
||||
environment:
|
||||
@@ -28,9 +32,23 @@ build:
|
||||
|
||||
# post-build step
|
||||
after_build:
|
||||
- 7z a DICUI.zip DICUI\bin\Debug
|
||||
- ps: appveyor DownloadFile https://github.com/saramibreak/DiscImageCreator/files/3854216/DiscImageCreator_20191116.zip
|
||||
- ps: appveyor DownloadFile https://archive.org/download/subdump_fua_0x28/subdump_fua_0x28.zip
|
||||
- 7z e DiscImageCreator_20191116.zip -oDICUI\bin\Debug\net462\Programs Release_ANSI\*
|
||||
- 7z e DiscImageCreator_20191116.zip -oDICUI\bin\Debug\net472\Programs Release_ANSI\*
|
||||
- 7z e DiscImageCreator_20191116.zip -oDICUI\bin\Debug\netcoreapp3.0\Programs Release_ANSI\*
|
||||
- 7z e subdump_fua_0x28.zip -oDICUI\bin\Debug\net462 *
|
||||
- mv DICUI\bin\Debug\net462\subdump_fua_0x28.exe DICUI\bin\Debug\net462\subdump.exe
|
||||
- 7z e subdump_fua_0x28.zip -oDICUI\bin\Debug\net472 *
|
||||
- mv DICUI\bin\Debug\net472\subdump_fua_0x28.exe DICUI\bin\Debug\net472\subdump.exe
|
||||
- 7z e subdump_fua_0x28.zip -oDICUI\bin\Debug\netcoreapp3.0 *
|
||||
- mv DICUI\bin\Debug\netcoreapp3.0\subdump_fua_0x28.exe DICUI\bin\Debug\netcoreapp3.0\subdump.exe
|
||||
- 7z a DICUI.zip DICUI\bin\Debug\*
|
||||
- 7z a DICUI-Check.zip DICUI.Check\bin\Debug\*
|
||||
|
||||
# artifact linking
|
||||
artifacts:
|
||||
- path: DICUI.zip
|
||||
name: DICUI
|
||||
name: DICUI
|
||||
- path: DICUI-Check.zip
|
||||
name: DICUI Check
|
||||
Reference in New Issue
Block a user