From 1b735b5d06150f3cb33af6d9616d403cc3c6ea5b Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Mon, 13 May 2019 21:55:08 -0700 Subject: [PATCH] Migrate to SubmissionInfo object, add JSON output --- DICUI.Forms/Windows/MainWindow.cs | 2 +- DICUI.Library/DICUI.Library.csproj | 5 + DICUI.Library/Data/Constants.cs | 96 +- DICUI.Library/Data/Enumerations.cs | 112 +- DICUI.Library/Data/SubmissionInfo.cs | 244 ++++ DICUI.Library/Utilities/Converters.cs | 1193 ++++++++++++----- DICUI.Library/Utilities/DumpEnvironment.cs | 673 ++++++---- DICUI.Library/Utilities/Extensions.cs | 64 +- DICUI.Library/packages.config | 1 + DICUI.Test/Utilities/ConvertersTest.cs | 4 +- .../Utilities/KnownSystemExtensionsTest.cs | 2 +- .../Utilities/MediaTypeExtensionsTest.cs | 2 +- DICUI/Windows/MainWindow.xaml.cs | 2 +- 13 files changed, 1683 insertions(+), 717 deletions(-) create mode 100644 DICUI.Library/Data/SubmissionInfo.cs diff --git a/DICUI.Forms/Windows/MainWindow.cs b/DICUI.Forms/Windows/MainWindow.cs index 1cce692d..667e49e6 100644 --- a/DICUI.Forms/Windows/MainWindow.cs +++ b/DICUI.Forms/Windows/MainWindow.cs @@ -653,7 +653,7 @@ namespace DICUI.Forms.Windows if (index != -1) MediaTypeComboBox.SelectedIndex = index; else - StatusLabel.Text = $"Disc of type '{Converters.MediaTypeToString(_currentMediaType)}' found, but the current system does not support it!"; + StatusLabel.Text = $"Disc of type '{Converters.LongName(_currentMediaType)}' found, but the current system does not support it!"; } /// diff --git a/DICUI.Library/DICUI.Library.csproj b/DICUI.Library/DICUI.Library.csproj index 148c0cd0..3af2b8cb 100644 --- a/DICUI.Library/DICUI.Library.csproj +++ b/DICUI.Library/DICUI.Library.csproj @@ -40,11 +40,15 @@ ..\packages\libmspack4n.0.8.0\lib\net40\libmspackn.dll + + ..\packages\Newtonsoft.Json.12.0.2\lib\net45\Newtonsoft.Json.dll + + @@ -61,6 +65,7 @@ + diff --git a/DICUI.Library/Data/Constants.cs b/DICUI.Library/Data/Constants.cs index ba30f7f3..05327bf6 100644 --- a/DICUI.Library/Data/Constants.cs +++ b/DICUI.Library/Data/Constants.cs @@ -59,96 +59,6 @@ public const string VideoNow = "/vn"; } - /// - /// Internal names of fields on the New Disc page - /// - public static class NewDiscPageStrings - { - // Common disc info - - public const string System = ""; // Undefined, use shortnames - public const string Media = ""; // Undefined, use shortnames - public const string Title = "d_title"; - public const string ForeignTitleNonLatin = "d_title_foreign"; - public const string DiscNumberLetter = "d_number"; - public const string DiscTitle = "d_label"; - public const string Category = "d_category"; // Category enum - public const string Region = "d_region"; // Single region only - public const string Languages = "d_languages[]"; // Multiple languages possible - public const string LanguageSelectionVia = "d_languages_selection[]"; // PS2; "Bios settings", "Language selector", "Options menu"; Muliple choices possible - public const string Serial = "d_serial"; - public const string Ring = "d_ring"; - public const string RingId = "d_ring_0_id"; // Hidden - public const string MasteringRingFirstLayerDataSide = "d_ring_0_ma1"; - public const string MasteringSIDCodeFirstLayerDataSide = "d_ring_0_ma1_sid"; - public const string ToolstampMasteringCodeFirstLayerDataSide = "d_ring_0_ts1"; - public const string MouldSIDCodeFirstLayerDataSide = "d_ring_0_mo1_sid"; - public const string AdditionalMouldFirstLayerDataSide = "dr_ring_0_mo1"; - public const string MasteringRingSecondLayerLabelSide = "d_ring_0_ma2"; - public const string MasteringSIDCodeSecondLayerLabelSide = "d_ring_0_ma2_sid"; - public const string ToolstampMasteringCodeSecondLayerLabelSide = "d_ring_0_ts2"; - public const string MouldSIDCodeSecondLayerLabelSide = "d_ring_0_mo2_sid"; - public const string AdditionalMouldSecondLayerLabelSide = "dr_ring_0_mo2"; - public const string RingOffsetsHidden = "d_ring_0_offsets"; // Hidden, value '1' - public const string RingZeroId = "d_ring_0_0_id"; // Hidden - public const string RingZeroDensity = "d_ring_0_0_density"; // Hidden - public const string RingWriteOffset = "d_ring_0_0_value"; - public const string RingCount = "d_ring_count"; // Hidden, value '1' - public const string Barcode = "d_barcode"; - public const string EXEDateBuildDate = "d_date"; // PSX, PS2, MCD, SS, DC, PC-98, ACD, CD32, CDTV, NGCD, QIS, FMT, HS, ITE, KEA, KFB, KS573, KSGV, KT, CHIHIRO, NAOMI, NAOMI2, STV, TRIFORCE, NAVI21 - public const string ErrorsCount = "d_errors"; - public const string Comments = "d_comments"; - public const string Contents = "d_contents"; - - // Version and editions - - public const string Version = "d_version"; - public const string VersionDatfile = "d_version_datfile"; - public const string CommonEditions = "d_editions[]"; // Multiple editions possible - public const string OtherEditions = "d_editions_text"; - - // EDC (PSX) - public const string EDC = "d_edc"; // 1 = No, 2 = Yes - - // Parent/Clone relationship - public const string ParentID = "d_parent_id"; - public const string RegionalParent = "d_is_regional_parent"; // Single checkbox - - // Extras - public const string PVD = "d_pvd"; // CD,DVD-based (ISO9660 FS only) - public const string DiscKey = "d_d1_key"; // PS3 BD-based, WIIU - public const string DiscID = "d_d2_key"; // PS3 BD-based - public const string PIC = "d_pic_data"; // BD-based - public const string Header = "d_header"; // MCD, SS, GD-based - public const string BCA = "d_bca"; // GC, WII - public const string SecuritySectorRanges = "d_ssranges"; // XBOX DVD-based with SS, XBOX360 DVD-based with SS - - // Copy protection - public const string AntiModchip = "d_protection_a"; // PSX; RedumpYesNo enum - public const string LibCrypt = "d_protection_1"; // PSX; RedumpYesNo enum - public const string LibCryptData = "d_libcrypt"; // PSX - public const string Protection = "d_protection"; // PC, MAC, DVD-VIDEO, BD-VIDEO, GAMEWAVE - public const string SecuROMData = "d_securom"; // PC - - // Dumpers and status (moderator only) - public const string Status = "d_status"; // DumpStatus enum - public const string Dumpers = "d_dumpers[]"; // Multiple dumpers possible (by dumper ID) - public const string OtherDumpers = "d_dumpers_text"; - - // Tracks and write offsets (CD,GD-based) - public const string ClrMameProData = "d_tracks"; - public const string Cuesheet = "d_cue"; - public const string CommonWriteOffsets = "d_offset[]"; // Multiple offsets possible - public const string OtherWriteOffsets = "d_offset_text"; - - // Size & checksums (DVD,BD,UMD-based) - public const string Layerbreak = "d_layerbreak"; // DVD-9, BD-50, UMD-DL only - public const string Size = "d_size"; - public const string CRC32 = "d_crc32"; - public const string MD5 = "d_md5"; - public const string SHA1 = "d_sha1"; - } - /// /// Template field values for submission info /// @@ -168,7 +78,6 @@ public const string PlaystationLanguageSelectionViaField = "Language Selection Via"; public const string DiscSerialField = "Disc Serial"; public const string BarcodeField = "Barcode"; - public const string ISBNField = "ISBN"; public const string CommentsField = "Comments"; public const string ContentsField = "Contents"; public const string VersionField = "Version"; @@ -187,6 +96,10 @@ public const string PVDField = "Primary Volume Descriptor (PVD)"; public const string DATField = "DAT"; + public const string SizeField = "Size"; + public const string CRC32Field = "CRC32"; + public const string MD5Field = "MD5"; + public const string SHA1Field = "SHA1"; public const string ErrorCountField = "Error Count"; public const string CuesheetField = "Cuesheet"; public const string SubIntentionField = "SubIntention Data (SecuROM/LibCrypt)"; @@ -209,7 +122,6 @@ public const string RequiredValue = "(REQUIRED)"; public const string RequiredIfExistsValue = "(REQUIRED, IF EXISTS)"; public const string OptionalValue = "(OPTIONAL)"; - public const string YesNoValue = "Yes/No"; public const string DiscNotDetected = "Disc Not Detected"; } } diff --git a/DICUI.Library/Data/Enumerations.cs b/DICUI.Library/Data/Enumerations.cs index 2eeba883..783f7f95 100644 --- a/DICUI.Library/Data/Enumerations.cs +++ b/DICUI.Library/Data/Enumerations.cs @@ -307,6 +307,49 @@ Custom }; + /// + /// List of all disc langauges + /// + public enum Language + { + Afrikaans, + Arabic, + Basque, + Bulgarian, + Catalan, + Chinese, + Croatian, + Czech, + Danish, + Dutch, + English, + Finnish, + French, + Gaelic, + German, + Greek, + Hebrew, + Hindi, + Hungarian, + Italian, + Japanese, + Korean, + Norwegian, + Polish, + Portuguese, + Punjabi, + Romanian, + Russian, + Slovak, + Slovenian, + Spanish, + Swedish, + Tamil, + Thai, + Turkish, + Ukrainian, + } + /// /// Known media types /// @@ -361,11 +404,78 @@ CED, } + /// + /// List of all known Redump regions + /// + public enum Region + { + Argentina, + Asia, + AsiaEurope, + AsiaUSA, + Australia, + Austria, + AustriaSwitzerland, + Belgium, + BelgiumNetherlands, + Brazil, + Canada, + China, + Croatia, + Czech, + Denmark, + Europe, + EuropeAsia, + EuropeAustralia, + Finland, + France, + FranceSpain, + Germany, + Greece, + Hungary, + India, + Ireland, + Israel, + Italy, + Japan, + JapanAsia, + JapanEurope, + JapanKorea, + JapanUSA, + Korea, + LatinAmerica, + Netherlands, + Norway, + Poland, + Portugal, + Russia, + Scandinavia, + Singapore, + Slovakia, + SouthAfrica, + Spain, + Sweden, + Switzerland, + Taiwan, + Thailand, + Turkey, + UnitedArabEmirates, + UK, + Ukraine, + USA, + USAAsia, + USABrazil, + USAEurope, + USAJapan, + World, + } + /// /// Generic yes/no values for Redump /// - public enum RedumpYesNo + public enum YesNo { + NULL = 0, No = 1, Yes = 2, } diff --git a/DICUI.Library/Data/SubmissionInfo.cs b/DICUI.Library/Data/SubmissionInfo.cs new file mode 100644 index 00000000..794d6d51 --- /dev/null +++ b/DICUI.Library/Data/SubmissionInfo.cs @@ -0,0 +1,244 @@ +using System; +using Newtonsoft.Json; +using Newtonsoft.Json.Converters; +using Newtonsoft.Json.Serialization; + +namespace DICUI.Data +{ + public class SubmissionInfo + { + #region Common disc info + + // TODO: Name not defined + [JsonProperty(PropertyName = "d_system", Required = Required.AllowNull)] + [JsonConverter(typeof(StringEnumConverter))] + public KnownSystem? System { get; set; } + + // TODO: Name not defined + [JsonProperty(PropertyName = "d_media", Required = Required.AllowNull)] + [JsonConverter(typeof(StringEnumConverter))] + public MediaType? Media { get; set; } + + [JsonProperty(PropertyName = "d_title", Required = Required.AllowNull)] + public string Title { get; set; } + + [JsonProperty(PropertyName = "d_title_foreign", DefaultValueHandling = DefaultValueHandling.Ignore)] + public string ForeignTitleNonLatin { get; set; } + + [JsonProperty(PropertyName = "d_number", NullValueHandling = NullValueHandling.Ignore)] + public string DiscNumberLetter { get; set; } + + [JsonProperty(PropertyName = "d_label", NullValueHandling = NullValueHandling.Ignore)] + public string DiscTitle { get; set; } + + [JsonProperty(PropertyName = "d_category", Required = Required.AllowNull)] + public Category? Category { get; set; } + + [JsonProperty(PropertyName = "d_region", Required = Required.AllowNull)] + [JsonConverter(typeof(StringEnumConverter))] + public Region? Region { get; set; } + + [JsonProperty(PropertyName = "d_languages", Required = Required.AllowNull)] + public Language?[] Languages { get; set; } + + // "Bios settings", "Language selector", "Options menu" + [JsonProperty(PropertyName = "d_languages_selection", NullValueHandling = NullValueHandling.Ignore)] + public string[] LanguageSelection { get; set; } + + [JsonProperty(PropertyName = "d_serial", NullValueHandling = NullValueHandling.Ignore)] + public string Serial { get; set; } + + [JsonProperty(PropertyName = "d_ring", NullValueHandling = NullValueHandling.Ignore)] + public string Ring { get; } + + [JsonProperty(PropertyName = "d_ring_0_id", NullValueHandling = NullValueHandling.Ignore)] + public string RingId { get; } + + [JsonProperty(PropertyName = "d_ring_0_ma1", Required = Required.AllowNull)] + public string MasteringRingFirstLayerDataSide { get; set; } + + [JsonProperty(PropertyName = "d_ring_0_ma1_sid", NullValueHandling = NullValueHandling.Ignore)] + public string MasteringSIDCodeFirstLayerDataSide { get; set; } + + [JsonProperty(PropertyName = "d_ring_0_ts1", NullValueHandling = NullValueHandling.Ignore)] + public string ToolstampMasteringCodeFirstLayerDataSide { get; set; } + + [JsonProperty(PropertyName = "d_ring_0_mo1_sid", NullValueHandling = NullValueHandling.Ignore)] + public string MouldSIDCodeFirstLayerDataSide { get; set; } + + [JsonProperty(PropertyName = "dr_ring_0_mo1", NullValueHandling = NullValueHandling.Ignore)] + public string AdditionalMouldFirstLayerDataSide { get; set; } + + [JsonProperty(PropertyName = "d_ring_0_ma2", NullValueHandling = NullValueHandling.Ignore)] + public string MasteringRingSecondLayerLabelSide { get; set; } + + [JsonProperty(PropertyName = "d_ring_0_ma2_sid", NullValueHandling = NullValueHandling.Ignore)] + public string MasteringSIDCodeSecondLayerLabelSide { get; set; } + + [JsonProperty(PropertyName = "d_ring_0_ts2", NullValueHandling = NullValueHandling.Ignore)] + public string ToolstampMasteringCodeSecondLayerLabelSide { get; set; } + + [JsonProperty(PropertyName = "d_ring_0_mo2_sid", NullValueHandling = NullValueHandling.Ignore)] + public string MouldSIDCodeSecondLayerLabelSide { get; set; } + + [JsonProperty(PropertyName = "dr_ring_0_mo2", NullValueHandling = NullValueHandling.Ignore)] + public string AdditionalMouldSecondLayerLabelSide { get; set; } + + [JsonProperty(PropertyName = "d_ring_0_offsets", NullValueHandling = NullValueHandling.Ignore)] + public string RingOffsetsHidden { get { return "1"; } } + + [JsonProperty(PropertyName = "d_ring_0_0_id", NullValueHandling = NullValueHandling.Ignore)] + public string RingZeroId { get; } + + [JsonProperty(PropertyName = "d_ring_0_0_density", NullValueHandling = NullValueHandling.Ignore)] + public string RingZeroDensity { get; } + + [JsonProperty(PropertyName = "d_ring_0_0_value", NullValueHandling = NullValueHandling.Ignore)] + public string RingWriteOffset { get; set; } + + [JsonProperty(PropertyName = "d_ring_count", NullValueHandling = NullValueHandling.Ignore)] + public string RingCount { get { return "1"; } } + + [JsonProperty(PropertyName = "d_barcode", NullValueHandling = NullValueHandling.Ignore)] + public string Barcode { get; set; } + + [JsonProperty(PropertyName = "d_date", NullValueHandling = NullValueHandling.Ignore)] + public DateTime? EXEDateBuildDate { get; set; } + + [JsonProperty(PropertyName = "d_errors", NullValueHandling = NullValueHandling.Ignore)] + public string ErrorsCount { get; set; } + + [JsonProperty(PropertyName = "d_comments", NullValueHandling = NullValueHandling.Ignore)] + public string Comments { get; set; } + + [JsonProperty(PropertyName = "d_contents", NullValueHandling = NullValueHandling.Ignore)] + public string Contents { get; set; } + + #endregion + + #region Version and Editions + + [JsonProperty(PropertyName = "d_version", NullValueHandling = NullValueHandling.Ignore)] + public string Version { get; set; } + + [JsonProperty(PropertyName = "d_version_datfile", NullValueHandling = NullValueHandling.Ignore)] + public string VersionDatfile { get; set; } + + [JsonProperty(PropertyName = "d_editions", NullValueHandling = NullValueHandling.Ignore)] + public string[] CommonEditions { get; set; } + + [JsonProperty(PropertyName = "d_editions_text", NullValueHandling = NullValueHandling.Ignore)] + public string OtherEditions { get; set; } + + #endregion + + #region EDC (PSX-only) + + [JsonProperty(PropertyName = "d_edc", NullValueHandling = NullValueHandling.Ignore)] + public YesNo EDC { get; set; } + + #endregion + + #region Parent/Clone relationship + + [JsonProperty(PropertyName = "d_parent_id", NullValueHandling = NullValueHandling.Ignore)] + public string ParentID { get; set; } + + [JsonProperty(PropertyName = "d_is_regional_parent", NullValueHandling = NullValueHandling.Ignore)] + public bool RegionalParent { get; set; } + + #endregion + + #region Extras + + [JsonProperty(PropertyName = "d_pvd", NullValueHandling = NullValueHandling.Ignore)] + public string PVD { get; set; } + + [JsonProperty(PropertyName = "d_d1_key", NullValueHandling = NullValueHandling.Ignore)] + public string DiscKey { get; set; } + + [JsonProperty(PropertyName = "d_d2_key", NullValueHandling = NullValueHandling.Ignore)] + public string DiscID { get; set; } + + [JsonProperty(PropertyName = "d_pic_data", NullValueHandling = NullValueHandling.Ignore)] + public string PIC { get; set; } + + [JsonProperty(PropertyName = "d_header", NullValueHandling = NullValueHandling.Ignore)] + public string Header { get; set; } + + [JsonProperty(PropertyName = "d_bca", NullValueHandling = NullValueHandling.Ignore)] + public string BCA { get; set; } + + [JsonProperty(PropertyName = "d_ssranges", NullValueHandling = NullValueHandling.Ignore)] + public string SecuritySectorRanges { get; set; } + + #endregion + + #region Copy protection + + [JsonProperty(PropertyName = "d_protection_a", NullValueHandling = NullValueHandling.Ignore)] + public YesNo AntiModchip { get; set; } + + [JsonProperty(PropertyName = "d_protection_1", NullValueHandling = NullValueHandling.Ignore)] + public YesNo LibCrypt { get; set; } + + [JsonProperty(PropertyName = "d_libcrypt", NullValueHandling = NullValueHandling.Ignore)] + public string LibCryptData { get; set; } + + [JsonProperty(PropertyName = "d_protection", NullValueHandling = NullValueHandling.Ignore)] + public string Protection { get; set; } + + [JsonProperty(PropertyName = "d_securom", NullValueHandling = NullValueHandling.Ignore)] + public string SecuROMData { get; set; } + + #endregion + + #region Dumpers and Status (Moderator only) + + [JsonProperty(PropertyName = "d_status", NullValueHandling = NullValueHandling.Ignore)] + public DumpStatus Status { get; set; } + + [JsonProperty(PropertyName = "d_dumpers", NullValueHandling = NullValueHandling.Ignore)] + public string[] Dumpers { get; set; } + + [JsonProperty(PropertyName = "d_dumpers_text", NullValueHandling = NullValueHandling.Ignore)] + public string OtherDumpers { get; set; } + + #endregion + + #region Tracks and write offsets (CD,GD-baed) + + [JsonProperty(PropertyName = "d_tracks", NullValueHandling = NullValueHandling.Ignore)] + public string ClrMameProData { get; set; } + + [JsonProperty(PropertyName = "d_cue", NullValueHandling = NullValueHandling.Ignore)] + public string Cuesheet { get; set; } + + [JsonProperty(PropertyName = "d_offset", NullValueHandling = NullValueHandling.Ignore)] + public int[] CommonWriteOffsets { get; set; } + + [JsonProperty(PropertyName = "d_offset_text", NullValueHandling = NullValueHandling.Ignore)] + public string OtherWriteOffsets { get; set; } + + #endregion + + #region Size & Checksum (DVD,BD,UMD-based) + + [JsonProperty(PropertyName = "d_layerbreak", NullValueHandling = NullValueHandling.Ignore)] + public long Layerbreak { get; set; } + + [JsonProperty(PropertyName = "d_size", NullValueHandling = NullValueHandling.Ignore)] + public long Size { get; set; } + + [JsonProperty(PropertyName = "d_crc32", NullValueHandling = NullValueHandling.Ignore)] + public string CRC32 { get; set; } + + [JsonProperty(PropertyName = "d_md5", NullValueHandling = NullValueHandling.Ignore)] + public string MD5 { get; set; } + + [JsonProperty(PropertyName = "d_sha1", NullValueHandling = NullValueHandling.Ignore)] + public string SHA1 { get; set; } + + #endregion + } +} diff --git a/DICUI.Library/Utilities/Converters.cs b/DICUI.Library/Utilities/Converters.cs index b2dcd351..3a5b6a50 100644 --- a/DICUI.Library/Utilities/Converters.cs +++ b/DICUI.Library/Utilities/Converters.cs @@ -266,356 +266,41 @@ namespace DICUI.Utilities } } - /// - /// Get the string representation of the MediaType enum values - /// - /// MediaType value to convert - /// String representing the value, if possible - public static string MediaTypeToString(MediaType? type) - { - switch (type) - { - #region Punched Media - - case MediaType.ApertureCard: - return "Aperture card"; - case MediaType.JacquardLoomCard: - return "Jacquard Loom card"; - case MediaType.MagneticStripeCard: - return "Magnetic stripe card"; - case MediaType.OpticalPhonecard: - return "Optical phonecard"; - case MediaType.PunchedCard: - return "Punched card"; - case MediaType.PunchedTape: - return "Punched tape"; - - #endregion - - #region Tape - - case MediaType.OpenReel: - return "Open Reel Tape"; - case MediaType.DataCartridge: - return "Data Tape Cartridge"; - case MediaType.Cassette: - return "Cassette Tape"; - - #endregion - - #region Disc / Disc - - case MediaType.BluRay: - return "BD-ROM"; - case MediaType.CDROM: - return "CD-ROM"; - case MediaType.DVD: - return "DVD-ROM"; - case MediaType.FloppyDisk: - return "Floppy Disk"; - case MediaType.Floptical: - return "Floptical"; - case MediaType.GDROM: - return "GD-ROM"; - case MediaType.HDDVD: - return "HD-DVD-ROM"; - case MediaType.HardDisk: - return "Hard Disk"; - case MediaType.IomegaBernoulliDisk: - return "Iomega Bernoulli Disk"; - case MediaType.IomegaJaz: - return "Iomega Jaz"; - case MediaType.IomegaZip: - return "Iomega Zip"; - case MediaType.LaserDisc: - return "LD-ROM / LV-ROM"; - case MediaType.Nintendo64DD: - return "64DD Disk"; - case MediaType.NintendoFamicomDiskSystem: - return "Famicom Disk System Disk"; - case MediaType.NintendoGameCubeGameDisc: - return "GameCube Game Disc"; - case MediaType.NintendoWiiOpticalDisc: - return "Wii Optical Disc"; - case MediaType.NintendoWiiUOpticalDisc: - return "Wii U Optical Disc"; - case MediaType.UMD: - return "UMD"; - - #endregion - - // Unsorted Formats - case MediaType.Cartridge: - return "Cartridge"; - case MediaType.CED: - return "CED"; - - case MediaType.NONE: - default: - return "Unknown"; - } - } + #region Convert to Long Name /// - /// Get the short string representation of the MediaType enum values + /// Get the string representation of the Category enum values /// - /// MediaType value to convert + /// Category value to convert /// Short string representing the value, if possible - public static string MediaTypeToShortString(MediaType? type) + public static string LongName(Category? category) { - switch (type) + switch (category) { - #region Punched Media - - case MediaType.ApertureCard: - return "aperture"; - case MediaType.JacquardLoomCard: - return "jacquard loom card"; - case MediaType.MagneticStripeCard: - return "magnetic stripe"; - case MediaType.OpticalPhonecard: - return "optical phonecard"; - case MediaType.PunchedCard: - return "punchcard"; - case MediaType.PunchedTape: - return "punchtape"; - - #endregion - - #region Tape - - case MediaType.OpenReel: - return "open reel"; - case MediaType.DataCartridge: - return "data cartridge"; - case MediaType.Cassette: - return "cassette"; - - #endregion - - #region Disc / Disc - - case MediaType.BluRay: - return "bdrom"; - case MediaType.CDROM: - return "cdrom"; - case MediaType.DVD: - return "dvd"; - case MediaType.FloppyDisk: - return "fd"; - case MediaType.Floptical: - return "floptical"; - case MediaType.GDROM: - return "gdrom"; - case MediaType.HDDVD: - return "hddvd"; - case MediaType.HardDisk: - return "hdd"; - case MediaType.IomegaBernoulliDisk: - return "bernoulli"; - case MediaType.IomegaJaz: - return "jaz"; - case MediaType.IomegaZip: - return "zip"; - case MediaType.LaserDisc: - return "ldrom"; - case MediaType.Nintendo64DD: - return "64dd"; - case MediaType.NintendoFamicomDiskSystem: - return "fds"; - case MediaType.NintendoGameCubeGameDisc: - return "gc"; - case MediaType.NintendoWiiOpticalDisc: - return "wii"; - case MediaType.NintendoWiiUOpticalDisc: - return "wiiu"; - case MediaType.UMD: - return "umd"; - - #endregion - - // Unsorted Formats - case MediaType.Cartridge: - return "cart"; - case MediaType.CED: - return "ced"; - - case MediaType.NONE: + 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 "unknown"; - } - } - - /// - /// Get the MediaType enum value for a given string - /// - /// String value to convert - /// MediaType represented by the string, if possible - public static MediaType StringToMediaType(string type) - { - switch (type.ToLowerInvariant()) - { - #region Punched Media - - case "aperture": - case "aperturecard": - case "aperture card": - return MediaType.ApertureCard; - case "jacquardloom": - case "jacquardloomcard": - case "jacquard loom card": - return MediaType.JacquardLoomCard; - case "magneticstripe": - case "magneticstripecard": - case "magnetic stripe card": - return MediaType.MagneticStripeCard; - case "opticalphone": - case "opticalphonecard": - case "optical phonecard": - return MediaType.OpticalPhonecard; - case "punchcard": - case "punchedcard": - case "punched card": - return MediaType.PunchedCard; - case "punchtape": - case "punchedtape": - case "punched tape": - return MediaType.PunchedTape; - - #endregion - - #region Tape - - case "openreel": - case "openreeltape": - case "open reel tape": - return MediaType.OpenReel; - case "datacart": - case "datacartridge": - case "datatapecartridge": - case "data tape cartridge": - return MediaType.DataCartridge; - case "cassette": - case "cassettetape": - case "cassette tape": - return MediaType.Cassette; - - #endregion - - #region Disc / Disc - - case "bd": - case "bdrom": - case "bd-rom": - case "bluray": - return MediaType.BluRay; - case "cd": - case "cdrom": - case "cd-rom": - return MediaType.CDROM; - case "dvd": - case "dvd5": - case "dvd-5": - case "dvd9": - case "dvd-9": - case "dvdrom": - case "dvd-rom": - return MediaType.DVD; - case "fd": - case "floppy": - case "floppydisk": - case "floppy disk": - case "floppy diskette": - return MediaType.FloppyDisk; - case "floptical": - return MediaType.Floptical; - case "gd": - case "gdrom": - case "gd-rom": - return MediaType.GDROM; - case "hddvd": - case "hd-dvd": - case "hddvdrom": - case "hd-dvd-rom": - return MediaType.HDDVD; - case "hdd": - case "harddisk": - case "hard disk": - return MediaType.HardDisk; - case "bernoullidisk": - case "iomegabernoullidisk": - case "bernoulli disk": - case "iomega bernoulli disk": - return MediaType.IomegaBernoulliDisk; - case "jaz": - case "iomegajaz": - case "iomega jaz": - return MediaType.IomegaJaz; - case "zip": - case "zipdisk": - case "iomegazip": - case "iomega zip": - return MediaType.IomegaZip; - case "ldrom": - case "lvrom": - case "ld-rom": - case "lv-rom": - case "laserdisc": - case "laservision": - case "ld-rom / lv-rom": - return MediaType.LaserDisc; - case "64dd": - case "n64dd": - case "64dddisk": - case "n64dddisk": - case "64dd disk": - case "n64dd disk": - return MediaType.Nintendo64DD; - case "fds": - case "famicom": - case "nfds": - case "nintendofamicom": - case "famicomdisksystem": - case "famicom disk system": - case "famicom disk system disk": - return MediaType.NintendoFamicomDiskSystem; - case "gc": - case "gamecube": - case "nintendogamecube": - case "nintendo gamecube": - case "gamecube disc": - case "gamecube game disc": - return MediaType.NintendoGameCubeGameDisc; - case "wii": - case "nintendowii": - case "nintendo wii": - case "nintendo wii disc": - case "wii optical disc": - return MediaType.NintendoWiiOpticalDisc; - case "wiiu": - case "nintendowiiu": - case "nintendo wiiu": - case "nintendo wiiu disc": - case "wiiu optical disc": - case "wii u optical disc": - return MediaType.NintendoWiiUOpticalDisc; - case "umd": - return MediaType.UMD; - - #endregion - - // Unsorted Formats - case "cartridge": - return MediaType.Cartridge; - case "ced": - case "rcaced": - case "rca ced": - case "videodisc": - case "rca videodisc": - return MediaType.CED; - - default: - return MediaType.NONE; + return null; } } @@ -624,7 +309,7 @@ namespace DICUI.Utilities /// /// KnownSystem value to convert /// String representing the value, if possible - public static string KnownSystemToString(KnownSystem? sys) + public static string LongName(KnownSystem? sys) { switch (sys) { @@ -878,12 +563,343 @@ namespace DICUI.Utilities } } + /// + /// Get the string representation of the Language enum values + /// + /// Language value to convert + /// String representing the value, if possible + public static string LongName(Language? lang) + { + switch (lang) + { + case Language.Afrikaans: + return "Afrikaans"; + case Language.Arabic: + return "Arabic"; + case Language.Basque: + return "Basque"; + case Language.Bulgarian: + return "Bulgarian"; + case Language.Catalan: + return "Catalan"; + case Language.Chinese: + return "Chinese"; + case Language.Croatian: + return "Croatian"; + case Language.Czech: + return "Czech"; + case Language.Danish: + return "Danish"; + case Language.Dutch: + return "Dutch"; + case Language.English: + return "English"; + case Language.Finnish: + return "Finnish"; + case Language.French: + return "French"; + case Language.Gaelic: + return "Gaelic"; + case Language.German: + return "German"; + case Language.Greek: + return "Greek"; + case Language.Hebrew: + return "Hebrew"; + case Language.Hindi: + return "Hindi"; + case Language.Hungarian: + return "Hungarian"; + case Language.Italian: + return "Italian"; + case Language.Japanese: + return "Japanese"; + case Language.Korean: + return "Korean"; + case Language.Norwegian: + return "Norwegian"; + case Language.Polish: + return "Polish"; + case Language.Portuguese: + return "Portuguese"; + case Language.Punjabi: + return "Punjabi"; + case Language.Romanian: + return "Romanian"; + case Language.Russian: + return "Russian"; + case Language.Slovak: + return "Slovak"; + case Language.Slovenian: + return "Slovenian"; + case Language.Spanish: + return "Spanish"; + case Language.Swedish: + return "Swedish"; + case Language.Tamil: + return "Tamil"; + case Language.Thai: + return "Thai"; + case Language.Turkish: + return "Turkish"; + case Language.Ukrainian: + return "Ukrainian"; + default: + return "Klingon (CHANGE THIS)"; + } + } + + /// + /// Get the string representation of the MediaType enum values + /// + /// MediaType value to convert + /// String representing the value, if possible + public static string LongName(MediaType? type) + { + switch (type) + { + #region Punched Media + + case MediaType.ApertureCard: + return "Aperture card"; + case MediaType.JacquardLoomCard: + return "Jacquard Loom card"; + case MediaType.MagneticStripeCard: + return "Magnetic stripe card"; + case MediaType.OpticalPhonecard: + return "Optical phonecard"; + case MediaType.PunchedCard: + return "Punched card"; + case MediaType.PunchedTape: + return "Punched tape"; + + #endregion + + #region Tape + + case MediaType.OpenReel: + return "Open Reel Tape"; + case MediaType.DataCartridge: + return "Data Tape Cartridge"; + case MediaType.Cassette: + return "Cassette Tape"; + + #endregion + + #region Disc / Disc + + case MediaType.BluRay: + return "BD-ROM"; + case MediaType.CDROM: + return "CD-ROM"; + case MediaType.DVD: + return "DVD-ROM"; + case MediaType.FloppyDisk: + return "Floppy Disk"; + case MediaType.Floptical: + return "Floptical"; + case MediaType.GDROM: + return "GD-ROM"; + case MediaType.HDDVD: + return "HD-DVD-ROM"; + case MediaType.HardDisk: + return "Hard Disk"; + case MediaType.IomegaBernoulliDisk: + return "Iomega Bernoulli Disk"; + case MediaType.IomegaJaz: + return "Iomega Jaz"; + case MediaType.IomegaZip: + return "Iomega Zip"; + case MediaType.LaserDisc: + return "LD-ROM / LV-ROM"; + case MediaType.Nintendo64DD: + return "64DD Disk"; + case MediaType.NintendoFamicomDiskSystem: + return "Famicom Disk System Disk"; + case MediaType.NintendoGameCubeGameDisc: + return "GameCube Game Disc"; + case MediaType.NintendoWiiOpticalDisc: + return "Wii Optical Disc"; + case MediaType.NintendoWiiUOpticalDisc: + return "Wii U Optical Disc"; + case MediaType.UMD: + return "UMD"; + + #endregion + + // Unsorted Formats + case MediaType.Cartridge: + return "Cartridge"; + case MediaType.CED: + return "CED"; + + case MediaType.NONE: + default: + return "Unknown"; + } + } + + /// + /// Get the string representation of the Region enum values + /// + /// Region value to convert + /// String representing the value, if possible + public static string LongName(Region? region) + { + switch (region) + { + case Region.Argentina: + return "Argentina"; + case Region.Asia: + return "Asia"; + case Region.AsiaEurope: + return "Asia, Europe"; + case Region.AsiaUSA: + return "Asia, USA"; + case Region.Australia: + return "Australia"; + case Region.Austria: + return "Austria"; + case Region.AustriaSwitzerland: + return "Austria, Switzerland"; + case Region.Belgium: + return "Belgium"; + case Region.BelgiumNetherlands: + return "Belgium, Netherlands"; + case Region.Brazil: + return "Brazil"; + case Region.Canada: + return "Canada"; + case Region.China: + return "China"; + case Region.Croatia: + return "Croatia"; + case Region.Czech: + return "Czech"; + case Region.Denmark: + return "Denmark"; + case Region.Europe: + return "Europe"; + case Region.EuropeAsia: + return "Europe, Asia"; + case Region.EuropeAustralia: + return "Europe, Australia"; + case Region.Finland: + return "Finland"; + case Region.France: + return "France"; + case Region.FranceSpain: + return "France, Spain"; + case Region.Germany: + return "Germany"; + case Region.Greece: + return "Greece"; + case Region.Hungary: + return "Hungary"; + case Region.India: + return "India"; + case Region.Ireland: + return "Ireland"; + case Region.Israel: + return "Israel"; + case Region.Italy: + return "Italy"; + case Region.Japan: + return "Japan"; + case Region.JapanAsia: + return "Japan, Asia"; + case Region.JapanEurope: + return "Japan, Europe"; + case Region.JapanKorea: + return "Japan, Korea"; + case Region.JapanUSA: + return "Japan, USA"; + case Region.Korea: + return "Korea"; + case Region.LatinAmerica: + return "Latin America"; + case Region.Netherlands: + return "Netherlands"; + case Region.Norway: + return "Norway"; + case Region.Poland: + return "Poland"; + case Region.Portugal: + return "Portugal"; + case Region.Russia: + return "Russia"; + case Region.Scandinavia: + return "Scandinavia"; + case Region.Singapore: + return "Singapore"; + case Region.Slovakia: + return "Slovakia"; + case Region.SouthAfrica: + return "South Africa"; + case Region.Spain: + return "Spain"; + case Region.Sweden: + return "Sweden"; + case Region.Switzerland: + return "Switzerland"; + case Region.Taiwan: + return "Taiwan"; + case Region.Thailand: + return "Thailand"; + case Region.Turkey: + return "Turkey"; + case Region.UnitedArabEmirates: + return "United Arab Emirates"; + case Region.UK: + return "UK"; + case Region.Ukraine: + return "Ukraine"; + case Region.USA: + return "USA"; + case Region.USAAsia: + return "USA, Asia"; + case Region.USABrazil: + return "USA, Brazil"; + case Region.USAEurope: + return "USA, Europe"; + case Region.USAJapan: + return "USA, Japan"; + case Region.World: + return "World"; + default: + return "World (CHANGE THIS)"; + } + } + + /// + /// Get the string representation of the YesNo enum values + /// + /// YesNo value to convert + /// String representing the value, if possible + public static string LongName(YesNo yesno) + { + switch(yesno) + { + case YesNo.No: + return "No"; + case YesNo.Yes: + return "Yes"; + default: + case YesNo.NULL: + return "Yes/No"; + } + } + + #endregion + + #region Convert to Short Name + /// /// Get the short string representation of the KnownSystem enum values /// /// KnownSystem value to convert /// Short string representing the value, if possible - public static string KnownSystemToShortString(KnownSystem? sys) + public static string ShortName(KnownSystem? sys) { switch (sys) { @@ -1137,6 +1153,318 @@ namespace DICUI.Utilities } } + /// + /// Get the short string representation of the Language enum values + /// + /// Language value to convert + /// Short string representing the value, if possible + public static string ShortName(Language? lang) + { + switch (lang) + { + case Language.Afrikaans: + return "afr"; + case Language.Arabic: + return "ara"; + case Language.Basque: + return "baq"; + case Language.Bulgarian: + return "bul"; + case Language.Catalan: + return "cat"; + case Language.Chinese: + return "chi"; + case Language.Croatian: + return "hrv"; + case Language.Czech: + return "cze"; + case Language.Danish: + return "dan"; + case Language.Dutch: + return "dut"; + case Language.English: + return "eng"; + case Language.Finnish: + return "fin"; + case Language.French: + return "fre"; + case Language.Gaelic: + return "gla"; + case Language.German: + return "ger"; + case Language.Greek: + return "gre"; + case Language.Hebrew: + return "heb"; + case Language.Hindi: + return "hin"; + case Language.Hungarian: + return "hun"; + case Language.Italian: + return "ita"; + case Language.Japanese: + return "jap"; + case Language.Korean: + return "kor"; + case Language.Norwegian: + return "nor"; + case Language.Polish: + return "pol"; + case Language.Portuguese: + return "por"; + case Language.Punjabi: + return "pan"; + case Language.Romanian: + return "ron"; + case Language.Russian: + return "rus"; + case Language.Slovak: + return "slk"; + case Language.Slovenian: + return "slv"; + case Language.Spanish: + return "spa"; + case Language.Swedish: + return "swe"; + case Language.Tamil: + return "tam"; + case Language.Thai: + return "tha"; + case Language.Turkish: + return "tur"; + case Language.Ukrainian: + return "ukr"; + default: + return "unk"; + } + } + + /// + /// Get the short string representation of the MediaType enum values + /// + /// MediaType value to convert + /// Short string representing the value, if possible + public static string ShortName(MediaType? type) + { + switch (type) + { + #region Punched Media + + case MediaType.ApertureCard: + return "aperture"; + case MediaType.JacquardLoomCard: + return "jacquard loom card"; + case MediaType.MagneticStripeCard: + return "magnetic stripe"; + case MediaType.OpticalPhonecard: + return "optical phonecard"; + case MediaType.PunchedCard: + return "punchcard"; + case MediaType.PunchedTape: + return "punchtape"; + + #endregion + + #region Tape + + case MediaType.OpenReel: + return "open reel"; + case MediaType.DataCartridge: + return "data cartridge"; + case MediaType.Cassette: + return "cassette"; + + #endregion + + #region Disc / Disc + + case MediaType.BluRay: + return "bdrom"; + case MediaType.CDROM: + return "cdrom"; + case MediaType.DVD: + return "dvd"; + case MediaType.FloppyDisk: + return "fd"; + case MediaType.Floptical: + return "floptical"; + case MediaType.GDROM: + return "gdrom"; + case MediaType.HDDVD: + return "hddvd"; + case MediaType.HardDisk: + return "hdd"; + case MediaType.IomegaBernoulliDisk: + return "bernoulli"; + case MediaType.IomegaJaz: + return "jaz"; + case MediaType.IomegaZip: + return "zip"; + case MediaType.LaserDisc: + return "ldrom"; + case MediaType.Nintendo64DD: + return "64dd"; + case MediaType.NintendoFamicomDiskSystem: + return "fds"; + case MediaType.NintendoGameCubeGameDisc: + return "gc"; + case MediaType.NintendoWiiOpticalDisc: + return "wii"; + case MediaType.NintendoWiiUOpticalDisc: + return "wiiu"; + case MediaType.UMD: + return "umd"; + + #endregion + + // Unsorted Formats + case MediaType.Cartridge: + return "cart"; + case MediaType.CED: + return "ced"; + + case MediaType.NONE: + default: + return "unknown"; + } + } + + /// + /// Get the short string representation of the Region enum values + /// + /// Region value to convert + /// Short string representing the value, if possible + public static string ShortName(Region? region) + { + switch (region) + { + case Region.Argentina: + return "Ar"; + case Region.Asia: + return "A"; + case Region.AsiaEurope: + return "A,E"; + case Region.AsiaUSA: + return "A,U"; + case Region.Australia: + return "Au"; + case Region.Austria: + return "At"; + case Region.AustriaSwitzerland: + return "At,Ch"; + case Region.Belgium: + return "Be"; + case Region.BelgiumNetherlands: + return "Be,N"; + case Region.Brazil: + return "B"; + case Region.Canada: + return "Ca"; + case Region.China: + return "C"; + case Region.Croatia: + return "Hr"; + case Region.Czech: + return "Cz"; + case Region.Denmark: + return "Dk"; + case Region.Europe: + return "E"; + case Region.EuropeAsia: + return "E,A"; + case Region.EuropeAustralia: + return "E,Au"; + case Region.Finland: + return "Fi"; + case Region.France: + return "F"; + case Region.FranceSpain: + return "F,S"; + case Region.Germany: + return "G"; + case Region.Greece: + return "Gr"; + case Region.Hungary: + return "H"; + case Region.India: + return "In"; + case Region.Ireland: + return "Ie"; + case Region.Israel: + return "Il"; + case Region.Italy: + return "I"; + case Region.Japan: + return "J"; + case Region.JapanAsia: + return "J,A"; + case Region.JapanEurope: + return "J,E"; + case Region.JapanKorea: + return "J,K"; + case Region.JapanUSA: + return "J,U"; + case Region.Korea: + return "K"; + case Region.LatinAmerica: + return "LAm"; + case Region.Netherlands: + return "N"; + case Region.Norway: + return "No"; + case Region.Poland: + return "P"; + case Region.Portugal: + return "Pt"; + case Region.Russia: + return "R"; + case Region.Scandinavia: + return "Sca"; + case Region.Singapore: + return "Sg"; + case Region.Slovakia: + return "Sk"; + case Region.SouthAfrica: + return "Za"; + case Region.Spain: + return "S"; + case Region.Sweden: + return "Sw"; + case Region.Switzerland: + return "Ch"; + case Region.Taiwan: + return "Tw"; + case Region.Thailand: + return "Th"; + case Region.Turkey: + return "Tr"; + case Region.UnitedArabEmirates: + return "Ae"; + case Region.UK: + return "Uk"; + case Region.Ukraine: + return "Ue"; + case Region.USA: + return "U"; + case Region.USAAsia: + return "U,A"; + case Region.USABrazil: + return "U,B"; + case Region.USAEurope: + return "U,E"; + case Region.USAJapan: + return "U,J"; + case Region.World: + return "W"; + default: + return null; + } + } + + #endregion + + #region Convert From String + /// /// Get the KnownSystem enum value for a given string /// @@ -1846,5 +2174,180 @@ namespace DICUI.Utilities return KnownSystem.NONE; } } + + /// + /// Get the MediaType enum value for a given string + /// + /// String value to convert + /// MediaType represented by the string, if possible + public static MediaType StringToMediaType(string type) + { + switch (type.ToLowerInvariant()) + { + #region Punched Media + + case "aperture": + case "aperturecard": + case "aperture card": + return MediaType.ApertureCard; + case "jacquardloom": + case "jacquardloomcard": + case "jacquard loom card": + return MediaType.JacquardLoomCard; + case "magneticstripe": + case "magneticstripecard": + case "magnetic stripe card": + return MediaType.MagneticStripeCard; + case "opticalphone": + case "opticalphonecard": + case "optical phonecard": + return MediaType.OpticalPhonecard; + case "punchcard": + case "punchedcard": + case "punched card": + return MediaType.PunchedCard; + case "punchtape": + case "punchedtape": + case "punched tape": + return MediaType.PunchedTape; + + #endregion + + #region Tape + + case "openreel": + case "openreeltape": + case "open reel tape": + return MediaType.OpenReel; + case "datacart": + case "datacartridge": + case "datatapecartridge": + case "data tape cartridge": + return MediaType.DataCartridge; + case "cassette": + case "cassettetape": + case "cassette tape": + return MediaType.Cassette; + + #endregion + + #region Disc / Disc + + case "bd": + case "bdrom": + case "bd-rom": + case "bluray": + return MediaType.BluRay; + case "cd": + case "cdrom": + case "cd-rom": + return MediaType.CDROM; + case "dvd": + case "dvd5": + case "dvd-5": + case "dvd9": + case "dvd-9": + case "dvdrom": + case "dvd-rom": + return MediaType.DVD; + case "fd": + case "floppy": + case "floppydisk": + case "floppy disk": + case "floppy diskette": + return MediaType.FloppyDisk; + case "floptical": + return MediaType.Floptical; + case "gd": + case "gdrom": + case "gd-rom": + return MediaType.GDROM; + case "hddvd": + case "hd-dvd": + case "hddvdrom": + case "hd-dvd-rom": + return MediaType.HDDVD; + case "hdd": + case "harddisk": + case "hard disk": + return MediaType.HardDisk; + case "bernoullidisk": + case "iomegabernoullidisk": + case "bernoulli disk": + case "iomega bernoulli disk": + return MediaType.IomegaBernoulliDisk; + case "jaz": + case "iomegajaz": + case "iomega jaz": + return MediaType.IomegaJaz; + case "zip": + case "zipdisk": + case "iomegazip": + case "iomega zip": + return MediaType.IomegaZip; + case "ldrom": + case "lvrom": + case "ld-rom": + case "lv-rom": + case "laserdisc": + case "laservision": + case "ld-rom / lv-rom": + return MediaType.LaserDisc; + case "64dd": + case "n64dd": + case "64dddisk": + case "n64dddisk": + case "64dd disk": + case "n64dd disk": + return MediaType.Nintendo64DD; + case "fds": + case "famicom": + case "nfds": + case "nintendofamicom": + case "famicomdisksystem": + case "famicom disk system": + case "famicom disk system disk": + return MediaType.NintendoFamicomDiskSystem; + case "gc": + case "gamecube": + case "nintendogamecube": + case "nintendo gamecube": + case "gamecube disc": + case "gamecube game disc": + return MediaType.NintendoGameCubeGameDisc; + case "wii": + case "nintendowii": + case "nintendo wii": + case "nintendo wii disc": + case "wii optical disc": + return MediaType.NintendoWiiOpticalDisc; + case "wiiu": + case "nintendowiiu": + case "nintendo wiiu": + case "nintendo wiiu disc": + case "wiiu optical disc": + case "wii u optical disc": + return MediaType.NintendoWiiUOpticalDisc; + case "umd": + return MediaType.UMD; + + #endregion + + // Unsorted Formats + case "cartridge": + return MediaType.Cartridge; + case "ced": + case "rcaced": + case "rca ced": + case "videodisc": + case "rca videodisc": + return MediaType.CED; + + default: + return MediaType.NONE; + } + } + + #endregion } } \ No newline at end of file diff --git a/DICUI.Library/Utilities/DumpEnvironment.cs b/DICUI.Library/Utilities/DumpEnvironment.cs index a6fdf299..ace55e1c 100644 --- a/DICUI.Library/Utilities/DumpEnvironment.cs +++ b/DICUI.Library/Utilities/DumpEnvironment.cs @@ -7,6 +7,7 @@ using System.Text; using System.Text.RegularExpressions; using System.Threading.Tasks; using DICUI.Data; +using Newtonsoft.Json; namespace DICUI.Utilities { @@ -411,45 +412,39 @@ namespace DICUI.Utilities /// Extract all of the possible information from a given input combination /// /// Drive letter to check - /// Dictionary containing mapped output values, null on error - /// TODO: Make sure that all special formats are accounted for - private Dictionary ExtractOutputInformation(IProgress progress) + /// SubmissionInfo populated based on outputs, null on error + private SubmissionInfo ExtractOutputInformation(IProgress progress) { // Ensure the current disc combination should exist if (!Validators.GetValidMediaTypes(System).Contains(Type)) - { return null; - } // Sanitize the output filename to strip off any potential extension string outputFilename = Path.GetFileNameWithoutExtension(OutputFilename); // Check that all of the relevant files are there if (!FoundAllFiles()) - { return null; - } - // Create the output dictionary with all user-inputted values by default + // Create the SubmissionInfo object with all user-inputted values by default string combinedBase = Path.Combine(OutputDirectory, outputFilename); - Dictionary mappings = new Dictionary + SubmissionInfo info = new SubmissionInfo() { - { Template.TitleField, Template.RequiredValue }, - { Template.ForeignTitleField, Template.OptionalValue }, - { Template.DiscNumberField, Template.OptionalValue }, - { Template.DiscTitleField, Template.OptionalValue }, - { Template.SystemField, System.Name() }, - { Template.MediaTypeField, Type.Name() }, - { 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") }, + System = this.System, + Media = this.Type, + Title = Template.RequiredValue, + ForeignTitleNonLatin = Template.OptionalValue, + DiscNumberLetter = Template.OptionalValue, + DiscTitle = Template.OptionalValue, + Category = Category.Games, + Region = null, + Languages = null, + Serial = Template.RequiredIfExistsValue, + Barcode = Template.OptionalValue, + Contents = Template.OptionalValue, + Version = Template.RequiredIfExistsValue, + OtherEditions = "Original (VERIFY THIS)", + ClrMameProData = GetDatfile(combinedBase + ".dat"), }; // Now we want to do a check by MediaType and extract all required info @@ -457,13 +452,13 @@ namespace DICUI.Utilities { case MediaType.CDROM: case MediaType.GDROM: // TODO: Verify GD-ROM outputs this - mappings[Template.MasteringRingField] = Template.RequiredIfExistsValue; - mappings[Template.MasteringSIDField] = Template.RequiredIfExistsValue; - mappings["Label-Side " + Template.MouldSIDField] = Template.RequiredIfExistsValue; - mappings["Data-Side " + Template.MouldSIDField] = Template.RequiredIfExistsValue; - mappings[Template.AdditionalMouldField] = Template.RequiredIfExistsValue; - mappings[Template.ToolstampField] = Template.RequiredIfExistsValue; - mappings[Template.PVDField] = GetPVD(combinedBase + "_mainInfo.txt") ?? "Disc has no PVD"; + info.MasteringRingFirstLayerDataSide = Template.RequiredIfExistsValue; + info.MasteringSIDCodeFirstLayerDataSide = Template.RequiredIfExistsValue; + info.ToolstampMasteringCodeFirstLayerDataSide = Template.RequiredIfExistsValue; + info.MouldSIDCodeFirstLayerDataSide = Template.RequiredIfExistsValue; + info.MouldSIDCodeSecondLayerLabelSide = Template.RequiredIfExistsValue; + info.AdditionalMouldFirstLayerDataSide = Template.RequiredIfExistsValue; + info.PVD = GetPVD(combinedBase + "_mainInfo.txt") ?? "Disc has no PVD"; ; long errorCount = -1; if (File.Exists(combinedBase + ".img_EdcEcc.txt")) @@ -471,14 +466,16 @@ namespace DICUI.Utilities else if (File.Exists(combinedBase + ".img_EccEdc.txt")) errorCount = GetErrorCount(combinedBase + ".img_EccEdc.txt"); - mappings[Template.ErrorCountField] = (errorCount == -1 ? "Error retrieving error count" : errorCount.ToString()); + info.ErrorsCount = (errorCount == -1 ? "Error retrieving error count" : errorCount.ToString()); + info.Cuesheet = GetFullFile(combinedBase + ".cue") ?? ""; ; - mappings[Template.CuesheetField] = GetFullFile(combinedBase + ".cue") ?? ""; - mappings[Template.WriteOffsetField] = GetWriteOffset(combinedBase + "_disc.txt") ?? ""; + string cdWriteOffset = GetWriteOffset(combinedBase + "_disc.txt") ?? ""; + info.RingWriteOffset = cdWriteOffset; + info.OtherWriteOffsets = cdWriteOffset; // GD-ROM-specfic options if (Type == MediaType.GDROM) - mappings[Template.HeaderField] = GetSegaHeader(combinedBase + "_mainInfo.txt") ?? ""; + info.Header = GetSegaHeader(combinedBase + "_mainInfo.txt") ?? ""; // System-specific options switch (System) @@ -487,19 +484,17 @@ namespace DICUI.Utilities case KnownSystem.EnhancedCD: case KnownSystem.IBMPCCompatible: case KnownSystem.RainbowDisc: - mappings[Template.ISBNField] = Template.OptionalValue; + info.Comments += $"[T:ISBN] {Template.OptionalValue}"; progress?.Report(Result.Success("Running copy protection scan... this might take a while!")); - mappings[Template.CopyProtectionField] = GetCopyProtection(); + info.Protection = GetCopyProtection(); progress?.Report(Result.Success("Copy protection scan complete!")); if (File.Exists(combinedBase + "_subIntention.txt")) { FileInfo fi = new FileInfo(combinedBase + "_subIntention.txt"); if (fi.Length > 0) - { - mappings[Template.SubIntentionField] = GetFullFile(combinedBase + "_subIntention.txt") ?? ""; - } + info.SecuROMData = GetFullFile(combinedBase + "_subIntention.txt") ?? ""; } break; @@ -524,57 +519,57 @@ namespace DICUI.Utilities case KnownSystem.SegaNaomi2: case KnownSystem.SegaTitanVideo: case KnownSystem.SNKNeoGeoCD: - mappings[Template.EXEDateBuildDate] = Template.RequiredValue; + info.EXEDateBuildDate = DateTime.MinValue; break; case KnownSystem.SegaCDMegaCD: - mappings[Template.HeaderField] = GetSegaHeader(combinedBase + "_mainInfo.txt") ?? ""; + info.Header = GetSegaHeader(combinedBase + "_mainInfo.txt") ?? ""; // Take only the last 16 lines for Sega CD - if (!string.IsNullOrEmpty(mappings[Template.HeaderField])) - mappings[Template.HeaderField] = string.Join("\n", mappings[Template.HeaderField].Split('\n').Skip(16)); + if (!string.IsNullOrEmpty(info.Header)) + info.Header = string.Join("\n", info.Header.Split('\n').Skip(16)); - if (GetSegaCDBuildInfo(mappings[Template.HeaderField], out string scdSerial, out string fixedDate)) + if (GetSegaCDBuildInfo(info.Header, out string scdSerial, out string fixedDate)) { - mappings[Template.DiscSerialField] = scdSerial ?? ""; - mappings[Template.EXEDateBuildDate] = fixedDate ?? ""; + info.Serial = scdSerial ?? ""; + info.EXEDateBuildDate = DateTime.Parse(fixedDate ?? DateTime.MinValue.ToString()); } break; case KnownSystem.SegaSaturn: - mappings[Template.HeaderField] = GetSegaHeader(combinedBase + "_mainInfo.txt") ?? ""; + info.Header = GetSegaHeader(combinedBase + "_mainInfo.txt") ?? ""; // Take only the first 16 lines for Saturn - if (!string.IsNullOrEmpty(mappings[Template.HeaderField])) - mappings[Template.HeaderField] = string.Join("\n", mappings[Template.HeaderField].Split('\n').Take(16)); + if (!string.IsNullOrEmpty(info.Header)) + info.Header = string.Join("\n", info.Header.Split('\n').Take(16)); - if (GetSaturnBuildInfo(mappings[Template.HeaderField], out string saturnSerial, out string version, out string buildDate)) + if (GetSaturnBuildInfo(info.Header, out string saturnSerial, out string version, out string buildDate)) { - mappings[Template.DiscSerialField] = saturnSerial ?? ""; - mappings[Template.VersionField] = version ?? ""; - mappings[Template.EXEDateBuildDate] = buildDate ?? ""; + info.Serial = saturnSerial ?? ""; + info.Version = version ?? ""; + info.EXEDateBuildDate = DateTime.Parse(buildDate ?? DateTime.MinValue.ToString()); } break; case KnownSystem.SonyPlayStation: - mappings[Template.EXEDateBuildDate] = GetPlayStationEXEDate(Drive.Letter) ?? ""; - mappings[Template.PlayStationEDCField] = GetMissingEDCCount(combinedBase + ".img_EdcEcc.txt") > 0 ? "No" : "Yes"; - mappings[Template.PlayStationAntiModchipField] = GetAntiModchipDetected(combinedBase + "_disc.txt") ? "Yes" : "No"; - mappings[Template.PlayStationLibCryptField] = "No"; + info.EXEDateBuildDate = DateTime.Parse(GetPlayStationEXEDate(Drive.Letter) ?? DateTime.MinValue.ToString()); + info.EDC = GetMissingEDCCount(combinedBase + ".img_EdcEcc.txt") > 0 ? YesNo.No : YesNo.Yes; + info.AntiModchip = GetAntiModchipDetected(combinedBase + "_disc.txt") ? YesNo.Yes : YesNo.No; + info.LibCrypt = YesNo.No; if (File.Exists(combinedBase + "_subIntention.txt")) { FileInfo fi = new FileInfo(combinedBase + "_subIntention.txt"); if (fi.Length > 0) { - mappings[Template.PlayStationLibCryptField] = "Yes"; - mappings[Template.SubIntentionField] = GetFullFile(combinedBase + "_subIntention.txt") ?? ""; + info.LibCrypt = YesNo.Yes; + info.LibCryptData = GetFullFile(combinedBase + "_subIntention.txt") ?? ""; } } break; case KnownSystem.SonyPlayStation2: - mappings[Template.PlaystationLanguageSelectionViaField] = "Bios settings, Language selector, Options menu"; - mappings[Template.EXEDateBuildDate] = GetPlayStationEXEDate(Drive.Letter) ?? ""; - mappings[Template.VersionField] = GetPlayStation2Version(Drive.Letter) ?? ""; + info.LanguageSelection = new string[]{ "Bios settings", "Language selector", "Options menu" }; + info.EXEDateBuildDate = DateTime.Parse(GetPlayStationEXEDate(Drive.Letter) ?? DateTime.MinValue.ToString()); + info.Version = GetPlayStation2Version(Drive.Letter) ?? ""; break; } @@ -585,54 +580,48 @@ namespace DICUI.Utilities bool isXbox = (System == KnownSystem.MicrosoftXBOX || System == KnownSystem.MicrosoftXBOX360); string layerbreak = GetLayerbreak(combinedBase + "_disc.txt", isXbox) ?? ""; + // Get the individual hash data, as per internal + if (GetISOHashValues(info.ClrMameProData, out long size, out string crc32, out string md5, out string sha1)) + { + info.Size = size; + info.CRC32 = crc32; + info.MD5 = md5; + info.SHA1 = sha1; + info.ClrMameProData = null; + } + // If we have a single-layer disc if (String.IsNullOrWhiteSpace(layerbreak)) { - switch (Type) - { - case MediaType.DVD: - mappings[Template.MediaTypeField] += "-5"; - break; - case MediaType.BluRay: - mappings[Template.MediaTypeField] += "-25"; - break; - } - mappings[Template.MasteringRingField] = Template.RequiredIfExistsValue; - mappings[Template.MasteringSIDField] = Template.RequiredIfExistsValue; - mappings["Label-Side " + Template.MouldSIDField] = Template.RequiredIfExistsValue; - mappings["Data-Side " + Template.MouldSIDField] = Template.RequiredIfExistsValue; - mappings[Template.AdditionalMouldField] = Template.RequiredIfExistsValue; - mappings[Template.ToolstampField] = Template.RequiredIfExistsValue; - mappings[Template.PVDField] = GetPVD(combinedBase + "_mainInfo.txt") ?? ""; + info.MasteringRingFirstLayerDataSide = Template.RequiredIfExistsValue; + info.MasteringSIDCodeFirstLayerDataSide = Template.RequiredIfExistsValue; + info.ToolstampMasteringCodeFirstLayerDataSide = Template.RequiredIfExistsValue; + info.MouldSIDCodeFirstLayerDataSide = Template.RequiredIfExistsValue; + info.MouldSIDCodeSecondLayerLabelSide = Template.RequiredIfExistsValue; + info.AdditionalMouldFirstLayerDataSide = Template.RequiredIfExistsValue; + info.PVD = GetPVD(combinedBase + "_mainInfo.txt") ?? ""; } // If we have a dual-layer disc else { - switch (Type) - { - case MediaType.DVD: - mappings[Template.MediaTypeField] += "-9"; - break; - case MediaType.BluRay: - mappings[Template.MediaTypeField] += "-50"; - break; - } - 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["Label-Side " + Template.MouldSIDField] = Template.RequiredIfExistsValue; - mappings["Data-Side " + 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] = layerbreak; + info.MasteringRingFirstLayerDataSide = Template.RequiredIfExistsValue; + info.MasteringSIDCodeFirstLayerDataSide = Template.RequiredIfExistsValue; + info.ToolstampMasteringCodeFirstLayerDataSide = Template.RequiredIfExistsValue; + info.MouldSIDCodeFirstLayerDataSide = Template.RequiredIfExistsValue; + info.AdditionalMouldFirstLayerDataSide = Template.RequiredIfExistsValue; + + info.MasteringRingSecondLayerLabelSide = Template.RequiredIfExistsValue; + info.MasteringSIDCodeSecondLayerLabelSide = Template.RequiredIfExistsValue; + info.ToolstampMasteringCodeSecondLayerLabelSide = Template.RequiredIfExistsValue; + info.MouldSIDCodeSecondLayerLabelSide = Template.RequiredIfExistsValue; + + info.PVD = GetPVD(combinedBase + "_mainInfo.txt") ?? ""; + info.Layerbreak = Int64.Parse(layerbreak); } // Bluray-specific options if (Type == MediaType.BluRay) - mappings[Template.PICField] = GetPIC(Path.Combine(OutputDirectory, "PIC.bin")) ?? ""; + info.PIC = GetPIC(Path.Combine(OutputDirectory, "PIC.bin")) ?? ""; // System-specific options switch (System) @@ -641,262 +630,263 @@ namespace DICUI.Utilities case KnownSystem.EnhancedCD: case KnownSystem.IBMPCCompatible: case KnownSystem.RainbowDisc: - mappings[Template.ISBNField] = Template.OptionalValue; + info.Comments += $"[T:ISBN] {Template.OptionalValue}"; progress?.Report(Result.Success("Running copy protection scan... this might take a while!")); - mappings[Template.CopyProtectionField] = GetCopyProtection(); + info.Protection = GetCopyProtection(); progress?.Report(Result.Success("Copy protection scan complete!")); if (File.Exists(combinedBase + "_subIntention.txt")) { FileInfo fi = new FileInfo(combinedBase + "_subIntention.txt"); if (fi.Length > 0) - { - mappings[Template.SubIntentionField] = GetFullFile(combinedBase + "_subIntention.txt") ?? ""; - } + info.SecuROMData = GetFullFile(combinedBase + "_subIntention.txt") ?? ""; } break; case KnownSystem.BDVideo: - mappings[Template.CopyProtectionField] = Template.RequiredIfExistsValue; + info.Protection = Template.RequiredIfExistsValue; break; case KnownSystem.DVDVideo: - mappings[Template.CopyProtectionField] = GetDVDProtection(combinedBase + "_CSSKey.txt", combinedBase + "_disc.txt") ?? ""; + info.Protection = GetDVDProtection(combinedBase + "_CSSKey.txt", combinedBase + "_disc.txt") ?? ""; break; case KnownSystem.KonamieAmusement: case KnownSystem.KonamiFirebeat: - mappings[Template.EXEDateBuildDate] = Template.RequiredValue; + info.EXEDateBuildDate = DateTime.MinValue; break; case KnownSystem.MicrosoftXBOX: if (GetXBOXAuxInfo(combinedBase + "_disc.txt", out string dmihash, out string pfihash, out string sshash, out string ss, out string ssver)) { - mappings[Template.XBOXDMIHash] = dmihash ?? ""; - mappings[Template.XBOXPFIHash] = pfihash ?? ""; - mappings[Template.XBOXSSHash] = sshash ?? ""; - mappings[Template.XBOXSSVersion] = ssver ?? ""; - mappings[Template.XBOXSSRanges] = ss ?? ""; + info.Comments += $"{Template.XBOXDMIHash}: {dmihash ?? ""}\n" + + $"{Template.XBOXPFIHash}: {pfihash ?? ""}\n" + + $"{Template.XBOXSSHash}: {sshash ?? ""}\n" + + $"{Template.XBOXSSVersion}: {ssver ?? ""}\n"; + info.SecuritySectorRanges = ss ?? ""; } - if (GetXBOXDMIInfo(Path.Combine(OutputDirectory, "DMI.bin"), out string serial, out string version, out string region)) + if (GetXBOXDMIInfo(Path.Combine(OutputDirectory, "DMI.bin"), out string serial, out string version, out Region? region)) { - mappings[Template.DiscSerialField] = serial ?? Template.RequiredValue; - mappings[Template.VersionField] = version ?? Template.RequiredValue; - mappings[Template.RegionField] = region ?? Template.RequiredValue; + info.Serial = serial ?? Template.RequiredValue; + info.Version = version ?? Template.RequiredValue; + info.Region = region; } break; case KnownSystem.MicrosoftXBOX360: if (GetXBOXAuxInfo(combinedBase + "_disc.txt", out string dmi360hash, out string pfi360hash, out string ss360hash, out string ss360, out string ssver360)) { - mappings[Template.XBOXDMIHash] = dmi360hash ?? ""; - mappings[Template.XBOXPFIHash] = pfi360hash ?? ""; - mappings[Template.XBOXSSHash] = ss360hash ?? ""; - mappings[Template.XBOXSSVersion] = ssver360 ?? ""; - mappings[Template.XBOXSSRanges] = ss360 ?? ""; + info.Comments += $"{Template.XBOXDMIHash}: {dmi360hash ?? ""}\n" + + $"{Template.XBOXPFIHash}: {pfi360hash ?? ""}\n" + + $"{Template.XBOXSSHash}: {ss360hash ?? ""}\n" + + $"{Template.XBOXSSVersion}: {ssver360 ?? ""}\n"; + info.SecuritySectorRanges = ss360 ?? ""; } - if (GetXBOX360DMIInfo(Path.Combine(OutputDirectory, "DMI.bin"), out string serial360, out string version360, out string region360)) + if (GetXBOX360DMIInfo(Path.Combine(OutputDirectory, "DMI.bin"), out string serial360, out string version360, out Region? region360)) { - mappings[Template.DiscSerialField] = serial360 ?? Template.RequiredValue; - mappings[Template.VersionField] = version360 ?? Template.RequiredValue; - mappings[Template.RegionField] = region360 ?? Template.RequiredValue; + info.Serial = serial360 ?? Template.RequiredValue; + info.Version = version360 ?? Template.RequiredValue; + info.Region = region360; } break; case KnownSystem.SonyPlayStation2: - mappings[Template.EXEDateBuildDate] = GetPlayStationEXEDate(Drive.Letter) ?? ""; - mappings[Template.VersionField] = GetPlayStation2Version(Drive.Letter) ?? ""; + info.EXEDateBuildDate = DateTime.Parse(GetPlayStationEXEDate(Drive.Letter) ?? DateTime.MinValue.ToString()); + info.Version = GetPlayStation2Version(Drive.Letter) ?? ""; break; case KnownSystem.SonyPlayStation3: - mappings[Template.PlayStation3WiiDiscKeyField] = Template.RequiredValue; - mappings[Template.PlayStation3DiscIDField] = Template.RequiredValue; + info.DiscKey = Template.RequiredValue; + info.DiscID = Template.RequiredValue; break; case KnownSystem.SonyPlayStation4: - mappings[Template.VersionField] = GetPlayStation4Version(Drive.Letter) ?? ""; + info.Version = GetPlayStation4Version(Drive.Letter) ?? ""; break; case KnownSystem.ZAPiTGamesGameWaveFamilyEntertainmentSystem: - mappings[Template.CopyProtectionField] = Template.RequiredIfExistsValue; + info.Protection = Template.RequiredIfExistsValue; break; } break; case MediaType.NintendoGameCubeGameDisc: - mappings[Template.GameCubeWiiBCAField] = Template.RequiredValue; + info.BCA = Template.RequiredValue; break; case MediaType.NintendoWiiOpticalDisc: - mappings[Template.PlayStation3WiiDiscKeyField] = Template.RequiredValue; - mappings[Template.GameCubeWiiBCAField] = Template.RequiredValue; + info.DiscKey = Template.RequiredValue; + info.BCA = Template.RequiredValue; break; case MediaType.UMD: - mappings[Template.PVDField] = GetPVD(combinedBase + "_mainInfo.txt") ?? ""; - mappings[Template.DATField] = Template.RequiredValue + " [Not automatically generated for UMD]"; + info.PVD = GetPVD(combinedBase + "_mainInfo.txt") ?? ""; + info.Size = -1; + info.CRC32 = Template.RequiredValue + " [Not automatically generated for UMD]"; + info.MD5 = Template.RequiredValue + " [Not automatically generated for UMD]"; + info.SHA1 = Template.RequiredValue + " [Not automatically generated for UMD]"; + info.ClrMameProData = null; + if (GetUMDAuxInfo(combinedBase + "_disc.txt", out string title, out string umdversion, out string umdlayer)) { - mappings[Template.TitleField] = title ?? ""; - mappings[Template.VersionField] = umdversion ?? ""; + info.Title = title ?? ""; + info.Version = umdversion ?? ""; + if (!String.IsNullOrWhiteSpace(umdlayer)) - { - mappings[Template.LayerbreakField] = umdlayer ?? ""; - mappings[Template.MediaTypeField] += "-DL"; - } - else - { - mappings[Template.MediaTypeField] += "-SL"; - } + info.Layerbreak = Int64.Parse(umdlayer ?? "-1"); } break; } - return mappings; + return info; } /// /// Format the output data in a human readable way, separating each printed line into a new item in the list /// - /// Information dictionary that should contain normalized values + /// Information object that should contain normalized values /// List of strings representing each line of an output file, null on error - private List FormatOutputData(Dictionary info) + private List FormatOutputData(SubmissionInfo info) { // Check to see if the inputs are valid if (info == null) - { return null; - } try { - // Initialize with all of the standard fields - List output = new List - { - Template.TitleField + ": " + info[Template.TitleField], - Template.ForeignTitleField + ": " + info[Template.ForeignTitleField], - Template.DiscNumberField + ": " + info[Template.DiscNumberField], - Template.DiscTitleField + ": " + info[Template.DiscTitleField], - Template.SystemField + ": " + info[Template.SystemField], - Template.MediaTypeField + ": " + info[Template.MediaTypeField], - Template.CategoryField + ": " + info[Template.CategoryField], - Template.RegionField + ": " + info[Template.RegionField], - Template.LanguagesField + ": " + info[Template.LanguagesField], - Template.DiscSerialField + ": " + info[Template.DiscSerialField] - }; + // Common disc info section + List output = new List { "Common Disc Info:" }; - // Known as EXE Date and Build Date depending on the form - if (info.ContainsKey(Template.EXEDateBuildDate)) - output.Add(Template.EXEDateBuildDate + ": " + info[Template.EXEDateBuildDate]); + AddIfExists(output, Template.TitleField, info.Title, 1); + 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.MediaTypeField, GetFixedMediaType(info.Media, info.Layerbreak), 1); + AddIfExists(output, Template.CategoryField, info.Category.Name(), 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.PlaystationLanguageSelectionViaField, info.LanguageSelection, 1); + AddIfExists(output, Template.DiscSerialField, info.Serial, 1); - output.Add("Ringcode Information:"); + // All ringcode information goes in an indented area + output.Add(""); output.Add("\tRingcode Information:"); // If we have a dual-layer disc - if (info.ContainsKey(Template.LayerbreakField)) + if (info.Layerbreak != default(long)) { - 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("\tData-Side " + Template.MouldSIDField + ": " + info["Data-Side " + Template.MouldSIDField]); - output.Add("\tLabel-Side " + Template.MouldSIDField + ": " + info["Label-Side " + 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]); + AddIfExists(output, "Inner " + Template.MasteringRingField, info.MasteringRingFirstLayerDataSide, 2); + AddIfExists(output, "Inner " + Template.MasteringSIDField, info.MasteringSIDCodeFirstLayerDataSide, 2); + AddIfExists(output, "Inner " + Template.ToolstampField, info.ToolstampMasteringCodeFirstLayerDataSide, 2); + AddIfExists(output, "Outer " + Template.MasteringRingField, info.MasteringRingSecondLayerLabelSide, 2); + AddIfExists(output, "Outer " + Template.MasteringSIDField, info.MasteringSIDCodeSecondLayerLabelSide, 2); + AddIfExists(output, "Outer " + Template.ToolstampField, info.ToolstampMasteringCodeSecondLayerLabelSide, 2); + AddIfExists(output, "Data-Side " + Template.MouldSIDField, info.MouldSIDCodeFirstLayerDataSide, 2); + AddIfExists(output, "Label-Side " + Template.MouldSIDField, info.MouldSIDCodeSecondLayerLabelSide, 2); + AddIfExists(output, Template.AdditionalMouldField, info.AdditionalMouldFirstLayerDataSide, 2); } // If we have a single-layer disc else { - output.Add("\t" + Template.MasteringRingField + ": " + info[Template.MasteringRingField]); - output.Add("\t" + Template.MasteringSIDField + ": " + info[Template.MasteringSIDField]); - output.Add("\tData-Side " + Template.MouldSIDField + ": " + info["Data-Side " + Template.MouldSIDField]); - output.Add("\tLabel-Side " + Template.MouldSIDField + ": " + info["Label-Side " + Template.MouldSIDField]); - output.Add("\t" + Template.AdditionalMouldField + ": " + info[Template.AdditionalMouldField]); - output.Add("\t" + Template.ToolstampField + ": " + info[Template.ToolstampField]); + AddIfExists(output, Template.MasteringRingField, info.MasteringRingFirstLayerDataSide, 2); + AddIfExists(output, Template.MasteringSIDField, info.MasteringSIDCodeFirstLayerDataSide, 2); + AddIfExists(output, "Data-Side " + Template.MouldSIDField, info.MouldSIDCodeFirstLayerDataSide, 2); + AddIfExists(output, "Label-Side " + Template.MouldSIDField, info.MouldSIDCodeSecondLayerLabelSide, 2); + AddIfExists(output, Template.AdditionalMouldField, info.AdditionalMouldFirstLayerDataSide, 2); + AddIfExists(output, Template.ToolstampField, info.ToolstampMasteringCodeFirstLayerDataSide, 2); } - output.Add(Template.BarcodeField + ": " + info[Template.BarcodeField]); - if (info.ContainsKey(Template.ISBNField)) - output.Add(Template.ISBNField + ": " + info[Template.ISBNField]); + AddIfExists(output, Template.BarcodeField, info.Barcode, 1); - if (info.ContainsKey(Template.ErrorCountField)) - output.Add(Template.ErrorCountField + ": " + info[Template.ErrorCountField]); + if (info.EXEDateBuildDate != null) + AddIfExists(output, Template.EXEDateBuildDate, ((DateTime)info.EXEDateBuildDate).ToString("yyyy-MM-dd"), 1); - 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]); + AddIfExists(output, Template.ErrorCountField, info.ErrorsCount, 1); - if (info.ContainsKey(Template.HeaderField)) + // Comments can be handled strangely sometimes + if (string.IsNullOrEmpty(info.Comments)) + info.Comments = Template.OptionalValue; + + AddIfExists(output, Template.CommentsField, info.Comments, 1); + AddIfExists(output, Template.ContentsField, info.Contents, 1); + + // Version and editions secion + output.Add(""); output.Add("Version and Editions:"); + AddIfExists(output, Template.VersionField, info.Version, 1); + AddIfExists(output, Template.EditionField, info.OtherEditions, 1); + + if (info.EDC != YesNo.NULL) { - output.Add(Template.HeaderField + ":"); output.Add(""); - output.AddRange(info[Template.HeaderField].Split('\n')); output.Add(""); + output.Add("EDC:"); + AddIfExists(output, Template.PlayStationEDCField, info.EDC.Name(), 1); } - if (info.ContainsKey(Template.PlayStationEDCField)) + // output.Add(""); output.Add("Parent/Clone Relationship:"); + // AddIfExists(output, Template.ParentIDField, info.ParentID); + // AddIfExists(output, Template.RegionalParentField, info.RegionalParent.ToString()); + + // Extras section + if (info.PVD != null || info.PIC != null || info.BCA != null) { - output.Add(Template.PlayStationEDCField + ": " + info[Template.PlayStationEDCField]); - output.Add(Template.PlayStationAntiModchipField + ": " + info[Template.PlayStationAntiModchipField]); - output.Add(Template.PlayStationLibCryptField + ": " + info[Template.PlayStationLibCryptField]); + output.Add(""); output.Add("Extras:"); + AddIfExists(output, Template.PVDField, info.PVD, 1); + AddIfExists(output, Template.PlayStation3WiiDiscKeyField, info.DiscKey, 1); + AddIfExists(output, Template.PlayStation3DiscIDField, info.DiscID, 1); + AddIfExists(output, Template.PICField, info.PIC, 1); + AddIfExists(output, Template.HeaderField, info.Header, 1); + AddIfExists(output, Template.GameCubeWiiBCAField, info.BCA, 1); + AddIfExists(output, Template.XBOXSSRanges, info.SecuritySectorRanges, 1); } - - if (info.ContainsKey(Template.LayerbreakField)) - output.Add(Template.LayerbreakField + ": " + info[Template.LayerbreakField]); - - output.Add(Template.PVDField + ":"); output.Add(""); - output.AddRange(info[Template.PVDField].Split('\n')); - - if (info.ContainsKey(Template.PlayStation3WiiDiscKeyField)) - output.Add(Template.PlayStation3WiiDiscKeyField + ": " + info[Template.PlayStation3WiiDiscKeyField]); - - if (info.ContainsKey(Template.PlayStation3DiscIDField)) - output.Add(Template.PlayStation3DiscIDField + ": " + info[Template.PlayStation3DiscIDField]); - - if (info.ContainsKey(Template.PICField)) + + // Copy protection section + if (info.Protection != null || info.EDC != YesNo.NULL) { - output.Add(Template.PICField + ":"); output.Add(""); - output.AddRange(info[Template.PICField].Split('\n')); + 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.SubIntentionField, info.LibCryptData, 1); + } + + AddIfExists(output, Template.CopyProtectionField, info.Protection, 1); + AddIfExists(output, Template.SubIntentionField, info.SecuROMData, 1); } - if (info.ContainsKey(Template.GameCubeWiiBCAField)) + // output.Add(""); output.Add("Dumpers and Status"); + // AddIfExists(output, Template.StatusField, info.Status.Name()); + // AddIfExists(output, Template.OtherDumpersField, info.OtherDumpers); + + // Tracks and write offsets section + if (!string.IsNullOrWhiteSpace(info.ClrMameProData)) { - output.Add(Template.GameCubeWiiBCAField + ":"); output.Add(""); - output.AddRange(info[Template.GameCubeWiiBCAField].Split('\n')); + output.Add(""); output.Add("Tracks and Write Offsets:"); + AddIfExists(output, Template.DATField, info.ClrMameProData, 1); + AddIfExists(output, Template.CuesheetField, info.Cuesheet, 1); + AddIfExists(output, Template.WriteOffsetField, info.OtherWriteOffsets, 1); } - - if (info.ContainsKey(Template.CopyProtectionField)) + // Size & checksum section + else { - output.Add(Template.CopyProtectionField + ":"); output.Add(""); - output.AddRange(info[Template.CopyProtectionField].Split('\n')); + output.Add(""); output.Add("Size & Checksum:"); + AddIfExists(output, Template.LayerbreakField, info.Layerbreak.ToString(), 1); + AddIfExists(output, Template.SizeField, info.Size.ToString(), 1); + AddIfExists(output, Template.CRC32Field, info.CRC32, 1); + AddIfExists(output, Template.MD5Field, info.MD5, 1); + AddIfExists(output, Template.SHA1Field, info.SHA1, 1); } - if (info.ContainsKey(Template.XBOXDMIHash)) + // Make sure there aren't any instances of two blank lines in a row + string last = null; + for (int i = 0; i < output.Count; ) { - 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.XBOXSSVersion + ": " + info[Template.XBOXSSVersion]); - output.Add(Template.XBOXSSRanges + ":"); output.Add(""); - output.AddRange(info[Template.XBOXSSRanges].Split('\n')); + if (output[i] == last) + { + output.RemoveAt(i); + } + else + { + last = output[i]; + i++; + } } - if (info.ContainsKey(Template.SubIntentionField)) - { - output.Add(Template.SubIntentionField + ":"); output.Add(""); - output.AddRange(info[Template.SubIntentionField].Split('\n')); output.Add(""); - } - - if (info.ContainsKey(Template.DATField)) - { - output.Add(Template.DATField + ":"); output.Add(""); - output.AddRange(info[Template.DATField].Split('\n')); output.Add(""); - } - - if (info.ContainsKey(Template.CuesheetField)) - { - output.Add(Template.CuesheetField + ":"); output.Add(""); - output.AddRange(info[Template.CuesheetField].Split('\n')); output.Add(""); - } - - if (info.ContainsKey(Template.WriteOffsetField)) - output.Add(Template.WriteOffsetField + ": " + info[Template.WriteOffsetField]); - return output; } catch @@ -906,6 +896,57 @@ namespace DICUI.Utilities } } + /// + /// Add the properly formatted key and value, if possible + /// + /// Output list + /// Name of the output key to write + /// Name of the output value to write + /// Number of tabs to indent the line + private void AddIfExists(List output, string key, string value, int indent) + { + // If there's no valid value to write + if (string.IsNullOrWhiteSpace(value)) + return; + + string prefix = ""; + for (int i = 0; i < indent; i++) + prefix += "\t"; + + // If the value contains a newline + if (value.Contains("\n")) + { + output.Add(prefix + key + ":"); output.Add(""); + string[] values = value.Split('\n'); + foreach (string val in values) + output.Add(prefix + val); + + output.Add(""); + } + + // For all regular values + else + { + output.Add(prefix + key + ": " + value); + } + } + + /// + /// Add the properly formatted key and value, if possible + /// + /// Output list + /// Name of the output key to write + /// Name of the output value to write + /// Number of tabs to indent the line + private void AddIfExists(List output, string key, string[] value, int indent) + { + // If there's no valid value to write + if (value == null || value.Length == 0) + return; + + AddIfExists(output, key, string.Join(", ", value), indent); + } + /// /// Get the existance of an anti-modchip string from the input file, if possible /// @@ -1139,6 +1180,39 @@ namespace DICUI.Utilities } } + /// + /// Get the adjusted name of the media baed on layers, if applicable + /// + /// MediaType to get the proper name for + /// Layerbreak value, as applicable + /// String representation of the media, including layer specification + private string GetFixedMediaType(MediaType? mediaType, long layerbreak) + { + switch (mediaType) + { + case MediaType.DVD: + if (layerbreak != default(long)) + return $"{mediaType.Name()}-9"; + else + return $"{mediaType.Name()}-5"; + + case MediaType.BluRay: + if (layerbreak != default(long)) + return $"{mediaType.Name()}-50"; + else + return $"{mediaType.Name()}-25"; + + case MediaType.UMD: + if (layerbreak != default(long)) + return $"{mediaType.Name()}-DL"; + else + return $"{mediaType.Name()}-SL"; + + default: + return mediaType.Name(); + } + } + /// /// Get the full lines from the input file, if possible /// @@ -1155,6 +1229,35 @@ namespace DICUI.Utilities return string.Join("\n", File.ReadAllLines(filename)); } + /// + /// Get the split values for ISO-based media + /// + /// String representing the combined hash data + /// True if extraction was successful, false otherwise + private bool GetISOHashValues(string hashData, out long size, out string crc32, out string md5, out string sha1) + { + size = -1; crc32 = null; md5 = null; sha1 = null; + + if (string.IsNullOrWhiteSpace(hashData)) + return false; + + // + Regex hashreg = new Regex(@" /// Get the layerbreak from the input file, if possible /// @@ -1722,9 +1825,9 @@ namespace DICUI.Utilities /// /// DMI.bin file location /// True on successful extraction of info, false otherwise - private bool GetXBOXDMIInfo(string dmi, out string serial, out string version, out string region) + private bool GetXBOXDMIInfo(string dmi, out string serial, out string version, out Region? region) { - serial = null; version = null; region = null; + serial = null; version = null; region = Region.World; if (!File.Exists(dmi)) return false; @@ -1753,7 +1856,7 @@ namespace DICUI.Utilities /// /// DMI.bin file location /// True on successful extraction of info, false otherwise - private bool GetXBOX360DMIInfo(string dmi, out string serial, out string version, out string region) + private bool GetXBOX360DMIInfo(string dmi, out string serial, out string version, out Region? region) { serial = null; version = null; region = null; @@ -1785,27 +1888,27 @@ namespace DICUI.Utilities /// Determine the region based on the XBOX serial character /// /// Character denoting the region - /// Region name, if possible - private string GetXBOXRegion(char region) + /// Region, if possible + private Region? GetXBOXRegion(char region) { switch (region) { case 'W': - return "World"; + return Region.World; case 'A': - return "USA"; + return Region.USA; case 'J': - return "Japan or Asia"; + return Region.JapanAsia; case 'E': - return "Europe (or single country)"; + return Region.Europe; case 'K': - return "USA, Japan or USA, Asia"; + return Region.USAJapan; case 'L': - return "USA, Europe"; + return Region.USAEurope; case 'H': - return "Japan, Europe"; + return Region.JapanEurope; default: - return "Could not determine region"; + return null; } } @@ -1873,15 +1976,18 @@ namespace DICUI.Utilities return Result.Failure("Error! Please check output directory as dump may be incomplete!"); progress?.Report(Result.Success("Extracting output information from output files...")); - Dictionary templateValues = ExtractOutputInformation(progress); + 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 formattedValues = FormatOutputData(templateValues); + List 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!")); @@ -1920,6 +2026,35 @@ namespace DICUI.Utilities return true; } + /// + /// Write the data to the output folder + /// + /// SubmissionInfo object representign the JSON to write out to the file + /// True on success, false on error + private bool WriteOutputData(SubmissionInfo info) + { + // Check to see if the input is valid + if (info == null) + return false; + + // Now write out to a generic file + try + { + using (StreamWriter sw = new StreamWriter(File.Open(Path.Combine(OutputDirectory, "!submissionInfo.json"), FileMode.Create, FileAccess.Write))) + { + string json = JsonConvert.SerializeObject(info, Formatting.Indented); + sw.WriteLine(json); + } + } + catch + { + // We don't care what the error is right now + return false; + } + + return true; + } + #endregion } } diff --git a/DICUI.Library/Utilities/Extensions.cs b/DICUI.Library/Utilities/Extensions.cs index f79be286..239d7c72 100644 --- a/DICUI.Library/Utilities/Extensions.cs +++ b/DICUI.Library/Utilities/Extensions.cs @@ -2,6 +2,17 @@ namespace DICUI.Utilities { + /// + /// Extensions for Category? + /// + public static class CategoryExtensions + { + public static string Name(this Category? category) + { + return Converters.LongName(category); + } + } + /// /// Extensions for DICCommand for easier calling /// @@ -31,12 +42,12 @@ namespace DICUI.Utilities { public static string Name(this MediaType? type) { - return Converters.MediaTypeToString(type); + return Converters.LongName(type); } public static string ShortName(this MediaType? type) { - return Converters.MediaTypeToShortString(type); + return Converters.ShortName(type); } public static string Extension(this MediaType? type) @@ -69,12 +80,12 @@ namespace DICUI.Utilities { public static string Name(this KnownSystem? system) { - return Converters.KnownSystemToString(system); + return Converters.LongName(system); } public static string ShortName(this KnownSystem? system) { - return Converters.KnownSystemToShortString(system); + return Converters.ShortName(system); } public static KnownSystemCategory Category(this KnownSystem? system) @@ -140,4 +151,49 @@ namespace DICUI.Utilities } } } + + /// + /// Extensions for Language? + /// + 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); + } + + } + + /// + /// Extensions for Region? + /// + 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); + } + + } + + /// + /// Extensions for YesNo + /// + public static class YesNoExtensions + { + public static string Name(this YesNo yesno) + { + return Converters.LongName(yesno); + } + } } diff --git a/DICUI.Library/packages.config b/DICUI.Library/packages.config index b3cbc6ff..651ffcdd 100644 --- a/DICUI.Library/packages.config +++ b/DICUI.Library/packages.config @@ -3,6 +3,7 @@ + \ No newline at end of file diff --git a/DICUI.Test/Utilities/ConvertersTest.cs b/DICUI.Test/Utilities/ConvertersTest.cs index 056cdf8f..c9be309c 100644 --- a/DICUI.Test/Utilities/ConvertersTest.cs +++ b/DICUI.Test/Utilities/ConvertersTest.cs @@ -73,7 +73,7 @@ namespace DICUI.Test.Utilities [InlineData(MediaType.NONE, "Unknown")] public void MediaTypeToStringTest(MediaType? mediaType, string expected) { - string actual = Converters.MediaTypeToString(mediaType); + string actual = Converters.LongName(mediaType); Assert.Equal(expected, actual); } @@ -85,7 +85,7 @@ namespace DICUI.Test.Utilities [InlineData(KnownSystem.NONE, "Unknown")] public void KnownSystemToStringTest(KnownSystem? knownSystem, string expected) { - string actual = Converters.KnownSystemToString(knownSystem); + string actual = Converters.LongName(knownSystem); Assert.Equal(expected, actual); } diff --git a/DICUI.Test/Utilities/KnownSystemExtensionsTest.cs b/DICUI.Test/Utilities/KnownSystemExtensionsTest.cs index 899d297e..1802a1e6 100644 --- a/DICUI.Test/Utilities/KnownSystemExtensionsTest.cs +++ b/DICUI.Test/Utilities/KnownSystemExtensionsTest.cs @@ -13,7 +13,7 @@ namespace DICUI.Test.Utilities var values = (KnownSystem[])Enum.GetValues(typeof(KnownSystem)); foreach(var system in values) { - string expected = Converters.KnownSystemToString(system); + string expected = Converters.LongName(system); string actual = ((KnownSystem?)system).Name(); Assert.Equal(expected, actual); diff --git a/DICUI.Test/Utilities/MediaTypeExtensionsTest.cs b/DICUI.Test/Utilities/MediaTypeExtensionsTest.cs index 3142b60d..a9da9065 100644 --- a/DICUI.Test/Utilities/MediaTypeExtensionsTest.cs +++ b/DICUI.Test/Utilities/MediaTypeExtensionsTest.cs @@ -12,7 +12,7 @@ namespace DICUI.Test.Utilities [InlineData(MediaType.NONE)] public void NameTest(MediaType? mediaType) { - string expected = Converters.MediaTypeToString(mediaType); + string expected = Converters.LongName(mediaType); string actual = mediaType.Name(); Assert.NotNull(actual); diff --git a/DICUI/Windows/MainWindow.xaml.cs b/DICUI/Windows/MainWindow.xaml.cs index 458e8b00..d7c8ec6b 100644 --- a/DICUI/Windows/MainWindow.xaml.cs +++ b/DICUI/Windows/MainWindow.xaml.cs @@ -646,7 +646,7 @@ namespace DICUI.Windows if (index != -1) MediaTypeComboBox.SelectedIndex = index; else - StatusLabel.Content = $"Disc of type '{Converters.MediaTypeToString(_currentMediaType)}' found, but the current system does not support it!"; + StatusLabel.Content = $"Disc of type '{Converters.LongName(_currentMediaType)}' found, but the current system does not support it!"; } ///