mirror of
https://github.com/SabreTools/MPF.git
synced 2026-02-04 21:30:11 +00:00
Compare commits
105 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
61ce45667b | ||
|
|
ababfdd2ed | ||
|
|
9683074197 | ||
|
|
ab2bc8f50c | ||
|
|
aa86ddaf47 | ||
|
|
68afebace4 | ||
|
|
bebe3ab8a0 | ||
|
|
1f314df8c1 | ||
|
|
38c3638f21 | ||
|
|
cde4b671fc | ||
|
|
578854cd3b | ||
|
|
1cd7885194 | ||
|
|
c0de39c229 | ||
|
|
a1148f80c8 | ||
|
|
632654d00b | ||
|
|
a6d6b800a5 | ||
|
|
8527cc5746 | ||
|
|
f94f54f4d7 | ||
|
|
2091ef1d92 | ||
|
|
af865bca9e | ||
|
|
23588fa5ae | ||
|
|
e763fec01e | ||
|
|
732ff2ccca | ||
|
|
f960aca8a9 | ||
|
|
335c1388d4 | ||
|
|
87c0d5b44b | ||
|
|
1a44fb5c8a | ||
|
|
285921cae3 | ||
|
|
2255dba640 | ||
|
|
99158f31c9 | ||
|
|
53a2ef227b | ||
|
|
c0efc63741 | ||
|
|
905bd1a7dc | ||
|
|
5d49d4833f | ||
|
|
8fd3e2d405 | ||
|
|
1521a918f3 | ||
|
|
5f580ee025 | ||
|
|
9c7cee0aa3 | ||
|
|
d549609a0f | ||
|
|
207fdbb49c | ||
|
|
63e63a0033 | ||
|
|
73be55a645 | ||
|
|
d913aa247e | ||
|
|
d9a9f3bfd4 | ||
|
|
ea3e040b3f | ||
|
|
ed67522675 | ||
|
|
6e3902bbb1 | ||
|
|
3f802e8548 | ||
|
|
c3c4cf6e5b | ||
|
|
39258c4e85 | ||
|
|
df81259fba | ||
|
|
a835c81951 | ||
|
|
af4f3e8444 | ||
|
|
085916e1e6 | ||
|
|
557354c844 | ||
|
|
a23a74ffa4 | ||
|
|
958aeeae32 | ||
|
|
c73ff42500 | ||
|
|
24a93e298b | ||
|
|
ae81bb0743 | ||
|
|
cf7863fbb2 | ||
|
|
5e0e71120d | ||
|
|
5adbdd29e6 | ||
|
|
fd855b9024 | ||
|
|
17c283ff67 | ||
|
|
a37e6aaf18 | ||
|
|
1dbf23ca95 | ||
|
|
2e52d00107 | ||
|
|
eb69b74b4a | ||
|
|
db4a785558 | ||
|
|
9bdd2d6951 | ||
|
|
de48c8f0f9 | ||
|
|
c59f7c2dae | ||
|
|
2740a6a1c1 | ||
|
|
56e8470069 | ||
|
|
a5f1a12aee | ||
|
|
8749b486a8 | ||
|
|
3446957f68 | ||
|
|
cb9813db3d | ||
|
|
6e6b716c18 | ||
|
|
400ef38c60 | ||
|
|
87d5fc0e66 | ||
|
|
d5d8ae0501 | ||
|
|
fae7a5254d | ||
|
|
97be13f020 | ||
|
|
dd0dfc5cf5 | ||
|
|
a7a295434d | ||
|
|
319f5563cb | ||
|
|
939174d8c4 | ||
|
|
1d5d7b265e | ||
|
|
a2ac7222f9 | ||
|
|
4f0b5904c3 | ||
|
|
7ff848347c | ||
|
|
a1c89d17b8 | ||
|
|
3575c43703 | ||
|
|
928c9966fa | ||
|
|
a404a270f1 | ||
|
|
dfba97685a | ||
|
|
8de2f1c9bb | ||
|
|
f57b29615b | ||
|
|
565a9bb09a | ||
|
|
d9d61cf665 | ||
|
|
106f16d703 | ||
|
|
8b600a6a35 | ||
|
|
b251ae7927 |
23
App.config
23
App.config
@@ -1,19 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8" ?>
|
||||
<configuration>
|
||||
<configSections>
|
||||
<sectionGroup name="userSettings" type="System.Configuration.UserSettingsGroup, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" >
|
||||
<section name="DICUI.Properties.Settings" type="System.Configuration.ClientSettingsSection, System, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" allowExeDefinition="MachineToLocalUser" requirePermission="false" />
|
||||
</sectionGroup>
|
||||
</configSections>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.6.1" />
|
||||
</startup>
|
||||
<userSettings>
|
||||
<DICUI.Properties.Settings>
|
||||
<setting name="
|
||||
" serializeAs="String">
|
||||
<value>Release_ANSI\\DiscImageCreator.exe</value>
|
||||
</setting>
|
||||
</DICUI.Properties.Settings>
|
||||
</userSettings>
|
||||
<appSettings>
|
||||
<add key="dicPath" value="Programs\DiscImageCreator.exe"/>
|
||||
<add key="psxt001zPath" value="psxt001z.exe"/>
|
||||
<add key="sgRawPath" value="sg_raw.exe"/>
|
||||
<add key="subdumpPath" value="subdump.exe"/>
|
||||
<add key="defaultOutputPath" value="ISO"/>
|
||||
</appSettings>
|
||||
</configuration>
|
||||
119
Constants.cs
Normal file
119
Constants.cs
Normal file
@@ -0,0 +1,119 @@
|
||||
namespace DICUI
|
||||
{
|
||||
/// <summary>
|
||||
/// Text for UI elements
|
||||
/// </summary>
|
||||
public static class UIElements
|
||||
{
|
||||
public const string StartDumping = "Start Dumping";
|
||||
public const string StopDumping = "Stop Dumping";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Top-level commands for DiscImageCreator
|
||||
/// </summary>
|
||||
public static class DICCommands
|
||||
{
|
||||
public const string Audio = "audio";
|
||||
public const string BluRay = "bd";
|
||||
public const string Close = "close";
|
||||
public const string CompactDisc = "cd";
|
||||
public const string Data = "data";
|
||||
public const string DigitalVideoDisc = "dvd";
|
||||
public const string DriveSpeed = "ls";
|
||||
public const string Eject = "eject";
|
||||
public const string Floppy = "fd";
|
||||
public const string GDROM = "gd";
|
||||
public const string MDS = "mds";
|
||||
public const string Reset = "reset";
|
||||
public const string Start = "start";
|
||||
public const string Stop = "stop";
|
||||
public const string Sub = "sub";
|
||||
public const string Swap = "swap";
|
||||
public const string XBOX = "xbox";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Dumping flags for DiscImageCreator
|
||||
/// </summary>
|
||||
public static class DICFlags
|
||||
{
|
||||
public const string AddOffset = "/a";
|
||||
public const string AMSF = "/p";
|
||||
public const string BEOpcode = "/be";
|
||||
public const string C2Opcode = "/c2";
|
||||
public const string CMI = "/c";
|
||||
public const string D8Opcode = "/d8";
|
||||
public const string DisableBeep = "/q";
|
||||
public const string ForceUnitAccess = "/f";
|
||||
public const string MCN = "/m";
|
||||
public const string MultiSession = "/ms";
|
||||
public const string NoFixSubP = "/np";
|
||||
public const string NoFixSubQ = "/nq";
|
||||
public const string NoFixSubQLibCrypt = "/nl";
|
||||
public const string NoFixSubQSecuROM = "/ns";
|
||||
public const string NoFixSubRtoW = "/nr";
|
||||
public const string Raw = "/raw";
|
||||
public const string Reverse = "/r";
|
||||
public const string ScanAntiMod = "/am";
|
||||
public const string ScanFileProtect = "/sf";
|
||||
public const string ScanSectorProtect = "/ss";
|
||||
public const string SeventyFour = "/74";
|
||||
public const string SubchannelReadLevel = "/s";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Template field values for submission info
|
||||
/// </summary>
|
||||
public static class Template
|
||||
{
|
||||
// Manual information
|
||||
|
||||
public const string TitleField = "Title";
|
||||
public const string DiscNumberField = "Disc Number / Letter";
|
||||
public const string DiscTitleField = "Disc Title";
|
||||
public const string CategoryField = "Category";
|
||||
public const string RegionField = "Region";
|
||||
public const string LanguagesField = "Languages";
|
||||
public const string DiscSerialField = "Disc Serial";
|
||||
public const string BarcodeField = "Barcode";
|
||||
public const string ISBNField = "ISBN";
|
||||
public const string CommentsField = "Comments";
|
||||
public const string ContentsField = "Contents";
|
||||
public const string VersionField = "Version";
|
||||
public const string EditionField = "Edition/Release";
|
||||
public const string CopyProtectionField = "Copy Protection";
|
||||
public const string MasteringRingField = "Mastering Ring";
|
||||
public const string MasteringSIDField = "Mastering SID Code";
|
||||
public const string MouldSIDField = "Mould SID Code";
|
||||
public const string AdditionalMouldField = "Additional Mould";
|
||||
public const string ToolstampField = "Toolstamp or Mastering Code";
|
||||
|
||||
// Automatic Information
|
||||
|
||||
public const string PVDField = "Primary Volume Descriptor (PVD)";
|
||||
public const string DATField = "DAT";
|
||||
public const string ErrorCountField = "Error Count";
|
||||
public const string CuesheetField = "Cuesheet";
|
||||
public const string SubIntentionField = "SubIntention (SecuROM)";
|
||||
public const string WriteOffsetField = "WriteOffset";
|
||||
public const string LayerbreakField = "Layerbreak";
|
||||
public const string PlaystationEXEDateField = "EXE Date";
|
||||
public const string PlayStationEDCField = "EDC"; // TODO: Not automatic yet
|
||||
public const string PlayStationAntiModchipField = "Anti-modchip"; // TODO: Not automatic yet
|
||||
public const string PlayStationLibCryptField = "LibCrypt"; // TODO: Not automatic yet
|
||||
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";
|
||||
|
||||
// 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";
|
||||
}
|
||||
}
|
||||
17
DICUI.csproj
17
DICUI.csproj
@@ -67,7 +67,10 @@
|
||||
<PropertyGroup />
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Configuration" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Management.Instrumentation" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
@@ -87,6 +90,10 @@
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</ApplicationDefinition>
|
||||
<Compile Include="Constants.cs" />
|
||||
<Compile Include="Utilities\DumpInformation.cs" />
|
||||
<Compile Include="Utilities\Validation.cs" />
|
||||
<Compile Include="Utilities\Converters.cs" />
|
||||
<Page Include="MainWindow.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
@@ -95,6 +102,7 @@
|
||||
<DependentUpon>App.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Enumerations.cs" />
|
||||
<Compile Include="MainWindow.xaml.cs">
|
||||
<DependentUpon>MainWindow.xaml</DependentUpon>
|
||||
<SubType>Code</SubType>
|
||||
@@ -104,15 +112,6 @@
|
||||
<Compile Include="Properties\AssemblyInfo.cs">
|
||||
<SubType>Code</SubType>
|
||||
</Compile>
|
||||
<Compile Include="Properties\Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
<DependentUpon>Resources.resx</DependentUpon>
|
||||
</Compile>
|
||||
<EmbeddedResource Include="Properties\Resources.resx">
|
||||
<Generator>ResXFileCodeGenerator</Generator>
|
||||
<LastGenOutput>Resources.Designer.cs</LastGenOutput>
|
||||
</EmbeddedResource>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
|
||||
155
Enumerations.cs
Normal file
155
Enumerations.cs
Normal file
@@ -0,0 +1,155 @@
|
||||
namespace DICUI
|
||||
{
|
||||
/// <summary>
|
||||
/// Known disc types
|
||||
/// </summary>
|
||||
public enum DiscType
|
||||
{
|
||||
NONE = 0,
|
||||
CD,
|
||||
DVD5,
|
||||
DVD9,
|
||||
GDROM,
|
||||
HDDVD,
|
||||
BD25,
|
||||
BD50,
|
||||
|
||||
// Special Formats
|
||||
GameCubeGameDisc,
|
||||
WiiOpticalDisc,
|
||||
WiiUOpticalDisc,
|
||||
UMD,
|
||||
|
||||
// Keeping this separate since it's currently unsupported in the UI
|
||||
Floppy = 99,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Known systems
|
||||
/// </summary>
|
||||
/// <remarks>Ensure that Utilities methods are updated as well</remarks>
|
||||
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,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Computers
|
||||
|
||||
AcornArchimedes,
|
||||
AppleMacintosh,
|
||||
CommodoreAmigaCD,
|
||||
FujitsuFMTowns,
|
||||
IBMPCCompatible,
|
||||
NECPC88,
|
||||
NECPC98,
|
||||
SharpX68000,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Arcade
|
||||
|
||||
AmigaCUBOCD32,
|
||||
AmericanLaserGames3DO,
|
||||
Atari3DO,
|
||||
Atronic,
|
||||
AUSCOMSystem1,
|
||||
BallyGameMagic,
|
||||
CapcomCPSystemIII,
|
||||
GlobalVRVarious,
|
||||
GlobalVRVortek,
|
||||
GlobalVRVortekV3,
|
||||
ICEPCHardware,
|
||||
IncredibleTechnologiesEagle,
|
||||
IncredibleTechnologiesVarious,
|
||||
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,
|
||||
|
||||
#endregion
|
||||
|
||||
#region Other
|
||||
|
||||
AudioCD,
|
||||
BDVideo,
|
||||
DVDVideo,
|
||||
EnhancedCD,
|
||||
PalmOS,
|
||||
PhilipsCDiDigitalVideo,
|
||||
PhotoCD,
|
||||
PlayStationGameSharkUpdates,
|
||||
TaoiKTV,
|
||||
TomyKissSite,
|
||||
VideoCD,
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:DICUI"
|
||||
mc:Ignorable="d"
|
||||
Title="Disc Image Creator GUI" Height="400" Width="600">
|
||||
Title="Disc Image Creator GUI" Height="450" Width="600">
|
||||
|
||||
<Grid>
|
||||
<Grid.ColumnDefinitions>
|
||||
@@ -13,16 +13,22 @@
|
||||
<ColumnDefinition Width="13*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition Height="4*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
<RowDefinition Height="1*"/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<GroupBox Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,5,5.2,5.4" HorizontalAlignment="Stretch" Header="Settings"/>
|
||||
<GroupBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,4.6,5.2,4.8" HorizontalAlignment="Stretch" Header="Controls"/>
|
||||
<GroupBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,5.2,5.2,4.8" HorizontalAlignment="Stretch" Header="Status"/>
|
||||
<ToolBarTray Grid.Row="0" Grid.Column="0" Grid.ColumnSpan="2" Height="30" HorizontalAlignment="Stretch" IsLocked="True">
|
||||
<ToolBar>
|
||||
<Button x:Name="tbr_Properties" Content="Properties" Command="Properties" Click="tbr_Properties_Click" CommandManager.CanExecute="tbr_Properties_CanExecute"/>
|
||||
</ToolBar>
|
||||
</ToolBarTray>
|
||||
<GroupBox Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,5,5.2,5.4" HorizontalAlignment="Stretch" Header="Settings"/>
|
||||
<GroupBox Grid.Row="2" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,4.6,5.2,4.8" HorizontalAlignment="Stretch" Header="Controls"/>
|
||||
<GroupBox Grid.Row="3" Grid.Column="0" Grid.ColumnSpan="2" Margin="5,5.2,5.2,4.8" HorizontalAlignment="Stretch" Header="Status"/>
|
||||
|
||||
<Grid Grid.Row="0" Grid.Column="0" Margin="15,25,15.2,10.4" Grid.ColumnSpan="2">
|
||||
<Grid Grid.Row="1" Grid.Column="0" Margin="15,25,15.2,10.4" Grid.ColumnSpan="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="2.5*"/>
|
||||
@@ -37,86 +43,41 @@
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label Grid.Row="0" Grid.Column="0" VerticalAlignment="Center">Disc Type</Label>
|
||||
<Label Grid.Row="1" Grid.Column="0" VerticalAlignment="Center">DiscImageCreator Path</Label>
|
||||
<Label Grid.Row="2" Grid.Column="0" VerticalAlignment="Center">Output Filename</Label>
|
||||
<Label Grid.Row="3" Grid.Column="0" VerticalAlignment="Center">Output Directory</Label>
|
||||
<Label Grid.Row="4" Grid.Column="0" VerticalAlignment="Center">Drive Letter</Label>
|
||||
<Label Grid.Row="5" Grid.Column="0" VerticalAlignment="Center">Drive Speed</Label>
|
||||
<ComboBox x:Name="cmb_DiscType" Grid.Row="0" Grid.Column="1" Height="22" SelectionChanged="cmb_DiscType_SelectionChanged" />
|
||||
|
||||
<ComboBox x:Name="cmb_DiscType" Grid.Row="0" Grid.Column="1" Height="22" Text="Bandai Playdia Quick Interactive System" DropDownClosed="cmb_DiscType_DropDownClosed" SelectionChanged="cmb_DiscType_SelectionChanged">
|
||||
<ComboBoxItem Content="Unknown"/>
|
||||
<ComboBoxItem Content="---------- Consoles ----------" IsEnabled="False"/>
|
||||
<ComboBoxItem Content="Bandai Playdia Quick Interactive System"/>
|
||||
<ComboBoxItem Content="Bandai / Apple Pippin"/>
|
||||
<ComboBoxItem Content="Commodore Amiga CD / CD32 / CDTV"/>
|
||||
<ComboBoxItem Content="Mattel HyperScan"/>
|
||||
<ComboBoxItem Content="Microsoft XBOX One"/>
|
||||
<ComboBoxItem Content="NEC PC-Engine / TurboGrafx CD"/>
|
||||
<ComboBoxItem Content="NEC PC-FX / PC-FXGA"/>
|
||||
<ComboBoxItem Content="Panasonic 3DO"/>
|
||||
<ComboBoxItem Content="Philips CD-i"/>
|
||||
<ComboBoxItem Content="Sega CD / Mega CD"/>
|
||||
<ComboBoxItem Content="Sega Saturn"/>
|
||||
<ComboBoxItem Content="SNK Neo Geo CD"/>
|
||||
<ComboBoxItem Content="Sony PlayStation"/>
|
||||
<ComboBoxItem Content="Sony PlayStation 2 (CD-Rom)"/>
|
||||
<ComboBoxItem Content="Sony PlayStation 2 (DVD-Rom)"/>
|
||||
<ComboBoxItem Content="Sony PlayStation 4"/>
|
||||
<ComboBoxItem Content="VTech V.Flash - V.Smile Pro"/>
|
||||
<ComboBoxItem Content="---------- Computers ----------" IsEnabled="False"/>
|
||||
<ComboBoxItem Content="Apple Macintosh (CD-Rom)"/>
|
||||
<ComboBoxItem Content="Apple Macintosh (DVD-Rom)"/>
|
||||
<ComboBoxItem Content="Fujitsu FM Towns series"/>
|
||||
<ComboBoxItem Content="IBM PC Compatible (CD-Rom)"/>
|
||||
<ComboBoxItem Content="IBM PC Compatible (DVD-Rom)"/>
|
||||
<ComboBoxItem Content="NEC PC-88"/>
|
||||
<ComboBoxItem Content="NEC PC-98"/>
|
||||
<ComboBoxItem Content="---------- Arcade ----------" IsEnabled="False"/>
|
||||
<ComboBoxItem Content="Sega Lindbergh"/>
|
||||
<ComboBoxItem Content="---------- Others ----------" IsEnabled="False"/>
|
||||
<ComboBoxItem Content="Audio CD"/>
|
||||
<ComboBoxItem Content="BD-Video"/>
|
||||
<ComboBoxItem Content="DVD-Video"/>
|
||||
<ComboBoxItem Content="PalmOS"/>
|
||||
<ComboBoxItem Content="Photo CD"/>
|
||||
<ComboBoxItem Content="PlayStation GameShark Updates"/>
|
||||
<ComboBoxItem Content="Tomy Kiss-Site"/>
|
||||
<ComboBoxItem Content="Video CD"/>
|
||||
</ComboBox>
|
||||
<Label Grid.Row="1" Grid.Column="0" VerticalAlignment="Center">Output Filename</Label>
|
||||
<TextBox x:Name="txt_OutputFilename" Grid.Row="1" Grid.Column="1" Height="22" TextChanged="txt_OutputFilename_TextChanged"/>
|
||||
|
||||
<TextBox x:Name="TXT_DiscImageCreatorPath" Grid.Row="1" Grid.Column="1" Height="22" Width="345" HorizontalAlignment="left" IsEnabled="False" ></TextBox>
|
||||
<Button x:Name="BTN_DiscImageCreatorBrowse" Grid.Row="1" Grid.Column="1" Height="22" Width="50" HorizontalAlignment="Right" Content="Browse" IsEnabled="False"></Button>
|
||||
<Label Grid.Row="2" Grid.Column="0" VerticalAlignment="Center">Output Directory</Label>
|
||||
<TextBox x:Name="txt_OutputDirectory" Grid.Row="2" Grid.Column="1" Height="22" Width="345" HorizontalAlignment="left" TextChanged="txt_OutputDirectory_TextChanged"/>
|
||||
<Button x:Name="btn_OutputDirectoryBrowse" Grid.Row="2" Grid.Column="1" Height="22" Width="50" HorizontalAlignment="Right" Content="Browse" Click="btn_OutputDirectoryBrowse_Click"/>
|
||||
|
||||
<TextBox x:Name="txt_OutputFilename" Grid.Row="2" Grid.Column="1" Height="22"></TextBox>
|
||||
<Label Grid.Row="3" Grid.Column="0" VerticalAlignment="Center">Drive Letter</Label>
|
||||
<ComboBox x:Name="cmb_DriveLetter" Grid.Row="3" Grid.Column="1" Height="22" Width="397" HorizontalAlignment="left" SelectionChanged="cmb_DriveLetter_SelectionChanged"/>
|
||||
|
||||
<TextBox x:Name="txt_OutputDirectory" Grid.Row="3" Grid.Column="1" Height="22" Width="345" HorizontalAlignment="left" Text="ISO" ></TextBox>
|
||||
<Button x:Name="BTN_OutputDirectoryBrowse" Grid.Row="3" Grid.Column="1" Height="22" Width="50" HorizontalAlignment="Right" Content="Browse" Click="BTN_OutputDirectoryBrowse_Click" ></Button>
|
||||
<Label Grid.Row="4" Grid.Column="0" VerticalAlignment="Center">Drive Speed</Label>
|
||||
<ComboBox x:Name="cmb_DriveSpeed" Grid.Row="4" Grid.Column="1" Height="22" Width="60" HorizontalAlignment="left" SelectionChanged="cmb_DriveSpeed_SelectionChanged"/>
|
||||
|
||||
<ComboBox x:Name="cmb_DriveLetter" Grid.Row="4" Grid.Column="1" Height="22" Width="60" HorizontalAlignment="left"></ComboBox>
|
||||
|
||||
<ComboBox x:Name="cmb_DriveSpeed" Grid.Row="5" Grid.Column="1" Height="22" Width="60" HorizontalAlignment="left" SelectionChanged="cmb_DriveSpeed_SelectionChanged">
|
||||
<ComboBoxItem Content="4"/>
|
||||
<ComboBoxItem Content="8"/>
|
||||
<ComboBoxItem Content="16"/>
|
||||
<ComboBoxItem Content="48"/>
|
||||
<ComboBoxItem Content="Custom"/>
|
||||
</ComboBox>
|
||||
<Label Grid.Row="5" Grid.Column="0" VerticalAlignment="Center">Parameters</Label>
|
||||
<TextBox x:Name="txt_Parameters" Grid.Row="5" Grid.Column="1" Height="22" Width="397" HorizontalAlignment="left" IsEnabled="False" />
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="1" Grid.Column="0" Margin="15,19.6,15.2,9.8" Grid.ColumnSpan="2">
|
||||
<Grid Grid.Row="2" Grid.Column="0" Margin="15,19.6,15.2,9.8" Grid.ColumnSpan="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition/>
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Button x:Name="btn_Start" Grid.Row="0" Grid.Column="0" Height="22" Width="150" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Start Dumping" Click="btn_Start_Click" IsEnabled="False" />
|
||||
<Button x:Name="btn_StartStop" Grid.Row="0" Grid.Column="0" Height="22" Width="150" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Start Dumping" Click="btn_StartStop_Click" IsEnabled="False" />
|
||||
<Button x:Name="btn_Search" Grid.Row="0" Grid.Column="1" Height="22" Width="150" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Scan for disks" Click="btn_Search_Click" />
|
||||
<CheckBox x:Name="chk_EjectWhenDone" Grid.Row="0" Grid.Column="2" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Eject When Done" IsChecked="False" />
|
||||
</Grid>
|
||||
|
||||
<Grid Grid.Row="2" Grid.Column="0" Margin="15,20.2,15.2,9.8" Grid.ColumnSpan="2">
|
||||
<Grid Grid.Row="3" Grid.Column="0" Margin="15,20.2,15.2,9.8" Grid.ColumnSpan="2">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="1*"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
@@ -125,9 +86,6 @@
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<Label x:Name="lbl_Status" Grid.Row="0" Grid.Column="0" VerticalAlignment="Center" HorizontalAlignment="Center" Content="Waiting for CD or DVD..." />
|
||||
|
||||
</Grid>
|
||||
|
||||
</Grid>
|
||||
|
||||
</Window>
|
||||
|
||||
1125
MainWindow.xaml.cs
1125
MainWindow.xaml.cs
File diff suppressed because it is too large
Load Diff
63
Properties/Resources.Designer.cs
generated
63
Properties/Resources.Designer.cs
generated
@@ -1,63 +0,0 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated by a tool.
|
||||
// Runtime Version:4.0.30319.42000
|
||||
//
|
||||
// Changes to this file may cause incorrect behavior and will be lost if
|
||||
// the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace DICUI.Properties {
|
||||
using System;
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// A strongly-typed resource class, for looking up localized strings, etc.
|
||||
/// </summary>
|
||||
// This class was auto-generated by the StronglyTypedResourceBuilder
|
||||
// class via a tool like ResGen or Visual Studio.
|
||||
// To add or remove a member, edit your .ResX file then rerun ResGen
|
||||
// with the /str option, or rebuild your VS project.
|
||||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "15.0.0.0")]
|
||||
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
|
||||
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
|
||||
internal class Resources {
|
||||
|
||||
private static global::System.Resources.ResourceManager resourceMan;
|
||||
|
||||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal Resources() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the cached ResourceManager instance used by this class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("DICUI.Properties.Resources", typeof(Resources).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Overrides the current thread's CurrentUICulture property for all
|
||||
/// resource lookups using this strongly typed resource class.
|
||||
/// </summary>
|
||||
[global::System.ComponentModel.EditorBrowsableAttribute(global::System.ComponentModel.EditorBrowsableState.Advanced)]
|
||||
internal static global::System.Globalization.CultureInfo Culture {
|
||||
get {
|
||||
return resourceCulture;
|
||||
}
|
||||
set {
|
||||
resourceCulture = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,117 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<root>
|
||||
<!--
|
||||
Microsoft ResX Schema
|
||||
|
||||
Version 2.0
|
||||
|
||||
The primary goals of this format is to allow a simple XML format
|
||||
that is mostly human readable. The generation and parsing of the
|
||||
various data types are done through the TypeConverter classes
|
||||
associated with the data types.
|
||||
|
||||
Example:
|
||||
|
||||
... ado.net/XML headers & schema ...
|
||||
<resheader name="resmimetype">text/microsoft-resx</resheader>
|
||||
<resheader name="version">2.0</resheader>
|
||||
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
|
||||
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
|
||||
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
|
||||
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
|
||||
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
|
||||
<value>[base64 mime encoded serialized .NET Framework object]</value>
|
||||
</data>
|
||||
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
|
||||
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
|
||||
<comment>This is a comment</comment>
|
||||
</data>
|
||||
|
||||
There are any number of "resheader" rows that contain simple
|
||||
name/value pairs.
|
||||
|
||||
Each data row contains a name, and value. The row also contains a
|
||||
type or mimetype. Type corresponds to a .NET class that support
|
||||
text/value conversion through the TypeConverter architecture.
|
||||
Classes that don't support this are serialized and stored with the
|
||||
mimetype set.
|
||||
|
||||
The mimetype is used for serialized objects, and tells the
|
||||
ResXResourceReader how to depersist the object. This is currently not
|
||||
extensible. For a given mimetype the value must be set accordingly:
|
||||
|
||||
Note - application/x-microsoft.net.object.binary.base64 is the format
|
||||
that the ResXResourceWriter will generate, however the reader can
|
||||
read any of the formats listed below.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.binary.base64
|
||||
value : The object must be serialized with
|
||||
: System.Serialization.Formatters.Binary.BinaryFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.soap.base64
|
||||
value : The object must be serialized with
|
||||
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
|
||||
: and then encoded with base64 encoding.
|
||||
|
||||
mimetype: application/x-microsoft.net.object.bytearray.base64
|
||||
value : The object must be serialized into a byte array
|
||||
: using a System.ComponentModel.TypeConverter
|
||||
: and then encoded with base64 encoding.
|
||||
-->
|
||||
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
|
||||
<xsd:element name="root" msdata:IsDataSet="true">
|
||||
<xsd:complexType>
|
||||
<xsd:choice maxOccurs="unbounded">
|
||||
<xsd:element name="metadata">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
<xsd:attribute name="type" type="xsd:string" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="assembly">
|
||||
<xsd:complexType>
|
||||
<xsd:attribute name="alias" type="xsd:string" />
|
||||
<xsd:attribute name="name" type="xsd:string" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="data">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
|
||||
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
|
||||
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
<xsd:element name="resheader">
|
||||
<xsd:complexType>
|
||||
<xsd:sequence>
|
||||
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
|
||||
</xsd:sequence>
|
||||
<xsd:attribute name="name" type="xsd:string" use="required" />
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:choice>
|
||||
</xsd:complexType>
|
||||
</xsd:element>
|
||||
</xsd:schema>
|
||||
<resheader name="resmimetype">
|
||||
<value>text/microsoft-resx</value>
|
||||
</resheader>
|
||||
<resheader name="version">
|
||||
<value>2.0</value>
|
||||
</resheader>
|
||||
<resheader name="reader">
|
||||
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
<resheader name="writer">
|
||||
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
|
||||
</resheader>
|
||||
</root>
|
||||
90
README.md
90
README.md
@@ -13,30 +13,100 @@ I would like this project to be a community project, so if you have some time an
|
||||
--------------------------------------------------------------------------
|
||||
Currently working on the project:
|
||||
|
||||
ReignStumble - Lead Developer
|
||||
ReignStumble - Co-Lead Programmer
|
||||
|
||||
darksabre76 - Contributer
|
||||
darksabre76 - Co-Lead Programmer
|
||||
|
||||
NHellFire - Contributer
|
||||
|
||||
Dizzzy - Concept/Ideas/Beta tester
|
||||
|
||||
## Changelist
|
||||
|
||||
Download the latest release here:
|
||||
[https://github.com/reignstumble/DICUI/releases](https://github.com/reignstumble/DICUI/releases)
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
2018-06-15
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Version 1.06 released:
|
||||
|
||||
- Fixed not being able to use the `/c2` flag properly
|
||||
- Fixed times when the ability to start dumping was improperly allowed
|
||||
- Added full support for XBOX and XBOX360 (XDG1, XDG2) dumping through DIC (using a Kreon, or presumably a 0800)
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
2018-06-14
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Version 1.05a released:
|
||||
|
||||
- Fixed some ordering and nullability issues
|
||||
- Added automatic fields for PS1, PS2, Saturn
|
||||
|
||||
Version 1.05 released:
|
||||
|
||||
- Miscellaneous fixes around custom parameter validation, dump information accuracy, settings window, and TODO cleanup
|
||||
- Add many more supported platforms, mostly arcade (based on publicly available information)
|
||||
- Add floppy disk dumping support
|
||||
- Add optional disc eject on completion
|
||||
- Add subdump for Sega Saturn
|
||||
- Fully support newest version of DIC including all new flags and commands
|
||||
|
||||
**Known Issues:**
|
||||
|
||||
- PlayStation and Saturn discs still don't have all internal information automatically generated
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
2018-06-13
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Version 1.04b released:
|
||||
|
||||
- Added subIntention reading
|
||||
- Fixed extra extensions being appended
|
||||
- Fixed internationalization error (number formatting)
|
||||
- Fixed "Custom Input" not working
|
||||
|
||||
Version 1.04a released:
|
||||
|
||||
- Fixed issue with empty trays
|
||||
- Added settings dialog
|
||||
|
||||
Version 1.04 released:
|
||||
|
||||
- Behind-the-scenes fixes and formatting
|
||||
- Better checks for external programs
|
||||
- Automatically changing disc information
|
||||
- Custom parameters (and parameter validation)
|
||||
- Automatic drive speed selection
|
||||
- Automatic submission information creation
|
||||
- Add ability to stop a dump from the UI
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
2018-06-08
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Version 1.03 released:
|
||||
|
||||
- edccchk now run on all CD-Roms
|
||||
- Discs unsupported by Windows are now regonized
|
||||
- Extra \ when accepting default save has been removed.
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
2018-05-18
|
||||
--------------------------------------------------------------------------
|
||||
|
||||
Version 1.02 released:
|
||||
Version 1.02b released:
|
||||
|
||||
- Fixed XBOX One and PS4 Drive Speed issue.
|
||||
- Started implementing DiscImageCreator Path selection.
|
||||
- Conforming my naming for objects and variable.
|
||||
- Fixed XBOX One and PS4 Drive Speed issue. (1.02)
|
||||
- Started implementing DiscImageCreator Path selection. (1.02)
|
||||
- Conforming my naming for objects and variable. (1.02)
|
||||
- Added missing DLL (1.02b)
|
||||
|
||||
--------------------------------------------------------------------------
|
||||
2018-05-14
|
||||
--------------------------------------------------------------------------
|
||||
Version 1.01d released:
|
||||
|
||||
|
||||
Download the latest release here:
|
||||
https://github.com/reignstumble/DICUI/releases
|
||||
Version 1.01d released
|
||||
507
Utilities/Converters.cs
Normal file
507
Utilities/Converters.cs
Normal file
@@ -0,0 +1,507 @@
|
||||
using System.Collections.Generic;
|
||||
|
||||
namespace DICUI.Utilities
|
||||
{
|
||||
public static class Converters
|
||||
{
|
||||
/// <summary>
|
||||
/// Get the DiscType associated with a given base command
|
||||
/// </summary>
|
||||
/// <param name="baseCommand">String value to check</param>
|
||||
/// <returns>DiscType if possible, null on error</returns>
|
||||
/// <remarks>This takes the "safe" route by assuming the larger of any given format</remarks>
|
||||
public static DiscType? BaseCommmandToDiscType(string baseCommand)
|
||||
{
|
||||
switch (baseCommand)
|
||||
{
|
||||
case DICCommands.CompactDisc:
|
||||
return DiscType.CD;
|
||||
case DICCommands.GDROM:
|
||||
case DICCommands.Swap:
|
||||
return DiscType.GDROM;
|
||||
case DICCommands.DigitalVideoDisc:
|
||||
return DiscType.DVD9;
|
||||
case DICCommands.BluRay:
|
||||
return DiscType.BD50;
|
||||
case DICCommands.XBOX:
|
||||
return DiscType.DVD5;
|
||||
|
||||
// Non-optical
|
||||
case DICCommands.Floppy:
|
||||
return DiscType.Floppy;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the most common known system for a given DiscType
|
||||
/// </summary>
|
||||
/// <param name="baseCommand">String value to check</param>
|
||||
/// <returns>KnownSystem if possible, null on error</returns>
|
||||
public static KnownSystem? BaseCommandToKnownSystem(string baseCommand)
|
||||
{
|
||||
switch (baseCommand)
|
||||
{
|
||||
case DICCommands.CompactDisc:
|
||||
case DICCommands.DigitalVideoDisc:
|
||||
case DICCommands.Floppy:
|
||||
return KnownSystem.IBMPCCompatible;
|
||||
case DICCommands.GDROM:
|
||||
case DICCommands.Swap:
|
||||
return KnownSystem.SegaDreamcast;
|
||||
case DICCommands.BluRay:
|
||||
return KnownSystem.SonyPlayStation3;
|
||||
case DICCommands.XBOX:
|
||||
return KnownSystem.MicrosoftXBOX;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the default extension for a given disc type
|
||||
/// </summary>
|
||||
/// <param name="type">DiscType value to check</param>
|
||||
/// <returns>Valid extension (with leading '.'), null on error</returns>
|
||||
public static string DiscTypeToExtension(DiscType? type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DiscType.CD:
|
||||
case DiscType.GDROM:
|
||||
return ".bin";
|
||||
case DiscType.DVD5:
|
||||
case DiscType.DVD9:
|
||||
case DiscType.HDDVD:
|
||||
case DiscType.BD25:
|
||||
case DiscType.BD50:
|
||||
case DiscType.WiiOpticalDisc:
|
||||
case DiscType.UMD:
|
||||
return ".iso";
|
||||
case DiscType.GameCubeGameDisc:
|
||||
return ".raw";
|
||||
case DiscType.WiiUOpticalDisc:
|
||||
return ".wud";
|
||||
case DiscType.Floppy:
|
||||
return ".img";
|
||||
case DiscType.NONE:
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the string representation of the DiscType enum values
|
||||
/// </summary>
|
||||
/// <param name="type">DiscType value to convert</param>
|
||||
/// <returns>String representing the value, if possible</returns>
|
||||
public static string DiscTypeToString(DiscType? type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DiscType.CD:
|
||||
return "CD-ROM";
|
||||
case DiscType.DVD5:
|
||||
return "DVD-5 [Single-Layer]";
|
||||
case DiscType.DVD9:
|
||||
return "DVD-9 [Dual-Layer]";
|
||||
case DiscType.GDROM:
|
||||
return "GD-ROM";
|
||||
case DiscType.HDDVD:
|
||||
return "HD-DVD";
|
||||
case DiscType.BD25:
|
||||
return "BluRay-25 [Single-Layer]";
|
||||
case DiscType.BD50:
|
||||
return "BluRay-50 [Dual-Layer]";
|
||||
|
||||
case DiscType.GameCubeGameDisc:
|
||||
return "GameCube Game";
|
||||
case DiscType.WiiOpticalDisc:
|
||||
return "Wii Optical";
|
||||
case DiscType.WiiUOpticalDisc:
|
||||
return "Wii U Optical";
|
||||
case DiscType.UMD:
|
||||
return "UMD";
|
||||
|
||||
case DiscType.Floppy:
|
||||
return "Floppy Disk";
|
||||
|
||||
case DiscType.NONE:
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the DIC command to be used for a given DiscType
|
||||
/// </summary>
|
||||
/// <param name="type">DiscType value to check</param>
|
||||
/// <returns>String containing the command, null on error</returns>
|
||||
public static string KnownSystemAndDiscTypeToBaseCommand(KnownSystem? sys, DiscType? type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case DiscType.CD:
|
||||
if (sys == KnownSystem.MicrosoftXBOX)
|
||||
{
|
||||
return DICCommands.XBOX;
|
||||
}
|
||||
return DICCommands.CompactDisc;
|
||||
case DiscType.DVD5:
|
||||
if (sys == KnownSystem.MicrosoftXBOX
|
||||
|| sys == KnownSystem.MicrosoftXBOX360XDG2
|
||||
|| sys == KnownSystem.MicrosoftXBOX360XDG3)
|
||||
{
|
||||
return DICCommands.XBOX;
|
||||
}
|
||||
return DICCommands.DigitalVideoDisc;
|
||||
case DiscType.DVD9:
|
||||
if (sys == KnownSystem.MicrosoftXBOX
|
||||
|| sys == KnownSystem.MicrosoftXBOX360XDG2
|
||||
|| sys == KnownSystem.MicrosoftXBOX360XDG3)
|
||||
{
|
||||
return DICCommands.XBOX;
|
||||
}
|
||||
return DICCommands.DigitalVideoDisc;
|
||||
case DiscType.GDROM:
|
||||
return DICCommands.GDROM;
|
||||
case DiscType.HDDVD:
|
||||
return null;
|
||||
case DiscType.BD25:
|
||||
case DiscType.BD50:
|
||||
return DICCommands.BluRay;
|
||||
|
||||
// Special Formats
|
||||
case DiscType.GameCubeGameDisc:
|
||||
return DICCommands.DigitalVideoDisc;
|
||||
case DiscType.WiiOpticalDisc:
|
||||
return null;
|
||||
case DiscType.WiiUOpticalDisc:
|
||||
return null;
|
||||
case DiscType.UMD:
|
||||
return null;
|
||||
|
||||
// Non-optical
|
||||
case DiscType.Floppy:
|
||||
return DICCommands.Floppy;
|
||||
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get list of default parameters for a given system and disc type
|
||||
/// </summary>
|
||||
/// <param name="sys">KnownSystem value to check</param>
|
||||
/// <param name="type">DiscType value to check</param>
|
||||
/// <returns>List of strings representing the parameters</returns>
|
||||
public static List<string> KnownSystemAndDiscTypeToParameters(KnownSystem? sys, DiscType? type)
|
||||
{
|
||||
// First check to see if the combination of system and disctype is valid
|
||||
List<DiscType?> validTypes = Validation.GetValidDiscTypes(sys);
|
||||
if (!validTypes.Contains(type))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Now sort based on disc type
|
||||
List<string> parameters = new List<string>();
|
||||
switch (type)
|
||||
{
|
||||
case DiscType.CD:
|
||||
parameters.Add(DICFlags.C2Opcode); parameters.Add("20");
|
||||
|
||||
switch (sys)
|
||||
{
|
||||
case KnownSystem.AppleMacintosh:
|
||||
case KnownSystem.IBMPCCompatible:
|
||||
parameters.Add(DICFlags.NoFixSubQSecuROM);
|
||||
parameters.Add(DICFlags.ScanFileProtect);
|
||||
parameters.Add(DICFlags.ScanSectorProtect);
|
||||
break;
|
||||
case KnownSystem.NECPCEngineTurboGrafxCD:
|
||||
parameters.Add(DICFlags.MCN);
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation:
|
||||
parameters.Add(DICFlags.ScanAntiMod);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case DiscType.DVD5:
|
||||
// Currently no defaults set
|
||||
break;
|
||||
case DiscType.DVD9:
|
||||
// Currently no defaults set
|
||||
break;
|
||||
case DiscType.GDROM:
|
||||
parameters.Add(DICFlags.C2Opcode); parameters.Add("20");
|
||||
break;
|
||||
case DiscType.HDDVD:
|
||||
break;
|
||||
case DiscType.BD25:
|
||||
// Currently no defaults set
|
||||
break;
|
||||
case DiscType.BD50:
|
||||
// Currently no defaults set
|
||||
break;
|
||||
|
||||
// Special Formats
|
||||
case DiscType.GameCubeGameDisc:
|
||||
parameters.Add(DICFlags.Raw);
|
||||
break;
|
||||
case DiscType.WiiOpticalDisc:
|
||||
// Currently no defaults set
|
||||
break;
|
||||
case DiscType.WiiUOpticalDisc:
|
||||
// Currently no defaults set
|
||||
break;
|
||||
case DiscType.UMD:
|
||||
break;
|
||||
|
||||
// Non-optical
|
||||
case DiscType.Floppy:
|
||||
// Currently no defaults set
|
||||
break;
|
||||
}
|
||||
|
||||
return parameters;
|
||||
}
|
||||
|
||||
/// <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.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.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.TaoiKTV:
|
||||
return "Tao iKTV";
|
||||
case KnownSystem.TomyKissSite:
|
||||
return "Tomy Kiss-Site";
|
||||
case KnownSystem.VideoCD:
|
||||
return "Video CD";
|
||||
|
||||
#endregion
|
||||
|
||||
case KnownSystem.NONE:
|
||||
default:
|
||||
return "Unknown";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
953
Utilities/DumpInformation.cs
Normal file
953
Utilities/DumpInformation.cs
Normal file
@@ -0,0 +1,953 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace DICUI.Utilities
|
||||
{
|
||||
public static class DumpInformation
|
||||
{
|
||||
/// <summary>
|
||||
/// Attempts to find the first track of a dumped disc based on the inputs
|
||||
/// </summary>
|
||||
/// <param name="outputDirectory">Base directory to use</param>
|
||||
/// <param name="outputFilename">Base filename to use</param>
|
||||
/// <returns>Proper path to first track, null on error</returns>
|
||||
/// <remarks>
|
||||
/// By default, this assumes that the outputFilename doesn't contain a proper path, and just a name.
|
||||
/// This can lead to a situation where the outputFilename contains a path, but only the filename gets
|
||||
/// used in the processing and can lead to a "false null" return
|
||||
/// </remarks>
|
||||
public static string GetFirstTrack(string outputDirectory, string outputFilename)
|
||||
{
|
||||
// First, sanitized the output filename to strip off any potential extension
|
||||
outputFilename = Path.GetFileNameWithoutExtension(outputFilename);
|
||||
|
||||
// Go through all standard output naming schemes
|
||||
string combinedBase = Path.Combine(outputDirectory, outputFilename);
|
||||
if (File.Exists(combinedBase + ".bin"))
|
||||
{
|
||||
return combinedBase + ".bin";
|
||||
}
|
||||
if (File.Exists(combinedBase + " (Track 1).bin"))
|
||||
{
|
||||
return combinedBase + " (Track 1).bin";
|
||||
}
|
||||
if (File.Exists(combinedBase + " (Track 01).bin"))
|
||||
{
|
||||
return combinedBase + " (Track 01).bin";
|
||||
}
|
||||
if (File.Exists(combinedBase + ".iso"))
|
||||
{
|
||||
return Path.Combine(combinedBase + ".iso");
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensures that all required output files have been created
|
||||
/// </summary>
|
||||
/// <param name="outputDirectory">Base directory to use</param>
|
||||
/// <param name="outputFilename">Base filename to use</param>
|
||||
/// <param name="type">DiscType value to check</param>
|
||||
/// <returns></returns>
|
||||
public static bool FoundAllFiles(string outputDirectory, string outputFilename, DiscType? type)
|
||||
{
|
||||
// First, sanitized the output filename to strip off any potential extension
|
||||
outputFilename = Path.GetFileNameWithoutExtension(outputFilename);
|
||||
|
||||
// Now ensure that all required files exist
|
||||
string combinedBase = Path.Combine(outputDirectory, outputFilename);
|
||||
switch (type)
|
||||
{
|
||||
case DiscType.CD:
|
||||
case DiscType.GDROM: // TODO: Verify GD-ROM outputs this
|
||||
return File.Exists(combinedBase + ".c2")
|
||||
&& File.Exists(combinedBase + ".ccd")
|
||||
&& File.Exists(combinedBase + ".cue")
|
||||
&& File.Exists(combinedBase + ".dat")
|
||||
&& File.Exists(combinedBase + ".img")
|
||||
&& File.Exists(combinedBase + ".img_EdcEcc.txt")
|
||||
&& File.Exists(combinedBase + ".scm")
|
||||
&& File.Exists(combinedBase + ".sub")
|
||||
&& File.Exists(combinedBase + "_c2Error.txt")
|
||||
&& File.Exists(combinedBase + "_cmd.txt")
|
||||
&& File.Exists(combinedBase + "_disc.txt")
|
||||
&& File.Exists(combinedBase + "_drive.txt")
|
||||
&& File.Exists(combinedBase + "_img.cue")
|
||||
&& File.Exists(combinedBase + "_mainError.txt")
|
||||
&& File.Exists(combinedBase + "_mainInfo.txt")
|
||||
&& File.Exists(combinedBase + "_subError.txt")
|
||||
&& File.Exists(combinedBase + "_subInfo.txt")
|
||||
&& File.Exists(combinedBase + "_subIntention.txt")
|
||||
&& File.Exists(combinedBase + "_subReadable.txt")
|
||||
&& File.Exists(combinedBase + "_volDesc.txt");
|
||||
case DiscType.DVD5:
|
||||
case DiscType.DVD9:
|
||||
case DiscType.HDDVD:
|
||||
case DiscType.BD25:
|
||||
case DiscType.BD50:
|
||||
case DiscType.GameCubeGameDisc:
|
||||
case DiscType.WiiOpticalDisc:
|
||||
case DiscType.WiiUOpticalDisc:
|
||||
case DiscType.UMD:
|
||||
return File.Exists(combinedBase + ".dat")
|
||||
&& File.Exists(combinedBase + "_cmd.txt")
|
||||
&& File.Exists(combinedBase + "_disc.txt")
|
||||
&& File.Exists(combinedBase + "_drive.txt")
|
||||
&& File.Exists(combinedBase + "_mainError.txt")
|
||||
&& File.Exists(combinedBase + "_mainInfo.txt")
|
||||
&& File.Exists(combinedBase + "_volDesc.txt");
|
||||
case DiscType.Floppy:
|
||||
return File.Exists(combinedBase + ".dat")
|
||||
&& File.Exists(combinedBase + "_cmd.txt")
|
||||
&& File.Exists(combinedBase + "_disc.txt");
|
||||
default:
|
||||
// Non-dumping commands will usually produce no output, so this is irrelevant
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extract all of the possible information from a given input combination
|
||||
/// </summary>
|
||||
/// <param name="outputDirectory">Base directory to use</param>
|
||||
/// <param name="outputFilename">Base filename to use</param>
|
||||
/// <param name="sys">KnownSystem value to check</param>
|
||||
/// <param name="type">DiscType value to check</param>
|
||||
/// <param name="driveLetter">Drive letter to check</param>
|
||||
/// <returns>Dictionary containing mapped output values, null on error</returns>
|
||||
/// <remarks>TODO: Make sure that all special formats are accounted for</remarks>
|
||||
public static Dictionary<string, string> ExtractOutputInformation(string outputDirectory, string outputFilename, KnownSystem? sys, DiscType? type, char driveLetter)
|
||||
{
|
||||
// First, sanitized the output filename to strip off any potential extension
|
||||
outputFilename = Path.GetFileNameWithoutExtension(outputFilename);
|
||||
|
||||
// First, we want to check that all of the relevant files are there
|
||||
if (!FoundAllFiles(outputDirectory, outputFilename, type))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Create the output dictionary with all user-inputted values by default
|
||||
string combinedBase = Path.Combine(outputDirectory, outputFilename);
|
||||
Dictionary<string, string> mappings = new Dictionary<string, string>
|
||||
{
|
||||
{ Template.TitleField, Template.RequiredValue },
|
||||
{ Template.DiscNumberField, Template.OptionalValue },
|
||||
{ Template.DiscTitleField, Template.OptionalValue },
|
||||
{ Template.CategoryField, "Games" },
|
||||
{ Template.RegionField, "World (CHANGE THIS)" },
|
||||
{ Template.LanguagesField, "Klingon (CHANGE THIS)" },
|
||||
{ Template.DiscSerialField, Template.RequiredIfExistsValue },
|
||||
{ Template.BarcodeField, Template.OptionalValue},
|
||||
{ Template.CommentsField, Template.OptionalValue },
|
||||
{ Template.ContentsField, Template.OptionalValue },
|
||||
{ Template.VersionField, Template.RequiredIfExistsValue },
|
||||
{ Template.EditionField, "Original (VERIFY THIS)" },
|
||||
{ Template.DATField, GetDatfile(combinedBase + ".dat") },
|
||||
};
|
||||
|
||||
// Now we want to do a check by DiscType and extract all required info
|
||||
switch (type)
|
||||
{
|
||||
case DiscType.CD:
|
||||
case DiscType.GDROM: // TODO: Verify GD-ROM outputs this
|
||||
mappings[Template.MasteringRingField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.MasteringSIDField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.MouldSIDField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.AdditionalMouldField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.ToolstampField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.PVDField] = GetPVD(combinedBase + "_mainInfo.txt");
|
||||
mappings[Template.ErrorCountField] = GetErrorCount(combinedBase + ".img_EdcEcc.txt",
|
||||
combinedBase + "_c2Error.txt",
|
||||
combinedBase + "_mainError.txt").ToString();
|
||||
mappings[Template.CuesheetField] = GetFullFile(combinedBase + ".cue");
|
||||
mappings[Template.WriteOffsetField] = GetWriteOffset(combinedBase + "_disc.txt");
|
||||
|
||||
// System-specific options
|
||||
switch (sys)
|
||||
{
|
||||
case KnownSystem.AppleMacintosh:
|
||||
case KnownSystem.IBMPCCompatible:
|
||||
mappings[Template.ISBNField] = Template.OptionalValue;
|
||||
mappings[Template.CopyProtectionField] = Template.RequiredIfExistsValue;
|
||||
if (File.Exists(combinedBase + "_subIntention.txt"))
|
||||
{
|
||||
FileInfo fi = new FileInfo(combinedBase + "_subIntention.txt");
|
||||
if (fi.Length > 0)
|
||||
{
|
||||
mappings[Template.SubIntentionField] = GetFullFile(combinedBase + "_subIntention.txt");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case KnownSystem.SegaSaturn:
|
||||
mappings[Template.SaturnHeaderField] = GetSaturnHeader(GetFirstTrack(outputDirectory, outputFilename)).ToString();
|
||||
if (GetSaturnBuildInfo(mappings[Template.SaturnHeaderField], out string serial, out string version, out string buildDate))
|
||||
{
|
||||
mappings[Template.DiscSerialField] = serial;
|
||||
mappings[Template.VersionField] = version;
|
||||
mappings[Template.SaturnBuildDateField] = buildDate;
|
||||
}
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation:
|
||||
mappings[Template.PlaystationEXEDateField] = GetPlayStationEXEDate(driveLetter);
|
||||
mappings[Template.PlayStationEDCField] = Template.YesNoValue;
|
||||
mappings[Template.PlayStationAntiModchipField] = Template.YesNoValue;
|
||||
mappings[Template.PlayStationLibCryptField] = Template.YesNoValue;
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation2:
|
||||
mappings[Template.PlaystationEXEDateField] = GetPlayStationEXEDate(driveLetter);
|
||||
mappings[Template.VersionField] = GetPlayStation2Version(driveLetter);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case DiscType.DVD5:
|
||||
case DiscType.HDDVD:
|
||||
case DiscType.BD25:
|
||||
mappings[Template.MasteringRingField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.MasteringSIDField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.MouldSIDField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.AdditionalMouldField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.ToolstampField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.PVDField] = GetPVD(combinedBase + "_mainInfo.txt");
|
||||
|
||||
// System-specific options
|
||||
switch (sys)
|
||||
{
|
||||
case KnownSystem.AppleMacintosh:
|
||||
case KnownSystem.IBMPCCompatible:
|
||||
mappings[Template.ISBNField] = Template.OptionalValue;
|
||||
mappings[Template.CopyProtectionField] = Template.RequiredIfExistsValue;
|
||||
if (File.Exists(combinedBase + "_subIntention.txt"))
|
||||
{
|
||||
FileInfo fi = new FileInfo(combinedBase + "_subIntention.txt");
|
||||
if (fi.Length > 0)
|
||||
{
|
||||
mappings[Template.SubIntentionField] = GetFullFile(combinedBase + "_subIntention.txt");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation2:
|
||||
mappings[Template.PlaystationEXEDateField] = GetPlayStationEXEDate(driveLetter);
|
||||
mappings[Template.VersionField] = GetPlayStation2Version(driveLetter);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
case DiscType.DVD9:
|
||||
case DiscType.BD50:
|
||||
mappings["Outer " + Template.MasteringRingField] = Template.RequiredIfExistsValue;
|
||||
mappings["Inner " + Template.MasteringRingField] = Template.RequiredIfExistsValue;
|
||||
mappings["Outer " + Template.MasteringSIDField] = Template.RequiredIfExistsValue;
|
||||
mappings["Inner " + Template.MasteringSIDField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.MouldSIDField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.AdditionalMouldField] = Template.RequiredIfExistsValue;
|
||||
mappings["Outer " + Template.ToolstampField] = Template.RequiredIfExistsValue;
|
||||
mappings["Inner " + Template.ToolstampField] = Template.RequiredIfExistsValue;
|
||||
mappings[Template.PVDField] = GetPVD(combinedBase + "_mainInfo.txt");
|
||||
mappings[Template.LayerbreakField] = GetLayerbreak(combinedBase + "_disc.txt");
|
||||
|
||||
// System-specific options
|
||||
switch (sys)
|
||||
{
|
||||
case KnownSystem.AppleMacintosh:
|
||||
case KnownSystem.IBMPCCompatible:
|
||||
mappings[Template.ISBNField] = Template.OptionalValue;
|
||||
mappings[Template.CopyProtectionField] = Template.RequiredIfExistsValue;
|
||||
if (File.Exists(combinedBase + "_subIntention.txt"))
|
||||
{
|
||||
FileInfo fi = new FileInfo(combinedBase + "_subIntention.txt");
|
||||
if (fi.Length > 0)
|
||||
{
|
||||
mappings[Template.SubIntentionField] = GetFullFile(combinedBase + "_subIntention.txt");
|
||||
}
|
||||
}
|
||||
break;
|
||||
case KnownSystem.MicrosoftXBOX:
|
||||
case KnownSystem.MicrosoftXBOX360XDG2:
|
||||
case KnownSystem.MicrosoftXBOX360XDG3:
|
||||
if (GetXBOXAuxInfo(combinedBase + "_disc.txt", out string dmihash, out string pfihash, out string sshash, out string ss))
|
||||
{
|
||||
mappings[Template.XBOXDMIHash] = dmihash;
|
||||
mappings[Template.XBOXPFIHash] = pfihash;
|
||||
mappings[Template.XBOXSSHash] = sshash;
|
||||
mappings[Template.XBOXSSRanges] = ss;
|
||||
}
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation2:
|
||||
mappings[Template.PlaystationEXEDateField] = GetPlayStationEXEDate(driveLetter);
|
||||
mappings[Template.VersionField] = GetPlayStation2Version(driveLetter);
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
return mappings;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the full lines from the input file, if possible
|
||||
/// </summary>
|
||||
/// <param name="filename">file location</param>
|
||||
/// <returns>Full text of the file, null on error</returns>
|
||||
private static string GetFullFile(string filename)
|
||||
{
|
||||
// If the file doesn't exist, we can't get info from it
|
||||
if (!File.Exists(filename))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return string.Join("\n", File.ReadAllLines(filename));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the proper datfile from the input file, if possible
|
||||
/// </summary>
|
||||
/// <param name="dat">.dat file location</param>
|
||||
/// <returns>Relevant pieces of the datfile, null on error</returns>
|
||||
private static string GetDatfile(string dat)
|
||||
{
|
||||
// If the file doesn't exist, we can't get info from it
|
||||
if (!File.Exists(dat))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
using (StreamReader sr = File.OpenText(dat))
|
||||
{
|
||||
try
|
||||
{
|
||||
// Make sure this file is a .dat
|
||||
if (sr.ReadLine() != "<?xml version=\"1.0\" encoding=\"UTF-8\"?>")
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (sr.ReadLine() != "<!DOCTYPE datafile PUBLIC \"-//Logiqx//DTD ROM Management Datafile//EN\" \"http://www.logiqx.com/Dats/datafile.dtd\">")
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Fast forward to the rom lines
|
||||
while (!sr.ReadLine().TrimStart().StartsWith("<game")) ;
|
||||
sr.ReadLine(); // <category>Games</category>
|
||||
sr.ReadLine(); // <description>Plextor</description>
|
||||
|
||||
// Now that we're at the relevant entries, read each line in and concatenate
|
||||
string pvd = "", line = sr.ReadLine().Trim();
|
||||
while (line.StartsWith("<rom"))
|
||||
{
|
||||
pvd += line + "\n";
|
||||
line = sr.ReadLine().Trim();
|
||||
}
|
||||
|
||||
return pvd.TrimEnd('\n');
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the exception is right now
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the detected error count from the input files, if possible
|
||||
/// </summary>
|
||||
/// <param name="edcecc">.img_EdcEcc.txt file location</param>
|
||||
/// <param name="c2Error">_c2Error.txt file location</param>
|
||||
/// <param name="mainError">_mainError.txt file location</param>
|
||||
/// <returns>Error count if possible, -1 on error</returns>
|
||||
private static long GetErrorCount(string edcecc, string c2Error, string mainError)
|
||||
{
|
||||
// If one of the files doesn't exist, we can't get info from them
|
||||
if (!File.Exists(edcecc) || !File.Exists(c2Error) || !File.Exists(mainError))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// First off, if the mainError file has any contents, we have an uncorrectable error
|
||||
if (new FileInfo(mainError).Length > 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// First line of defense is the EdcEcc error file
|
||||
using (StreamReader sr = File.OpenText(edcecc))
|
||||
{
|
||||
try
|
||||
{
|
||||
// Fast forward to the PVD
|
||||
string line = sr.ReadLine();
|
||||
while (!line.StartsWith("[NO ERROR]")
|
||||
&& !line.StartsWith("Total errors:"))
|
||||
{
|
||||
line = sr.ReadLine();
|
||||
}
|
||||
|
||||
// Now that we're at the error line, determine what the value should be
|
||||
if (line.StartsWith("[NO ERROR]"))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
else if (line.StartsWith("Total errors:"))
|
||||
{
|
||||
return Int64.Parse(line.Remove(0, 14));
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the exception is right now
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the layerbreak from the input file, if possible
|
||||
/// </summary>
|
||||
/// <param name="disc">_disc.txt file location</param>
|
||||
/// <returns>Layerbreak if possible, null on error</returns>
|
||||
private static string GetLayerbreak(string disc)
|
||||
{
|
||||
// If the file doesn't exist, we can't get info from it
|
||||
if (!File.Exists(disc))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
using (StreamReader sr = File.OpenText(disc))
|
||||
{
|
||||
try
|
||||
{
|
||||
// Make sure this file is a _disc.txt
|
||||
if (sr.ReadLine() != "========== DiscStructure ==========")
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Fast forward to the layerbreak
|
||||
while (!sr.ReadLine().Trim().StartsWith("EndDataSector")) ;
|
||||
|
||||
// Now that we're at the layerbreak line, attempt to get the decimal version
|
||||
return sr.ReadLine().Split(' ')[1];
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the exception is right now
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the PVD from the input file, if possible
|
||||
/// </summary>
|
||||
/// <param name="mainInfo">_mainInfo.txt file location</param>
|
||||
/// <returns>Newline-deliminated PVD if possible, null on error</returns>
|
||||
private static string GetPVD(string mainInfo)
|
||||
{
|
||||
// If the file doesn't exist, we can't get info from it
|
||||
if (!File.Exists(mainInfo))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
using (StreamReader sr = File.OpenText(mainInfo))
|
||||
{
|
||||
try
|
||||
{
|
||||
// Make sure this file is a _mainInfo.txt
|
||||
if (sr.ReadLine() != "========== LBA[000016, 0x00010]: Main Channel ==========")
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Fast forward to the PVD
|
||||
while (!sr.ReadLine().StartsWith("0310")) ;
|
||||
|
||||
// Now that we're at the PVD, read each line in and concatenate
|
||||
string pvd = sr.ReadLine() + "\n"; // 0320
|
||||
pvd += sr.ReadLine() + "\n"; // 0330
|
||||
pvd += sr.ReadLine() + "\n"; // 0340
|
||||
pvd += sr.ReadLine() + "\n"; // 0350
|
||||
pvd += sr.ReadLine() + "\n"; // 0360
|
||||
pvd += sr.ReadLine() + "\n"; // 0370
|
||||
|
||||
return pvd;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the exception is right now
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the EXE date from a PlayStation disc, if possible
|
||||
/// </summary>
|
||||
/// <param name="driveLetter">Drive letter to use to check</param>
|
||||
/// <returns>EXE date in "yyyy-mm-dd" format if possible, null on error</returns>
|
||||
private static string GetPlayStationEXEDate(char driveLetter)
|
||||
{
|
||||
// If the folder no longer exists, we can't do this part
|
||||
string drivePath = driveLetter + ":\\";
|
||||
if (!Directory.Exists(drivePath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// If we can't find SYSTEM.CNF, we don't have a PlayStation disc
|
||||
string systemCnfPath = Path.Combine(drivePath, "SYSTEM.CNF");
|
||||
if (!File.Exists(systemCnfPath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Let's try reading SYSTEM.CNF to find the "BOOT" value
|
||||
string exeName = null;
|
||||
try
|
||||
{
|
||||
using (StreamReader sr = File.OpenText(systemCnfPath))
|
||||
{
|
||||
// Not assuming proper ordering, just in case
|
||||
string line = sr.ReadLine();
|
||||
while (!line.StartsWith("BOOT"))
|
||||
{
|
||||
line = sr.ReadLine();
|
||||
}
|
||||
|
||||
// Once it finds the "BOOT" line, extract the name
|
||||
exeName = Regex.Match(line, @"BOOT.? = cdrom.?:\\(.*?);.*").Groups[1].Value;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the error was
|
||||
return null;
|
||||
}
|
||||
|
||||
// Now that we have the EXE name, try to get the fileinfo for it
|
||||
string exePath = Path.Combine(drivePath, exeName);
|
||||
if (!File.Exists(exePath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
FileInfo fi = new FileInfo(exePath);
|
||||
return fi.LastWriteTimeUtc.ToString("yyyy-MM-dd");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the version from a PlayStation 2 disc, if possible
|
||||
/// </summary>
|
||||
/// <param name="driveLetter">Drive letter to use to check</param>
|
||||
/// <returns>Game version if possible, null on error</returns>
|
||||
private static string GetPlayStation2Version(char driveLetter)
|
||||
{
|
||||
// If the folder no longer exists, we can't do this part
|
||||
string drivePath = driveLetter + ":\\";
|
||||
if (!Directory.Exists(drivePath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// If we can't find SYSTEM.CNF, we don't have a PlayStation disc
|
||||
string systemCnfPath = Path.Combine(drivePath, "SYSTEM.CNF");
|
||||
if (!File.Exists(systemCnfPath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Let's try reading SYSTEM.CNF to find the "VER" value
|
||||
try
|
||||
{
|
||||
using (StreamReader sr = File.OpenText(systemCnfPath))
|
||||
{
|
||||
// Not assuming proper ordering, just in case
|
||||
string line = sr.ReadLine();
|
||||
while (!line.StartsWith("VER"))
|
||||
{
|
||||
line = sr.ReadLine();
|
||||
}
|
||||
|
||||
// Once it finds the "VER" line, extract the version
|
||||
return Regex.Match(line, @"VER = (.*)").Groups[1].Value;
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the error was
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the header from a Saturn disc, if possible
|
||||
/// </summary>
|
||||
/// <param name="firstTrackPath">Path to the first track to check</param>
|
||||
/// <returns>Header as a byte array if possible, null on error</returns>
|
||||
private static string GetSaturnHeader(string firstTrackPath)
|
||||
{
|
||||
// If the file doesn't exist, we can't get the header
|
||||
if (!File.Exists(firstTrackPath))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Try to open the file and read the correct number of bytes
|
||||
try
|
||||
{
|
||||
using (BinaryReader br = new BinaryReader(File.OpenRead(firstTrackPath)))
|
||||
{
|
||||
br.ReadBytes(0x10);
|
||||
byte[] headerBytes = br.ReadBytes(0x100);
|
||||
|
||||
// Now format the bytes in a way we like
|
||||
string headerString = "";
|
||||
int ptr = 0;
|
||||
while (ptr < headerBytes.Length)
|
||||
{
|
||||
byte[] sub = new byte[16];
|
||||
Array.Copy(headerBytes, ptr, sub, 0, 16);
|
||||
headerString += ptr.ToString("X").PadLeft(4, '0') + " : "
|
||||
+ BitConverter.ToString(sub).Replace("-", " ") + " "
|
||||
+ Encoding.ASCII.GetString(sub) + "\n";
|
||||
ptr += 16;
|
||||
}
|
||||
|
||||
return headerString.TrimEnd('\n');
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the error was
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the build info from a Saturn disc, if possible
|
||||
/// </summary>
|
||||
/// <<param name="saturnHeader">String representing a formatter variant of the Saturn header</param>
|
||||
/// <returns>True on successful extraction of info, false otherwise</returns>
|
||||
private static bool GetSaturnBuildInfo(string saturnHeader, out string serial, out string version, out string date)
|
||||
{
|
||||
serial = null; version = null; date = null;
|
||||
|
||||
// If the input header is null, we can't do a thing
|
||||
if (String.IsNullOrWhiteSpace(saturnHeader))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Now read it in cutting it into lines for easier parsing
|
||||
try
|
||||
{
|
||||
string[] header = saturnHeader.Split('\n');
|
||||
string serialVersionLine = header[2].Substring(57);
|
||||
string dateLine = header[3].Substring(57);
|
||||
serial = serialVersionLine.Substring(0, 8);
|
||||
version = serialVersionLine.Substring(10, 6);
|
||||
date = dateLine.Substring(0, 8);
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the error is
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the XBOX/360 auxiliary info from the outputted files, if possible
|
||||
/// </summary>
|
||||
/// <param name="disc">_disc.txt file location</param>
|
||||
/// <returns>True on successful extraction of info, false otherwise</returns>
|
||||
private static bool GetXBOXAuxInfo(string disc, out string dmihash, out string pfihash, out string sshash, out string ss)
|
||||
{
|
||||
dmihash = null; pfihash = null; sshash = null; ss = null;
|
||||
|
||||
// If the file doesn't exist, we can't get info from it
|
||||
if (!File.Exists(disc))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
using (StreamReader sr = File.OpenText(disc))
|
||||
{
|
||||
try
|
||||
{
|
||||
// Make sure this file is a _disc.txt for XBOX
|
||||
if (sr.ReadLine() != "========== Lock state ==========")
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Fast forward to the Security Sector Ranges
|
||||
while (!sr.ReadLine().Trim().StartsWith("Number of security sector ranges:")) ;
|
||||
|
||||
// Now that we're at the ranges, read each line in and concatenate
|
||||
// TODO: Make this output like the old method (startlba-endlba)
|
||||
string line = sr.ReadLine();
|
||||
while (!line.Trim().StartsWith("========== Unlock 2 state(wxripper) =========="))
|
||||
{
|
||||
ss += line + "\n";
|
||||
line = sr.ReadLine();
|
||||
}
|
||||
|
||||
// Fast forward to the aux hashes
|
||||
while (!line.Trim().StartsWith("<rom"))
|
||||
{
|
||||
line = sr.ReadLine();
|
||||
}
|
||||
|
||||
// Read in the hashes to the proper parts
|
||||
sshash = line.Trim();
|
||||
pfihash = sr.ReadLine().Trim();
|
||||
dmihash = sr.ReadLine().Trim();
|
||||
|
||||
return true;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the exception is right now
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the write offset from the input file, if possible
|
||||
/// </summary>
|
||||
/// <param name="disc">_disc.txt file location</param>
|
||||
/// <returns>Sample write offset if possible, null on error</returns>
|
||||
private static string GetWriteOffset(string disc)
|
||||
{
|
||||
// If the file doesn't exist, we can't get info from it
|
||||
if (!File.Exists(disc))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
using (StreamReader sr = File.OpenText(disc))
|
||||
{
|
||||
try
|
||||
{
|
||||
// Make sure this file is a _disc.txt
|
||||
if (sr.ReadLine() != "========== TOC ==========")
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Fast forward to the offsets
|
||||
while (!sr.ReadLine().Trim().StartsWith("========== Offset")) ;
|
||||
sr.ReadLine(); // Combined Offset
|
||||
sr.ReadLine(); // Drive Offset
|
||||
sr.ReadLine(); // Separator line
|
||||
|
||||
// Now that we're at the offsets, attempt to get the sample offset
|
||||
return sr.ReadLine().Split(' ').LastOrDefault();
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the exception is right now
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Format the output data in a human readable way, separating each printed line into a new item in the list
|
||||
/// </summary>
|
||||
/// <param name="info">Information dictionary that should contain normalized values</param>
|
||||
/// <param name="sys">KnownSystem value to check</param>
|
||||
/// <param name="type">DiscType value to check</param>
|
||||
/// <returns>List of strings representing each line of an output file, null on error</returns>
|
||||
/// <remarks>TODO: Get full list of customizable stuff for other systems</remarks>
|
||||
public static List<string> FormatOutputData(Dictionary<string, string> info, KnownSystem? sys, DiscType? type)
|
||||
{
|
||||
// Check to see if the inputs are valid
|
||||
if (info == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
List<string> output = new List<string>();
|
||||
|
||||
output.Add(Template.TitleField + ": " + info[Template.TitleField]);
|
||||
output.Add(Template.DiscNumberField + ": " + info[Template.DiscNumberField]);
|
||||
output.Add(Template.DiscTitleField + ": " + info[Template.DiscTitleField]);
|
||||
output.Add(Template.CategoryField + ": " + info[Template.CategoryField]);
|
||||
output.Add(Template.RegionField + ": " + info[Template.RegionField]);
|
||||
output.Add(Template.LanguagesField + ": " + info[Template.LanguagesField]);
|
||||
output.Add(Template.DiscSerialField + ": " + info[Template.DiscSerialField]);
|
||||
switch (sys)
|
||||
{
|
||||
case KnownSystem.SegaSaturn:
|
||||
output.Add(Template.SaturnBuildDateField + ": " + info[Template.SaturnBuildDateField]);
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation:
|
||||
case KnownSystem.SonyPlayStation2:
|
||||
output.Add(Template.PlaystationEXEDateField + ": " + info[Template.PlaystationEXEDateField]);
|
||||
break;
|
||||
}
|
||||
output.Add("Ringcode Information:");
|
||||
switch (type)
|
||||
{
|
||||
case DiscType.CD:
|
||||
case DiscType.GDROM:
|
||||
case DiscType.DVD5:
|
||||
case DiscType.HDDVD:
|
||||
case DiscType.BD25:
|
||||
output.Add("\t" + Template.MasteringRingField + ": " + info[Template.MasteringRingField]);
|
||||
output.Add("\t" + Template.MasteringSIDField + ": " + info[Template.MasteringSIDField]);
|
||||
output.Add("\t" + Template.MouldSIDField + ": " + info[Template.MouldSIDField]);
|
||||
output.Add("\t" + Template.AdditionalMouldField + ": " + info[Template.AdditionalMouldField]);
|
||||
output.Add("\t" + Template.ToolstampField + ": " + info[Template.ToolstampField]);
|
||||
break;
|
||||
case DiscType.DVD9:
|
||||
case DiscType.BD50:
|
||||
output.Add("\tOuter " + Template.MasteringRingField + ": " + info["Outer " + Template.MasteringRingField]);
|
||||
output.Add("\tInner " + Template.MasteringRingField + ": " + info["Inner " + Template.MasteringRingField]);
|
||||
output.Add("\tOuter " + Template.MasteringSIDField + ": " + info["Outer " + Template.MasteringSIDField]);
|
||||
output.Add("\tInner " + Template.MasteringSIDField + ": " + info["Inner " + Template.MasteringSIDField]);
|
||||
output.Add("\t" + Template.MouldSIDField + ": " + info[Template.MouldSIDField]);
|
||||
output.Add("\t" + Template.AdditionalMouldField + ": " + info[Template.AdditionalMouldField]);
|
||||
output.Add("\tOuter " + Template.ToolstampField + ": " + info["Outer " + Template.ToolstampField]);
|
||||
output.Add("\tInner " + Template.ToolstampField + ": " + info["Inner " + Template.ToolstampField]);
|
||||
break;
|
||||
}
|
||||
output.Add(Template.BarcodeField + ": " + info[Template.BarcodeField]);
|
||||
switch(sys)
|
||||
{
|
||||
case KnownSystem.AppleMacintosh:
|
||||
case KnownSystem.IBMPCCompatible:
|
||||
output.Add(Template.ISBNField + ": " + info[Template.ISBNField]);
|
||||
break;
|
||||
}
|
||||
switch (type)
|
||||
{
|
||||
case DiscType.CD:
|
||||
case DiscType.GDROM:
|
||||
output.Add(Template.ErrorCountField + ": " + info[Template.ErrorCountField]);
|
||||
break;
|
||||
}
|
||||
output.Add(Template.CommentsField + ": " + info[Template.CommentsField]);
|
||||
output.Add(Template.ContentsField + ": " + info[Template.ContentsField]);
|
||||
output.Add(Template.VersionField + ": " + info[Template.VersionField]);
|
||||
output.Add(Template.EditionField + ": " + info[Template.EditionField]);
|
||||
switch (sys)
|
||||
{
|
||||
case KnownSystem.SegaSaturn:
|
||||
output.Add(Template.SaturnHeaderField + ":"); output.Add("");
|
||||
output.AddRange(info[Template.SaturnHeaderField].Split('\n')); output.Add("");
|
||||
break;
|
||||
case KnownSystem.SonyPlayStation:
|
||||
output.Add(Template.PlayStationEDCField + ": " + info[Template.PlayStationEDCField]);
|
||||
output.Add(Template.PlayStationAntiModchipField + ": " + info[Template.PlayStationAntiModchipField]);
|
||||
output.Add(Template.PlayStationLibCryptField + ": " + info[Template.PlayStationLibCryptField]);
|
||||
break;
|
||||
}
|
||||
switch (type)
|
||||
{
|
||||
case DiscType.DVD9:
|
||||
case DiscType.BD50:
|
||||
output.Add(Template.LayerbreakField + ": " + info[Template.LayerbreakField]);
|
||||
break;
|
||||
}
|
||||
output.Add(Template.PVDField + ":"); output.Add("");
|
||||
output.AddRange(info[Template.PVDField].Split('\n'));
|
||||
switch (sys)
|
||||
{
|
||||
case KnownSystem.AppleMacintosh:
|
||||
case KnownSystem.IBMPCCompatible:
|
||||
output.Add(Template.CopyProtectionField + ": " + info[Template.CopyProtectionField]); output.Add("");
|
||||
|
||||
if (info.ContainsKey(Template.SubIntentionField))
|
||||
{
|
||||
output.Add(Template.SubIntentionField + ":"); output.Add("");
|
||||
output.AddRange(info[Template.SubIntentionField].Split('\n'));
|
||||
}
|
||||
break;
|
||||
case KnownSystem.MicrosoftXBOX:
|
||||
case KnownSystem.MicrosoftXBOX360XDG2:
|
||||
case KnownSystem.MicrosoftXBOX360XDG3:
|
||||
output.Add(Template.XBOXDMIHash + ": " + info[Template.XBOXDMIHash]);
|
||||
output.Add(Template.XBOXPFIHash + ": " + info[Template.XBOXPFIHash]);
|
||||
output.Add(Template.XBOXSSHash + ": " + info[Template.XBOXSSHash]); output.Add("");
|
||||
output.Add(Template.XBOXSSRanges + ":"); output.Add("");
|
||||
output.AddRange(info[Template.XBOXSSRanges].Split('\n'));
|
||||
break;
|
||||
}
|
||||
switch (type)
|
||||
{
|
||||
case DiscType.CD:
|
||||
case DiscType.GDROM:
|
||||
output.Add(Template.CuesheetField + ":"); output.Add("");
|
||||
output.AddRange(info[Template.CuesheetField].Split('\n')); output.Add("");
|
||||
output.Add(Template.WriteOffsetField + ": " + info[Template.WriteOffsetField]); output.Add("");
|
||||
break;
|
||||
}
|
||||
output.Add(Template.DATField + ":"); output.Add("");
|
||||
output.AddRange(info[Template.DATField].Split('\n'));
|
||||
|
||||
return output;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the error is
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write the data to the output folder
|
||||
/// </summary>
|
||||
/// <param name="outputDirectory">Base directory to use</param>
|
||||
/// <param name="outputFilename">Base filename to use</param>
|
||||
/// <param name="lines">Preformatted list of lines to write out to the file</param>
|
||||
/// <returns>True on success, false on error</returns>
|
||||
public static bool WriteOutputData(string outputDirectory, string outputFilename, List<string> lines)
|
||||
{
|
||||
// Check to see if the inputs are valid
|
||||
if (lines == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
// Then, sanitized the output filename to strip off any potential extension
|
||||
outputFilename = Path.GetFileNameWithoutExtension(outputFilename);
|
||||
|
||||
// Now write out to a generic file
|
||||
try
|
||||
{
|
||||
using (StreamWriter sw = new StreamWriter(File.Open(Path.Combine(outputDirectory, "!submissionInfo.txt"), FileMode.Create, FileAccess.Write)))
|
||||
{
|
||||
foreach (string line in lines)
|
||||
{
|
||||
sw.WriteLine(line);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch
|
||||
{
|
||||
// We don't care what the error is right now
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
1157
Utilities/Validation.cs
Normal file
1157
Utilities/Validation.cs
Normal file
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user