mirror of
https://github.com/SabreTools/MPF.git
synced 2026-07-02 17:24:48 +00:00
Cleanup brigade
This commit is contained in:
@@ -149,7 +149,7 @@ x360 - Microsoft XBOX 360");
|
||||
if (((MediaType)val) == MediaType.NONE)
|
||||
continue;
|
||||
|
||||
Console.WriteLine($"{((MediaType?)val).ShortName()} - {((MediaType?)val).Name()}");
|
||||
Console.WriteLine($"{((MediaType?)val).ShortName()} - {((MediaType?)val).LongName()}");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,7 +164,7 @@ x360 - Microsoft XBOX 360");
|
||||
if (((KnownSystem)val) == KnownSystem.NONE)
|
||||
continue;
|
||||
|
||||
Console.WriteLine($"{((KnownSystem?)val).ShortName()} - {((KnownSystem?)val).Name()}");
|
||||
Console.WriteLine($"{((KnownSystem?)val).ShortName()} - {((KnownSystem?)val).LongName()}");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -63,6 +63,7 @@
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Utilities\Drive.cs" />
|
||||
<Compile Include="Web\CookieAwareWebClient.cs">
|
||||
<SubType>Component</SubType>
|
||||
</Compile>
|
||||
|
||||
@@ -34,3 +34,4 @@ using System.Runtime.InteropServices;
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.11")]
|
||||
[assembly: AssemblyFileVersion("1.11.0.0")]
|
||||
[assembly: InternalsVisibleTo("DICUI.Test")]
|
||||
|
||||
@@ -5,13 +5,47 @@ namespace DICUI.Utilities
|
||||
{
|
||||
public static class Converters
|
||||
{
|
||||
#region Cross-enumeration conversions
|
||||
|
||||
/// <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? ToKnownSystem(this DICCommand baseCommand)
|
||||
{
|
||||
switch (baseCommand)
|
||||
{
|
||||
case DICCommand.Audio:
|
||||
return KnownSystem.AudioCD;
|
||||
case DICCommand.CompactDisc:
|
||||
case DICCommand.Data:
|
||||
case DICCommand.DigitalVideoDisc:
|
||||
case DICCommand.Floppy:
|
||||
return KnownSystem.IBMPCCompatible;
|
||||
case DICCommand.GDROM:
|
||||
case DICCommand.Swap:
|
||||
return KnownSystem.SegaDreamcast;
|
||||
case DICCommand.BluRay:
|
||||
return KnownSystem.SonyPlayStation3;
|
||||
case DICCommand.XBOX:
|
||||
case DICCommand.XBOXSwap:
|
||||
return KnownSystem.MicrosoftXBOX;
|
||||
case DICCommand.XGD2Swap:
|
||||
case DICCommand.XGD3Swap:
|
||||
return KnownSystem.MicrosoftXBOX360;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the 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)
|
||||
public static MediaType? ToMediaType(this DICCommand baseCommand)
|
||||
{
|
||||
switch (baseCommand)
|
||||
{
|
||||
@@ -40,32 +74,113 @@ namespace DICUI.Utilities
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the most common known system for a given MediaType
|
||||
/// Convert IMAPI physical media type to a MediaType
|
||||
/// </summary>
|
||||
/// <param name="baseCommand">DICCommand value to check</param>
|
||||
/// <returns>KnownSystem if possible, null on error</returns>
|
||||
public static KnownSystem? BaseCommandToKnownSystem(DICCommand baseCommand)
|
||||
/// <param name="type">IMAPI_MEDIA_PHYSICAL_TYPE value to check</param>
|
||||
/// <returns>MediaType if possible, null on error</returns>
|
||||
public static MediaType? ToMediaType(IMAPI_MEDIA_PHYSICAL_TYPE type)
|
||||
{
|
||||
switch (baseCommand)
|
||||
switch (type)
|
||||
{
|
||||
case DICCommand.Audio:
|
||||
return KnownSystem.AudioCD;
|
||||
case DICCommand.CompactDisc:
|
||||
case DICCommand.Data:
|
||||
case DICCommand.DigitalVideoDisc:
|
||||
case DICCommand.Floppy:
|
||||
return KnownSystem.IBMPCCompatible;
|
||||
case DICCommand.GDROM:
|
||||
case DICCommand.Swap:
|
||||
return KnownSystem.SegaDreamcast;
|
||||
case DICCommand.BluRay:
|
||||
return KnownSystem.SonyPlayStation3;
|
||||
case DICCommand.XBOX:
|
||||
case DICCommand.XBOXSwap:
|
||||
return KnownSystem.MicrosoftXBOX;
|
||||
case DICCommand.XGD2Swap:
|
||||
case DICCommand.XGD3Swap:
|
||||
return KnownSystem.MicrosoftXBOX360;
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_UNKNOWN:
|
||||
return MediaType.NONE;
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_CDROM:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_CDR:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_CDRW:
|
||||
return MediaType.CDROM;
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDROM:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDRAM:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDPLUSR:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDPLUSRW:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDPLUSR_DUALLAYER:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDDASHR:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDDASHRW:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDDASHR_DUALLAYER:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DISK:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDPLUSRW_DUALLAYER:
|
||||
return MediaType.DVD;
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_HDDVDROM:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_HDDVDR:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_HDDVDRAM:
|
||||
return MediaType.HDDVD;
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_BDROM:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_BDR:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_BDRE:
|
||||
return MediaType.BluRay;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the default extension for a given disc type
|
||||
/// </summary>
|
||||
/// <param name="type">MediaType value to check</param>
|
||||
/// <returns>Valid extension (with leading '.'), null on error</returns>
|
||||
public static string Extension(this MediaType? type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
case MediaType.GDROM:
|
||||
case MediaType.Cartridge:
|
||||
return ".bin";
|
||||
case MediaType.DVD:
|
||||
case MediaType.HDDVD:
|
||||
case MediaType.BluRay:
|
||||
case MediaType.NintendoWiiOpticalDisc:
|
||||
case MediaType.UMD:
|
||||
return ".iso";
|
||||
case MediaType.LaserDisc:
|
||||
case MediaType.NintendoGameCubeGameDisc:
|
||||
return ".raw";
|
||||
case MediaType.NintendoWiiUOpticalDisc:
|
||||
return ".wud";
|
||||
case MediaType.FloppyDisk:
|
||||
return ".img";
|
||||
case MediaType.Cassette:
|
||||
return ".wav";
|
||||
case MediaType.NONE:
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Convert to Long Name
|
||||
|
||||
/// <summary>
|
||||
/// Get the string representation of the Category enum values
|
||||
/// </summary>
|
||||
/// <param name="category">Category value to convert</param>
|
||||
/// <returns>Short string representing the value, if possible</returns>
|
||||
public static string LongName(this Category? category)
|
||||
{
|
||||
switch (category)
|
||||
{
|
||||
case Category.Games:
|
||||
return "Games";
|
||||
case Category.Demos:
|
||||
return "Demos";
|
||||
case Category.Video:
|
||||
return "Video";
|
||||
case Category.Audio:
|
||||
return "Audio";
|
||||
case Category.Multimedia:
|
||||
return "Multimedia";
|
||||
case Category.Applications:
|
||||
return "Applications";
|
||||
case Category.Coverdiscs:
|
||||
return "Coverdiscs";
|
||||
case Category.Educational:
|
||||
return "Educational";
|
||||
case Category.BonusDiscs:
|
||||
return "Bonus Discs";
|
||||
case Category.Preproduction:
|
||||
return "Preproduction";
|
||||
case Category.AddOns:
|
||||
return "Add-Ons";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
@@ -76,7 +191,7 @@ namespace DICUI.Utilities
|
||||
/// </summary>
|
||||
/// <param name="command">DICCommand value to convert</param>
|
||||
/// <returns>String representing the value, if possible</returns>
|
||||
public static string DICCommandToString(DICCommand command)
|
||||
public static string LongName(this DICCommand command)
|
||||
{
|
||||
switch (command)
|
||||
{
|
||||
@@ -134,7 +249,7 @@ namespace DICUI.Utilities
|
||||
/// </summary>
|
||||
/// <param name="command">DICFlag value to convert</param>
|
||||
/// <returns>String representing the value, if possible</returns>
|
||||
public static string DICFlagToString(DICFlag flag)
|
||||
public static string LongName(this DICFlag flag)
|
||||
{
|
||||
switch (flag)
|
||||
{
|
||||
@@ -193,123 +308,12 @@ namespace DICUI.Utilities
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Convert IMAPI physical media type to a MediaType
|
||||
/// </summary>
|
||||
/// <param name="type">IMAPI_MEDIA_PHYSICAL_TYPE value to check</param>
|
||||
/// <returns>MediaType if possible, null on error</returns>
|
||||
public static MediaType? IMAPIDiskTypeToMediaType(IMAPI_MEDIA_PHYSICAL_TYPE type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_UNKNOWN:
|
||||
return MediaType.NONE;
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_CDROM:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_CDR:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_CDRW:
|
||||
return MediaType.CDROM;
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDROM:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDRAM:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDPLUSR:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDPLUSRW:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDPLUSR_DUALLAYER:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDDASHR:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDDASHRW:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDDASHR_DUALLAYER:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DISK:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_DVDPLUSRW_DUALLAYER:
|
||||
return MediaType.DVD;
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_HDDVDROM:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_HDDVDR:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_HDDVDRAM:
|
||||
return MediaType.HDDVD;
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_BDROM:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_BDR:
|
||||
case IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_BDRE:
|
||||
return MediaType.BluRay;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the default extension for a given disc type
|
||||
/// </summary>
|
||||
/// <param name="type">MediaType value to check</param>
|
||||
/// <returns>Valid extension (with leading '.'), null on error</returns>
|
||||
public static string MediaTypeToExtension(MediaType? type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
case MediaType.CDROM:
|
||||
case MediaType.GDROM:
|
||||
case MediaType.Cartridge:
|
||||
return ".bin";
|
||||
case MediaType.DVD:
|
||||
case MediaType.HDDVD:
|
||||
case MediaType.BluRay:
|
||||
case MediaType.NintendoWiiOpticalDisc:
|
||||
case MediaType.UMD:
|
||||
return ".iso";
|
||||
case MediaType.LaserDisc:
|
||||
case MediaType.NintendoGameCubeGameDisc:
|
||||
return ".raw";
|
||||
case MediaType.NintendoWiiUOpticalDisc:
|
||||
return ".wud";
|
||||
case MediaType.FloppyDisk:
|
||||
return ".img";
|
||||
case MediaType.Cassette:
|
||||
return ".wav";
|
||||
case MediaType.NONE:
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
#region Convert to Long Name
|
||||
|
||||
/// <summary>
|
||||
/// Get the string representation of the Category enum values
|
||||
/// </summary>
|
||||
/// <param name="category">Category value to convert</param>
|
||||
/// <returns>Short string representing the value, if possible</returns>
|
||||
public static string LongName(Category? category)
|
||||
{
|
||||
switch (category)
|
||||
{
|
||||
case Category.Games:
|
||||
return "Games";
|
||||
case Category.Demos:
|
||||
return "Demos";
|
||||
case Category.Video:
|
||||
return "Video";
|
||||
case Category.Audio:
|
||||
return "Audio";
|
||||
case Category.Multimedia:
|
||||
return "Multimedia";
|
||||
case Category.Applications:
|
||||
return "Applications";
|
||||
case Category.Coverdiscs:
|
||||
return "Coverdiscs";
|
||||
case Category.Educational:
|
||||
return "Educational";
|
||||
case Category.BonusDiscs:
|
||||
return "Bonus Discs";
|
||||
case Category.Preproduction:
|
||||
return "Preproduction";
|
||||
case Category.AddOns:
|
||||
return "Add-Ons";
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/// <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 LongName(KnownSystem? sys)
|
||||
public static string LongName(this KnownSystem? sys)
|
||||
{
|
||||
switch (sys)
|
||||
{
|
||||
@@ -563,12 +567,38 @@ namespace DICUI.Utilities
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the string representation of the KnownSystemCategory enum values
|
||||
/// </summary>
|
||||
/// <param name="category">KnownSystemCategory value to convert</param>
|
||||
/// <returns>String representing the value, if possible</returns>
|
||||
public static string LongName(this KnownSystemCategory? category)
|
||||
{
|
||||
switch (category)
|
||||
{
|
||||
case KnownSystemCategory.Arcade:
|
||||
return "Arcade";
|
||||
case KnownSystemCategory.Computer:
|
||||
return "Computers";
|
||||
case KnownSystemCategory.DiscBasedConsole:
|
||||
return "Disc-Based Consoles";
|
||||
case KnownSystemCategory.OtherConsole:
|
||||
return "Other Consoles";
|
||||
case KnownSystemCategory.Other:
|
||||
return "Other";
|
||||
case KnownSystemCategory.Custom:
|
||||
return "Custom";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the string representation of the Language enum values
|
||||
/// </summary>
|
||||
/// <param name="lang">Language value to convert</param>
|
||||
/// <returns>String representing the value, if possible</returns>
|
||||
public static string LongName(Language? lang)
|
||||
public static string LongName(this Language? lang)
|
||||
{
|
||||
switch (lang)
|
||||
{
|
||||
@@ -654,7 +684,7 @@ namespace DICUI.Utilities
|
||||
/// </summary>
|
||||
/// <param name="type">MediaType value to convert</param>
|
||||
/// <returns>String representing the value, if possible</returns>
|
||||
public static string LongName(MediaType? type)
|
||||
public static string LongName(this MediaType? type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -744,7 +774,7 @@ namespace DICUI.Utilities
|
||||
/// </summary>
|
||||
/// <param name="region">Region value to convert</param>
|
||||
/// <returns>String representing the value, if possible</returns>
|
||||
public static string LongName(Region? region)
|
||||
public static string LongName(this Region? region)
|
||||
{
|
||||
switch (region)
|
||||
{
|
||||
@@ -876,7 +906,7 @@ namespace DICUI.Utilities
|
||||
/// </summary>
|
||||
/// <param name="yesno">YesNo value to convert</param>
|
||||
/// <returns>String representing the value, if possible</returns>
|
||||
public static string LongName(YesNo yesno)
|
||||
public static string LongName(this YesNo yesno)
|
||||
{
|
||||
switch(yesno)
|
||||
{
|
||||
@@ -899,7 +929,7 @@ namespace DICUI.Utilities
|
||||
/// </summary>
|
||||
/// <param name="sys">KnownSystem value to convert</param>
|
||||
/// <returns>Short string representing the value, if possible</returns>
|
||||
public static string ShortName(KnownSystem? sys)
|
||||
public static string ShortName(this KnownSystem? sys)
|
||||
{
|
||||
switch (sys)
|
||||
{
|
||||
@@ -1158,7 +1188,7 @@ namespace DICUI.Utilities
|
||||
/// </summary>
|
||||
/// <param name="lang">Language value to convert</param>
|
||||
/// <returns>Short string representing the value, if possible</returns>
|
||||
public static string ShortName(Language? lang)
|
||||
public static string ShortName(this Language? lang)
|
||||
{
|
||||
switch (lang)
|
||||
{
|
||||
@@ -1244,7 +1274,7 @@ namespace DICUI.Utilities
|
||||
/// </summary>
|
||||
/// <param name="type">MediaType value to convert</param>
|
||||
/// <returns>Short string representing the value, if possible</returns>
|
||||
public static string ShortName(MediaType? type)
|
||||
public static string ShortName(this MediaType? type)
|
||||
{
|
||||
switch (type)
|
||||
{
|
||||
@@ -1334,7 +1364,7 @@ namespace DICUI.Utilities
|
||||
/// </summary>
|
||||
/// <param name="region">Region value to convert</param>
|
||||
/// <returns>Short string representing the value, if possible</returns>
|
||||
public static string ShortName(Region? region)
|
||||
public static string ShortName(this Region? region)
|
||||
{
|
||||
switch (region)
|
||||
{
|
||||
|
||||
52
DICUI.Library/Utilities/Drive.cs
Normal file
52
DICUI.Library/Utilities/Drive.cs
Normal file
@@ -0,0 +1,52 @@
|
||||
namespace DICUI.Utilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents information for a single drive
|
||||
/// </summary>
|
||||
public class Drive
|
||||
{
|
||||
/// <summary>
|
||||
/// Windows drive letter
|
||||
/// </summary>
|
||||
public char Letter { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents if it is a floppy drive
|
||||
/// </summary>
|
||||
public bool IsFloppy { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Media label as read by Windows
|
||||
/// </summary>
|
||||
public string VolumeLabel { get; private set; }
|
||||
|
||||
/// <summary>
|
||||
/// Represents if Windows has marked the drive as active
|
||||
/// </summary>
|
||||
public bool MarkedActive { get; private set; }
|
||||
|
||||
private Drive(char letter, string volumeLabel, bool isFloppy, bool markedActive)
|
||||
{
|
||||
this.Letter = letter;
|
||||
this.IsFloppy = isFloppy;
|
||||
this.VolumeLabel = volumeLabel;
|
||||
this.MarkedActive = markedActive;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create a new Floppy drive instance
|
||||
/// </summary>
|
||||
/// <param name="letter">Drive letter to use</param>
|
||||
/// <returns>Drive object for a Floppy drive</returns>
|
||||
public static Drive Floppy(char letter) => new Drive(letter, null, true, true);
|
||||
|
||||
/// <summary>
|
||||
/// Create a new Optical drive instance
|
||||
/// </summary>
|
||||
/// <param name="letter">Drive letter to use</param>
|
||||
/// <param name="volumeLabel">Media label, if it exists</param>
|
||||
/// <param name="active">True if the drive is marked active, false otherwise</param>
|
||||
/// <returns>Drive object for an Optical drive</returns>
|
||||
public static Drive Optical(char letter, string volumeLabel, bool active) => new Drive(letter, volumeLabel, false, active);
|
||||
}
|
||||
}
|
||||
@@ -12,62 +12,115 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace DICUI.Utilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Represents information for a single drive
|
||||
/// </summary>
|
||||
public class Drive
|
||||
{
|
||||
public char Letter { get; private set; }
|
||||
public bool IsFloppy { get; private set; }
|
||||
public string VolumeLabel { get; private set; }
|
||||
public bool MarkedActive { get; private set; }
|
||||
|
||||
private Drive(char letter, string volumeLabel, bool isFloppy, bool markedActive)
|
||||
{
|
||||
this.Letter = letter;
|
||||
this.IsFloppy = isFloppy;
|
||||
this.VolumeLabel = volumeLabel;
|
||||
this.MarkedActive = markedActive;
|
||||
}
|
||||
|
||||
public static Drive Floppy(char letter) => new Drive(letter, null, true, true);
|
||||
public static Drive Optical(char letter, string volumeLabel, bool active) => new Drive(letter, volumeLabel, false, active);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Represents the state of all settings to be used during dumping
|
||||
/// </summary>
|
||||
public class DumpEnvironment
|
||||
{
|
||||
// Tool paths
|
||||
public string DICPath;
|
||||
public string SubdumpPath;
|
||||
#region Tool paths
|
||||
|
||||
// Output paths
|
||||
public string OutputDirectory;
|
||||
public string OutputFilename;
|
||||
/// <summary>
|
||||
/// Path to DiscImageCreator executable
|
||||
/// </summary>
|
||||
public string DICPath { get; set; }
|
||||
|
||||
// UI information
|
||||
public Drive Drive;
|
||||
public KnownSystem? System;
|
||||
public MediaType? Type;
|
||||
public bool IsFloppy { get => Drive.IsFloppy; }
|
||||
public Parameters DICParameters;
|
||||
/// <summary>
|
||||
/// Path to Subdump executable
|
||||
/// </summary>
|
||||
public string SubdumpPath { get; set; }
|
||||
|
||||
// extra DIC arguments
|
||||
public bool QuietMode;
|
||||
public bool ParanoidMode;
|
||||
public bool ScanForProtection;
|
||||
public int RereadAmountC2;
|
||||
#endregion
|
||||
|
||||
// Redump login information
|
||||
public string Username;
|
||||
public string Password;
|
||||
#region Output paths
|
||||
|
||||
/// <summary>
|
||||
/// Base output directory to write files to
|
||||
/// </summary>
|
||||
public string OutputDirectory { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Base output filename for DiscImageCreator
|
||||
/// </summary>
|
||||
public string OutputFilename { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region UI information
|
||||
|
||||
/// <summary>
|
||||
/// Drive object representing the current drive
|
||||
/// </summary>
|
||||
public Drive Drive { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Currently selected system
|
||||
/// </summary>
|
||||
public KnownSystem? System { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Currently selected media type
|
||||
/// </summary>
|
||||
public MediaType? Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Parameters object representing what to send to DiscImageCreator
|
||||
/// </summary>
|
||||
public Parameters DICParameters { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Extra DIC arguments
|
||||
|
||||
/// <summary>
|
||||
/// Enable quiet mode (no beeps)
|
||||
/// </summary>
|
||||
public bool QuietMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Enable paranoid mode (extra flags)
|
||||
/// </summary>
|
||||
public bool ParanoidMode { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Scan for copy protection, where applicable
|
||||
/// </summary>
|
||||
public bool ScanForProtection { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Number of C2 error reread attempts
|
||||
/// </summary>
|
||||
public int RereadAmountC2 { get; set; }
|
||||
|
||||
#endregion
|
||||
|
||||
#region Redump login information
|
||||
|
||||
/// <summary>
|
||||
/// Redump.org username for pulling existing disc data
|
||||
/// </summary>
|
||||
public string Username { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Redump.org password for pulling existing disc data
|
||||
/// </summary>
|
||||
public string Password { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Determine if a complete set of Redump credentials might exist
|
||||
/// </summary>
|
||||
public bool HasRedumpLogin { get => !string.IsNullOrWhiteSpace(Username) && !string.IsNullOrWhiteSpace(Password); }
|
||||
|
||||
#endregion
|
||||
|
||||
// External process information
|
||||
#region External process information
|
||||
|
||||
/// <summary>
|
||||
/// Process to track DiscImageCreator instances
|
||||
/// </summary>
|
||||
private Process dicProcess;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Functionality
|
||||
|
||||
/// <summary>
|
||||
@@ -84,47 +137,6 @@ namespace DICUI.Utilities
|
||||
{ }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Eject the disc using DIC
|
||||
/// </summary>
|
||||
public async void EjectDisc()
|
||||
{
|
||||
// Validate that the required program exists
|
||||
if (!File.Exists(DICPath))
|
||||
return;
|
||||
|
||||
CancelDumping();
|
||||
|
||||
// Validate we're not trying to eject a floppy disk
|
||||
if (IsFloppy)
|
||||
return;
|
||||
|
||||
Process childProcess;
|
||||
await Task.Run(() =>
|
||||
{
|
||||
childProcess = new Process()
|
||||
{
|
||||
StartInfo = new ProcessStartInfo()
|
||||
{
|
||||
FileName = DICPath,
|
||||
Arguments = DICCommandStrings.Eject + " " + Drive.Letter,
|
||||
CreateNoWindow = true,
|
||||
UseShellExecute = false,
|
||||
RedirectStandardInput = true,
|
||||
RedirectStandardOutput = true,
|
||||
},
|
||||
};
|
||||
childProcess.Start();
|
||||
childProcess.WaitForExit(1000);
|
||||
|
||||
// Just in case, we want to push a button 5 times to clear any errors
|
||||
for (int i = 0; i < 5; i++)
|
||||
childProcess.StandardInput.WriteLine("Y");
|
||||
|
||||
childProcess.Dispose();
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets if the current drive has the latest firmware
|
||||
/// </summary>
|
||||
@@ -172,71 +184,46 @@ namespace DICUI.Utilities
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the full parameter string for DIC
|
||||
/// Eject the disc using DIC
|
||||
/// </summary>
|
||||
/// <param name="driveSpeed">Nullable int representing the drive speed</param>
|
||||
/// <returns>String representing the params, null on error</returns>
|
||||
public string GetFullParameters(int? driveSpeed)
|
||||
public async void EjectDisc()
|
||||
{
|
||||
// Populate with the correct params for inputs (if we're not on the default option)
|
||||
if (System != KnownSystem.NONE && Type != MediaType.NONE)
|
||||
// Validate that the required program exists
|
||||
if (!File.Exists(DICPath))
|
||||
return;
|
||||
|
||||
CancelDumping();
|
||||
|
||||
// Validate we're not trying to eject a floppy disk
|
||||
if (Drive.IsFloppy)
|
||||
return;
|
||||
|
||||
Process childProcess;
|
||||
await Task.Run(() =>
|
||||
{
|
||||
// If drive letter is invalid, skip this
|
||||
if (Drive == null)
|
||||
return null;
|
||||
childProcess = new Process()
|
||||
{
|
||||
StartInfo = new ProcessStartInfo()
|
||||
{
|
||||
FileName = DICPath,
|
||||
Arguments = DICCommandStrings.Eject + " " + Drive.Letter,
|
||||
CreateNoWindow = true,
|
||||
UseShellExecute = false,
|
||||
RedirectStandardInput = true,
|
||||
RedirectStandardOutput = true,
|
||||
},
|
||||
};
|
||||
childProcess.Start();
|
||||
childProcess.WaitForExit(1000);
|
||||
|
||||
FixOutputPaths();
|
||||
// Just in case, we want to push a button 5 times to clear any errors
|
||||
for (int i = 0; i < 5; i++)
|
||||
childProcess.StandardInput.WriteLine("Y");
|
||||
|
||||
// Set the proper parameters
|
||||
DICParameters = new Parameters(System, Type, Drive.Letter, Path.Combine(OutputDirectory, OutputFilename), driveSpeed, ParanoidMode, RereadAmountC2);
|
||||
if (QuietMode)
|
||||
DICParameters[DICFlag.DisableBeep] = true;
|
||||
|
||||
// Generate and return the param string
|
||||
return DICParameters.GenerateParameters();
|
||||
}
|
||||
|
||||
return null;
|
||||
childProcess.Dispose();
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Execute a complete dump workflow
|
||||
/// </summary>
|
||||
public async Task<Result> StartDumping(IProgress<Result> progress)
|
||||
{
|
||||
Result result = IsValidForDump();
|
||||
|
||||
// Execute DIC and external tools, if needed
|
||||
if (Validators.GetSupportStatus(System, Type)
|
||||
&& !result.Message.Contains("not supported") // Completely unsupported media
|
||||
&& !result.Message.Contains("submission info")) // Submission info-only media
|
||||
{
|
||||
// If the environment is invalid, return
|
||||
if (!result)
|
||||
return result;
|
||||
|
||||
progress?.Report(Result.Success("Executing DiscImageCreator... please wait!"));
|
||||
await Task.Run(() => ExecuteDiskImageCreator());
|
||||
progress?.Report(Result.Success("DiscImageCreator has finished!"));
|
||||
|
||||
// Execute additional tools
|
||||
progress?.Report(Result.Success("Running any additional tools... please wait!"));
|
||||
result = await Task.Run(() => ExecuteAdditionalToolsAfterDIC());
|
||||
progress?.Report(result);
|
||||
}
|
||||
|
||||
// Verify dump output and save it
|
||||
progress?.Report(Result.Success("Gathering submission information... please wait!"));
|
||||
result = await Task.Run(() => VerifyAndSaveDumpOutput(progress));
|
||||
progress?.Report(Result.Success("All submission information gathered!"));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public for Testing Purposes
|
||||
|
||||
/// <summary>
|
||||
/// Fix output paths to strip out any invalid characters
|
||||
/// </summary>
|
||||
@@ -284,15 +271,6 @@ namespace DICUI.Utilities
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the parameters are valid
|
||||
/// </summary>
|
||||
/// <returns>True if the configuration is valid, false otherwise</returns>
|
||||
public bool ParametersValid()
|
||||
{
|
||||
return DICParameters.IsValid() && !(IsFloppy ^ Type == MediaType.FloppyDisk);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensures that all required output files have been created
|
||||
/// </summary>
|
||||
@@ -358,6 +336,113 @@ namespace DICUI.Utilities
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get the full parameter string for DIC
|
||||
/// </summary>
|
||||
/// <param name="driveSpeed">Nullable int representing the drive speed</param>
|
||||
/// <returns>String representing the params, null on error</returns>
|
||||
public string GetFullParameters(int? driveSpeed)
|
||||
{
|
||||
// Populate with the correct params for inputs (if we're not on the default option)
|
||||
if (System != KnownSystem.NONE && Type != MediaType.NONE)
|
||||
{
|
||||
// If drive letter is invalid, skip this
|
||||
if (Drive == null)
|
||||
return null;
|
||||
|
||||
FixOutputPaths();
|
||||
|
||||
// Set the proper parameters
|
||||
DICParameters = new Parameters(System, Type, Drive.Letter, Path.Combine(OutputDirectory, OutputFilename), driveSpeed, ParanoidMode, RereadAmountC2);
|
||||
if (QuietMode)
|
||||
DICParameters[DICFlag.DisableBeep] = true;
|
||||
|
||||
// Generate and return the param string
|
||||
return DICParameters.GenerateParameters();
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Execute a complete dump workflow
|
||||
/// </summary>
|
||||
public async Task<Result> StartDumping(IProgress<Result> progress)
|
||||
{
|
||||
Result result = IsValidForDump();
|
||||
|
||||
// Execute DIC and external tools, if needed
|
||||
if (Validators.GetSupportStatus(System, Type)
|
||||
&& !result.Message.Contains("not supported") // Completely unsupported media
|
||||
&& !result.Message.Contains("submission info")) // Submission info-only media
|
||||
{
|
||||
// If the environment is invalid, return
|
||||
if (!result)
|
||||
return result;
|
||||
|
||||
progress?.Report(Result.Success("Executing DiscImageCreator... please wait!"));
|
||||
await Task.Run(() => ExecuteDiskImageCreator());
|
||||
progress?.Report(Result.Success("DiscImageCreator has finished!"));
|
||||
|
||||
// Execute additional tools
|
||||
progress?.Report(Result.Success("Running any additional tools... please wait!"));
|
||||
result = await Task.Run(() => ExecuteAdditionalToolsAfterDIC());
|
||||
progress?.Report(result);
|
||||
}
|
||||
|
||||
// Verify dump output and save it
|
||||
progress?.Report(Result.Success("Gathering submission information... please wait!"));
|
||||
result = await Task.Run(() => VerifyAndSaveDumpOutput(progress));
|
||||
progress?.Report(Result.Success("All submission information gathered!"));
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verify that the current environment has a complete dump and create submission info is possible
|
||||
/// </summary>
|
||||
/// <returns>Result instance with the outcome</returns>
|
||||
public Result VerifyAndSaveDumpOutput(IProgress<Result> progress)
|
||||
{
|
||||
// Check to make sure that the output had all the correct files
|
||||
if (!FoundAllFiles())
|
||||
return Result.Failure("Error! Please check output directory as dump may be incomplete!");
|
||||
|
||||
progress?.Report(Result.Success("Extracting output information from output files..."));
|
||||
SubmissionInfo submissionInfo = ExtractOutputInformation(progress);
|
||||
progress?.Report(Result.Success("Extracting information complete!"));
|
||||
|
||||
// TODO: Add UI step here (possibly) to get user info on the disc
|
||||
|
||||
progress?.Report(Result.Success("Formatting extracted information..."));
|
||||
List<string> formattedValues = FormatOutputData(submissionInfo);
|
||||
progress?.Report(Result.Success("Formatting complete!"));
|
||||
|
||||
progress?.Report(Result.Success("Writing information to !submissionInfo.txt..."));
|
||||
bool success = WriteOutputData(formattedValues);
|
||||
success &= WriteOutputData(submissionInfo);
|
||||
|
||||
if (success)
|
||||
progress?.Report(Result.Success("Writing complete!"));
|
||||
else
|
||||
progress?.Report(Result.Failure("Writing could not complete!"));
|
||||
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Internal for Testing Purposes
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the parameters are valid
|
||||
/// </summary>
|
||||
/// <returns>True if the configuration is valid, false otherwise</returns>
|
||||
internal bool ParametersValid()
|
||||
{
|
||||
return DICParameters.IsValid() && !(Drive.IsFloppy ^ Type == MediaType.FloppyDisk);
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Helpers
|
||||
@@ -858,12 +943,12 @@ namespace DICUI.Utilities
|
||||
AddIfExists(output, Template.ForeignTitleField, info.ForeignTitleNonLatin, 1);
|
||||
AddIfExists(output, Template.DiscNumberField, info.DiscNumberLetter, 1);
|
||||
AddIfExists(output, Template.DiscTitleField, info.DiscTitle, 1);
|
||||
AddIfExists(output, Template.SystemField, info.System.Name(), 1);
|
||||
AddIfExists(output, Template.SystemField, info.System.LongName(), 1);
|
||||
AddIfExists(output, Template.MediaTypeField, GetFixedMediaType(info.Media, info.Layerbreak), 1);
|
||||
AddIfExists(output, Template.CategoryField, info.Category.Name(), 1);
|
||||
AddIfExists(output, Template.CategoryField, info.Category.LongName(), 1);
|
||||
AddIfExists(output, Template.MatchingIDsField, info.MatchedIDs, 1);
|
||||
AddIfExists(output, Template.RegionField, info.Region.Name(), 1);
|
||||
AddIfExists(output, Template.LanguagesField, (info.Languages ?? new Language?[] { null }).Select(l => l.Name()).ToArray(), 1);
|
||||
AddIfExists(output, Template.RegionField, info.Region.LongName(), 1);
|
||||
AddIfExists(output, Template.LanguagesField, (info.Languages ?? new Language?[] { null }).Select(l => l.LongName()).ToArray(), 1);
|
||||
AddIfExists(output, Template.PlaystationLanguageSelectionViaField, info.LanguageSelection, 1);
|
||||
AddIfExists(output, Template.DiscSerialField, info.Serial, 1);
|
||||
|
||||
@@ -909,7 +994,7 @@ namespace DICUI.Utilities
|
||||
if (info.EDC != YesNo.NULL)
|
||||
{
|
||||
output.Add("EDC:");
|
||||
AddIfExists(output, Template.PlayStationEDCField, info.EDC.Name(), 1);
|
||||
AddIfExists(output, Template.PlayStationEDCField, info.EDC.LongName(), 1);
|
||||
}
|
||||
|
||||
// Parent/Clone Relationship section
|
||||
@@ -936,8 +1021,8 @@ namespace DICUI.Utilities
|
||||
output.Add(""); output.Add("Copy Protection:");
|
||||
if (info.EDC != YesNo.NULL)
|
||||
{
|
||||
AddIfExists(output, Template.PlayStationAntiModchipField, info.AntiModchip.Name(), 1);
|
||||
AddIfExists(output, Template.PlayStationLibCryptField, info.LibCrypt.Name(), 1);
|
||||
AddIfExists(output, Template.PlayStationAntiModchipField, info.AntiModchip.LongName(), 1);
|
||||
AddIfExists(output, Template.PlayStationLibCryptField, info.LibCrypt.LongName(), 1);
|
||||
AddIfExists(output, Template.SubIntentionField, info.LibCryptData, 1);
|
||||
}
|
||||
|
||||
@@ -1072,24 +1157,24 @@ namespace DICUI.Utilities
|
||||
{
|
||||
case MediaType.DVD:
|
||||
if (layerbreak != default(long))
|
||||
return $"{mediaType.Name()}-9";
|
||||
return $"{mediaType.LongName()}-9";
|
||||
else
|
||||
return $"{mediaType.Name()}-5";
|
||||
return $"{mediaType.LongName()}-5";
|
||||
|
||||
case MediaType.BluRay:
|
||||
if (layerbreak != default(long))
|
||||
return $"{mediaType.Name()}-50";
|
||||
return $"{mediaType.LongName()}-50";
|
||||
else
|
||||
return $"{mediaType.Name()}-25";
|
||||
return $"{mediaType.LongName()}-25";
|
||||
|
||||
case MediaType.UMD:
|
||||
if (layerbreak != default(long))
|
||||
return $"{mediaType.Name()}-DL";
|
||||
return $"{mediaType.LongName()}-DL";
|
||||
else
|
||||
return $"{mediaType.Name()}-SL";
|
||||
return $"{mediaType.LongName()}-SL";
|
||||
|
||||
default:
|
||||
return mediaType.Name();
|
||||
return mediaType.LongName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1112,38 +1197,6 @@ namespace DICUI.Utilities
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Verify that the current environment has a complete dump and create submission info is possible
|
||||
/// </summary>
|
||||
/// <returns>Result instance with the outcome</returns>
|
||||
public Result VerifyAndSaveDumpOutput(IProgress<Result> progress)
|
||||
{
|
||||
// Check to make sure that the output had all the correct files
|
||||
if (!FoundAllFiles())
|
||||
return Result.Failure("Error! Please check output directory as dump may be incomplete!");
|
||||
|
||||
progress?.Report(Result.Success("Extracting output information from output files..."));
|
||||
SubmissionInfo submissionInfo = ExtractOutputInformation(progress);
|
||||
progress?.Report(Result.Success("Extracting information complete!"));
|
||||
|
||||
// TODO: Add UI step here (possibly) to get user info on the disc
|
||||
|
||||
progress?.Report(Result.Success("Formatting extracted information..."));
|
||||
List<string> formattedValues = FormatOutputData(submissionInfo);
|
||||
progress?.Report(Result.Success("Formatting complete!"));
|
||||
|
||||
progress?.Report(Result.Success("Writing information to !submissionInfo.txt..."));
|
||||
bool success = WriteOutputData(formattedValues);
|
||||
success &= WriteOutputData(submissionInfo);
|
||||
|
||||
if (success)
|
||||
progress?.Report(Result.Success("Writing complete!"));
|
||||
else
|
||||
progress?.Report(Result.Failure("Writing could not complete!"));
|
||||
|
||||
return Result.Success();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write the data to the output folder
|
||||
/// </summary>
|
||||
|
||||
@@ -2,59 +2,11 @@
|
||||
|
||||
namespace DICUI.Utilities
|
||||
{
|
||||
/// <summary>
|
||||
/// Extensions for Category?
|
||||
/// </summary>
|
||||
public static class CategoryExtensions
|
||||
{
|
||||
public static string Name(this Category? category)
|
||||
{
|
||||
return Converters.LongName(category);
|
||||
}
|
||||
}
|
||||
|
||||
/// <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.LongName(type);
|
||||
}
|
||||
|
||||
public static string ShortName(this MediaType? type)
|
||||
{
|
||||
return Converters.ShortName(type);
|
||||
}
|
||||
|
||||
public static string Extension(this MediaType? type)
|
||||
{
|
||||
return Converters.MediaTypeToExtension(type);
|
||||
}
|
||||
|
||||
public static bool DoesSupportDriveSpeed(this MediaType? type)
|
||||
{
|
||||
switch (type)
|
||||
@@ -78,16 +30,6 @@ namespace DICUI.Utilities
|
||||
/// </summary>
|
||||
public static class KnownSystemExtensions
|
||||
{
|
||||
public static string Name(this KnownSystem? system)
|
||||
{
|
||||
return Converters.LongName(system);
|
||||
}
|
||||
|
||||
public static string ShortName(this KnownSystem? system)
|
||||
{
|
||||
return Converters.ShortName(system);
|
||||
}
|
||||
|
||||
public static KnownSystemCategory Category(this KnownSystem? system)
|
||||
{
|
||||
if (system < KnownSystem.MarkerDiscBasedConsoleEnd)
|
||||
@@ -121,79 +63,4 @@ namespace DICUI.Utilities
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <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.DiscBasedConsole:
|
||||
return "Disc-Based Consoles";
|
||||
case KnownSystemCategory.OtherConsole:
|
||||
return "Other Consoles";
|
||||
case KnownSystemCategory.Other:
|
||||
return "Other";
|
||||
case KnownSystemCategory.Custom:
|
||||
return "Custom";
|
||||
default:
|
||||
return "";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extensions for Language?
|
||||
/// </summary>
|
||||
public static class LanguageExtensions
|
||||
{
|
||||
public static string Name(this Language? lang)
|
||||
{
|
||||
return Converters.LongName(lang);
|
||||
}
|
||||
|
||||
public static string ShortName(this Language? lang)
|
||||
{
|
||||
return Converters.ShortName(lang);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extensions for Region?
|
||||
/// </summary>
|
||||
public static class RegionExtensions
|
||||
{
|
||||
public static string Name(this Region? region)
|
||||
{
|
||||
return Converters.LongName(region);
|
||||
}
|
||||
|
||||
public static string ShortName(this Region? region)
|
||||
{
|
||||
return Converters.ShortName(region);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extensions for YesNo
|
||||
/// </summary>
|
||||
public static class YesNoExtensions
|
||||
{
|
||||
public static string Name(this YesNo yesno)
|
||||
{
|
||||
return Converters.LongName(yesno);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -133,8 +133,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;
|
||||
|
||||
@@ -184,7 +184,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;
|
||||
|
||||
@@ -285,7 +285,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
|
||||
@@ -297,7 +297,7 @@ namespace DICUI.Utilities
|
||||
if (Command == DICCommand.CompactDisc)
|
||||
{
|
||||
if (this[DICFlag.AMSF])
|
||||
parameters.Add(DICFlag.AMSF.Name());
|
||||
parameters.Add(DICFlag.AMSF.LongName());
|
||||
}
|
||||
|
||||
// BE Opcode
|
||||
@@ -309,7 +309,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);
|
||||
@@ -325,7 +325,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)
|
||||
@@ -361,7 +361,7 @@ namespace DICUI.Utilities
|
||||
if (Command == DICCommand.DigitalVideoDisc)
|
||||
{
|
||||
if (this[DICFlag.CopyrightManagementInformation])
|
||||
parameters.Add(DICFlag.CopyrightManagementInformation.Name());
|
||||
parameters.Add(DICFlag.CopyrightManagementInformation.LongName());
|
||||
}
|
||||
|
||||
// D8 Opcode
|
||||
@@ -372,7 +372,7 @@ namespace DICUI.Utilities
|
||||
|| Command == DICCommand.Swap)
|
||||
{
|
||||
if (this[DICFlag.D8Opcode])
|
||||
parameters.Add(DICFlag.D8Opcode.Name());
|
||||
parameters.Add(DICFlag.D8Opcode.LongName());
|
||||
}
|
||||
|
||||
// Disable Beep
|
||||
@@ -386,7 +386,7 @@ namespace DICUI.Utilities
|
||||
|| Command == DICCommand.XBOX)
|
||||
{
|
||||
if (this[DICFlag.DisableBeep])
|
||||
parameters.Add(DICFlag.DisableBeep.Name());
|
||||
parameters.Add(DICFlag.DisableBeep.LongName());
|
||||
}
|
||||
|
||||
// Force Unit Access
|
||||
@@ -398,7 +398,7 @@ namespace DICUI.Utilities
|
||||
{
|
||||
if (this[DICFlag.ForceUnitAccess])
|
||||
{
|
||||
parameters.Add(DICFlag.ForceUnitAccess.Name());
|
||||
parameters.Add(DICFlag.ForceUnitAccess.LongName());
|
||||
if (ForceUnitAccessValue != null)
|
||||
parameters.Add(ForceUnitAccessValue.ToString());
|
||||
}
|
||||
@@ -408,14 +408,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
|
||||
@@ -426,7 +426,7 @@ namespace DICUI.Utilities
|
||||
|| Command == DICCommand.Swap)
|
||||
{
|
||||
if (this[DICFlag.NoFixSubP])
|
||||
parameters.Add(DICFlag.NoFixSubP.Name());
|
||||
parameters.Add(DICFlag.NoFixSubP.LongName());
|
||||
}
|
||||
|
||||
// Not fix SubQ
|
||||
@@ -437,7 +437,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)
|
||||
@@ -448,7 +448,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)
|
||||
@@ -459,7 +459,7 @@ namespace DICUI.Utilities
|
||||
|| Command == DICCommand.Swap)
|
||||
{
|
||||
if (this[DICFlag.NoFixSubQSecuROM])
|
||||
parameters.Add(DICFlag.NoFixSubQSecuROM.Name());
|
||||
parameters.Add(DICFlag.NoFixSubQSecuROM.LongName());
|
||||
}
|
||||
|
||||
// Not fix SubRtoW
|
||||
@@ -470,14 +470,14 @@ namespace DICUI.Utilities
|
||||
|| Command == DICCommand.Swap)
|
||||
{
|
||||
if (this[DICFlag.NoFixSubRtoW])
|
||||
parameters.Add(DICFlag.NoFixSubRtoW.Name());
|
||||
parameters.Add(DICFlag.NoFixSubRtoW.LongName());
|
||||
}
|
||||
|
||||
// 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
|
||||
@@ -485,7 +485,7 @@ namespace DICUI.Utilities
|
||||
|| Command == DICCommand.Data)
|
||||
{
|
||||
if (this[DICFlag.Reverse])
|
||||
parameters.Add(DICFlag.Reverse.Name());
|
||||
parameters.Add(DICFlag.Reverse.LongName());
|
||||
}
|
||||
|
||||
// Scan PlayStation anti-mod strings
|
||||
@@ -493,7 +493,7 @@ 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
|
||||
@@ -505,7 +505,7 @@ namespace DICUI.Utilities
|
||||
{
|
||||
if (this[DICFlag.ScanFileProtect])
|
||||
{
|
||||
parameters.Add(DICFlag.ScanFileProtect.Name());
|
||||
parameters.Add(DICFlag.ScanFileProtect.LongName());
|
||||
if (ScanFileProtectValue != null)
|
||||
{
|
||||
if (ScanFileProtectValue > 0)
|
||||
@@ -522,14 +522,14 @@ 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
|
||||
@@ -539,7 +539,7 @@ namespace DICUI.Utilities
|
||||
{
|
||||
if (SkipSectorValue[0] != null && SkipSectorValue[1] != null)
|
||||
{
|
||||
parameters.Add(DICFlag.SkipSector.Name());
|
||||
parameters.Add(DICFlag.SkipSector.LongName());
|
||||
if (SkipSectorValue[0] >= 0 && SkipSectorValue[1] >= 0)
|
||||
{
|
||||
parameters.Add(SkipSectorValue[0].ToString());
|
||||
@@ -562,7 +562,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)
|
||||
@@ -578,7 +578,7 @@ namespace DICUI.Utilities
|
||||
{
|
||||
if (this[DICFlag.VideoNow])
|
||||
{
|
||||
parameters.Add(DICFlag.VideoNow.Name());
|
||||
parameters.Add(DICFlag.VideoNow.LongName());
|
||||
if (VideoNowValue != null)
|
||||
{
|
||||
if (VideoNowValue >= 0)
|
||||
|
||||
@@ -788,7 +788,7 @@ namespace DICUI.Utilities
|
||||
dataWriter.Recorder = recorder;
|
||||
var media = dataWriter.CurrentPhysicalMediaType;
|
||||
if (media != IMAPI_MEDIA_PHYSICAL_TYPE.IMAPI_MEDIA_TYPE_UNKNOWN)
|
||||
return Converters.IMAPIDiskTypeToMediaType(media);
|
||||
return Converters.ToMediaType(media);
|
||||
}
|
||||
catch
|
||||
{
|
||||
@@ -816,17 +816,17 @@ namespace DICUI.Utilities
|
||||
case MediaType.DVD:
|
||||
case MediaType.FloppyDisk:
|
||||
case MediaType.HDDVD:
|
||||
return Result.Success("{0} ready to dump", type.Name());
|
||||
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.Name());
|
||||
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.Name());
|
||||
return Result.Success("{0} supported for submission info parsing", type.LongName());
|
||||
|
||||
// Specifically unknown type
|
||||
case MediaType.NONE:
|
||||
@@ -834,7 +834,7 @@ namespace DICUI.Utilities
|
||||
|
||||
// Undumpable but recognized types
|
||||
default:
|
||||
return Result.Failure("{0} discs are not supported for dumping", type.Name());
|
||||
return Result.Failure("{0} discs are not supported for dumping", type.LongName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -62,13 +62,11 @@
|
||||
</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" />
|
||||
|
||||
@@ -26,7 +26,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);
|
||||
}
|
||||
|
||||
@@ -49,7 +49,7 @@ 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);
|
||||
}
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace DICUI.Test.Utilities
|
||||
[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);
|
||||
}
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,19 +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.LongName(system);
|
||||
string actual = ((KnownSystem?)system).Name();
|
||||
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void IsMarkerTest()
|
||||
{
|
||||
@@ -42,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,27 +7,25 @@ namespace DICUI.Test.Utilities
|
||||
public class MediaTypeExtensionsTest
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(MediaType.CDROM)]
|
||||
[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.LongName(mediaType);
|
||||
string actual = mediaType.Name();
|
||||
string actual = mediaType.LongName();
|
||||
|
||||
Assert.NotNull(actual);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(MediaType.CDROM)]
|
||||
[InlineData(MediaType.DVD)]
|
||||
[InlineData(MediaType.LaserDisc)]
|
||||
[InlineData(MediaType.FloppyDisk)]
|
||||
[InlineData(MediaType.NONE)]
|
||||
public void ExtensionTest(MediaType? mediaType)
|
||||
[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);
|
||||
|
||||
@@ -14,13 +14,13 @@ namespace DICUI
|
||||
public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
|
||||
{
|
||||
if (value is DICCommand)
|
||||
return ((DICCommand)value).Name();
|
||||
return ((DICCommand)value).LongName();
|
||||
else if (value is DICFlag)
|
||||
return ((DICFlag)value).Name();
|
||||
return ((DICFlag)value).LongName();
|
||||
else if (value is MediaType?)
|
||||
return ((MediaType?)value).Name();
|
||||
return ((MediaType?)value).LongName();
|
||||
else if (value is KnownSystem?)
|
||||
return ((KnownSystem?)value).Name();
|
||||
return ((KnownSystem?)value).LongName();
|
||||
else
|
||||
return "";
|
||||
}
|
||||
|
||||
@@ -26,9 +26,9 @@ namespace DICUI
|
||||
get
|
||||
{
|
||||
if (IsHeader())
|
||||
return "---------- " + (data as KnownSystemCategory?).Name() + " ----------";
|
||||
return "---------- " + (data as KnownSystemCategory?).LongName() + " ----------";
|
||||
else
|
||||
return (data as KnownSystem?).Name();
|
||||
return (data as KnownSystem?).LongName();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace DICUI
|
||||
|
||||
public static implicit operator MediaType? (MediaTypeComboBoxItem item) => item.data;
|
||||
|
||||
public string Name { get { return data.Name(); }
|
||||
public string Name { get { return data.LongName(); }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -291,7 +291,7 @@ namespace DICUI.Windows
|
||||
.ToDictionary(
|
||||
k => k.Key,
|
||||
v => v
|
||||
.OrderBy(s => s.Name())
|
||||
.OrderBy(s => s.LongName())
|
||||
.ToList()
|
||||
);
|
||||
|
||||
@@ -631,7 +631,7 @@ namespace DICUI.Windows
|
||||
{
|
||||
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() + "."));
|
||||
ViewModels.LoggerViewModel.VerboseLogLn(_currentMediaType == null ? "unable to detect." : ("detected " + _currentMediaType.LongName() + "."));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -681,7 +681,7 @@ namespace DICUI.Windows
|
||||
else
|
||||
outputFilename = OutputFilenameTextBox.Text;
|
||||
|
||||
MediaType? mediaType = Converters.BaseCommmandToMediaType(_env.DICParameters.Command);
|
||||
MediaType? mediaType = _env.DICParameters.Command.ToMediaType();
|
||||
int mediaTypeIndex = _mediaTypes.IndexOf(mediaType);
|
||||
if (mediaTypeIndex > -1)
|
||||
MediaTypeComboBox.SelectedIndex = mediaTypeIndex;
|
||||
|
||||
Reference in New Issue
Block a user