diff --git a/SabreTools.Core/Enums.cs b/SabreTools.Core/Enums.cs
index 629073f6..7939e53a 100644
--- a/SabreTools.Core/Enums.cs
+++ b/SabreTools.Core/Enums.cs
@@ -31,18 +31,28 @@ namespace SabreTools.Core
///
public enum MergingFlag
{
+ [Mapping("none")]
None = 0,
+
+ [Mapping("split")]
Split,
+
+ [Mapping("merged")]
Merged,
+
+ [Mapping("nonmerged", "unmerged")]
NonMerged,
/// This is not usually defined for Merging flags
+ [Mapping("fullmerged")]
FullMerged,
/// This is not usually defined for Merging flags
+ [Mapping("device", "devicenonmerged", "deviceunmerged")]
DeviceNonMerged,
/// This is not usually defined for Merging flags
+ [Mapping("full", "fullnonmerged", "fullunmerged")]
FullNonMerged,
}
@@ -51,9 +61,16 @@ namespace SabreTools.Core
///
public enum NodumpFlag
{
+ [Mapping("none")]
None = 0,
+
+ [Mapping("obsolete")]
Obsolete,
+
+ [Mapping("required")]
Required,
+
+ [Mapping("ignore")]
Ignore,
}
@@ -62,26 +79,31 @@ namespace SabreTools.Core
///
public enum PackingFlag
{
+ [Mapping("none")]
None = 0,
///
/// Force all sets to be in archives, except disk and media
///
+ [Mapping("yes", "zip")]
Zip,
///
/// Force all sets to be extracted into subfolders
///
+ [Mapping("no", "unzip")]
Unzip,
///
/// Force sets with single items to be extracted to the parent folder
///
+ [Mapping("partial")]
Partial,
///
/// Force all sets to be extracted to the parent folder
///
+ [Mapping("flat")]
Flat,
}
@@ -100,7 +122,10 @@ namespace SabreTools.Core
///
NULL = 0,
+ [Mapping("cpu")]
CPU = 1 << 0,
+
+ [Mapping("audio")]
Audio = 1 << 1,
}
@@ -115,20 +140,49 @@ namespace SabreTools.Core
///
NULL = 0,
+ [Mapping("joy")]
Joy = 1 << 0,
+
+ [Mapping("stick")]
Stick = 1 << 1,
+
+ [Mapping("paddle")]
Paddle = 1 << 2,
+
+ [Mapping("pedal")]
Pedal = 1 << 3,
+
+ [Mapping("lightgun")]
Lightgun = 1 << 4,
+
+ [Mapping("positional")]
Positional = 1 << 5,
+
+ [Mapping("dial")]
Dial = 1 << 6,
+
+ [Mapping("trackball")]
Trackball = 1 << 7,
+
+ [Mapping("mouse")]
Mouse = 1 << 8,
+
+ [Mapping("only_buttons")]
OnlyButtons = 1 << 9,
+
+ [Mapping("keypad")]
Keypad = 1 << 10,
+
+ [Mapping("keyboard")]
Keyboard = 1 << 11,
+
+ [Mapping("mahjong")]
Mahjong = 1 << 12,
+
+ [Mapping("hanafuda")]
Hanafuda = 1 << 13,
+
+ [Mapping("gambling")]
Gambling = 1 << 14,
}
@@ -143,26 +197,67 @@ namespace SabreTools.Core
///
NULL = 0,
+ [Mapping("unknown")]
Unknown = 1 << 0,
+
+ [Mapping("cartridge")]
Cartridge = 1 << 1,
+
+ [Mapping("floppydisk")]
FloppyDisk = 1 << 2,
+
+ [Mapping("harddisk")]
HardDisk = 1 << 3,
+
+ [Mapping("cylinder")]
Cylinder = 1 << 4,
+
+ [Mapping("cassette")]
Cassette = 1 << 5,
+
+ [Mapping("punchcard")]
PunchCard = 1 << 6,
+
+ [Mapping("punchtape")]
PunchTape = 1 << 7,
+
+ [Mapping("printout")]
Printout = 1 << 8,
+
+ [Mapping("serial")]
Serial = 1 << 9,
+
+ [Mapping("parallel")]
Parallel = 1 << 10,
+
+ [Mapping("snapshot")]
Snapshot = 1 << 11,
+
+ [Mapping("quickload")]
QuickLoad = 1 << 12,
+
+ [Mapping("memcard")]
MemCard = 1 << 13,
+
+ [Mapping("cdrom")]
CDROM = 1 << 14,
+
+ [Mapping("magtape")]
MagTape = 1 << 15,
+
+ [Mapping("romimage")]
ROMImage = 1 << 16,
+
+ [Mapping("midiin")]
MIDIIn = 1 << 17,
+
+ [Mapping("midiout")]
MIDIOut = 1 << 18,
+
+ [Mapping("picture")]
Picture = 1 << 19,
+
+ [Mapping("vidfile")]
VidFile = 1 << 20,
}
@@ -177,10 +272,19 @@ namespace SabreTools.Core
///
NULL = 0,
+ [Mapping("raster")]
Raster = 1 << 0,
+
+ [Mapping("vector")]
Vector = 1 << 1,
+
+ [Mapping("lcd")]
LCD = 1 << 2,
+
+ [Mapping("svg")]
SVG = 1 << 3,
+
+ [Mapping("unknown")]
Unknown = 1 << 4,
}
@@ -195,7 +299,10 @@ namespace SabreTools.Core
///
NULL = 0,
+ [Mapping("big")]
Big = 1 << 0,
+
+ [Mapping("little")]
Little = 1 << 1,
}
@@ -210,7 +317,10 @@ namespace SabreTools.Core
///
NULL = 0,
+ [Mapping("unemulated")]
Unemulated = 1 << 0,
+
+ [Mapping("imperfect")]
Imperfect = 1 << 1,
}
@@ -225,19 +335,46 @@ namespace SabreTools.Core
///
NULL = 0,
+ [Mapping("protection")]
Protection = 1 << 0,
+
+ [Mapping("palette")]
Palette = 1 << 1,
+
+ [Mapping("graphics")]
Graphics = 1 << 2,
+
+ [Mapping("sound")]
Sound = 1 << 3,
+
+ [Mapping("controls")]
Controls = 1 << 4,
+
+ [Mapping("keyboard")]
Keyboard = 1 << 5,
+
+ [Mapping("mouse")]
Mouse = 1 << 6,
+
+ [Mapping("microphone")]
Microphone = 1 << 7,
+
+ [Mapping("camera")]
Camera = 1 << 8,
+
+ [Mapping("disk")]
Disk = 1 << 9,
+
+ [Mapping("printer")]
Printer = 1 << 10,
+
+ [Mapping("lan")]
Lan = 1 << 11,
+
+ [Mapping("wan")]
Wan = 1 << 12,
+
+ [Mapping("timing")]
Timing = 1 << 13,
}
@@ -252,10 +389,19 @@ namespace SabreTools.Core
///
NULL = 0,
+ [Mapping("none", "no")]
None = 1 << 0,
+
+ [Mapping("good")]
Good = 1 << 1,
+
+ [Mapping("baddump")]
BadDump = 1 << 2,
+
+ [Mapping("nodump", "yes")]
Nodump = 1 << 3,
+
+ [Mapping("verified")]
Verified = 1 << 4,
}
@@ -264,50 +410,136 @@ namespace SabreTools.Core
///
public enum ItemType
{
+ ///
+ /// This is a fake flag that is used for filter only
+ ///
+ NULL = 0,
+
// "Actionable" item types
+
+ [Mapping("rom")]
Rom,
+
+ [Mapping("disk")]
Disk,
+
+ [Mapping("file")]
+ File,
+
+ [Mapping("media")]
Media,
// "Auxiliary" item types
+
+ [Mapping("adjuster")]
Adjuster,
+
+ [Mapping("analog")]
Analog,
+
+ [Mapping("archive")]
Archive,
+
+ [Mapping("biosset")]
BiosSet,
+
+ [Mapping("chip")]
Chip,
+
+ [Mapping("condition")]
Condition,
+
+ [Mapping("configuration")]
Configuration,
+
+ [Mapping("control")]
Control,
+
+ [Mapping("dataarea")]
DataArea,
+
+ [Mapping("device")]
Device,
+
+ [Mapping("deviceref", "device_ref")]
DeviceReference,
+
+ [Mapping("dipswitch")]
DipSwitch,
+
+ [Mapping("diskarea")]
DiskArea,
+
+ [Mapping("display")]
Display,
+
+ [Mapping("driver")]
Driver,
+
+ [Mapping("extension")]
Extension,
+
+ [Mapping("feature")]
Feature,
- File,
+
+ [Mapping("info")]
Info,
+
+ [Mapping("input")]
Input,
+
+ [Mapping("instance")]
Instance,
+
+ [Mapping("location")]
Location,
+
+ [Mapping("part")]
Part,
+
+ [Mapping("partfeature", "part_feature")]
PartFeature,
+
+ [Mapping("port")]
Port,
+
+ [Mapping("ramoption", "ram_option")]
RamOption,
+
+ [Mapping("release")]
Release,
+
+ [Mapping("releasedetails", "release_details")]
ReleaseDetails,
+
+ [Mapping("sample")]
Sample,
+
+ [Mapping("serials")]
Serials,
+
+ [Mapping("setting")]
Setting,
+
+ [Mapping("sharedfeat", "shared_feat", "sharedfeature", "shared_feature")]
SharedFeature,
+
+ [Mapping("slot")]
Slot,
+
+ [Mapping("slotoption", "slot_option")]
SlotOption,
+
+ [Mapping("softwarelist", "software_list")]
SoftwareList,
+
+ [Mapping("sound")]
Sound,
+
+ [Mapping("sourcedetails", "source_details")]
SourceDetails,
+ [Mapping("blank")]
Blank = 99, // This is not a real type, only used internally
}
@@ -322,19 +554,46 @@ namespace SabreTools.Core
///
NULL = 0,
+ [Mapping("load16_byte")]
Load16Byte = 1 << 0,
+
+ [Mapping("load16_word")]
Load16Word = 1 << 1,
+
+ [Mapping("load16_word_swap")]
Load16WordSwap = 1 << 2,
+
+ [Mapping("load32_byte")]
Load32Byte = 1 << 3,
+
+ [Mapping("load32_word")]
Load32Word = 1 << 4,
+
+ [Mapping("load32_word_swap")]
Load32WordSwap = 1 << 5,
+
+ [Mapping("load32_dword")]
Load32DWord = 1 << 6,
+
+ [Mapping("load64_word")]
Load64Word = 1 << 7,
+
+ [Mapping("load64_word_swap")]
Load64WordSwap = 1 << 8,
+
+ [Mapping("reload")]
Reload = 1 << 9,
+
+ [Mapping("fill")]
Fill = 1 << 10,
+
+ [Mapping("continue")]
Continue = 1 << 11,
+
+ [Mapping("reload_plain")]
ReloadPlain = 1 << 12,
+
+ [Mapping("ignore")]
Ignore = 1 << 13,
}
@@ -344,14 +603,17 @@ namespace SabreTools.Core
[Flags]
public enum MachineType
{
- ///
- /// This is a fake flag that is used for filter only
- ///
- NULL = 1 << 0,
+ [Mapping("none")]
+ None = 0,
- Bios = 1 << 1,
- Device = 1 << 2,
- Mechanical = 1 << 3,
+ [Mapping("bios")]
+ Bios = 1 << 0,
+
+ [Mapping("dev", "device")]
+ Device = 1 << 1,
+
+ [Mapping("mech", "mechanical")]
+ Mechanical = 1 << 2,
}
///
@@ -365,8 +627,13 @@ namespace SabreTools.Core
///
NULL = 0,
+ [Mapping("rom")]
Rom = 1 << 0,
+
+ [Mapping("megarom")]
MegaRom = 1 << 1,
+
+ [Mapping("sccpluscart")]
SCCPlusCart = 1 << 2,
}
@@ -381,11 +648,22 @@ namespace SabreTools.Core
///
NULL = 0,
+ [Mapping("eq")]
Equal = 1 << 0,
+
+ [Mapping("ne")]
NotEqual = 1 << 1,
+
+ [Mapping("gt")]
GreaterThan = 1 << 2,
+
+ [Mapping("le")]
LessThanOrEqual = 1 << 3,
+
+ [Mapping("lt")]
LessThan = 1 << 4,
+
+ [Mapping("ge")]
GreaterThanOrEqual = 1 << 5,
}
@@ -400,8 +678,13 @@ namespace SabreTools.Core
///
NULL = 0,
+ [Mapping("no")]
No = 1 << 0,
+
+ [Mapping("partial")]
Partial = 1 << 1,
+
+ [Mapping("yes")]
Yes = 1 << 2,
}
@@ -411,12 +694,13 @@ namespace SabreTools.Core
[Flags]
public enum SoftwareListStatus
{
- ///
- /// This is a fake flag that is used for filter only
- ///
- NULL = 0,
+ [Mapping("none")]
+ None = 0,
+ [Mapping("original")]
Original = 1 << 0,
+
+ [Mapping("compatible")]
Compatible = 1 << 1,
}
@@ -431,8 +715,13 @@ namespace SabreTools.Core
///
NULL = 0,
+ [Mapping("no", "unsupported")]
No = 1 << 0,
+
+ [Mapping("partial")]
Partial = 1 << 1,
+
+ [Mapping("yes", "supported")]
Yes = 1 << 2,
}
@@ -447,8 +736,13 @@ namespace SabreTools.Core
///
NULL = 0,
+ [Mapping("good")]
Good = 1 << 0,
+
+ [Mapping("imperfect")]
Imperfect = 1 << 1,
+
+ [Mapping("preliminary")]
Preliminary = 1 << 2,
}
@@ -461,68 +755,141 @@ namespace SabreTools.Core
///
public enum DatHeaderField
{
+ ///
+ /// This is a fake flag that is used for filter only
+ ///
NULL = 0,
#region Common
+ [Mapping("file", "filename", "file_name")]
FileName,
+
+ [Mapping("dat", "datname", "dat_name", "internalname", "internal_name")]
Name,
+
+ [Mapping("desc", "description")]
Description,
+
+ [Mapping("root", "rootdir", "root_dir", "rootdirectory", "root_directory")]
RootDir,
+
+ [Mapping("category")]
Category,
+
+ [Mapping("version")]
Version,
+
+ [Mapping("date", "timestamp", "time_stamp")]
Date,
+
+ [Mapping("author")]
Author,
+
+ [Mapping("email", "e_mail")]
Email,
+
+ [Mapping("homepage", "home_page")]
Homepage,
+
+ [Mapping("url")]
Url,
+
+ [Mapping("comment")]
Comment,
+
+ [Mapping("header", "headerskipper", "header_skipper", "skipper")]
HeaderSkipper,
+
+ [Mapping("dattype", "type", "superdat")]
Type,
+
+ [Mapping("forcemerging", "force_merging")]
ForceMerging,
+
+ [Mapping("forcenodump", "force_nodump")]
ForceNodump,
+
+ [Mapping("forcepacking", "force_packing")]
ForcePacking,
#endregion
#region ListXML
+ [Mapping("debug")]
Debug,
+
+ [Mapping("mameconfig", "mame_config")]
MameConfig,
#endregion
#region Logiqx
+ [Mapping("id", "nointroid", "no_intro_id")]
NoIntroID,
+
+ [Mapping("build")]
Build,
+
+ [Mapping("rommode", "rom_mode")]
RomMode,
+
+ [Mapping("biosmode", "bios_mode")]
BiosMode,
+
+ [Mapping("samplemode", "sample_mode")]
SampleMode,
+
+ [Mapping("lockrommode", "lockrom_mode", "lock_rommode", "lock_rom_mode")]
LockRomMode,
+
+ [Mapping("lockbiosmode", "lockbios_mode", "lock_biosmode", "lock_bios_mode")]
LockBiosMode,
+
+ [Mapping("locksamplemode", "locksample_mode", "lock_samplemode", "lock_sample_mode")]
LockSampleMode,
#endregion
#region OfflineList
+ /// "plugin" is used with RomCenter
+ [Mapping("system", "plugin")]
System,
+
+ [Mapping("screenshotwidth", "screenshotswidth", "screenshot_width", "screenshots_width")]
ScreenshotsWidth,
+
+ [Mapping("screenshotheight", "screenshotsheight", "screenshot_height", "screenshots_height")]
ScreenshotsHeight,
+
+ [Mapping("canopen", "can_open")]
CanOpen,
+
+ [Mapping("romtitle", "rom_title")]
RomTitle,
// Infos
+
+ [Mapping("info_name", "infos_name")]
Info_Name,
+
+ [Mapping("info_visible", "infos_visible")]
Info_Visible,
+
+ [Mapping("info_isnamingoption", "info_is_naming_option", "infos_isnamingoption", "infos_is_naming_option")]
Info_IsNamingOption,
+
+ [Mapping("info_default", "infos_default")]
Info_Default,
#endregion
#region RomCenter
+ [Mapping("rcversion", "rc_version", "romcenterversion", "romcenter_version", "rom_center_version")]
RomCenterVersion,
#endregion
@@ -537,6 +904,7 @@ namespace SabreTools.Core
#region Common
+ [Mapping("type")]
Type,
#endregion
@@ -545,197 +913,505 @@ namespace SabreTools.Core
#region Actionable
- // Rom
+ #region Rom
+
+ [Mapping("name")]
Name,
+
+ [Mapping("bios")]
Bios,
+
+ [Mapping("size")]
Size,
+
+ [Mapping("crc", "crc32")]
CRC,
+
+ [Mapping("md5", "md5hash", "md5_hash")]
MD5,
+
+ [Mapping("sha1", "sha_1", "sha1hash", "sha1_hash", "sha_1hash", "sha_1_hash")]
SHA1,
+
+ [Mapping("sha256", "sha_256", "sha256hash", "sha256_hash", "sha_256hash", "sha_256_hash")]
SHA256,
+
+ [Mapping("sha384", "sha_384", "sha384hash", "sha384_hash", "sha_384hash", "sha_384_hash")]
SHA384,
+
+ [Mapping("sha512", "sha_512", "sha512hash", "sha512_hash", "sha_512hash", "sha_512_hash")]
SHA512,
+
+ [Mapping("spamsum", "spam_sum")]
SpamSum,
+
+ [Mapping("merge", "mergetag", "merge_tag")]
Merge,
+
+ [Mapping("region")]
Region,
+
+ [Mapping("offset")]
Offset,
+
+ [Mapping("date")]
Date,
+
+ [Mapping("status")]
Status,
+
+ [Mapping("optional")]
Optional,
+
+ [Mapping("inverted")]
Inverted,
- // Rom (Archive.org)
+ #endregion
+
+ #region Rom (Archive.org)
+
+ [Mapping("ado_source")]
ArchiveDotOrgSource,
+
+ [Mapping("ado_format")]
ArchiveDotOrgFormat,
+
+ [Mapping("original_filename")]
OriginalFilename,
+
+ [Mapping("rotation")]
Rotation,
+
+ [Mapping("summation")]
Summation,
- // Rom (AttractMode)
+ #endregion
+
+ #region Rom (AttractMode)
+
+ [Mapping("altname", "alt_name", "altromname", "alt_romname", "alt_rom_name")]
AltName,
+
+ [Mapping("alttitle", "alt_title", "altromtitle", "alt_romtitle", "alt_rom_title")]
AltTitle,
- // Rom (Logiqx)
+ #endregion
+
+ #region Rom (Logiqx)
+
+ [Mapping("mia")]
MIA,
- // Rom (OpenMSX)
+ #endregion
+
+ #region Rom (OpenMSX)
+
+ [Mapping("original")]
Original,
+
+ [Mapping("subtype", "sub_type", "openmsxsubtype", "openmsx_subtype", "openmsx_sub_type")]
OpenMSXSubType,
+
+ [Mapping("openmsxtype", "openmsx_type")]
OpenMSXType,
+
+ [Mapping("remark")]
Remark,
+
+ [Mapping("boot")]
Boot,
- // Rom (SoftwareList)
+ #endregion
+
+ #region Rom (SoftwareList)
+
+ [Mapping("loadflag", "load_flag")]
LoadFlag,
+
+ [Mapping("value")]
Value,
- // Disk
+ #endregion
+
+ #region Disk
+
+ [Mapping("index")]
Index,
+
+ [Mapping("writable")]
Writable,
#endregion
+ #endregion
+
#region Auxiliary
- // Adjuster
+ #region Adjuster
+
+ [Mapping("default")]
Default,
- // Analog
+ #endregion
+
+ #region Analog
+
+ [Mapping("analog_mask")]
Analog_Mask,
- // Archive
+ #endregion
+
+ #region Archive
+
+ [Mapping("number")]
Number,
+
+ [Mapping("clone")]
Clone,
+
+ [Mapping("regparent", "reg_parent")]
RegParent,
+
+ [Mapping("languages")]
Languages,
+
+ [Mapping("devstatus", "dev_status")]
DevStatus,
+
+ [Mapping("physical")]
Physical,
+
+ [Mapping("complete")]
Complete,
+
+ [Mapping("categories")]
Categories,
- // BiosSet
+ #endregion
+
+ #region BiosSet
+
+ [Mapping("description", "biosdescription", "bios_description")]
Description,
- // Chip
+ #endregion
+
+ #region Chip
+
+ [Mapping("tag")]
Tag,
+
+ [Mapping("chiptype", "chip_type")]
ChipType,
+
+ [Mapping("clock")]
Clock,
- // Condition
+ #endregion
+
+ #region Condition
+
+ [Mapping("mask")]
Mask,
+
+ [Mapping("relation")]
Relation,
+
+ [Mapping("condition_tag")]
Condition_Tag,
+
+ [Mapping("condition_mask")]
Condition_Mask,
+
+ [Mapping("condition_relation")]
Condition_Relation,
+
+ [Mapping("condition_value")]
Condition_Value,
- // Control
+ #endregion
+
+ #region Control
+
+ [Mapping("control_type")]
Control_Type,
+
+ [Mapping("control_player")]
Control_Player,
+
+ [Mapping("control_buttons")]
Control_Buttons,
+
+ [Mapping("control_reqbuttons", "control_req_buttons")]
Control_RequiredButtons,
+
+ [Mapping("control_minimum")]
Control_Minimum,
+
+ [Mapping("control_maximum")]
Control_Maximum,
+
+ [Mapping("control_sensitivity")]
Control_Sensitivity,
+
+ [Mapping("control_keydelta", "control_key_delta")]
Control_KeyDelta,
+
+ [Mapping("control_reverse")]
Control_Reverse,
+
+ [Mapping("control_ways")]
Control_Ways,
+
+ [Mapping("control_ways2")]
Control_Ways2,
+
+ [Mapping("control_ways3")]
Control_Ways3,
- // DataArea
+ #endregion
+
+ #region DataArea
+
+ [Mapping("areaname", "area_name")]
AreaName,
+
+ [Mapping("areasize", "area_size")]
AreaSize,
+
+ [Mapping("areawidth", "area_width")]
AreaWidth,
+
+ [Mapping("areaendinanness", "area_endianness")]
AreaEndianness,
- // Device
+ #endregion
+
+ #region Device
+
+ [Mapping("devicetype", "device_type")]
DeviceType,
+
+ [Mapping("fixedimage", "fixed_image")]
FixedImage,
+
+ [Mapping("mandatory")]
Mandatory,
+
+ [Mapping("interface")]
Interface,
- // Display
+ #endregion
+
+ #region Display
+
+ [Mapping("displaytype", "display_type")]
DisplayType,
+
+ [Mapping("rotate")]
Rotate,
+
+ [Mapping("flipx")]
FlipX,
+
+ [Mapping("width")]
Width,
+
+ [Mapping("height")]
Height,
+
+ [Mapping("refresh")]
Refresh,
+
+ [Mapping("pixclock", "pix_clock")]
PixClock,
+
+ [Mapping("htotal")]
HTotal,
+
+ [Mapping("hbend")]
HBEnd,
+
+ [Mapping("hbstart")]
HBStart,
+
+ [Mapping("vtotal")]
VTotal,
+
+ [Mapping("vbend")]
VBEnd,
+
+ [Mapping("vbstart")]
VBStart,
- // Driver
+ #endregion
+
+ #region Driver
+
+ [Mapping("supportstatus", "support_status")]
SupportStatus,
+
+ [Mapping("emulationstatus", "emulation_status")]
EmulationStatus,
+
+ [Mapping("cocktailstatus", "cocktail_status")]
CocktailStatus,
+
+ [Mapping("savestatestatus", "savestate_status", "save_state_status")]
SaveStateStatus,
+
+ [Mapping("requiresartwork", "requires_artwork")]
RequiresArtwork,
+
+ [Mapping("unofficial")]
Unofficial,
+
+ [Mapping("nosoundhardware", "no_sound_hardware")]
NoSoundHardware,
+
+ [Mapping("incomplete")]
Incomplete,
- // Extension
+ #endregion
+
+ #region Extension
+
+ [Mapping("extension_name")]
Extension_Name,
- // Feature
+ #endregion
+
+ #region Feature
+
+ [Mapping("featuretype", "feature_type")]
FeatureType,
+
+ [Mapping("featurestatus", "feature_status")]
FeatureStatus,
+
+ [Mapping("featureoverall", "feature_overall")]
FeatureOverall,
- // Input
+ #endregion
+
+ #region Input
+
+ [Mapping("service")]
Service,
+
+ [Mapping("tilt")]
Tilt,
+
+ [Mapping("players")]
Players,
+
+ [Mapping("coins")]
Coins,
- // Instance
+ #endregion
+
+ #region Instance
+
+ [Mapping("instance_name")]
Instance_Name,
+
+ [Mapping("instance_briefname", "instance_brief_name")]
Instance_BriefName,
- // Location
+ #endregion
+
+ #region Location
+
+ [Mapping("location_name")]
Location_Name,
+
+ [Mapping("location_number")]
Location_Number,
+
+ [Mapping("location_inverted")]
Location_Inverted,
- // Part
+ #endregion
+
+ #region Part
+
+ [Mapping("partname", "part_name")]
Part_Name,
+
+ [Mapping("partinterface", "part_interface")]
Part_Interface,
- // PartFeature
+ #endregion
+
+ #region PartFeature
+
+ [Mapping("part_feature_name")]
Part_Feature_Name,
+
+ [Mapping("part_feature_value")]
Part_Feature_Value,
- // RamOption
+ #endregion
+
+ #region RamOption
+
+ [Mapping("content")]
Content,
- // Release
+ #endregion
+
+ #region Release
+
+ [Mapping("language")]
Language,
- // Setting
+ #endregion
+
+ #region Setting
+
+ [Mapping("setting_name", "value_name")]
Setting_Name,
+
+ [Mapping("setting_value", "value_value")]
Setting_Value,
+
+ [Mapping("setting_default", "value_default")]
Setting_Default,
- // SlotOption
+ #endregion
+
+ #region SlotOption
+
+ [Mapping("slotoption_name")]
SlotOption_Name,
+
+ [Mapping("slotoption_devicename", "slotoption_device_name")]
SlotOption_DeviceName,
+
+ [Mapping("slotoption_default")]
SlotOption_Default,
- // SoftwareList
+ #endregion
+
+ #region SoftwareList
+
+ [Mapping("softwareliststatus", "softwarelist_status")]
SoftwareListStatus,
+
+ [Mapping("filter")]
Filter,
- // Sound
+ #endregion
+
+ #region Sound
+
+ [Mapping("channels")]
Channels,
#endregion
+ #endregion
+
#endregion // Item-Specific
}
@@ -744,77 +1420,150 @@ namespace SabreTools.Core
///
public enum MachineField
{
+ ///
+ /// This is a fake flag that is used for filter only
+ ///
NULL = 0,
#region Common
+ [Mapping("name")]
Name,
+
+ /// "extra" is used with AttractMode
+ [Mapping("comment", "extra")]
Comment,
+
+ [Mapping("desc", "description")]
Description,
+
+ [Mapping("year")]
Year,
+
+ [Mapping("manufacturer")]
Manufacturer,
+
+ [Mapping("publisher")]
Publisher,
+
+ [Mapping("category")]
Category,
+
+ [Mapping("romof", "rom_of")]
RomOf,
+
+ [Mapping("cloneof", "clone_of")]
CloneOf,
+
+ [Mapping("sampleof", "sample_of")]
SampleOf,
+
+ [Mapping("type")]
Type,
#endregion
#region AttractMode
+ [Mapping("players")]
Players,
+
+ [Mapping("rotation")]
Rotation,
+
+ [Mapping("control")]
Control,
+
+ [Mapping("amstatus", "am_status", "gamestatus", "supportstatus", "support_status")]
Status,
+
+ [Mapping("displaycount", "display_count")]
DisplayCount,
+
+ [Mapping("displaytype", "display_type")]
DisplayType,
+
+ [Mapping("buttons")]
Buttons,
#endregion
#region ListXML
+ [Mapping("history")]
History,
+
+ [Mapping("sourcefile", "source_file")]
SourceFile,
+
+ [Mapping("runnable")]
Runnable,
#endregion
#region Logiqx
+ [Mapping("board")]
Board,
+
+ [Mapping("rebuildto", "rebuild_to")]
RebuildTo,
+
+ [Mapping("id", "nointroid", "nointro_id", "no_intro_id")]
NoIntroId,
+
+ [Mapping("cloneofid", "nointrocloneofid", "nointro_cloneofid", "no_intro_cloneofid", "no_intro_clone_of_id")]
NoIntroCloneOfId,
#endregion
#region Logiqx EmuArc
+ [Mapping("titleid", "title_id")]
TitleID,
+
+ [Mapping("developer")]
Developer,
+
+ [Mapping("genre")]
Genre,
+
+ [Mapping("subgenre", "sub_genre")]
Subgenre,
+
+ [Mapping("ratings")]
Ratings,
+
+ [Mapping("score")]
Score,
+
+ [Mapping("enabled")]
Enabled,
+
+ [Mapping("crc", "hascrc", "has_crc")]
CRC,
+
+ [Mapping("relatedto", "related_to")]
RelatedTo,
#endregion
#region OpenMSX
+ [Mapping("genmsxid", "genmsx_id", "gen_msxid", "gen_msx_id")]
GenMSXID,
+
+ [Mapping("system", "msxsystem", "msx_system")]
System,
+
+ [Mapping("country")]
Country,
#endregion
#region SoftwareList
+ [Mapping("supported")]
Supported,
#endregion
@@ -829,9 +1578,16 @@ namespace SabreTools.Core
///
public enum LogLevel
{
+ [Mapping("verbose")]
VERBOSE = 0,
+
+ [Mapping("user")]
USER,
+
+ [Mapping("warning")]
WARNING,
+
+ [Mapping("error")]
ERROR,
}
diff --git a/SabreTools.Core/Tools/Converters.cs b/SabreTools.Core/Tools/Converters.cs
index 778f41c2..1261e8d9 100644
--- a/SabreTools.Core/Tools/Converters.cs
+++ b/SabreTools.Core/Tools/Converters.cs
@@ -44,14 +44,7 @@ namespace SabreTools.Core.Tools
/// String to get value from
/// ChipType value corresponding to the string
public static ChipType AsChipType(this string chipType)
- {
- return chipType?.ToLowerInvariant() switch
- {
- "cpu" => ChipType.CPU,
- "audio" => ChipType.Audio,
- _ => ChipType.NULL,
- };
- }
+ => AsEnumValue(chipType);
///
/// Get ControlType value from input string
@@ -59,27 +52,7 @@ namespace SabreTools.Core.Tools
/// String to get value from
/// ControlType value corresponding to the string
public static ControlType AsControlType(this string controlType)
- {
- return controlType?.ToLowerInvariant() switch
- {
- "joy" => ControlType.Joy,
- "stick" => ControlType.Stick,
- "paddle" => ControlType.Paddle,
- "pedal" => ControlType.Pedal,
- "lightgun" => ControlType.Lightgun,
- "positional" => ControlType.Positional,
- "dial" => ControlType.Dial,
- "trackball" => ControlType.Trackball,
- "mouse" => ControlType.Mouse,
- "only_buttons" => ControlType.OnlyButtons,
- "keypad" => ControlType.Keypad,
- "keyboard" => ControlType.Keyboard,
- "mahjong" => ControlType.Mahjong,
- "hanafuda" => ControlType.Hanafuda,
- "gambling" => ControlType.Gambling,
- _ => ControlType.NULL,
- };
- }
+ => AsEnumValue(controlType);
///
/// Get DatHeaderField value from input string
@@ -108,161 +81,7 @@ namespace SabreTools.Core.Tools
.Replace('-', '_')
.Replace('.', '_');
- return headerInput switch
- {
- #region Common
-
- "file" => DatHeaderField.FileName,
- "filename" => DatHeaderField.FileName,
- "file_name" => DatHeaderField.FileName,
-
- "dat" => DatHeaderField.Name,
- "datname" => DatHeaderField.Name,
- "dat_name" => DatHeaderField.Name,
- "internalname" => DatHeaderField.Name,
- "internal_name" => DatHeaderField.Name,
-
- "desc" => DatHeaderField.Description,
- "description" => DatHeaderField.Description,
-
- "root" => DatHeaderField.RootDir,
- "rootdir" => DatHeaderField.RootDir,
- "root_dir" => DatHeaderField.RootDir,
- "rootdirectory" => DatHeaderField.RootDir,
- "root_directory" => DatHeaderField.RootDir,
-
- "category" => DatHeaderField.Category,
-
- "version" => DatHeaderField.Version,
-
- "date" => DatHeaderField.Date,
- "timestamp" => DatHeaderField.Date,
- "time_stamp" => DatHeaderField.Date,
-
- "author" => DatHeaderField.Author,
-
- "email" => DatHeaderField.Email,
- "e_mail" => DatHeaderField.Email,
-
- "homepage" => DatHeaderField.Homepage,
- "home_page" => DatHeaderField.Homepage,
-
- "url" => DatHeaderField.Url,
-
- "comment" => DatHeaderField.Comment,
-
- "header" => DatHeaderField.HeaderSkipper,
- "headerskipper" => DatHeaderField.HeaderSkipper,
- "header_skipper" => DatHeaderField.HeaderSkipper,
- "skipper" => DatHeaderField.HeaderSkipper,
-
- "dattype" => DatHeaderField.Type,
- "type" => DatHeaderField.Type,
- "superdat" => DatHeaderField.Type,
-
- "forcemerging" => DatHeaderField.ForceMerging,
- "force_merging" => DatHeaderField.ForceMerging,
-
- "forcenodump" => DatHeaderField.ForceNodump,
- "force_nodump" => DatHeaderField.ForceNodump,
-
- "forcepacking" => DatHeaderField.ForcePacking,
- "force_packing" => DatHeaderField.ForcePacking,
-
- #endregion
-
- #region ListXML
-
- "debug" => DatHeaderField.Debug,
-
- "mameconfig" => DatHeaderField.MameConfig,
- "mame_config" => DatHeaderField.MameConfig,
-
- #endregion
-
- #region Logiqx
-
- "id" => DatHeaderField.NoIntroID,
- "nointroid" => DatHeaderField.NoIntroID,
- "no_intro_id" => DatHeaderField.NoIntroID,
-
- "build" => DatHeaderField.Build,
-
- "rommode" => DatHeaderField.RomMode,
- "rom_mode" => DatHeaderField.RomMode,
-
- "biosmode" => DatHeaderField.BiosMode,
- "bios_mode" => DatHeaderField.BiosMode,
-
- "samplemode" => DatHeaderField.SampleMode,
- "sample_mode" => DatHeaderField.SampleMode,
-
- "lockrommode" => DatHeaderField.LockRomMode,
- "lockrom_mode" => DatHeaderField.LockRomMode,
- "lock_rommode" => DatHeaderField.LockRomMode,
- "lock_rom_mode" => DatHeaderField.LockRomMode,
-
- "lockbiosmode" => DatHeaderField.LockBiosMode,
- "lockbios_mode" => DatHeaderField.LockBiosMode,
- "lock_biosmode" => DatHeaderField.LockBiosMode,
- "lock_bios_mode" => DatHeaderField.LockBiosMode,
-
- "locksamplemode" => DatHeaderField.LockSampleMode,
- "locksample_mode" => DatHeaderField.LockSampleMode,
- "lock_samplemode" => DatHeaderField.LockSampleMode,
- "lock_sample_mode" => DatHeaderField.LockSampleMode,
-
- #endregion
-
- #region OfflineList
-
- "system" => DatHeaderField.System,
- "plugin" => DatHeaderField.System, // Used with RomCenter
-
- "screenshotwidth" => DatHeaderField.ScreenshotsWidth,
- "screenshotswidth" => DatHeaderField.ScreenshotsWidth,
- "screenshot_width" => DatHeaderField.ScreenshotsWidth,
- "screenshots_width" => DatHeaderField.ScreenshotsWidth,
-
- "screenshotheight" => DatHeaderField.ScreenshotsHeight,
- "screenshotsheight" => DatHeaderField.ScreenshotsHeight,
- "screenshot_height" => DatHeaderField.ScreenshotsHeight,
- "screenshots_height" => DatHeaderField.ScreenshotsHeight,
-
- "info_name" => DatHeaderField.Info_Name,
- "infos_name" => DatHeaderField.Info_Name,
-
- "info_visible" => DatHeaderField.Info_Visible,
- "infos_visible" => DatHeaderField.Info_Visible,
-
- "info_isnamingoption" => DatHeaderField.Info_IsNamingOption,
- "info_is_naming_option" => DatHeaderField.Info_IsNamingOption,
- "infos_isnamingoption" => DatHeaderField.Info_IsNamingOption,
- "infos_is_naming_option" => DatHeaderField.Info_IsNamingOption,
-
- "info_default" => DatHeaderField.Info_Default,
- "infos_default" => DatHeaderField.Info_Default,
-
- "canopen" => DatHeaderField.CanOpen,
- "can_open" => DatHeaderField.CanOpen,
-
- "romtitle" => DatHeaderField.RomTitle,
- "rom_title" => DatHeaderField.RomTitle,
-
- #endregion
-
- #region RomCenter
-
- "rcversion" => DatHeaderField.RomCenterVersion,
- "rc_version" => DatHeaderField.RomCenterVersion,
- "romcenterversion" => DatHeaderField.RomCenterVersion,
- "romcenter_version" => DatHeaderField.RomCenterVersion,
- "rom_center_version" => DatHeaderField.RomCenterVersion,
-
- #endregion
-
- _ => DatHeaderField.NULL,
- };
+ return AsEnumValue(headerInput);
}
///
@@ -292,459 +111,7 @@ namespace SabreTools.Core.Tools
.Replace('-', '_')
.Replace('.', '_');
- return itemInput switch
- {
- #region Common
-
- "type" => DatItemField.Type,
-
- #endregion
-
- #region Item-Specific
-
- #region Actionable
-
- #region Rom
-
- "name" => DatItemField.Name,
-
- "bios" => DatItemField.Bios,
-
- "size" => DatItemField.Size,
-
- "crc" => DatItemField.CRC,
- "crc32" => DatItemField.CRC,
-
- "md5" => DatItemField.MD5,
- "md5hash" => DatItemField.MD5,
- "md5_hash" => DatItemField.MD5,
-
- "sha1" => DatItemField.SHA1,
- "sha_1" => DatItemField.SHA1,
- "sha1hash" => DatItemField.SHA1,
- "sha1_hash" => DatItemField.SHA1,
- "sha_1hash" => DatItemField.SHA1,
- "sha_1_hash" => DatItemField.SHA1,
-
- "sha256" => DatItemField.SHA256,
- "sha_256" => DatItemField.SHA256,
- "sha256hash" => DatItemField.SHA256,
- "sha256_hash" => DatItemField.SHA256,
- "sha_256hash" => DatItemField.SHA256,
- "sha_256_hash" => DatItemField.SHA256,
-
- "sha384" => DatItemField.SHA384,
- "sha_384" => DatItemField.SHA384,
- "sha384hash" => DatItemField.SHA384,
- "sha384_hash" => DatItemField.SHA384,
- "sha_384hash" => DatItemField.SHA384,
- "sha_384_hash" => DatItemField.SHA384,
-
- "sha512" => DatItemField.SHA512,
- "sha_512" => DatItemField.SHA512,
- "sha512hash" => DatItemField.SHA512,
- "sha512_hash" => DatItemField.SHA512,
- "sha_512hash" => DatItemField.SHA512,
- "sha_512_hash" => DatItemField.SHA512,
-
- "spamsum" => DatItemField.SpamSum,
- "spam_sum" => DatItemField.SpamSum,
-
- "merge" => DatItemField.Merge,
- "mergetag" => DatItemField.Merge,
- "merge_tag" => DatItemField.Merge,
-
- "region" => DatItemField.Region,
-
- "offset" => DatItemField.Offset,
-
- "date" => DatItemField.Date,
-
- "status" => DatItemField.Status,
-
- "optional" => DatItemField.Optional,
-
- "inverted" => DatItemField.Inverted,
-
- #endregion
-
- #region Rom (Archive.org)
-
- "ado_source" => DatItemField.ArchiveDotOrgSource,
-
- "ado_format" => DatItemField.ArchiveDotOrgFormat,
-
- "original_filename" => DatItemField.OriginalFilename,
-
- "rotation" => DatItemField.Rotation,
-
- "summation" => DatItemField.Summation,
-
- #endregion
-
- #region Rom (AttractMode)
-
- "altname" => DatItemField.AltName,
- "alt_name" => DatItemField.AltName,
- "altromname" => DatItemField.AltName,
- "alt_romname" => DatItemField.AltName,
- "alt_rom_name" => DatItemField.AltName,
-
- "alttitle" => DatItemField.AltTitle,
- "alt_title" => DatItemField.AltTitle,
- "altromtitle" => DatItemField.AltTitle,
- "alt_romtitle" => DatItemField.AltTitle,
- "alt_rom_title" => DatItemField.AltTitle,
-
- #endregion
-
- #region Rom (Logiqx)
-
- "mia" => DatItemField.MIA,
-
- #endregion
-
- #region Rom (OpenMSX)
-
- "original" => DatItemField.Original,
-
- "subtype" => DatItemField.OpenMSXSubType,
- "sub_type" => DatItemField.OpenMSXSubType,
- "openmsxsubtype" => DatItemField.OpenMSXSubType,
- "openmsx_subtype" => DatItemField.OpenMSXSubType,
- "openmsx_sub_type" => DatItemField.OpenMSXSubType,
-
- "openmsxtype" => DatItemField.OpenMSXType,
- "openmsx_type" => DatItemField.OpenMSXType,
-
- "remark" => DatItemField.Remark,
-
- "boot" => DatItemField.Boot,
-
- #endregion
-
- #region Rom (SoftwareList)
-
- "areaname" => DatItemField.AreaName,
- "area_name" => DatItemField.AreaName,
-
- "areasize" => DatItemField.AreaSize,
- "area_size" => DatItemField.AreaSize,
-
- "areawidth" => DatItemField.AreaWidth,
- "area_width" => DatItemField.AreaWidth,
-
- "areaendinanness" => DatItemField.AreaEndianness,
- "area_endianness" => DatItemField.AreaEndianness,
-
- "loadflag" => DatItemField.LoadFlag,
- "load_flag" => DatItemField.LoadFlag,
-
- "partname" => DatItemField.Part_Name,
- "part_name" => DatItemField.Part_Name,
-
- "partinterface" => DatItemField.Part_Interface,
- "part_interface" => DatItemField.Part_Interface,
-
- "part_feature_name" => DatItemField.Part_Feature_Name,
-
- "part_feature_value" => DatItemField.Part_Feature_Value,
-
- "value" => DatItemField.Value,
-
- #endregion
-
- #region Disk
-
- "index" => DatItemField.Index,
-
- "writable" => DatItemField.Writable,
-
- #endregion
-
- #endregion
-
- #region Auxiliary
-
- #region Adjuster
-
- "default" => DatItemField.Default,
-
- #endregion
-
- #region Analog
-
- "analog_mask" => DatItemField.Analog_Mask,
-
- #endregion
-
- #region Archive
-
- "number" => DatItemField.Number,
-
- "clone" => DatItemField.Clone,
-
- "regparent" => DatItemField.RegParent,
- "reg_parent" => DatItemField.RegParent,
-
- "languages" => DatItemField.Languages,
-
- "devstatus" => DatItemField.DevStatus,
- "dev_status" => DatItemField.DevStatus,
-
- "physical" => DatItemField.Physical,
-
- "complete" => DatItemField.Complete,
-
- "categories" => DatItemField.Categories,
-
- #endregion
-
- #region BiosSet
-
- "description" => DatItemField.Description,
- "biosdescription" => DatItemField.Description,
- "bios_description" => DatItemField.Description,
-
- #endregion
-
- #region Chip
-
- "tag" => DatItemField.Tag,
-
- "chiptype" => DatItemField.ChipType,
- "chip_type" => DatItemField.ChipType,
-
- "clock" => DatItemField.Clock,
-
- #endregion
-
- #region Condition
-
- "mask" => DatItemField.Mask,
-
- "relation" => DatItemField.Relation,
-
- "condition_tag" => DatItemField.Condition_Tag,
-
- "condition_mask" => DatItemField.Condition_Mask,
-
- "condition_relation" => DatItemField.Condition_Relation,
-
- "condition_value" => DatItemField.Condition_Value,
-
- #endregion
-
- #region Control
-
- "control_type" => DatItemField.Control_Type,
-
- "control_player" => DatItemField.Control_Player,
-
- "control_buttons" => DatItemField.Control_Buttons,
-
- "control_reqbuttons" => DatItemField.Control_RequiredButtons,
- "control_req_buttons" => DatItemField.Control_RequiredButtons,
-
- "control_minimum" => DatItemField.Control_Minimum,
-
- "control_maximum" => DatItemField.Control_Maximum,
-
- "control_sensitivity" => DatItemField.Control_Sensitivity,
-
- "control_keydelta" => DatItemField.Control_KeyDelta,
- "control_key_delta" => DatItemField.Control_KeyDelta,
-
- "control_reverse" => DatItemField.Control_Reverse,
-
- "control_ways" => DatItemField.Control_Ways,
-
- "control_ways2" => DatItemField.Control_Ways2,
-
- "control_ways3" => DatItemField.Control_Ways3,
-
- #endregion
-
- #region Device
-
- "devicetype" => DatItemField.DeviceType,
- "device_type" => DatItemField.DeviceType,
-
- "fixedimage" => DatItemField.FixedImage,
- "fixed_image" => DatItemField.FixedImage,
-
- "mandatory" => DatItemField.Mandatory,
-
- "interface" => DatItemField.Interface,
-
- #endregion
-
- #region Display
-
- "displaytype" => DatItemField.DisplayType,
- "display_type" => DatItemField.DisplayType,
-
- "rotate" => DatItemField.Rotate,
-
- "flipx" => DatItemField.FlipX,
-
- "width" => DatItemField.Width,
-
- "height" => DatItemField.Height,
-
- "refresh" => DatItemField.Refresh,
-
- "pixclock" => DatItemField.PixClock,
- "pix_clock" => DatItemField.PixClock,
-
- "htotal" => DatItemField.HTotal,
-
- "hbend" => DatItemField.HBEnd,
-
- "hbstart" => DatItemField.HBStart,
-
- "vtotal" => DatItemField.VTotal,
-
- "vbend" => DatItemField.VBEnd,
-
- "vbstart" => DatItemField.VBStart,
-
- #endregion
-
- #region Driver
-
- "supportstatus" => DatItemField.SupportStatus,
- "support_status" => DatItemField.SupportStatus,
-
- "emulationstatus" => DatItemField.EmulationStatus,
- "emulation_status" => DatItemField.EmulationStatus,
-
- "cocktailstatus" => DatItemField.CocktailStatus,
- "cocktail_status" => DatItemField.CocktailStatus,
-
- "savestatestatus" => DatItemField.SaveStateStatus,
- "savestate_status" => DatItemField.SaveStateStatus,
- "save_state_status" => DatItemField.SaveStateStatus,
-
- "requiresartwork" => DatItemField.RequiresArtwork,
- "requires_artwork" => DatItemField.RequiresArtwork,
-
- "unofficial" => DatItemField.Unofficial,
-
- "nosoundhardware" => DatItemField.NoSoundHardware,
- "no_sound_hardware" => DatItemField.NoSoundHardware,
-
- "incomplete" => DatItemField.Incomplete,
-
- #endregion
-
- #region Extension
-
- "extension_name" => DatItemField.Extension_Name,
-
- #endregion
-
- #region Feature
-
- "featuretype" => DatItemField.FeatureType,
- "feature_type" => DatItemField.FeatureType,
-
- "featurestatus" => DatItemField.FeatureStatus,
- "feature_status" => DatItemField.FeatureStatus,
-
- "featureoverall" => DatItemField.FeatureOverall,
- "feature_overall" => DatItemField.FeatureOverall,
-
- #endregion
-
- #region Input
-
- "service" => DatItemField.Service,
-
- "tilt" => DatItemField.Tilt,
-
- "players" => DatItemField.Players,
-
- "coins" => DatItemField.Coins,
-
- #endregion
-
- #region Instance
-
- "instance_name" => DatItemField.Instance_Name,
-
- "instance_briefname" => DatItemField.Instance_BriefName,
- "instance_brief_name" => DatItemField.Instance_BriefName,
-
- #endregion
-
- #region Location
-
- "location_name" => DatItemField.Location_Name,
-
- "location_number" => DatItemField.Location_Number,
-
- "location_inverted" => DatItemField.Location_Inverted,
-
- #endregion
-
- #region RamOption
-
- "content" => DatItemField.Content,
-
- #endregion
-
- #region Release
-
- "language" => DatItemField.Language,
-
- #endregion
-
- #region Setting
-
- "setting_name" => DatItemField.Setting_Name,
- "value_name" => DatItemField.Setting_Name,
-
- "setting_value" => DatItemField.Setting_Value,
- "value_value" => DatItemField.Setting_Value,
-
- "setting_default" => DatItemField.Setting_Default,
- "value_default" => DatItemField.Setting_Default,
-
- #endregion
-
- #region SlotOption
-
- "slotoption_name" => DatItemField.SlotOption_Name,
-
- "slotoption_devicename" => DatItemField.SlotOption_DeviceName,
- "slotoption_device_name" => DatItemField.SlotOption_DeviceName,
-
- "slotoption_default" => DatItemField.SlotOption_Default,
-
- #endregion
-
- #region SoftwareList
-
- "softwareliststatus" => DatItemField.SoftwareListStatus,
- "softwarelist_status" => DatItemField.SoftwareListStatus,
-
- "filter" => DatItemField.Filter,
-
- #endregion
-
- #region Sound
-
- "channels" => DatItemField.Channels,
-
- #endregion
-
- #endregion
-
- #endregion // Item-Specific
-
- _ => DatItemField.NULL,
- };
+ return AsEnumValue(itemInput);
}
///
@@ -753,33 +120,7 @@ namespace SabreTools.Core.Tools
/// String to get value from
/// DeviceType value corresponding to the string
public static DeviceType AsDeviceType(this string deviceType)
- {
- return deviceType?.ToLowerInvariant() switch
- {
- "unknown" => DeviceType.Unknown,
- "cartridge" => DeviceType.Cartridge,
- "floppydisk" => DeviceType.FloppyDisk,
- "harddisk" => DeviceType.HardDisk,
- "cylinder" => DeviceType.Cylinder,
- "cassette" => DeviceType.Cassette,
- "punchcard" => DeviceType.PunchCard,
- "punchtape" => DeviceType.PunchTape,
- "printout" => DeviceType.Printout,
- "serial" => DeviceType.Serial,
- "parallel" => DeviceType.Parallel,
- "snapshot" => DeviceType.Snapshot,
- "quickload" => DeviceType.QuickLoad,
- "memcard" => DeviceType.MemCard,
- "cdrom" => DeviceType.CDROM,
- "magtape" => DeviceType.MagTape,
- "romimage" => DeviceType.ROMImage,
- "midiin" => DeviceType.MIDIIn,
- "midiout" => DeviceType.MIDIOut,
- "picture" => DeviceType.Picture,
- "vidfile" => DeviceType.VidFile,
- _ => DeviceType.NULL,
- };
- }
+ => AsEnumValue(deviceType);
///
/// Get DisplayType value from input string
@@ -787,17 +128,7 @@ namespace SabreTools.Core.Tools
/// String to get value from
/// DisplayType value corresponding to the string
public static DisplayType AsDisplayType(this string displayType)
- {
- return displayType?.ToLowerInvariant() switch
- {
- "raster" => DisplayType.Raster,
- "vector" => DisplayType.Vector,
- "lcd" => DisplayType.LCD,
- "svg" => DisplayType.SVG,
- "unknown" => DisplayType.Unknown,
- _ => DisplayType.NULL,
- };
- }
+ => AsEnumValue(displayType);
///
/// Get Endianness value from input string
@@ -805,14 +136,7 @@ namespace SabreTools.Core.Tools
/// String to get value from
/// Endianness value corresponding to the string
public static Endianness AsEndianness(this string endianness)
- {
- return endianness?.ToLowerInvariant() switch
- {
- "big" => Endianness.Big,
- "little" => Endianness.Little,
- _ => Endianness.NULL,
- };
- }
+ => AsEnumValue(endianness);
///
/// Get FeatureStatus value from input string
@@ -820,14 +144,7 @@ namespace SabreTools.Core.Tools
/// String to get value from
/// FeatureStatus value corresponding to the string
public static FeatureStatus AsFeatureStatus(this string featureStatus)
- {
- return featureStatus?.ToLowerInvariant() switch
- {
- "unemulated" => FeatureStatus.Unemulated,
- "imperfect" => FeatureStatus.Imperfect,
- _ => FeatureStatus.NULL,
- };
- }
+ => AsEnumValue(featureStatus);
///
/// Get FeatureType value from input string
@@ -835,26 +152,7 @@ namespace SabreTools.Core.Tools
/// String to get value from
/// FeatureType value corresponding to the string
public static FeatureType AsFeatureType(this string featureType)
- {
- return featureType?.ToLowerInvariant() switch
- {
- "protection" => FeatureType.Protection,
- "palette" => FeatureType.Palette,
- "graphics" => FeatureType.Graphics,
- "sound" => FeatureType.Sound,
- "controls" => FeatureType.Controls,
- "keyboard" => FeatureType.Keyboard,
- "mouse" => FeatureType.Mouse,
- "microphone" => FeatureType.Microphone,
- "camera" => FeatureType.Camera,
- "disk" => FeatureType.Disk,
- "printer" => FeatureType.Printer,
- "lan" => FeatureType.Lan,
- "wan" => FeatureType.Wan,
- "timing" => FeatureType.Timing,
- _ => FeatureType.NULL,
- };
- }
+ => AsEnumValue(featureType);
///
/// Get ItemStatus value from input string
@@ -862,76 +160,15 @@ namespace SabreTools.Core.Tools
/// String to get value from
/// ItemStatus value corresponding to the string
public static ItemStatus AsItemStatus(this string status)
- {
- return status?.ToLowerInvariant() switch
- {
- "good" => ItemStatus.Good,
- "baddump" => ItemStatus.BadDump,
- "nodump" => ItemStatus.Nodump,
- "yes" => ItemStatus.Nodump,
- "verified" => ItemStatus.Verified,
- "none" => ItemStatus.None,
- "no" => ItemStatus.None,
- _ => ItemStatus.None,
- };
- }
+ => AsEnumValue(status);
///
/// Get ItemType? value from input string
///
/// String to get value from
/// ItemType? value corresponding to the string
- public static ItemType? AsItemType(this string itemType)
- {
- return itemType?.ToLowerInvariant() switch
- {
- "adjuster" => ItemType.Adjuster,
- "analog" => ItemType.Analog,
- "archive" => ItemType.Archive,
- "biosset" => ItemType.BiosSet,
- "blank" => ItemType.Blank,
- "chip" => ItemType.Chip,
- "condition" => ItemType.Condition,
- "configuration" => ItemType.Configuration,
- "control" => ItemType.Control,
- "dataarea" => ItemType.DataArea,
- "device" => ItemType.Device,
- "deviceref" => ItemType.DeviceReference,
- "device_ref" => ItemType.DeviceReference,
- "dipswitch" => ItemType.DipSwitch,
- "disk" => ItemType.Disk,
- "diskarea" => ItemType.DiskArea,
- "display" => ItemType.Display,
- "driver" => ItemType.Driver,
- "extension" => ItemType.Extension,
- "feature" => ItemType.Feature,
- "info" => ItemType.Info,
- "input" => ItemType.Input,
- "instance" => ItemType.Instance,
- "location" => ItemType.Location,
- "media" => ItemType.Media,
- "part" => ItemType.Part,
- "partfeature" => ItemType.PartFeature,
- "part_feature" => ItemType.PartFeature,
- "port" => ItemType.Port,
- "ramoption" => ItemType.RamOption,
- "release" => ItemType.Release,
- "releasedetails" => ItemType.ReleaseDetails,
- "release_details" => ItemType.ReleaseDetails,
- "rom" => ItemType.Rom,
- "sample" => ItemType.Sample,
- "serials" => ItemType.Serials,
- "setting" => ItemType.Setting,
- "sharedfeat" => ItemType.SharedFeature,
- "slot" => ItemType.Slot,
- "slotoption" => ItemType.SlotOption,
- "softwarelist" => ItemType.SoftwareList,
- "sound" => ItemType.Sound,
- "sourcedetails" => ItemType.SourceDetails,
- "source_details" => ItemType.SourceDetails,
- _ => null,
- };
- }
+ public static ItemType AsItemType(this string itemType)
+ => AsEnumValue(itemType);
///
/// Get LoadFlag value from input string
@@ -939,26 +176,7 @@ namespace SabreTools.Core.Tools
/// String to get value from
/// LoadFlag value corresponding to the string
public static LoadFlag AsLoadFlag(this string loadFlag)
- {
- return loadFlag?.ToLowerInvariant() switch
- {
- "load16_byte" => LoadFlag.Load16Byte,
- "load16_word" => LoadFlag.Load16Word,
- "load16_word_swap" => LoadFlag.Load16WordSwap,
- "load32_byte" => LoadFlag.Load32Byte,
- "load32_word" => LoadFlag.Load32Word,
- "load32_word_swap" => LoadFlag.Load32WordSwap,
- "load32_dword" => LoadFlag.Load32DWord,
- "load64_word" => LoadFlag.Load64Word,
- "load64_word_swap" => LoadFlag.Load64WordSwap,
- "reload" => LoadFlag.Reload,
- "fill" => LoadFlag.Fill,
- "continue" => LoadFlag.Continue,
- "reload_plain" => LoadFlag.ReloadPlain,
- "ignore" => LoadFlag.Ignore,
- _ => LoadFlag.NULL,
- };
- }
+ => AsEnumValue(loadFlag);
///
/// Get LogLevel value from input string
@@ -966,16 +184,7 @@ namespace SabreTools.Core.Tools
/// String to get value from
/// LogLevel value corresponding to the string
public static LogLevel AsLogLevel(this string logLevel)
- {
- return logLevel?.ToLowerInvariant() switch
- {
- "verbose" => LogLevel.VERBOSE,
- "user" => LogLevel.USER,
- "warning" => LogLevel.WARNING,
- "error" => LogLevel.ERROR,
- _ => LogLevel.VERBOSE,
- };
- }
+ => AsEnumValue(logLevel);
///
/// Get MachineField value from input string
@@ -1004,144 +213,7 @@ namespace SabreTools.Core.Tools
.Replace('-', '_')
.Replace('.', '_');
- return machineInput switch
- {
- #region Common
-
- "name" => MachineField.Name,
-
- "comment" => MachineField.Comment,
- "extra" => MachineField.Comment, // Used with AttractMode
-
- "desc" => MachineField.Description,
- "description" => MachineField.Description,
-
- "year" => MachineField.Year,
-
- "manufacturer" => MachineField.Manufacturer,
-
- "publisher" => MachineField.Publisher,
-
- "category" => MachineField.Category,
-
- "romof" => MachineField.RomOf,
- "rom_of" => MachineField.RomOf,
-
- "cloneof" => MachineField.CloneOf,
- "clone_of" => MachineField.CloneOf,
-
- "sampleof" => MachineField.SampleOf,
- "sample_of" => MachineField.SampleOf,
-
- "type" => MachineField.Type,
-
- #endregion
-
- #region AttractMode
-
- "players" => MachineField.Players,
-
- "rotation" => MachineField.Rotation,
-
- "control" => MachineField.Control,
-
- "amstatus" => MachineField.Status,
- "am_status" => MachineField.Status,
- "gamestatus" => MachineField.Status,
- "supportstatus" => MachineField.Status,
- "support_status" => MachineField.Status,
-
- "displaycount" => MachineField.DisplayCount,
- "display_count" => MachineField.DisplayCount,
-
- "displaytype" => MachineField.DisplayType,
- "display_type" => MachineField.DisplayType,
-
- "buttons" => MachineField.Buttons,
-
- #endregion
-
- #region ListXML
-
- "history" => MachineField.History,
-
- "sourcefile" => MachineField.SourceFile,
- "source_file" => MachineField.SourceFile,
-
- "runnable" => MachineField.Runnable,
-
- #endregion
-
- #region Logiqx
-
- "board" => MachineField.Board,
-
- "rebuildto" => MachineField.RebuildTo,
- "rebuild_to" => MachineField.RebuildTo,
-
- "id" => MachineField.NoIntroId,
- "nointroid" => MachineField.NoIntroId,
- "nointro_id" => MachineField.NoIntroId,
- "no_intro_id" => MachineField.NoIntroId,
-
- "cloneofid" => MachineField.NoIntroCloneOfId,
- "nointrocloneofid" => MachineField.NoIntroCloneOfId,
- "nointro_cloneofid" => MachineField.NoIntroCloneOfId,
- "no_intro_cloneofid" => MachineField.NoIntroCloneOfId,
- "no_intro_clone_of_id" => MachineField.NoIntroCloneOfId,
-
- #endregion
-
- #region Logiqx EmuArc
-
- "titleid" => MachineField.TitleID,
- "title_id" => MachineField.TitleID,
-
- "developer" => MachineField.Developer,
-
- "genre" => MachineField.Genre,
-
- "subgenre" => MachineField.Subgenre,
- "sub_genre" => MachineField.Subgenre,
-
- "ratings" => MachineField.Ratings,
-
- "score" => MachineField.Score,
-
- "enabled" => MachineField.Enabled,
-
- "crc" => MachineField.CRC,
- "hascrc" => MachineField.CRC,
- "has_crc" => MachineField.CRC,
-
- "relatedto" => MachineField.RelatedTo,
- "related_to" => MachineField.RelatedTo,
-
- #endregion
-
- #region OpenMSX
-
- "genmsxid" => MachineField.GenMSXID,
- "genmsx_id" => MachineField.GenMSXID,
- "gen_msxid" => MachineField.GenMSXID,
- "gen_msx_id" => MachineField.GenMSXID,
-
- "system" => MachineField.System,
- "msxsystem" => MachineField.System,
- "msx_system" => MachineField.System,
-
- "country" => MachineField.Country,
-
- #endregion
-
- #region SoftwareList
-
- "supported" => MachineField.Supported,
-
- #endregion
-
- _ => MachineField.NULL,
- };
+ return AsEnumValue(machineInput);
}
///
@@ -1150,18 +222,7 @@ namespace SabreTools.Core.Tools
/// String to get value from
/// MachineType value corresponding to the string
public static MachineType AsMachineType(this string gametype)
- {
- return gametype?.ToLowerInvariant() switch
- {
- "bios" => MachineType.Bios,
- "dev" => MachineType.Device,
- "device" => MachineType.Device,
- "mech" => MachineType.Mechanical,
- "mechanical" => MachineType.Mechanical,
- "none" => MachineType.NULL,
- _ => MachineType.NULL,
- };
- }
+ => AsEnumValue(gametype);
///
/// Get MergingFlag value from input string
@@ -1169,24 +230,7 @@ namespace SabreTools.Core.Tools
/// String to get value from
/// MergingFlag value corresponding to the string
public static MergingFlag AsMergingFlag(this string merging)
- {
- return merging?.ToLowerInvariant() switch
- {
- "split" => MergingFlag.Split,
- "merged" => MergingFlag.Merged,
- "fullmerged" => MergingFlag.FullMerged,
- "nonmerged" => MergingFlag.NonMerged,
- "unmerged" => MergingFlag.NonMerged,
- "full" => MergingFlag.FullNonMerged,
- "fullnonmerged" => MergingFlag.FullNonMerged,
- "fullunmerged" => MergingFlag.FullNonMerged,
- "device" => MergingFlag.DeviceNonMerged,
- "devicenonmerged" => MergingFlag.DeviceNonMerged,
- "deviceunmerged" => MergingFlag.DeviceNonMerged,
- "none" => MergingFlag.None,
- _ => MergingFlag.None,
- };
- }
+ => AsEnumValue(merging);
///
/// Get NodumpFlag value from input string
@@ -1194,32 +238,15 @@ namespace SabreTools.Core.Tools
/// String to get value from
/// NodumpFlag value corresponding to the string
public static NodumpFlag AsNodumpFlag(this string nodump)
- {
- return nodump?.ToLowerInvariant() switch
- {
- "obsolete" => NodumpFlag.Obsolete,
- "required" => NodumpFlag.Required,
- "ignore" => NodumpFlag.Ignore,
- "none" => NodumpFlag.None,
- _ => NodumpFlag.None,
- };
- }
+ => AsEnumValue(nodump);
///
/// Get OpenMSXSubType value from input string
///
- /// String to get value from
+ /// String to get value from
/// OpenMSXSubType value corresponding to the string
- public static OpenMSXSubType AsOpenMSXSubType(this string itemType)
- {
- return itemType?.ToLowerInvariant() switch
- {
- "rom" => OpenMSXSubType.Rom,
- "megarom" => OpenMSXSubType.MegaRom,
- "sccpluscart" => OpenMSXSubType.SCCPlusCart,
- _ => OpenMSXSubType.NULL,
- };
- }
+ public static OpenMSXSubType AsOpenMSXSubType(this string subType)
+ => AsEnumValue(subType);
///
/// Get PackingFlag value from input string
@@ -1227,19 +254,7 @@ namespace SabreTools.Core.Tools
/// String to get value from
/// PackingFlag value corresponding to the string
public static PackingFlag AsPackingFlag(this string packing)
- {
- return packing?.ToLowerInvariant() switch
- {
- "yes" => PackingFlag.Zip,
- "zip" => PackingFlag.Zip,
- "no" => PackingFlag.Unzip,
- "unzip" => PackingFlag.Unzip,
- "partial" => PackingFlag.Partial,
- "flat" => PackingFlag.Flat,
- "none" => PackingFlag.None,
- _ => PackingFlag.None,
- };
- }
+ => AsEnumValue(packing);
///
/// Get Relation value from input string
@@ -1247,18 +262,7 @@ namespace SabreTools.Core.Tools
/// String to get value from
/// Relation value corresponding to the string
public static Relation AsRelation(this string relation)
- {
- return relation?.ToLowerInvariant() switch
- {
- "eq" => Relation.Equal,
- "ne" => Relation.NotEqual,
- "gt" => Relation.GreaterThan,
- "le" => Relation.LessThanOrEqual,
- "lt" => Relation.LessThan,
- "ge" => Relation.GreaterThanOrEqual,
- _ => Relation.NULL,
- };
- }
+ => AsEnumValue(relation);
///
/// Get Runnable value from input string
@@ -1266,15 +270,7 @@ namespace SabreTools.Core.Tools
/// String to get value from
/// Runnable value corresponding to the string
public static Runnable AsRunnable(this string runnable)
- {
- return runnable?.ToLowerInvariant() switch
- {
- "no" => Runnable.No,
- "partial" => Runnable.Partial,
- "yes" => Runnable.Yes,
- _ => Runnable.NULL,
- };
- }
+ => AsEnumValue(runnable);
///
/// Get SoftwareListStatus value from input string
@@ -1282,15 +278,7 @@ namespace SabreTools.Core.Tools
/// String to get value from
/// SoftwareListStatus value corresponding to the string
public static SoftwareListStatus AsSoftwareListStatus(this string status)
- {
- return status?.ToLowerInvariant() switch
- {
- "original" => SoftwareListStatus.Original,
- "compatible" => SoftwareListStatus.Compatible,
- "none" => SoftwareListStatus.NULL,
- _ => SoftwareListStatus.NULL,
- };
- }
+ => AsEnumValue(status);
///
/// Get Supported value from input string
@@ -1298,17 +286,7 @@ namespace SabreTools.Core.Tools
/// String to get value from
/// Supported value corresponding to the string
public static Supported AsSupported(this string supported)
- {
- return supported?.ToLowerInvariant() switch
- {
- "no" => Supported.No,
- "unsupported" => Supported.No,
- "partial" => Supported.Partial,
- "yes" => Supported.Yes,
- "supported" => Supported.Yes,
- _ => Supported.NULL,
- };
- }
+ => AsEnumValue(supported);
///
/// Get SupportStatus value from input string
@@ -1316,15 +294,7 @@ namespace SabreTools.Core.Tools
/// String to get value from
/// SupportStatus value corresponding to the string
public static SupportStatus AsSupportStatus(this string supportStatus)
- {
- return supportStatus?.ToLowerInvariant() switch
- {
- "good" => SupportStatus.Good,
- "imperfect" => SupportStatus.Imperfect,
- "preliminary" => SupportStatus.Preliminary,
- _ => SupportStatus.NULL,
- };
- }
+ => AsEnumValue(supportStatus);
///
/// Get bool? value from input string
@@ -1335,25 +305,47 @@ namespace SabreTools.Core.Tools
{
return yesno?.ToLowerInvariant() switch
{
- "yes" => true,
- "true" => true,
- "no" => false,
- "false" => false,
+ "yes" or "true" => true,
+ "no" or "false" => false,
_ => null,
};
}
+
+ ///
+ /// Get the enum value for an input string, if possible
+ ///
+ /// String value to parse/param>
+ /// Enum type that is expected
+ /// Enum value representing the input, default on error
+ private static T AsEnumValue(string value)
+ {
+ // Get the mapping dictionary
+ var mappings = GenerateToEnum();
+
+ // Normalize the input value
+ value = value?.ToLowerInvariant();
+ if (value == null)
+ return default;
+
+ // Try to get the value from the mappings
+ if (mappings.ContainsKey(value))
+ return mappings[value];
+
+ // Otherwise, return the default value for the enum
+ return default;
+ }
///
/// Get a set of mappings from strings to enum values
///
- /// Enum type to generate from
+ /// Enum type that is expected
/// Dictionary of string to enum values
- private static Dictionary GenerateToEnum(Type type)
+ private static Dictionary GenerateToEnum()
{
try
{
// Get all of the values for the enum type
- var values = Enum.GetValues(type);
+ var values = Enum.GetValues(typeof(T));
// Build the output dictionary
Dictionary mappings = new();
@@ -1820,17 +812,36 @@ namespace SabreTools.Core.Tools
};
}
+ ///
+ /// Get the string value for an input enum, if possible
+ ///
+ /// Enum value to parse/param>
+ /// Enum type that is expected
+ /// String value representing the input, default on error
+ private static string? AsStringValue(T value)
+ {
+ // Get the mapping dictionary
+ var mappings = GenerateToString();
+
+ // Try to get the value from the mappings
+ if (mappings.ContainsKey(value))
+ return mappings[value];
+
+ // Otherwise, return null
+ return null;
+ }
+
///
/// Get a set of mappings from enum values to string
///
/// Enum type to generate from
/// Dictionary of enum to string values
- private static Dictionary GenerateToString(Type type)
+ private static Dictionary GenerateToString()
{
try
{
// Get all of the values for the enum type
- var values = Enum.GetValues(type);
+ var values = Enum.GetValues(typeof(T));
// Build the output dictionary
Dictionary mappings = new();
diff --git a/SabreTools.DatFiles/Formats/ClrMamePro.cs b/SabreTools.DatFiles/Formats/ClrMamePro.cs
index 05947887..607b62ff 100644
--- a/SabreTools.DatFiles/Formats/ClrMamePro.cs
+++ b/SabreTools.DatFiles/Formats/ClrMamePro.cs
@@ -212,7 +212,7 @@ namespace SabreTools.DatFiles.Formats
bool containsItems = false;
Machine machine = new()
{
- MachineType = (resource ? MachineType.Bios : MachineType.NULL),
+ MachineType = (resource ? MachineType.Bios : MachineType.None),
};
// If there's no subtree to the header, skip it
@@ -276,7 +276,10 @@ namespace SabreTools.DatFiles.Formats
string itemKey = cmpr.InternalName;
// Create the proper DatItem based on the type
- ItemType itemType = itemKey.AsItemType() ?? ItemType.Rom;
+ ItemType itemType = itemKey.AsItemType();
+ if (itemType == ItemType.NULL)
+ itemType = ItemType.Rom;
+
DatItem item = DatItem.Create(itemType);
// Then populate it with information
diff --git a/SabreTools.DatFiles/Formats/DosCenter.cs b/SabreTools.DatFiles/Formats/DosCenter.cs
index 030a94ac..f3033d43 100644
--- a/SabreTools.DatFiles/Formats/DosCenter.cs
+++ b/SabreTools.DatFiles/Formats/DosCenter.cs
@@ -145,7 +145,7 @@ namespace SabreTools.DatFiles.Formats
bool containsItems = false;
Machine machine = new()
{
- MachineType = MachineType.NULL,
+ MachineType = MachineType.None,
};
// If there's no subtree to the header, skip it
diff --git a/SabreTools.DatFiles/Formats/Listxml.cs b/SabreTools.DatFiles/Formats/Listxml.cs
index 91ee37ba..ba3568d0 100644
--- a/SabreTools.DatFiles/Formats/Listxml.cs
+++ b/SabreTools.DatFiles/Formats/Listxml.cs
@@ -302,7 +302,7 @@ namespace SabreTools.DatFiles.Formats
CloneOf = reader.GetAttribute("cloneof"),
RomOf = reader.GetAttribute("romof"),
SampleOf = reader.GetAttribute("sampleof"),
- MachineType = (machineType == 0x0 ? MachineType.NULL : machineType),
+ MachineType = (machineType == 0x0 ? MachineType.None : machineType),
SourceFile = reader.GetAttribute("sourcefile"),
Runnable = reader.GetAttribute("runnable").AsRunnable(),
diff --git a/SabreTools.DatFiles/Formats/Logiqx.cs b/SabreTools.DatFiles/Formats/Logiqx.cs
index d911626e..c99c3c96 100644
--- a/SabreTools.DatFiles/Formats/Logiqx.cs
+++ b/SabreTools.DatFiles/Formats/Logiqx.cs
@@ -490,7 +490,7 @@ namespace SabreTools.DatFiles.Formats
RomOf = reader.GetAttribute("romof"),
SampleOf = reader.GetAttribute("sampleof"),
- MachineType = (machineType == 0x0 ? MachineType.NULL : machineType),
+ MachineType = (machineType == 0x0 ? MachineType.None : machineType),
};
if (Header.Type == "SuperDAT" && !keep)
diff --git a/SabreTools.DatItems/Formats/SoftwareList.cs b/SabreTools.DatItems/Formats/SoftwareList.cs
index b518fed3..e3bbeb44 100644
--- a/SabreTools.DatItems/Formats/SoftwareList.cs
+++ b/SabreTools.DatItems/Formats/SoftwareList.cs
@@ -40,7 +40,7 @@ namespace SabreTools.DatItems.Formats
public SoftwareListStatus Status { get; set; }
[JsonIgnore]
- public bool StatusSpecified { get { return Status != SoftwareListStatus.NULL; } }
+ public bool StatusSpecified { get { return Status != SoftwareListStatus.None; } }
///
/// Filter to apply to the software list
diff --git a/SabreTools.DatItems/Machine.cs b/SabreTools.DatItems/Machine.cs
index 58a4b1a9..456a7ece 100644
--- a/SabreTools.DatItems/Machine.cs
+++ b/SabreTools.DatItems/Machine.cs
@@ -97,7 +97,7 @@ namespace SabreTools.DatItems
public MachineType MachineType { get; set; } = 0x0;
[JsonIgnore]
- public bool MachineTypeSpecified { get { return MachineType != 0x0 && MachineType != MachineType.NULL; } }
+ public bool MachineTypeSpecified { get { return MachineType != 0x0 && MachineType != MachineType.None; } }
#endregion
diff --git a/SabreTools.Filtering/DatItemFilter.cs b/SabreTools.Filtering/DatItemFilter.cs
index 1d3ef687..9f763710 100644
--- a/SabreTools.Filtering/DatItemFilter.cs
+++ b/SabreTools.Filtering/DatItemFilter.cs
@@ -208,7 +208,7 @@ namespace SabreTools.Filtering
public FilterItem SlotOption_Default { get; private set; } = new FilterItem() { Neutral = null };
// SoftwareList
- public FilterItem SoftwareListStatus { get; private set; } = new FilterItem() { Positive = Core.SoftwareListStatus.NULL, Negative = Core.SoftwareListStatus.NULL };
+ public FilterItem SoftwareListStatus { get; private set; } = new FilterItem() { Positive = Core.SoftwareListStatus.None, Negative = Core.SoftwareListStatus.None };
public FilterItem Filter { get; private set; } = new FilterItem();
// Sound
@@ -266,7 +266,7 @@ namespace SabreTools.Filtering
#region Common
case DatItemField.Type:
- if (value.AsItemType() == null)
+ if (value.AsItemType() == ItemType.NULL)
return;
SetStringFilter(Type, value, negate);
@@ -2117,9 +2117,9 @@ namespace SabreTools.Filtering
return false;
// Filter on status
- if (SoftwareListStatus.MatchesPositive(Core.SoftwareListStatus.NULL, softwareList.Status) == false)
+ if (SoftwareListStatus.MatchesPositive(Core.SoftwareListStatus.None, softwareList.Status) == false)
return false;
- if (SoftwareListStatus.MatchesNegative(Core.SoftwareListStatus.NULL, softwareList.Status) == true)
+ if (SoftwareListStatus.MatchesNegative(Core.SoftwareListStatus.None, softwareList.Status) == true)
return false;
// Filter on filter
diff --git a/SabreTools.Filtering/DatItemRemover.cs b/SabreTools.Filtering/DatItemRemover.cs
index 0e7a1c60..52af6009 100644
--- a/SabreTools.Filtering/DatItemRemover.cs
+++ b/SabreTools.Filtering/DatItemRemover.cs
@@ -1121,7 +1121,7 @@ namespace SabreTools.Filtering
softwareList.Tag = null;
if (DatItemFields.Contains(DatItemField.SoftwareListStatus))
- softwareList.Status = SoftwareListStatus.NULL;
+ softwareList.Status = SoftwareListStatus.None;
if (DatItemFields.Contains(DatItemField.Filter))
softwareList.Filter = null;
diff --git a/SabreTools.Test/Core/ConvertersTests.cs b/SabreTools.Test/Core/ConvertersTests.cs
index d9168d49..08311330 100644
--- a/SabreTools.Test/Core/ConvertersTests.cs
+++ b/SabreTools.Test/Core/ConvertersTests.cs
@@ -6,6 +6,41 @@ namespace SabreTools.Test.Core
{
public class ConvertersTests
{
+ #region String to Enum
+
+ [Theory]
+ [InlineData(null, ChipType.NULL)]
+ [InlineData("cpu", ChipType.CPU)]
+ [InlineData("audio", ChipType.Audio)]
+ public void AsChipTypeTest(string field, ChipType expected)
+ {
+ ChipType actual = field.AsChipType();
+ Assert.Equal(expected, actual);
+ }
+
+ [Theory]
+ [InlineData(null, ControlType.NULL)]
+ [InlineData("joy", ControlType.Joy)]
+ [InlineData("stick", ControlType.Stick)]
+ [InlineData("paddle", ControlType.Paddle)]
+ [InlineData("pedal", ControlType.Pedal)]
+ [InlineData("lightgun", ControlType.Lightgun)]
+ [InlineData("positional", ControlType.Positional)]
+ [InlineData("dial", ControlType.Dial)]
+ [InlineData("trackball", ControlType.Trackball)]
+ [InlineData("mouse", ControlType.Mouse)]
+ [InlineData("only_buttons", ControlType.OnlyButtons)]
+ [InlineData("keypad", ControlType.Keypad)]
+ [InlineData("keyboard", ControlType.Keyboard)]
+ [InlineData("mahjong", ControlType.Mahjong)]
+ [InlineData("hanafuda", ControlType.Hanafuda)]
+ [InlineData("gambling", ControlType.Gambling)]
+ public void AsControlTypeTest(string field, ControlType expected)
+ {
+ ControlType actual = field.AsControlType();
+ Assert.Equal(expected, actual);
+ }
+
[Theory]
[InlineData(null, DatHeaderField.NULL)]
[InlineData("datname", DatHeaderField.NULL)]
@@ -23,8 +58,9 @@ namespace SabreTools.Test.Core
[InlineData("header datname", DatHeaderField.Name)]
[InlineData("DAT.DATNAME", DatHeaderField.Name)]
[InlineData("dAt.DAtnamE", DatHeaderField.Name)]
- public void AsDatHeaderFieldTest(string field, DatHeaderField expected)
+ public void AsDatHeaderFieldProcessingTest(string field, DatHeaderField expected)
{
+ // TODO: Write new test for all supported fields
DatHeaderField actual = field.AsDatHeaderField();
Assert.Equal(expected, actual);
}
@@ -42,12 +78,205 @@ namespace SabreTools.Test.Core
[InlineData("datitem name", DatItemField.Name)]
[InlineData("ITEM.NAME", DatItemField.Name)]
[InlineData("iTeM.namE", DatItemField.Name)]
- public void AsDatItemFieldTest(string field, DatItemField expected)
+ public void AsDatItemFieldProcessingTest(string field, DatItemField expected)
{
+ // TODO: Write new test for all supported fields
DatItemField actual = field.AsDatItemField();
Assert.Equal(expected, actual);
}
+ [Theory]
+ [InlineData(null, DeviceType.NULL)]
+ [InlineData("unknown", DeviceType.Unknown)]
+ [InlineData("cartridge", DeviceType.Cartridge)]
+ [InlineData("floppydisk", DeviceType.FloppyDisk)]
+ [InlineData("harddisk", DeviceType.HardDisk)]
+ [InlineData("cylinder", DeviceType.Cylinder)]
+ [InlineData("cassette", DeviceType.Cassette)]
+ [InlineData("punchcard", DeviceType.PunchCard)]
+ [InlineData("punchtape", DeviceType.PunchTape)]
+ [InlineData("printout", DeviceType.Printout)]
+ [InlineData("serial", DeviceType.Serial)]
+ [InlineData("parallel", DeviceType.Parallel)]
+ [InlineData("snapshot", DeviceType.Snapshot)]
+ [InlineData("quickload", DeviceType.QuickLoad)]
+ [InlineData("memcard", DeviceType.MemCard)]
+ [InlineData("cdrom", DeviceType.CDROM)]
+ [InlineData("magtape", DeviceType.MagTape)]
+ [InlineData("romimage", DeviceType.ROMImage)]
+ [InlineData("midiin", DeviceType.MIDIIn)]
+ [InlineData("midiout", DeviceType.MIDIOut)]
+ [InlineData("picture", DeviceType.Picture)]
+ [InlineData("vidfile", DeviceType.VidFile)]
+ public void AsDeviceTypeTest(string field, DeviceType expected)
+ {
+ DeviceType actual = field.AsDeviceType();
+ Assert.Equal(expected, actual);
+ }
+
+ [Theory]
+ [InlineData(null, DisplayType.NULL)]
+ [InlineData("raster", DisplayType.Raster)]
+ [InlineData("vector", DisplayType.Vector)]
+ [InlineData("lcd", DisplayType.LCD)]
+ [InlineData("svg", DisplayType.SVG)]
+ [InlineData("unknown", DisplayType.Unknown)]
+ public void AsDisplayTypeTest(string field, DisplayType expected)
+ {
+ DisplayType actual = field.AsDisplayType();
+ Assert.Equal(expected, actual);
+ }
+
+ [Theory]
+ [InlineData(null, Endianness.NULL)]
+ [InlineData("big", Endianness.Big)]
+ [InlineData("little", Endianness.Little)]
+ public void AsEndiannessTest(string field, Endianness expected)
+ {
+ Endianness actual = field.AsEndianness();
+ Assert.Equal(expected, actual);
+ }
+
+ [Theory]
+ [InlineData(null, FeatureStatus.NULL)]
+ [InlineData("unemulated", FeatureStatus.Unemulated)]
+ [InlineData("imperfect", FeatureStatus.Imperfect)]
+ public void AsFeatureStatusTest(string field, FeatureStatus expected)
+ {
+ FeatureStatus actual = field.AsFeatureStatus();
+ Assert.Equal(expected, actual);
+ }
+
+ [Theory]
+ [InlineData(null, FeatureType.NULL)]
+ [InlineData("protection", FeatureType.Protection)]
+ [InlineData("palette", FeatureType.Palette)]
+ [InlineData("graphics", FeatureType.Graphics)]
+ [InlineData("sound", FeatureType.Sound)]
+ [InlineData("controls", FeatureType.Controls)]
+ [InlineData("keyboard", FeatureType.Keyboard)]
+ [InlineData("mouse", FeatureType.Mouse)]
+ [InlineData("microphone", FeatureType.Microphone)]
+ [InlineData("camera", FeatureType.Camera)]
+ [InlineData("disk", FeatureType.Disk)]
+ [InlineData("printer", FeatureType.Printer)]
+ [InlineData("lan", FeatureType.Lan)]
+ [InlineData("wan", FeatureType.Wan)]
+ [InlineData("timing", FeatureType.Timing)]
+ public void AsFeatureTypeTest(string field, FeatureType expected)
+ {
+ FeatureType actual = field.AsFeatureType();
+ Assert.Equal(expected, actual);
+ }
+
+ [Theory]
+ [InlineData(null, ItemStatus.NULL)]
+ [InlineData("none", ItemStatus.None)]
+ [InlineData("no", ItemStatus.None)]
+ [InlineData("good", ItemStatus.Good)]
+ [InlineData("baddump", ItemStatus.BadDump)]
+ [InlineData("nodump", ItemStatus.Nodump)]
+ [InlineData("yes", ItemStatus.Nodump)]
+ [InlineData("verified", ItemStatus.Verified)]
+ public void AsItemStatusTest(string field, ItemStatus expected)
+ {
+ ItemStatus actual = field.AsItemStatus();
+ Assert.Equal(expected, actual);
+ }
+
+ [Theory]
+ [InlineData(null, ItemType.NULL)]
+ [InlineData("adjuster", ItemType.Adjuster)]
+ [InlineData("analog", ItemType.Analog)]
+ [InlineData("archive", ItemType.Archive)]
+ [InlineData("biosset", ItemType.BiosSet)]
+ [InlineData("blank", ItemType.Blank)]
+ [InlineData("chip", ItemType.Chip)]
+ [InlineData("condition", ItemType.Condition)]
+ [InlineData("configuration", ItemType.Configuration)]
+ [InlineData("control", ItemType.Control)]
+ [InlineData("dataarea", ItemType.DataArea)]
+ [InlineData("device", ItemType.Device)]
+ [InlineData("deviceref", ItemType.DeviceReference)]
+ [InlineData("device_ref", ItemType.DeviceReference)]
+ [InlineData("dipswitch", ItemType.DipSwitch)]
+ [InlineData("disk", ItemType.Disk)]
+ [InlineData("diskarea", ItemType.DiskArea)]
+ [InlineData("display", ItemType.Display)]
+ [InlineData("driver", ItemType.Driver)]
+ [InlineData("extension", ItemType.Extension)]
+ [InlineData("feature", ItemType.Feature)]
+ [InlineData("file", ItemType.File)]
+ [InlineData("info", ItemType.Info)]
+ [InlineData("input", ItemType.Input)]
+ [InlineData("instance", ItemType.Instance)]
+ [InlineData("location", ItemType.Location)]
+ [InlineData("media", ItemType.Media)]
+ [InlineData("part", ItemType.Part)]
+ [InlineData("partfeature", ItemType.PartFeature)]
+ [InlineData("part_feature", ItemType.PartFeature)]
+ [InlineData("port", ItemType.Port)]
+ [InlineData("ramoption", ItemType.RamOption)]
+ [InlineData("ram_option", ItemType.RamOption)]
+ [InlineData("release", ItemType.Release)]
+ [InlineData("releasedetails", ItemType.ReleaseDetails)]
+ [InlineData("release_details", ItemType.ReleaseDetails)]
+ [InlineData("rom", ItemType.Rom)]
+ [InlineData("sample", ItemType.Sample)]
+ [InlineData("serials", ItemType.Serials)]
+ [InlineData("setting", ItemType.Setting)]
+ [InlineData("sharedfeat", ItemType.SharedFeature)]
+ [InlineData("shared_feat", ItemType.SharedFeature)]
+ [InlineData("sharedfeature", ItemType.SharedFeature)]
+ [InlineData("shared_feature", ItemType.SharedFeature)]
+ [InlineData("slot", ItemType.Slot)]
+ [InlineData("slotoption", ItemType.SlotOption)]
+ [InlineData("slot_option", ItemType.SlotOption)]
+ [InlineData("softwarelist", ItemType.SoftwareList)]
+ [InlineData("software_list", ItemType.SoftwareList)]
+ [InlineData("sound", ItemType.Sound)]
+ [InlineData("sourcedetails", ItemType.SourceDetails)]
+ [InlineData("source_details", ItemType.SourceDetails)]
+ public void AsItemTypeTest(string field, ItemType expected)
+ {
+ ItemType actual = field.AsItemType();
+ Assert.Equal(expected, actual);
+ }
+
+ [Theory]
+ [InlineData(null, LoadFlag.NULL)]
+ [InlineData("load16_byte", LoadFlag.Load16Byte)]
+ [InlineData("load16_word", LoadFlag.Load16Word)]
+ [InlineData("load16_word_swap", LoadFlag.Load16WordSwap)]
+ [InlineData("load32_byte", LoadFlag.Load32Byte)]
+ [InlineData("load32_word", LoadFlag.Load32Word)]
+ [InlineData("load32_word_swap", LoadFlag.Load32WordSwap)]
+ [InlineData("load32_dword", LoadFlag.Load32DWord)]
+ [InlineData("load64_word", LoadFlag.Load64Word)]
+ [InlineData("load64_word_swap", LoadFlag.Load64WordSwap)]
+ [InlineData("reload", LoadFlag.Reload)]
+ [InlineData("fill", LoadFlag.Fill)]
+ [InlineData("continue", LoadFlag.Continue)]
+ [InlineData("reload_plain", LoadFlag.ReloadPlain)]
+ [InlineData("ignore", LoadFlag.Ignore)]
+ public void AsLoadFlagTest(string field, LoadFlag expected)
+ {
+ LoadFlag actual = field.AsLoadFlag();
+ Assert.Equal(expected, actual);
+ }
+
+ [Theory]
+ [InlineData(null, LogLevel.VERBOSE)]
+ [InlineData("verbose", LogLevel.VERBOSE)]
+ [InlineData("user", LogLevel.USER)]
+ [InlineData("warning", LogLevel.WARNING)]
+ [InlineData("error", LogLevel.ERROR)]
+ public void AsLogLevelTest(string field, LogLevel expected)
+ {
+ LogLevel actual = field.AsLogLevel();
+ Assert.Equal(expected, actual);
+ }
+
[Theory]
[InlineData(null, MachineField.NULL)]
[InlineData("name", MachineField.NULL)]
@@ -61,10 +290,220 @@ namespace SabreTools.Test.Core
[InlineData("machine name", MachineField.Name)]
[InlineData("GAME.NAME", MachineField.Name)]
[InlineData("gAmE.namE", MachineField.Name)]
+ public void AsMachineFieldProcessingTest(string field, MachineField expected)
+ {
+ MachineField actual = field.AsMachineField();
+ Assert.Equal(expected, actual);
+ }
+
+ [Theory]
+ [InlineData(null, MachineField.NULL)]
+ [InlineData("game.board", MachineField.Board)]
+ [InlineData("game.buttons", MachineField.Buttons)]
+ [InlineData("game.category", MachineField.Category)]
+ [InlineData("game.cloneof", MachineField.CloneOf)]
+ [InlineData("game.clone_of", MachineField.CloneOf)]
+ [InlineData("game.comment", MachineField.Comment)]
+ [InlineData("game.extra", MachineField.Comment)]
+ [InlineData("game.control", MachineField.Control)]
+ [InlineData("game.country", MachineField.Country)]
+ [InlineData("game.crc", MachineField.CRC)]
+ [InlineData("game.hascrc", MachineField.CRC)]
+ [InlineData("game.has_crc", MachineField.CRC)]
+ [InlineData("game.desc", MachineField.Description)]
+ [InlineData("game.description", MachineField.Description)]
+ [InlineData("game.developer", MachineField.Developer)]
+ [InlineData("game.displaycount", MachineField.DisplayCount)]
+ [InlineData("game.display_count", MachineField.DisplayCount)]
+ [InlineData("game.displaytype", MachineField.DisplayType)]
+ [InlineData("game.display_type", MachineField.DisplayType)]
+ [InlineData("game.enabled", MachineField.Enabled)]
+ [InlineData("game.genmsxid", MachineField.GenMSXID)]
+ [InlineData("game.genmsx_id", MachineField.GenMSXID)]
+ [InlineData("game.gen_msxid", MachineField.GenMSXID)]
+ [InlineData("game.gen_msx_id", MachineField.GenMSXID)]
+ [InlineData("game.genre", MachineField.Genre)]
+ [InlineData("game.history", MachineField.History)]
+ [InlineData("game.manufacturer", MachineField.Manufacturer)]
+ [InlineData("game.name", MachineField.Name)]
+ [InlineData("game.cloneofid", MachineField.NoIntroCloneOfId)]
+ [InlineData("game.nointrocloneofid", MachineField.NoIntroCloneOfId)]
+ [InlineData("game.nointro_cloneofid", MachineField.NoIntroCloneOfId)]
+ [InlineData("game.no_intro_cloneofid", MachineField.NoIntroCloneOfId)]
+ [InlineData("game.no_intro_clone_of_id", MachineField.NoIntroCloneOfId)]
+ [InlineData("game.id", MachineField.NoIntroId)]
+ [InlineData("game.nointroid", MachineField.NoIntroId)]
+ [InlineData("game.nointro_id", MachineField.NoIntroId)]
+ [InlineData("game.no_intro_id", MachineField.NoIntroId)]
+ [InlineData("game.players", MachineField.Players)]
+ [InlineData("game.publisher", MachineField.Publisher)]
+ [InlineData("game.ratings", MachineField.Ratings)]
+ [InlineData("game.rebuildto", MachineField.RebuildTo)]
+ [InlineData("game.rebuild_to", MachineField.RebuildTo)]
+ [InlineData("game.relatedto", MachineField.RelatedTo)]
+ [InlineData("game.related_to", MachineField.RelatedTo)]
+ [InlineData("game.romof", MachineField.RomOf)]
+ [InlineData("game.rom_of", MachineField.RomOf)]
+ [InlineData("game.rotation", MachineField.Rotation)]
+ [InlineData("game.runnable", MachineField.Runnable)]
+ [InlineData("game.sampleof", MachineField.SampleOf)]
+ [InlineData("game.sample_of", MachineField.SampleOf)]
+ [InlineData("game.score", MachineField.Score)]
+ [InlineData("game.sourcefile", MachineField.SourceFile)]
+ [InlineData("game.source_file", MachineField.SourceFile)]
+ [InlineData("game.amstatus", MachineField.Status)]
+ [InlineData("game.am_status", MachineField.Status)]
+ [InlineData("game.gamestatus", MachineField.Status)]
+ [InlineData("game.supportstatus", MachineField.Status)]
+ [InlineData("game.support_status", MachineField.Status)]
+ [InlineData("game.subgenre", MachineField.Subgenre)]
+ [InlineData("game.sub_genre", MachineField.Subgenre)]
+ [InlineData("game.supported", MachineField.Supported)]
+ [InlineData("game.system", MachineField.System)]
+ [InlineData("game.msxsystem", MachineField.System)]
+ [InlineData("game.msx_system", MachineField.System)]
+ [InlineData("game.titleid", MachineField.TitleID)]
+ [InlineData("game.title_id", MachineField.TitleID)]
+ [InlineData("game.type", MachineField.Type)]
+ [InlineData("game.year", MachineField.Year)]
public void AsMachineFieldTest(string field, MachineField expected)
{
MachineField actual = field.AsMachineField();
Assert.Equal(expected, actual);
}
+
+ [Theory]
+ [InlineData(null, MachineType.None)]
+ [InlineData("none", MachineType.None)]
+ [InlineData("bios", MachineType.Bios)]
+ [InlineData("dev", MachineType.Device)]
+ [InlineData("device", MachineType.Device)]
+ [InlineData("mech", MachineType.Mechanical)]
+ [InlineData("mechanical", MachineType.Mechanical)]
+ public void AsMachineTypeTest(string field, MachineType expected)
+ {
+ MachineType actual = field.AsMachineType();
+ Assert.Equal(expected, actual);
+ }
+
+ [Theory]
+ [InlineData(null, MergingFlag.None)]
+ [InlineData("none", MergingFlag.None)]
+ [InlineData("split", MergingFlag.Split)]
+ [InlineData("merged", MergingFlag.Merged)]
+ [InlineData("nonmerged", MergingFlag.NonMerged)]
+ [InlineData("unmerged", MergingFlag.NonMerged)]
+ [InlineData("fullmerged", MergingFlag.FullMerged)]
+ [InlineData("device", MergingFlag.DeviceNonMerged)]
+ [InlineData("devicenonmerged", MergingFlag.DeviceNonMerged)]
+ [InlineData("deviceunmerged", MergingFlag.DeviceNonMerged)]
+ [InlineData("full", MergingFlag.FullNonMerged)]
+ [InlineData("fullnonmerged", MergingFlag.FullNonMerged)]
+ [InlineData("fullunmerged", MergingFlag.FullNonMerged)]
+ public void AsMergingFlagTest(string field, MergingFlag expected)
+ {
+ MergingFlag actual = field.AsMergingFlag();
+ Assert.Equal(expected, actual);
+ }
+
+ [Theory]
+ [InlineData(null, NodumpFlag.None)]
+ [InlineData("none", NodumpFlag.None)]
+ [InlineData("obsolete", NodumpFlag.Obsolete)]
+ [InlineData("required", NodumpFlag.Required)]
+ [InlineData("ignore", NodumpFlag.Ignore)]
+ public void AsNodumpFlagTest(string field, NodumpFlag expected)
+ {
+ NodumpFlag actual = field.AsNodumpFlag();
+ Assert.Equal(expected, actual);
+ }
+
+ [Theory]
+ [InlineData(null, OpenMSXSubType.NULL)]
+ [InlineData("rom", OpenMSXSubType.Rom)]
+ [InlineData("megarom", OpenMSXSubType.MegaRom)]
+ [InlineData("sccpluscart", OpenMSXSubType.SCCPlusCart)]
+ public void AsOpenMSXSubTypeTest(string field, OpenMSXSubType expected)
+ {
+ OpenMSXSubType actual = field.AsOpenMSXSubType();
+ Assert.Equal(expected, actual);
+ }
+
+ [Theory]
+ [InlineData(null, PackingFlag.None)]
+ [InlineData("none", PackingFlag.None)]
+ [InlineData("yes", PackingFlag.Zip)]
+ [InlineData("zip", PackingFlag.Zip)]
+ [InlineData("no", PackingFlag.Unzip)]
+ [InlineData("unzip", PackingFlag.Unzip)]
+ [InlineData("partial", PackingFlag.Partial)]
+ [InlineData("flat", PackingFlag.Flat)]
+ public void AsPackingFlagTest(string field, PackingFlag expected)
+ {
+ PackingFlag actual = field.AsPackingFlag();
+ Assert.Equal(expected, actual);
+ }
+
+ [Theory]
+ [InlineData(null, Relation.NULL)]
+ [InlineData("eq", Relation.Equal)]
+ [InlineData("ne", Relation.NotEqual)]
+ [InlineData("gt", Relation.GreaterThan)]
+ [InlineData("le", Relation.LessThanOrEqual)]
+ [InlineData("lt", Relation.LessThan)]
+ [InlineData("ge", Relation.GreaterThanOrEqual)]
+ public void AsRelationTest(string field, Relation expected)
+ {
+ Relation actual = field.AsRelation();
+ Assert.Equal(expected, actual);
+ }
+
+ [Theory]
+ [InlineData(null, Runnable.NULL)]
+ [InlineData("no", Runnable.No)]
+ [InlineData("partial", Runnable.Partial)]
+ [InlineData("yes", Runnable.Yes)]
+ public void AsRunnableTest(string field, Runnable expected)
+ {
+ Runnable actual = field.AsRunnable();
+ Assert.Equal(expected, actual);
+ }
+
+ [Theory]
+ [InlineData(null, SoftwareListStatus.None)]
+ [InlineData("none", SoftwareListStatus.None)]
+ [InlineData("original", SoftwareListStatus.Original)]
+ [InlineData("compatible", SoftwareListStatus.Compatible)]
+ public void AsSoftwareListStatusTest(string field, SoftwareListStatus expected)
+ {
+ SoftwareListStatus actual = field.AsSoftwareListStatus();
+ Assert.Equal(expected, actual);
+ }
+
+ [Theory]
+ [InlineData(null, Supported.NULL)]
+ [InlineData("no", Supported.No)]
+ [InlineData("unsupported", Supported.No)]
+ [InlineData("partial", Supported.Partial)]
+ [InlineData("yes", Supported.Yes)]
+ [InlineData("supported", Supported.Yes)]
+ public void AsSupportedTest(string field, Supported expected)
+ {
+ Supported actual = field.AsSupported();
+ Assert.Equal(expected, actual);
+ }
+
+ [Theory]
+ [InlineData(null, SupportStatus.NULL)]
+ [InlineData("good", SupportStatus.Good)]
+ [InlineData("imperfect", SupportStatus.Imperfect)]
+ [InlineData("preliminary", SupportStatus.Preliminary)]
+ public void AsSupportStatusTest(string field, SupportStatus expected)
+ {
+ SupportStatus actual = field.AsSupportStatus();
+ Assert.Equal(expected, actual);
+ }
+
+ #endregion
}
}
\ No newline at end of file