mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Remove redundant helper methods
This commit is contained in:
@@ -449,7 +449,7 @@ Possible values are: Verbose, User, Warning, Error");
|
||||
|
||||
public override bool ProcessFeatures(Dictionary<string, SabreTools.Help.Feature> features)
|
||||
{
|
||||
LogLevel = GetString(features, LogLevelStringValue).AsLogLevel();
|
||||
LogLevel = GetString(features, LogLevelStringValue).AsEnumValue<LogLevel>();
|
||||
ScriptMode = GetBoolean(features, ScriptValue);
|
||||
|
||||
InitializeConfiguration();
|
||||
|
||||
@@ -9,22 +9,6 @@ namespace SabreTools.Core.Tools
|
||||
{
|
||||
#region String to Enum
|
||||
|
||||
/// <summary>
|
||||
/// Get ChipType value from input string
|
||||
/// </summary>
|
||||
/// <param name="chipType">String to get value from</param>
|
||||
/// <returns>ChipType value corresponding to the string</returns>
|
||||
public static ChipType AsChipType(this string? chipType)
|
||||
=> AsEnumValue<ChipType>(chipType);
|
||||
|
||||
/// <summary>
|
||||
/// Get ControlType value from input string
|
||||
/// </summary>
|
||||
/// <param name="controlType">String to get value from</param>
|
||||
/// <returns>ControlType value corresponding to the string</returns>
|
||||
public static ControlType AsControlType(this string? controlType)
|
||||
=> AsEnumValue<ControlType>(controlType);
|
||||
|
||||
/// <summary>
|
||||
/// Get DatHeaderField value from input string
|
||||
/// </summary>
|
||||
@@ -85,78 +69,6 @@ namespace SabreTools.Core.Tools
|
||||
return AsEnumValue<DatItemField>(itemInput);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get DeviceType value from input string
|
||||
/// </summary>
|
||||
/// <param name="deviceType">String to get value from</param>
|
||||
/// <returns>DeviceType value corresponding to the string</returns>
|
||||
public static DeviceType AsDeviceType(this string? deviceType)
|
||||
=> AsEnumValue<DeviceType>(deviceType);
|
||||
|
||||
/// <summary>
|
||||
/// Get DisplayType value from input string
|
||||
/// </summary>
|
||||
/// <param name="displayType">String to get value from</param>
|
||||
/// <returns>DisplayType value corresponding to the string</returns>
|
||||
public static DisplayType AsDisplayType(this string? displayType)
|
||||
=> AsEnumValue<DisplayType>(displayType);
|
||||
|
||||
/// <summary>
|
||||
/// Get Endianness value from input string
|
||||
/// </summary>
|
||||
/// <param name="endianness">String to get value from</param>
|
||||
/// <returns>Endianness value corresponding to the string</returns>
|
||||
public static Endianness AsEndianness(this string? endianness)
|
||||
=> AsEnumValue<Endianness>(endianness);
|
||||
|
||||
/// <summary>
|
||||
/// Get FeatureStatus value from input string
|
||||
/// </summary>
|
||||
/// <param name="featureStatus">String to get value from</param>
|
||||
/// <returns>FeatureStatus value corresponding to the string</returns>
|
||||
public static FeatureStatus AsFeatureStatus(this string? featureStatus)
|
||||
=> AsEnumValue<FeatureStatus>(featureStatus);
|
||||
|
||||
/// <summary>
|
||||
/// Get FeatureType value from input string
|
||||
/// </summary>
|
||||
/// <param name="emulationStatus">String to get value from</param>
|
||||
/// <returns>FeatureType value corresponding to the string</returns>
|
||||
public static FeatureType AsFeatureType(this string? featureType)
|
||||
=> AsEnumValue<FeatureType>(featureType);
|
||||
|
||||
/// <summary>
|
||||
/// Get ItemStatus value from input string
|
||||
/// </summary>
|
||||
/// <param name="status">String to get value from</param>
|
||||
/// <returns>ItemStatus value corresponding to the string</returns>
|
||||
public static ItemStatus AsItemStatus(this string? status)
|
||||
=> AsEnumValue<ItemStatus>(status);
|
||||
|
||||
/// <summary>
|
||||
/// Get ItemType? value from input string
|
||||
/// </summary>
|
||||
/// <param name="itemType">String to get value from</param>
|
||||
/// <returns>ItemType? value corresponding to the string</returns>
|
||||
public static ItemType AsItemType(this string? itemType)
|
||||
=> AsEnumValue<ItemType>(itemType);
|
||||
|
||||
/// <summary>
|
||||
/// Get LoadFlag value from input string
|
||||
/// </summary>
|
||||
/// <param name="loadFlag">String to get value from</param>
|
||||
/// <returns>LoadFlag value corresponding to the string</returns>
|
||||
public static LoadFlag AsLoadFlag(this string? loadFlag)
|
||||
=> AsEnumValue<LoadFlag>(loadFlag);
|
||||
|
||||
/// <summary>
|
||||
/// Get LogLevel value from input string
|
||||
/// </summary>
|
||||
/// <param name="logLevel">String to get value from</param>
|
||||
/// <returns>LogLevel value corresponding to the string</returns>
|
||||
public static LogLevel AsLogLevel(this string? logLevel)
|
||||
=> AsEnumValue<LogLevel>(logLevel);
|
||||
|
||||
/// <summary>
|
||||
/// Get MachineField value from input string
|
||||
/// </summary>
|
||||
@@ -187,86 +99,6 @@ namespace SabreTools.Core.Tools
|
||||
return AsEnumValue<MachineField>(machineInput);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get MachineType value from input string
|
||||
/// </summary>
|
||||
/// <param name="gametype">String to get value from</param>
|
||||
/// <returns>MachineType value corresponding to the string</returns>
|
||||
public static MachineType AsMachineType(this string? gametype)
|
||||
=> AsEnumValue<MachineType>(gametype);
|
||||
|
||||
/// <summary>
|
||||
/// Get MergingFlag value from input string
|
||||
/// </summary>
|
||||
/// <param name="merging">String to get value from</param>
|
||||
/// <returns>MergingFlag value corresponding to the string</returns>
|
||||
public static MergingFlag AsMergingFlag(this string? merging)
|
||||
=> AsEnumValue<MergingFlag>(merging);
|
||||
|
||||
/// <summary>
|
||||
/// Get NodumpFlag value from input string
|
||||
/// </summary>
|
||||
/// <param name="nodump">String to get value from</param>
|
||||
/// <returns>NodumpFlag value corresponding to the string</returns>
|
||||
public static NodumpFlag AsNodumpFlag(this string? nodump)
|
||||
=> AsEnumValue<NodumpFlag>(nodump);
|
||||
|
||||
/// <summary>
|
||||
/// Get OpenMSXSubType value from input string
|
||||
/// </summary>
|
||||
/// <param name="subType">String to get value from</param>
|
||||
/// <returns>OpenMSXSubType value corresponding to the string</returns>
|
||||
public static OpenMSXSubType AsOpenMSXSubType(this string? subType)
|
||||
=> AsEnumValue<OpenMSXSubType>(subType);
|
||||
|
||||
/// <summary>
|
||||
/// Get PackingFlag value from input string
|
||||
/// </summary>
|
||||
/// <param name="packing">String to get value from</param>
|
||||
/// <returns>PackingFlag value corresponding to the string</returns>
|
||||
public static PackingFlag AsPackingFlag(this string? packing)
|
||||
=> AsEnumValue<PackingFlag>(packing);
|
||||
|
||||
/// <summary>
|
||||
/// Get Relation value from input string
|
||||
/// </summary>
|
||||
/// <param name="relation">String to get value from</param>
|
||||
/// <returns>Relation value corresponding to the string</returns>
|
||||
public static Relation AsRelation(this string? relation)
|
||||
=> AsEnumValue<Relation>(relation);
|
||||
|
||||
/// <summary>
|
||||
/// Get Runnable value from input string
|
||||
/// </summary>
|
||||
/// <param name="runnable">String to get value from</param>
|
||||
/// <returns>Runnable value corresponding to the string</returns>
|
||||
public static Runnable AsRunnable(this string? runnable)
|
||||
=> AsEnumValue<Runnable>(runnable);
|
||||
|
||||
/// <summary>
|
||||
/// Get SoftwareListStatus value from input string
|
||||
/// </summary>
|
||||
/// <param name="status">String to get value from</param>
|
||||
/// <returns>SoftwareListStatus value corresponding to the string</returns>
|
||||
public static SoftwareListStatus AsSoftwareListStatus(this string? status)
|
||||
=> AsEnumValue<SoftwareListStatus>(status);
|
||||
|
||||
/// <summary>
|
||||
/// Get Supported value from input string
|
||||
/// </summary>
|
||||
/// <param name="supported">String to get value from</param>
|
||||
/// <returns>Supported value corresponding to the string</returns>
|
||||
public static Supported AsSupported(this string? supported)
|
||||
=> AsEnumValue<Supported>(supported);
|
||||
|
||||
/// <summary>
|
||||
/// Get SupportStatus value from input string
|
||||
/// </summary>
|
||||
/// <param name="supported">String to get value from</param>
|
||||
/// <returns>SupportStatus value corresponding to the string</returns>
|
||||
public static SupportStatus AsSupportStatus(this string? supportStatus)
|
||||
=> AsEnumValue<SupportStatus>(supportStatus);
|
||||
|
||||
/// <summary>
|
||||
/// Get bool? value from input string
|
||||
/// </summary>
|
||||
@@ -288,7 +120,7 @@ namespace SabreTools.Core.Tools
|
||||
/// <param name="value">String value to parse/param>
|
||||
/// <typeparam name="T">Enum type that is expected</typeparam>
|
||||
/// <returns>Enum value representing the input, default on error</returns>
|
||||
internal static T? AsEnumValue<T>(string? value)
|
||||
public static T? AsEnumValue<T>(this string? value)
|
||||
{
|
||||
// Get the mapping dictionary
|
||||
var mappings = GenerateToEnum<T>();
|
||||
@@ -353,171 +185,6 @@ namespace SabreTools.Core.Tools
|
||||
|
||||
#region Enum to String
|
||||
|
||||
/// <summary>
|
||||
/// Get string value from input ChipType
|
||||
/// </summary>
|
||||
/// <param name="chipType">ChipType to get value from</param>
|
||||
/// <returns>String value corresponding to the ChipType</returns>
|
||||
public static string? FromChipType(this ChipType chipType)
|
||||
=> AsStringValue(chipType);
|
||||
|
||||
/// <summary>
|
||||
/// Get string value from input ControlType
|
||||
/// </summary>
|
||||
/// <param name="controlType">ControlType to get value from</param>
|
||||
/// <returns>String value corresponding to the ControlType</returns>
|
||||
public static string? FromControlType(this ControlType controlType)
|
||||
=> AsStringValue(controlType);
|
||||
|
||||
/// <summary>
|
||||
/// Get string value from input DeviceType
|
||||
/// </summary>
|
||||
/// <param name="deviceType">vDeviceType to get value from</param>
|
||||
/// <returns>String value corresponding to the DeviceType</returns>
|
||||
public static string? FromDeviceType(this DeviceType deviceType)
|
||||
=> AsStringValue(deviceType);
|
||||
|
||||
/// <summary>
|
||||
/// Get string value from input DisplayType
|
||||
/// </summary>
|
||||
/// <param name="displayType">DisplayType to get value from</param>
|
||||
/// <returns>String value corresponding to the DisplayType</returns>
|
||||
public static string? FromDisplayType(this DisplayType displayType)
|
||||
=> AsStringValue(displayType);
|
||||
|
||||
/// <summary>
|
||||
/// Get string value from input Endianness
|
||||
/// </summary>
|
||||
/// <param name="endianness">Endianness to get value from</param>
|
||||
/// <returns>String value corresponding to the Endianness</returns>
|
||||
public static string? FromEndianness(this Endianness endianness)
|
||||
=> AsStringValue(endianness);
|
||||
|
||||
/// <summary>
|
||||
/// Get string value from input FeatureStatus
|
||||
/// </summary>
|
||||
/// <param name="featureStatus">FeatureStatus to get value from</param>
|
||||
/// <returns>String value corresponding to the FeatureStatus</returns>
|
||||
public static string? FromFeatureStatus(this FeatureStatus featureStatus)
|
||||
=> AsStringValue(featureStatus);
|
||||
|
||||
/// <summary>
|
||||
/// Get string value from input FeatureType
|
||||
/// </summary>
|
||||
/// <param name="featureType">FeatureType to get value from</param>
|
||||
/// <returns>String value corresponding to the FeatureType</returns>
|
||||
public static string? FromFeatureType(this FeatureType featureType)
|
||||
=> AsStringValue(featureType);
|
||||
|
||||
/// <summary>
|
||||
/// Get string value from input ItemStatus
|
||||
/// </summary>
|
||||
/// <param name="status">ItemStatus to get value from</param>
|
||||
/// <param name="yesno">True to use Yes/No format instead</param>
|
||||
/// <returns>String value corresponding to the ItemStatus</returns>
|
||||
public static string? FromItemStatus(this ItemStatus status, bool yesno)
|
||||
=> AsStringValue(status, yesno);
|
||||
|
||||
/// <summary>
|
||||
/// Get string value from input ItemType?
|
||||
/// </summary>
|
||||
/// <param name="itemType">ItemType? to get value from</param>
|
||||
/// <returns>String value corresponding to the ItemType?</returns>
|
||||
public static string? FromItemType(this ItemType itemType)
|
||||
=> AsStringValue(itemType);
|
||||
|
||||
/// <summary>
|
||||
/// Get string value from input LoadFlag
|
||||
/// </summary>
|
||||
/// <param name="loadFlag">LoadFlag to get value from</param>
|
||||
/// <returns>String value corresponding to the LoadFlag</returns>
|
||||
public static string? FromLoadFlag(this LoadFlag loadFlag)
|
||||
=> AsStringValue(loadFlag);
|
||||
|
||||
/// <summary>
|
||||
/// Get string value from input MachineType
|
||||
/// </summary>
|
||||
/// <param name="gametype">MachineType to get value from</param>
|
||||
/// <param name="romCenter">True to use old naming instead</param>
|
||||
/// <returns>String value corresponding to the MachineType</returns>
|
||||
public static string? FromMachineType(this MachineType gametype, bool old)
|
||||
=> AsStringValue(gametype, old);
|
||||
|
||||
/// <summary>
|
||||
/// Get string value from input MergingFlag
|
||||
/// </summary>
|
||||
/// <param name="merging">MergingFlag to get value from</param>
|
||||
/// <param name="romCenter">True to use RomCenter naming instead</param>
|
||||
/// <returns>String value corresponding to the MergingFlag</returns>
|
||||
public static string? FromMergingFlag(this MergingFlag merging, bool romCenter)
|
||||
=> AsStringValue(merging, romCenter);
|
||||
|
||||
/// <summary>
|
||||
/// Get string value from input NodumpFlag
|
||||
/// </summary>
|
||||
/// <param name="nodump">NodumpFlag to get value from</param>
|
||||
/// <returns>String value corresponding to the NodumpFlag</returns>
|
||||
public static string? FromNodumpFlag(this NodumpFlag nodump)
|
||||
=> AsStringValue(nodump);
|
||||
|
||||
/// <summary>
|
||||
/// Get string value from input OpenMSXSubType
|
||||
/// </summary>
|
||||
/// <param name="subType">OpenMSXSubType to get value from</param>
|
||||
/// <returns>String value corresponding to the OpenMSXSubType</returns>
|
||||
public static string? FromOpenMSXSubType(this OpenMSXSubType subType)
|
||||
=> AsStringValue(subType);
|
||||
|
||||
/// <summary>
|
||||
/// Get string value from input PackingFlag
|
||||
/// </summary>
|
||||
/// <param name="packing">PackingFlag to get value from</param>
|
||||
/// <param name="yesno">True to use Yes/No format instead</param>
|
||||
/// <returns>String value corresponding to the PackingFlag</returns>
|
||||
public static string? FromPackingFlag(this PackingFlag packing, bool yesno)
|
||||
=> AsStringValue(packing, yesno);
|
||||
|
||||
/// <summary>
|
||||
/// Get string value from input Relation
|
||||
/// </summary>
|
||||
/// <param name="relation">Relation to get value from</param>
|
||||
/// <returns>String value corresponding to the Relation</returns>
|
||||
public static string? FromRelation(this Relation relation)
|
||||
=> AsStringValue(relation);
|
||||
|
||||
/// <summary>
|
||||
/// Get string value from input Runnable
|
||||
/// </summary>
|
||||
/// <param name="runnable">Runnable to get value from</param>
|
||||
/// <returns>String value corresponding to the Runnable</returns>
|
||||
public static string? FromRunnable(this Runnable runnable)
|
||||
=> AsStringValue(runnable);
|
||||
|
||||
/// <summary>
|
||||
/// Get string value from input SoftwareListStatus
|
||||
/// </summary>
|
||||
/// <param name="status">SoftwareListStatus to get value from</param>
|
||||
/// <returns>String value corresponding to the SoftwareListStatus</returns>
|
||||
public static string? FromSoftwareListStatus(this SoftwareListStatus status)
|
||||
=> AsStringValue(status);
|
||||
|
||||
/// <summary>
|
||||
/// Get string value from input Supported
|
||||
/// </summary>
|
||||
/// <param name="supported">Supported to get value from</param>
|
||||
/// <param name="verbose">True to use verbose output, false otherwise</param>
|
||||
/// <returns>String value corresponding to the Supported</returns>
|
||||
public static string? FromSupported(this Supported supported, bool verbose)
|
||||
=> AsStringValue(supported, verbose);
|
||||
|
||||
/// <summary>
|
||||
/// Get string value from input SupportStatus
|
||||
/// </summary>
|
||||
/// <param name="supportStatus">SupportStatus to get value from</param>
|
||||
/// <returns>String value corresponding to the SupportStatus</returns>
|
||||
public static string? FromSupportStatus(this SupportStatus supportStatus)
|
||||
=> AsStringValue(supportStatus);
|
||||
|
||||
/// <summary>
|
||||
/// Get string value from input bool?
|
||||
/// </summary>
|
||||
@@ -540,7 +207,7 @@ namespace SabreTools.Core.Tools
|
||||
/// <param name="useSecond">True to use the second mapping option, if it exists</param>
|
||||
/// <typeparam name="T">Enum type that is expected</typeparam>
|
||||
/// <returns>String value representing the input, default on error</returns>
|
||||
internal static string? AsStringValue<T>(T value, bool useSecond = false) where T : notnull
|
||||
public static string? AsStringValue<T>(this T value, bool useSecond = false) where T : notnull
|
||||
{
|
||||
// Get the mapping dictionary
|
||||
var mappings = GenerateToString<T>(useSecond);
|
||||
|
||||
@@ -458,13 +458,13 @@ namespace SabreTools.DatFiles
|
||||
Type = mappings[DatHeaderField.Type];
|
||||
|
||||
if (mappings.ContainsKey(DatHeaderField.ForceMerging))
|
||||
ForceMerging = mappings[DatHeaderField.ForceMerging].AsMergingFlag();
|
||||
ForceMerging = mappings[DatHeaderField.ForceMerging].AsEnumValue<MergingFlag>();
|
||||
|
||||
if (mappings.ContainsKey(DatHeaderField.ForceNodump))
|
||||
ForceNodump = mappings[DatHeaderField.ForceNodump].AsNodumpFlag();
|
||||
ForceNodump = mappings[DatHeaderField.ForceNodump].AsEnumValue<NodumpFlag>();
|
||||
|
||||
if (mappings.ContainsKey(DatHeaderField.ForcePacking))
|
||||
ForcePacking = mappings[DatHeaderField.ForcePacking].AsPackingFlag();
|
||||
ForcePacking = mappings[DatHeaderField.ForcePacking].AsEnumValue<PackingFlag>();
|
||||
|
||||
#endregion
|
||||
|
||||
@@ -487,13 +487,13 @@ namespace SabreTools.DatFiles
|
||||
Build = mappings[DatHeaderField.Build];
|
||||
|
||||
if (mappings.ContainsKey(DatHeaderField.RomMode))
|
||||
RomMode = mappings[DatHeaderField.RomMode].AsMergingFlag();
|
||||
RomMode = mappings[DatHeaderField.RomMode].AsEnumValue<MergingFlag>();
|
||||
|
||||
if (mappings.ContainsKey(DatHeaderField.BiosMode))
|
||||
BiosMode = mappings[DatHeaderField.BiosMode].AsMergingFlag();
|
||||
BiosMode = mappings[DatHeaderField.BiosMode].AsEnumValue<MergingFlag>();
|
||||
|
||||
if (mappings.ContainsKey(DatHeaderField.SampleMode))
|
||||
SampleMode = mappings[DatHeaderField.SampleMode].AsMergingFlag();
|
||||
SampleMode = mappings[DatHeaderField.SampleMode].AsEnumValue<MergingFlag>();
|
||||
|
||||
if (mappings.ContainsKey(DatHeaderField.LockRomMode))
|
||||
LockRomMode = mappings[DatHeaderField.LockRomMode].AsYesNo();
|
||||
|
||||
@@ -60,11 +60,11 @@ namespace SabreTools.DatFiles.Formats
|
||||
Header.HeaderSkipper ??= cmp.Header;
|
||||
Header.Type ??= cmp.Type;
|
||||
if (Header.ForceMerging == MergingFlag.None)
|
||||
Header.ForceMerging = cmp.ForceMerging?.AsMergingFlag() ?? MergingFlag.None;
|
||||
Header.ForceMerging = cmp.ForceMerging?.AsEnumValue<MergingFlag>() ?? MergingFlag.None;
|
||||
if (Header.ForcePacking == PackingFlag.None)
|
||||
Header.ForcePacking = cmp.ForceZipping?.AsPackingFlag() ?? PackingFlag.None;
|
||||
Header.ForcePacking = cmp.ForceZipping?.AsEnumValue<PackingFlag>() ?? PackingFlag.None;
|
||||
if (Header.ForcePacking == PackingFlag.None)
|
||||
Header.ForcePacking = cmp.ForcePacking?.AsPackingFlag() ?? PackingFlag.None;
|
||||
Header.ForcePacking = cmp.ForcePacking?.AsEnumValue<PackingFlag>() ?? PackingFlag.None;
|
||||
|
||||
// Handle implied SuperDAT
|
||||
if (cmp.Name?.Contains(" - SuperDAT") == true && keep)
|
||||
@@ -258,7 +258,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
//xxHash364 = rom.xxHash364, // TODO: Add to internal model
|
||||
//xxHash3128 = rom.xxHash3128, // TODO: Add to internal model
|
||||
MergeTag = rom.Merge,
|
||||
ItemStatus = rom.Status?.AsItemStatus() ?? ItemStatus.NULL,
|
||||
ItemStatus = rom.Status?.AsEnumValue<ItemStatus>() ?? ItemStatus.NULL,
|
||||
Region = rom.Region,
|
||||
//Flags = rom.Flags, // TODO: Add to internal model
|
||||
Offset = rom.Offs,
|
||||
@@ -304,7 +304,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
MD5 = disk.MD5,
|
||||
SHA1 = disk.SHA1,
|
||||
MergeTag = disk.Merge,
|
||||
ItemStatus = disk.Status?.AsItemStatus() ?? ItemStatus.NULL,
|
||||
ItemStatus = disk.Status?.AsEnumValue<ItemStatus>() ?? ItemStatus.NULL,
|
||||
//Flags = disk.Flags, // TODO: Add to internal model
|
||||
|
||||
Source = new Source
|
||||
@@ -411,7 +411,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var item = new Chip
|
||||
{
|
||||
ChipType = chip.Type?.AsChipType() ?? ChipType.NULL,
|
||||
ChipType = chip.Type?.AsEnumValue<ChipType>() ?? ChipType.NULL,
|
||||
Name = chip.Name,
|
||||
//Flags = chip.Flags, // TODO: Add to internal model
|
||||
Clock = NumberHelper.ConvertToInt64(chip.Clock),
|
||||
@@ -448,7 +448,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var item = new Display
|
||||
{
|
||||
DisplayType = video.Screen?.AsDisplayType() ?? DisplayType.NULL,
|
||||
DisplayType = video.Screen?.AsEnumValue<DisplayType>() ?? DisplayType.NULL,
|
||||
Width = NumberHelper.ConvertToInt64(video.X),
|
||||
Height = NumberHelper.ConvertToInt64(video.Y),
|
||||
//AspectX = video.AspectX, // TODO: Add to internal model or find mapping
|
||||
@@ -614,7 +614,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
containsItems = true;
|
||||
var item = new Driver
|
||||
{
|
||||
Status = driver.Status?.AsSupportStatus() ?? SupportStatus.NULL,
|
||||
Status = driver.Status?.AsEnumValue<SupportStatus>() ?? SupportStatus.NULL,
|
||||
//Color = driver.Color, // TODO: Add to internal model or find mapping
|
||||
//Sound = driver.Sound, // TODO: Add to internal model or find mapping
|
||||
//PaletteSize = driver.PaletteSize, // TODO: Add to internal model or find mapping
|
||||
|
||||
@@ -199,9 +199,9 @@ namespace SabreTools.DatFiles.Formats
|
||||
};
|
||||
|
||||
if (Header.ForceMergingSpecified)
|
||||
clrMamePro.ForceMerging = Header.ForceMerging.FromMergingFlag(romCenter: false);
|
||||
clrMamePro.ForceMerging = Header.ForceMerging.AsStringValue<MergingFlag>(useSecond: false);
|
||||
if (Header.ForcePackingSpecified)
|
||||
clrMamePro.ForcePacking = Header.ForcePacking.FromPackingFlag(yesno: false);
|
||||
clrMamePro.ForcePacking = Header.ForcePacking.AsStringValue<PackingFlag>(useSecond: false);
|
||||
|
||||
return clrMamePro;
|
||||
}
|
||||
@@ -394,7 +394,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
};
|
||||
|
||||
if (item.ItemStatusSpecified)
|
||||
rom.Status = item.ItemStatus.FromItemStatus(yesno: false);
|
||||
rom.Status = item.ItemStatus.AsStringValue<ItemStatus>(useSecond: false);
|
||||
if (item.InvertedSpecified)
|
||||
rom.Inverted = item.Inverted.FromYesNo();
|
||||
if (item.MIASpecified)
|
||||
@@ -418,7 +418,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
};
|
||||
|
||||
if (item.ItemStatusSpecified)
|
||||
disk.Status = item.ItemStatus.FromItemStatus(yesno: false);
|
||||
disk.Status = item.ItemStatus.AsStringValue<ItemStatus>(useSecond: false);
|
||||
|
||||
return disk;
|
||||
}
|
||||
@@ -470,7 +470,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var chip = new Models.ClrMamePro.Chip
|
||||
{
|
||||
Type = item.ChipType.FromChipType(),
|
||||
Type = item.ChipType.AsStringValue<ChipType>(),
|
||||
Name = item.Name,
|
||||
//Flags = item.Flags, // TODO: Add to internal model
|
||||
Clock = item.Clock?.ToString(),
|
||||
@@ -485,7 +485,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var video = new Models.ClrMamePro.Video
|
||||
{
|
||||
Screen = item.DisplayType.FromDisplayType(),
|
||||
Screen = item.DisplayType.AsStringValue<DisplayType>(),
|
||||
X = item.Width?.ToString(),
|
||||
Y = item.Height?.ToString(),
|
||||
//AspectX = item.AspectX, // TODO: Add to internal model or find mapping
|
||||
@@ -573,7 +573,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var driver = new Models.ClrMamePro.Driver
|
||||
{
|
||||
Status = item.Status.FromSupportStatus(),
|
||||
Status = item.Status.AsStringValue<SupportStatus>(),
|
||||
//Color = item.Color, // TODO: Add to internal model or find mapping
|
||||
//Sound = item.Sound, // TODO: Add to internal model or find mapping
|
||||
//PaletteSize = item.PaletteSize, // TODO: Add to internal model or find mapping
|
||||
|
||||
@@ -97,7 +97,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Name = game.Name,
|
||||
SourceFile = game.SourceFile,
|
||||
Runnable = game.Runnable.AsRunnable(),
|
||||
Runnable = game.Runnable.AsEnumValue<Runnable>(),
|
||||
CloneOf = game.CloneOf,
|
||||
RomOf = game.RomOf,
|
||||
SampleOf = game.SampleOf,
|
||||
@@ -220,7 +220,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
MergeTag = rom.Merge,
|
||||
Region = rom.Region,
|
||||
Offset = rom.Offset,
|
||||
ItemStatus = rom.Status.AsItemStatus(),
|
||||
ItemStatus = rom.Status.AsEnumValue<ItemStatus>(),
|
||||
Optional = rom.Optional.AsYesNo(),
|
||||
//Dispose = rom.Dispose.AsYesNo(), // TODO: Add to internal model
|
||||
//SoundOnly = rom.SoundOnly.AsYesNo(), // TODO: Add to internal model
|
||||
@@ -264,7 +264,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Region = disk.Region,
|
||||
Index = disk.Index,
|
||||
Writable = disk.Writable.AsYesNo(),
|
||||
ItemStatus = disk.Status.AsItemStatus(),
|
||||
ItemStatus = disk.Status.AsEnumValue<ItemStatus>(),
|
||||
Optional = disk.Optional.AsYesNo(),
|
||||
|
||||
Source = new Source
|
||||
@@ -369,7 +369,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Name = chip.Name,
|
||||
Tag = chip.Tag,
|
||||
ChipType = chip.Type.AsChipType(),
|
||||
ChipType = chip.Type.AsEnumValue<ChipType>(),
|
||||
//SoundOnly = chip.SoundOnly, // TODO: Add to internal model
|
||||
Clock = NumberHelper.ConvertToInt64(chip.Clock),
|
||||
|
||||
@@ -406,7 +406,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
var item = new Display
|
||||
{
|
||||
Tag = display.Tag,
|
||||
DisplayType = display.Type.AsDisplayType(),
|
||||
DisplayType = display.Type.AsEnumValue<DisplayType>(),
|
||||
Rotate = NumberHelper.ConvertToInt64(display.Rotate),
|
||||
FlipX = display.FlipX.AsYesNo(),
|
||||
Width = NumberHelper.ConvertToInt64(display.Width),
|
||||
@@ -452,7 +452,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var item = new Display
|
||||
{
|
||||
DisplayType = video.Screen?.AsDisplayType() ?? DisplayType.NULL,
|
||||
DisplayType = video.Screen?.AsEnumValue<DisplayType>() ?? DisplayType.NULL,
|
||||
Width = NumberHelper.ConvertToInt64(video.Width),
|
||||
Height = NumberHelper.ConvertToInt64(video.Height),
|
||||
//AspectX = video.AspectX, // TODO: Add to internal model or find mapping
|
||||
@@ -549,7 +549,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var controlItem = new Control
|
||||
{
|
||||
ControlType = control.Type.AsControlType(),
|
||||
ControlType = control.Type.AsEnumValue<ControlType>(),
|
||||
Player = NumberHelper.ConvertToInt64(control.Player),
|
||||
Buttons = NumberHelper.ConvertToInt64(control.Buttons),
|
||||
RequiredButtons = NumberHelper.ConvertToInt64(control.ReqButtons),
|
||||
@@ -609,7 +609,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Tag = dipswitch.Condition.Tag,
|
||||
Mask = dipswitch.Condition.Mask,
|
||||
Relation = dipswitch.Condition.Relation.AsRelation(),
|
||||
Relation = dipswitch.Condition.Relation.AsEnumValue<Relation>(),
|
||||
Value = dipswitch.Condition.Value,
|
||||
};
|
||||
item.Conditions = [condition];
|
||||
@@ -646,7 +646,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Tag = dipvalue.Condition.Tag,
|
||||
Mask = dipvalue.Condition.Mask,
|
||||
Relation = dipvalue.Condition.Relation.AsRelation(),
|
||||
Relation = dipvalue.Condition.Relation.AsEnumValue<Relation>(),
|
||||
Value = dipvalue.Condition.Value,
|
||||
};
|
||||
dipValueItem.Conditions = [condition];
|
||||
@@ -700,7 +700,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Tag = configuration.Condition.Tag,
|
||||
Mask = configuration.Condition.Mask,
|
||||
Relation = configuration.Condition.Relation.AsRelation(),
|
||||
Relation = configuration.Condition.Relation.AsEnumValue<Relation>(),
|
||||
Value = configuration.Condition.Value,
|
||||
};
|
||||
item.Conditions = [condition];
|
||||
@@ -737,7 +737,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Tag = dipvalue.Condition.Tag,
|
||||
Mask = dipvalue.Condition.Mask,
|
||||
Relation = dipvalue.Condition.Relation.AsRelation(),
|
||||
Relation = dipvalue.Condition.Relation.AsEnumValue<Relation>(),
|
||||
Value = dipvalue.Condition.Value,
|
||||
};
|
||||
settingItem.Conditions = [condition];
|
||||
@@ -837,7 +837,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Tag = adjuster.Condition.Tag,
|
||||
Mask = adjuster.Condition.Mask,
|
||||
Relation = adjuster.Condition.Relation.AsRelation(),
|
||||
Relation = adjuster.Condition.Relation.AsEnumValue<Relation>(),
|
||||
Value = adjuster.Condition.Value,
|
||||
};
|
||||
item.Conditions = [condition];
|
||||
@@ -866,13 +866,13 @@ namespace SabreTools.DatFiles.Formats
|
||||
containsItems = true;
|
||||
var item = new Driver
|
||||
{
|
||||
Status = driver.Status.AsSupportStatus(),
|
||||
//Color = driver.Color.AsSupportStatus(), // TODO: Add to internal model
|
||||
//Sound = driver.Sound.AsSupportStatus(), // TODO: Add to internal model
|
||||
Status = driver.Status.AsEnumValue<SupportStatus>(),
|
||||
//Color = driver.Color.AsEnumValue<SupportStatus>(), // TODO: Add to internal model
|
||||
//Sound = driver.Sound.AsEnumValue<SupportStatus>(), // TODO: Add to internal model
|
||||
//PaletteSize = NumberHelper.ConvertToInt64(driver.PaletteSize), // TODO: Add to internal model
|
||||
Emulation = driver.Emulation.AsSupportStatus(),
|
||||
Cocktail = driver.Cocktail.AsSupportStatus(),
|
||||
SaveState = driver.SaveState.AsSupported(),
|
||||
Emulation = driver.Emulation.AsEnumValue<SupportStatus>(),
|
||||
Cocktail = driver.Cocktail.AsEnumValue<SupportStatus>(),
|
||||
SaveState = driver.SaveState.AsEnumValue<Supported>(),
|
||||
RequiresArtwork = driver.RequiresArtwork.AsYesNo(),
|
||||
Unofficial = driver.Unofficial.AsYesNo(),
|
||||
NoSoundHardware = driver.NoSoundHardware.AsYesNo(),
|
||||
@@ -909,9 +909,9 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var item = new Feature
|
||||
{
|
||||
Type = feature.Type.AsFeatureType(),
|
||||
Status = feature.Status.AsFeatureStatus(),
|
||||
Overall = feature.Overall.AsFeatureStatus(),
|
||||
Type = feature.Type.AsEnumValue<FeatureType>(),
|
||||
Status = feature.Status.AsEnumValue<FeatureStatus>(),
|
||||
Overall = feature.Overall.AsEnumValue<FeatureStatus>(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
@@ -945,7 +945,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var item = new Device
|
||||
{
|
||||
DeviceType = device.Type.AsDeviceType(),
|
||||
DeviceType = device.Type.AsEnumValue<DeviceType>(),
|
||||
Tag = device.Tag,
|
||||
FixedImage = device.FixedImage,
|
||||
Mandatory = NumberHelper.ConvertToInt64(device.Mandatory),
|
||||
@@ -1057,7 +1057,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Tag = softwarelist.Tag,
|
||||
Name = softwarelist.Name,
|
||||
Status = softwarelist.Status.AsSoftwareListStatus(),
|
||||
Status = softwarelist.Status.AsEnumValue<SoftwareListStatus>(),
|
||||
Filter = softwarelist.Filter,
|
||||
|
||||
Source = new Source
|
||||
|
||||
@@ -374,7 +374,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Name = machine.Name,
|
||||
SourceFile = machine.SourceFile,
|
||||
Runnable = machine.Runnable.FromRunnable(),
|
||||
Runnable = machine.Runnable.AsStringValue<Runnable>(),
|
||||
CloneOf = machine.CloneOf,
|
||||
RomOf = machine.RomOf,
|
||||
SampleOf = machine.SampleOf,
|
||||
@@ -435,7 +435,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Merge = item.MergeTag,
|
||||
Region = item.Region,
|
||||
Offset = item.Offset,
|
||||
Status = item.ItemStatus.FromItemStatus(yesno: false),
|
||||
Status = item.ItemStatus.AsStringValue<ItemStatus>(useSecond: false),
|
||||
Optional = item.Optional.FromYesNo(),
|
||||
//Dispose = item.Dispose.FromYesNo(), // TODO: Add to internal model
|
||||
//SoundOnly = item.SoundOnly.FromYesNo(), // TODO: Add to internal model
|
||||
@@ -458,7 +458,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Region = item.Region,
|
||||
Index = item.Index,
|
||||
Writable = item.Writable.FromYesNo(),
|
||||
Status = item.ItemStatus.FromItemStatus(yesno: false),
|
||||
Status = item.ItemStatus.AsStringValue<ItemStatus>(useSecond: false),
|
||||
Optional = item.Optional.FromYesNo(),
|
||||
};
|
||||
|
||||
@@ -500,7 +500,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Name = item.Name,
|
||||
Tag = item.Tag,
|
||||
Type = item.ChipType.FromChipType(),
|
||||
Type = item.ChipType.AsStringValue<ChipType>(),
|
||||
//SoundOnly = item.SoundOnly, // TODO: Add to internal model
|
||||
Clock = item.Clock?.ToString(),
|
||||
};
|
||||
@@ -516,7 +516,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
var display = new Models.Listxml.Display
|
||||
{
|
||||
Tag = item.Tag,
|
||||
Type = item.DisplayType.FromDisplayType(),
|
||||
Type = item.DisplayType.AsStringValue<DisplayType>(),
|
||||
Rotate = item.Rotate?.ToString(),
|
||||
FlipX = item.FlipX.FromYesNo(),
|
||||
Width = item.Width?.ToString(),
|
||||
@@ -582,7 +582,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var control = new Models.Listxml.Control
|
||||
{
|
||||
Type = item.ControlType.FromControlType(),
|
||||
Type = item.ControlType.AsStringValue<ControlType>(),
|
||||
Player = item.Player?.ToString(),
|
||||
Buttons = item.Buttons?.ToString(),
|
||||
ReqButtons = item.RequiredButtons?.ToString(),
|
||||
@@ -618,7 +618,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Tag = conditionItem?.Tag,
|
||||
Mask = conditionItem?.Mask,
|
||||
Relation = conditionItem?.Relation.FromRelation(),
|
||||
Relation = conditionItem?.Relation.AsStringValue<Relation>(),
|
||||
Value = conditionItem?.Value,
|
||||
};
|
||||
dipswitch.Condition = condition;
|
||||
@@ -681,7 +681,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Tag = conditionItem?.Tag,
|
||||
Mask = conditionItem?.Mask,
|
||||
Relation = conditionItem?.Relation.FromRelation(),
|
||||
Relation = conditionItem?.Relation.AsStringValue<Relation>(),
|
||||
Value = conditionItem?.Value,
|
||||
};
|
||||
dipvalue.Condition = condition;
|
||||
@@ -709,7 +709,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Tag = conditionItem?.Tag,
|
||||
Mask = conditionItem?.Mask,
|
||||
Relation = conditionItem?.Relation.FromRelation(),
|
||||
Relation = conditionItem?.Relation.AsStringValue<Relation>(),
|
||||
Value = conditionItem?.Value,
|
||||
};
|
||||
configuration.Condition = condition;
|
||||
@@ -772,7 +772,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Tag = conditionItem?.Tag,
|
||||
Mask = conditionItem?.Mask,
|
||||
Relation = conditionItem?.Relation.FromRelation(),
|
||||
Relation = conditionItem?.Relation.AsStringValue<Relation>(),
|
||||
Value = conditionItem?.Value,
|
||||
};
|
||||
confsetting.Condition = condition;
|
||||
@@ -812,7 +812,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Tag = conditionItem?.Tag,
|
||||
Mask = conditionItem?.Mask,
|
||||
Relation = conditionItem?.Relation.FromRelation(),
|
||||
Relation = conditionItem?.Relation.AsStringValue<Relation>(),
|
||||
Value = conditionItem?.Value,
|
||||
};
|
||||
adjuster.Condition = condition;
|
||||
@@ -828,13 +828,13 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var driver = new Models.Listxml.Driver
|
||||
{
|
||||
Status = item.Status.FromSupportStatus(),
|
||||
//Color = item.Color.FromSupportStatus(), // TODO: Add to internal model
|
||||
//Sound = item.Sound.FromSupportStatus(), // TODO: Add to internal model
|
||||
Status = item.Status.AsStringValue<SupportStatus>(),
|
||||
//Color = item.Color.AsStringValue<SupportStatus>(), // TODO: Add to internal model
|
||||
//Sound = item.Sound.AsStringValue<SupportStatus>(), // TODO: Add to internal model
|
||||
//PaletteSize = driver.PaletteSize?.ToString(), // TODO: Add to internal model
|
||||
Emulation = item.Emulation.FromSupportStatus(),
|
||||
Cocktail = item.Cocktail.FromSupportStatus(),
|
||||
SaveState = item.SaveState.FromSupported(verbose: true),
|
||||
Emulation = item.Emulation.AsStringValue<SupportStatus>(),
|
||||
Cocktail = item.Cocktail.AsStringValue<SupportStatus>(),
|
||||
SaveState = item.SaveState.AsStringValue<Supported>(useSecond: true),
|
||||
RequiresArtwork = item.RequiresArtwork.FromYesNo(),
|
||||
Unofficial = item.Unofficial.FromYesNo(),
|
||||
NoSoundHardware = item.NoSoundHardware.FromYesNo(),
|
||||
@@ -851,9 +851,9 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var feature = new Models.Listxml.Feature
|
||||
{
|
||||
Type = item.Type.FromFeatureType(),
|
||||
Status = item.Status.FromFeatureStatus(),
|
||||
Overall = item.Overall.FromFeatureStatus(),
|
||||
Type = item.Type.AsStringValue<FeatureType>(),
|
||||
Status = item.Status.AsStringValue<FeatureStatus>(),
|
||||
Overall = item.Overall.AsStringValue<FeatureStatus>(),
|
||||
};
|
||||
|
||||
return feature;
|
||||
@@ -866,7 +866,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var device = new Models.Listxml.Device
|
||||
{
|
||||
Type = item.DeviceType.FromDeviceType(),
|
||||
Type = item.DeviceType.AsStringValue<DeviceType>(),
|
||||
Tag = item.Tag,
|
||||
FixedImage = item.FixedImage,
|
||||
Mandatory = item.Mandatory?.ToString(),
|
||||
@@ -937,7 +937,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Tag = item.Tag,
|
||||
Name = item.Name,
|
||||
Status = item.Status.FromSoftwareListStatus(),
|
||||
Status = item.Status.AsStringValue<SoftwareListStatus>(),
|
||||
Filter = item.Filter,
|
||||
};
|
||||
|
||||
|
||||
@@ -102,11 +102,11 @@ namespace SabreTools.DatFiles.Formats
|
||||
Header.HeaderSkipper ??= clrMamePro.Header;
|
||||
|
||||
if (Header.ForceMerging == MergingFlag.None)
|
||||
Header.ForceMerging = clrMamePro.ForceMerging.AsMergingFlag();
|
||||
Header.ForceMerging = clrMamePro.ForceMerging.AsEnumValue<MergingFlag>();
|
||||
if (Header.ForceNodump == NodumpFlag.None)
|
||||
Header.ForceNodump = clrMamePro.ForceNodump.AsNodumpFlag();
|
||||
Header.ForceNodump = clrMamePro.ForceNodump.AsEnumValue<NodumpFlag>();
|
||||
if (Header.ForcePacking == PackingFlag.None)
|
||||
Header.ForcePacking = clrMamePro.ForcePacking.AsPackingFlag();
|
||||
Header.ForcePacking = clrMamePro.ForcePacking.AsEnumValue<PackingFlag>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -122,11 +122,11 @@ namespace SabreTools.DatFiles.Formats
|
||||
Header.System ??= romCenter.Plugin;
|
||||
|
||||
if (Header.RomMode == MergingFlag.None)
|
||||
Header.RomMode = romCenter.RomMode.AsMergingFlag();
|
||||
Header.RomMode = romCenter.RomMode.AsEnumValue<MergingFlag>();
|
||||
if (Header.BiosMode == MergingFlag.None)
|
||||
Header.BiosMode = romCenter.BiosMode.AsMergingFlag();
|
||||
Header.BiosMode = romCenter.BiosMode.AsEnumValue<MergingFlag>();
|
||||
if (Header.SampleMode == MergingFlag.None)
|
||||
Header.SampleMode = romCenter.SampleMode.AsMergingFlag();
|
||||
Header.SampleMode = romCenter.SampleMode.AsEnumValue<MergingFlag>();
|
||||
|
||||
Header.LockRomMode ??= romCenter.LockRomMode.AsYesNo();
|
||||
Header.LockBiosMode ??= romCenter.LockBiosMode.AsYesNo();
|
||||
@@ -218,7 +218,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
RebuildTo = game.RebuildTo,
|
||||
NoIntroId = game.Id,
|
||||
NoIntroCloneOfId = game.CloneOfId,
|
||||
Runnable = game.Runnable.AsRunnable(),
|
||||
Runnable = game.Runnable.AsEnumValue<Runnable>(),
|
||||
|
||||
Description = game.Description,
|
||||
Year = game.Year,
|
||||
@@ -406,7 +406,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
//xxHash364 = rom.xxHash364, // TODO: Add to internal model
|
||||
//xxHash3128 = rom.xxHash3128, // TODO: Add to internal model
|
||||
MergeTag = rom.Merge,
|
||||
ItemStatus = rom.Status?.AsItemStatus() ?? ItemStatus.NULL,
|
||||
ItemStatus = rom.Status?.AsEnumValue<ItemStatus>() ?? ItemStatus.NULL,
|
||||
//Serial = rom.Serial, // TODO: Add to internal model
|
||||
//Header = rom.Header, // TODO: Add to internal model
|
||||
Date = rom.Date,
|
||||
@@ -449,7 +449,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
MD5 = disk.MD5,
|
||||
SHA1 = disk.SHA1,
|
||||
MergeTag = disk.Merge,
|
||||
ItemStatus = disk.Status?.AsItemStatus() ?? ItemStatus.NULL,
|
||||
ItemStatus = disk.Status?.AsEnumValue<ItemStatus>() ?? ItemStatus.NULL,
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
@@ -621,10 +621,10 @@ namespace SabreTools.DatFiles.Formats
|
||||
containsItems = true;
|
||||
var item = new Driver
|
||||
{
|
||||
Status = driver.Status?.AsSupportStatus() ?? SupportStatus.NULL,
|
||||
Emulation = driver.Emulation?.AsSupportStatus() ?? SupportStatus.NULL,
|
||||
Cocktail = driver.Cocktail?.AsSupportStatus() ?? SupportStatus.NULL,
|
||||
SaveState = driver.SaveState?.AsSupported() ?? Supported.NULL,
|
||||
Status = driver.Status?.AsEnumValue<SupportStatus>() ?? SupportStatus.NULL,
|
||||
Emulation = driver.Emulation?.AsEnumValue<SupportStatus>() ?? SupportStatus.NULL,
|
||||
Cocktail = driver.Cocktail?.AsEnumValue<SupportStatus>() ?? SupportStatus.NULL,
|
||||
SaveState = driver.SaveState?.AsEnumValue<Supported>() ?? Supported.NULL,
|
||||
RequiresArtwork = driver.RequiresArtwork?.AsYesNo(),
|
||||
Unofficial = driver.Unofficial?.AsYesNo(),
|
||||
NoSoundHardware = driver.NoSoundHardware?.AsYesNo(),
|
||||
@@ -663,7 +663,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Tag = softwarelist.Tag,
|
||||
Name = softwarelist.Name,
|
||||
Status = softwarelist.Status?.AsSoftwareListStatus() ?? SoftwareListStatus.None,
|
||||
Status = softwarelist.Status?.AsEnumValue<SoftwareListStatus>() ?? SoftwareListStatus.None,
|
||||
Filter = softwarelist.Filter,
|
||||
|
||||
Source = new Source
|
||||
|
||||
@@ -233,11 +233,11 @@ namespace SabreTools.DatFiles.Formats
|
||||
};
|
||||
|
||||
if (Header.ForceMergingSpecified)
|
||||
subheader.ForceMerging = Header.ForceMerging.FromMergingFlag(romCenter: false);
|
||||
subheader.ForceMerging = Header.ForceMerging.AsStringValue<MergingFlag>(useSecond: false);
|
||||
if (Header.ForceNodumpSpecified)
|
||||
subheader.ForceNodump = Header.ForceNodump.FromNodumpFlag();
|
||||
subheader.ForceNodump = Header.ForceNodump.AsStringValue<NodumpFlag>();
|
||||
if (Header.ForcePackingSpecified)
|
||||
subheader.ForcePacking = Header.ForcePacking.FromPackingFlag(yesno: false);
|
||||
subheader.ForcePacking = Header.ForcePacking.AsStringValue<PackingFlag>(useSecond: false);
|
||||
|
||||
return subheader;
|
||||
}
|
||||
@@ -265,11 +265,11 @@ namespace SabreTools.DatFiles.Formats
|
||||
};
|
||||
|
||||
if (Header.RomModeSpecified)
|
||||
subheader.RomMode = Header.RomMode.FromMergingFlag(romCenter: true);
|
||||
subheader.RomMode = Header.RomMode.AsStringValue<MergingFlag>(useSecond: true);
|
||||
if (Header.BiosModeSpecified)
|
||||
subheader.BiosMode = Header.BiosMode.FromMergingFlag(romCenter: true);
|
||||
subheader.BiosMode = Header.BiosMode.AsStringValue<MergingFlag>(useSecond: true);
|
||||
if (Header.SampleModeSpecified)
|
||||
subheader.SampleMode = Header.SampleMode.FromMergingFlag(romCenter: true);
|
||||
subheader.SampleMode = Header.SampleMode.AsStringValue<MergingFlag>(useSecond: true);
|
||||
|
||||
if (Header.LockRomModeSpecified)
|
||||
subheader.LockRomMode = Header.LockRomMode.FromYesNo();
|
||||
@@ -413,7 +413,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
game.RebuildTo = machine.RebuildTo;
|
||||
game.Id = machine.NoIntroId;
|
||||
game.CloneOfId = machine.NoIntroCloneOfId;
|
||||
game.Runnable = machine.Runnable.FromRunnable();
|
||||
game.Runnable = machine.Runnable.AsStringValue<Runnable>();
|
||||
if (machine.Comment != null)
|
||||
{
|
||||
if (machine.Comment.Contains(';'))
|
||||
@@ -538,7 +538,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
};
|
||||
|
||||
if (item.ItemStatusSpecified)
|
||||
rom.Status = item.ItemStatus.FromItemStatus(yesno: false);
|
||||
rom.Status = item.ItemStatus.AsStringValue<ItemStatus>(useSecond: false);
|
||||
if (item.InvertedSpecified)
|
||||
rom.Inverted = item.Inverted.FromYesNo();
|
||||
if (item.MIASpecified)
|
||||
@@ -562,7 +562,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
};
|
||||
|
||||
if (item.ItemStatusSpecified)
|
||||
disk.Status = item.ItemStatus.FromItemStatus(yesno: false);
|
||||
disk.Status = item.ItemStatus.AsStringValue<ItemStatus>(useSecond: false);
|
||||
|
||||
return disk;
|
||||
}
|
||||
@@ -626,10 +626,10 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
var driver = new Models.Logiqx.Driver
|
||||
{
|
||||
Status = item.Status.FromSupportStatus(),
|
||||
Emulation = item.Emulation.FromSupportStatus(),
|
||||
Cocktail = item.Cocktail.FromSupportStatus(),
|
||||
SaveState = item.SaveState.FromSupported(true),
|
||||
Status = item.Status.AsStringValue<SupportStatus>(),
|
||||
Emulation = item.Emulation.AsStringValue<SupportStatus>(),
|
||||
Cocktail = item.Cocktail.AsStringValue<SupportStatus>(),
|
||||
SaveState = item.SaveState.AsStringValue<Supported>(useSecond: true),
|
||||
};
|
||||
|
||||
if (item.RequiresArtworkSpecified)
|
||||
@@ -657,7 +657,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
};
|
||||
|
||||
if (item.StatusSpecified)
|
||||
softwarelist.Status = item.Status.FromSoftwareListStatus();
|
||||
softwarelist.Status = item.Status.AsStringValue<SoftwareListStatus>();
|
||||
|
||||
return softwarelist;
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
if (datItemObj == null)
|
||||
return;
|
||||
|
||||
switch (datItemObj.Value<string>("type").AsItemType())
|
||||
switch (datItemObj.Value<string>("type").AsEnumValue<ItemType>())
|
||||
{
|
||||
case ItemType.Adjuster:
|
||||
datItem = datItemObj.ToObject<Adjuster>();
|
||||
|
||||
@@ -79,7 +79,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
|
||||
// Read item values
|
||||
DatItem? item = null;
|
||||
switch (row.Type.AsItemType())
|
||||
switch (row.Type.AsEnumValue<ItemType>())
|
||||
{
|
||||
case ItemType.Disk:
|
||||
item = new Disk
|
||||
@@ -87,7 +87,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Name = row.DiskName,
|
||||
MD5 = row.MD5,
|
||||
SHA1 = row.SHA1,
|
||||
ItemStatus = row.Status.AsItemStatus(),
|
||||
ItemStatus = row.Status.AsEnumValue<ItemStatus>(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
@@ -125,7 +125,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
SHA384 = row.SHA384,
|
||||
SHA512 = row.SHA512,
|
||||
SpamSum = row.SpamSum,
|
||||
ItemStatus = row.Status.AsItemStatus(),
|
||||
ItemStatus = row.Status.AsEnumValue<ItemStatus>(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
|
||||
@@ -164,7 +164,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Description = Header.Description,
|
||||
GameName = disk.Machine.Name,
|
||||
GameDescription = disk.Machine.Description,
|
||||
Type = disk.ItemType.FromItemType(),
|
||||
Type = disk.ItemType.AsStringValue<ItemType>(),
|
||||
RomName = string.Empty,
|
||||
DiskName = disk.Name,
|
||||
Size = string.Empty,
|
||||
@@ -175,7 +175,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
SHA384 = string.Empty,
|
||||
SHA512 = string.Empty,
|
||||
SpamSum = string.Empty,
|
||||
Status = disk.ItemStatus.FromItemStatus(yesno: false),
|
||||
Status = disk.ItemStatus.AsStringValue<ItemStatus>(useSecond: false),
|
||||
};
|
||||
return row;
|
||||
}
|
||||
@@ -192,7 +192,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Description = Header.Description,
|
||||
GameName = media.Machine.Name,
|
||||
GameDescription = media.Machine.Description,
|
||||
Type = media.ItemType.FromItemType(),
|
||||
Type = media.ItemType.AsStringValue<ItemType>(),
|
||||
RomName = string.Empty,
|
||||
DiskName = media.Name,
|
||||
Size = string.Empty,
|
||||
@@ -220,7 +220,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Description = Header.Description,
|
||||
GameName = rom.Machine.Name,
|
||||
GameDescription = rom.Machine.Description,
|
||||
Type = rom.ItemType.FromItemType(),
|
||||
Type = rom.ItemType.AsStringValue<ItemType>(),
|
||||
RomName = rom.Name,
|
||||
DiskName = string.Empty,
|
||||
Size = rom.Size?.ToString(),
|
||||
@@ -231,7 +231,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
SHA384 = rom.SHA384,
|
||||
SHA512 = rom.SHA512,
|
||||
SpamSum = rom.SpamSum,
|
||||
Status = rom.ItemStatus.FromItemStatus(yesno: false),
|
||||
Status = rom.ItemStatus.AsStringValue<ItemStatus>(useSecond: false),
|
||||
};
|
||||
return row;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using SabreTools.Core;
|
||||
using SabreTools.Core.Tools;
|
||||
using SabreTools.DatItems;
|
||||
using SabreTools.DatItems.Formats;
|
||||
@@ -93,7 +94,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Name = software.Name,
|
||||
CloneOf = software.CloneOf,
|
||||
Supported = software.Supported.AsSupported(),
|
||||
Supported = software.Supported.AsEnumValue<Supported>(),
|
||||
Description = software.Description,
|
||||
Year = software.Year,
|
||||
Publisher = software.Publisher,
|
||||
@@ -258,7 +259,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Name = dataarea.Name,
|
||||
Size = NumberHelper.ConvertToInt64(dataarea.Size),
|
||||
Width = NumberHelper.ConvertToInt64(dataarea.Width),
|
||||
Endianness = dataarea.Endianness.AsEndianness(),
|
||||
Endianness = dataarea.Endianness.AsEnumValue<Endianness>(),
|
||||
|
||||
Source = new Source
|
||||
{
|
||||
@@ -300,8 +301,8 @@ namespace SabreTools.DatFiles.Formats
|
||||
SHA1 = rom.SHA1,
|
||||
Offset = rom.Offset,
|
||||
Value = rom.Value,
|
||||
ItemStatus = rom.Status.AsItemStatus(),
|
||||
LoadFlag = rom.LoadFlag.AsLoadFlag(),
|
||||
ItemStatus = rom.Status.AsEnumValue<ItemStatus>(),
|
||||
LoadFlag = rom.LoadFlag.AsEnumValue<LoadFlag>(),
|
||||
|
||||
Part = part,
|
||||
DataArea = dataarea,
|
||||
@@ -377,7 +378,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Name = rom.Name,
|
||||
MD5 = rom.MD5,
|
||||
SHA1 = rom.SHA1,
|
||||
ItemStatus = rom.Status.AsItemStatus(),
|
||||
ItemStatus = rom.Status.AsEnumValue<ItemStatus>(),
|
||||
Writable = rom.Writeable.AsYesNo(),
|
||||
|
||||
Part = part,
|
||||
|
||||
@@ -261,7 +261,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
{
|
||||
Name = machine.Name,
|
||||
CloneOf = machine.CloneOf,
|
||||
Supported = machine.Supported.FromSupported(verbose: true),
|
||||
Supported = machine.Supported.AsStringValue<Supported>(useSecond: true),
|
||||
Description = machine.Description,
|
||||
Year = machine.Year,
|
||||
Publisher = machine.Publisher,
|
||||
@@ -381,7 +381,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Name = item.DataArea?.Name,
|
||||
Size = item.DataArea?.Size?.ToString(),
|
||||
Width = item.DataArea?.Width?.ToString(),
|
||||
Endianness = item.DataArea?.Endianness.FromEndianness(),
|
||||
Endianness = item.DataArea?.Endianness.AsStringValue<Endianness>(),
|
||||
Rom = CreateRom(item),
|
||||
};
|
||||
return [dataArea];
|
||||
@@ -401,8 +401,8 @@ namespace SabreTools.DatFiles.Formats
|
||||
SHA1 = item.SHA1,
|
||||
Offset = item.Offset,
|
||||
Value = item.Value,
|
||||
Status = item.ItemStatus.FromItemStatus(yesno: false),
|
||||
LoadFlag = item.LoadFlag.FromLoadFlag(),
|
||||
Status = item.ItemStatus.AsStringValue<ItemStatus>(useSecond: false),
|
||||
LoadFlag = item.LoadFlag.AsStringValue<LoadFlag>(),
|
||||
};
|
||||
return [rom];
|
||||
}
|
||||
@@ -429,7 +429,7 @@ namespace SabreTools.DatFiles.Formats
|
||||
Name = item.Name,
|
||||
MD5 = item.MD5,
|
||||
SHA1 = item.SHA1,
|
||||
Status = item.ItemStatus.FromItemStatus(yesno: false),
|
||||
Status = item.ItemStatus.AsStringValue<ItemStatus>(useSecond: false),
|
||||
Writeable = item.Writable?.ToString(),
|
||||
};
|
||||
return [disk];
|
||||
|
||||
@@ -104,7 +104,7 @@ namespace SabreTools.DatFiles
|
||||
datHeader.Author = DatHeaderMappings[DatHeaderField.Author];
|
||||
|
||||
if (DatHeaderMappings.ContainsKey(DatHeaderField.BiosMode))
|
||||
datHeader.BiosMode = DatHeaderMappings[DatHeaderField.BiosMode].AsMergingFlag();
|
||||
datHeader.BiosMode = DatHeaderMappings[DatHeaderField.BiosMode].AsEnumValue<MergingFlag>();
|
||||
|
||||
if (DatHeaderMappings.ContainsKey(DatHeaderField.Build))
|
||||
datHeader.Build = DatHeaderMappings[DatHeaderField.Build];
|
||||
@@ -133,13 +133,13 @@ namespace SabreTools.DatFiles
|
||||
datHeader.FileName = DatHeaderMappings[DatHeaderField.FileName];
|
||||
|
||||
if (DatHeaderMappings.ContainsKey(DatHeaderField.ForceMerging))
|
||||
datHeader.ForceMerging = DatHeaderMappings[DatHeaderField.ForceMerging].AsMergingFlag();
|
||||
datHeader.ForceMerging = DatHeaderMappings[DatHeaderField.ForceMerging].AsEnumValue<MergingFlag>();
|
||||
|
||||
if (DatHeaderMappings.ContainsKey(DatHeaderField.ForceNodump))
|
||||
datHeader.ForceNodump = DatHeaderMappings[DatHeaderField.ForceNodump].AsNodumpFlag();
|
||||
datHeader.ForceNodump = DatHeaderMappings[DatHeaderField.ForceNodump].AsEnumValue<NodumpFlag>();
|
||||
|
||||
if (DatHeaderMappings.ContainsKey(DatHeaderField.ForcePacking))
|
||||
datHeader.ForcePacking = DatHeaderMappings[DatHeaderField.ForcePacking].AsPackingFlag();
|
||||
datHeader.ForcePacking = DatHeaderMappings[DatHeaderField.ForcePacking].AsEnumValue<PackingFlag>();
|
||||
|
||||
if (DatHeaderMappings.ContainsKey(DatHeaderField.HeaderSkipper))
|
||||
datHeader.HeaderSkipper = DatHeaderMappings[DatHeaderField.HeaderSkipper];
|
||||
@@ -174,7 +174,7 @@ namespace SabreTools.DatFiles
|
||||
datHeader.RomCenterVersion = DatHeaderMappings[DatHeaderField.RomCenterVersion];
|
||||
|
||||
if (DatHeaderMappings.ContainsKey(DatHeaderField.RomMode))
|
||||
datHeader.RomMode = DatHeaderMappings[DatHeaderField.RomMode].AsMergingFlag();
|
||||
datHeader.RomMode = DatHeaderMappings[DatHeaderField.RomMode].AsEnumValue<MergingFlag>();
|
||||
|
||||
if (DatHeaderMappings.ContainsKey(DatHeaderField.RomTitle))
|
||||
datHeader.RomTitle = DatHeaderMappings[DatHeaderField.RomTitle];
|
||||
@@ -183,7 +183,7 @@ namespace SabreTools.DatFiles
|
||||
datHeader.RootDir = DatHeaderMappings[DatHeaderField.RootDir];
|
||||
|
||||
if (DatHeaderMappings.ContainsKey(DatHeaderField.SampleMode))
|
||||
datHeader.SampleMode = DatHeaderMappings[DatHeaderField.SampleMode].AsMergingFlag();
|
||||
datHeader.SampleMode = DatHeaderMappings[DatHeaderField.SampleMode].AsEnumValue<MergingFlag>();
|
||||
|
||||
if (DatHeaderMappings.ContainsKey(DatHeaderField.ScreenshotsHeight))
|
||||
datHeader.ScreenshotsHeight = DatHeaderMappings[DatHeaderField.ScreenshotsHeight];
|
||||
|
||||
@@ -73,8 +73,8 @@ namespace SabreTools.DatItems
|
||||
[XmlElement("itemtype")]
|
||||
public ItemType ItemType
|
||||
{
|
||||
get => _internal.ReadString(Models.Metadata.DatItem.TypeKey).AsItemType();
|
||||
set => _internal[Models.Metadata.DatItem.TypeKey] = value.FromItemType();
|
||||
get => _internal.ReadString(Models.Metadata.DatItem.TypeKey).AsEnumValue<ItemType>();
|
||||
set => _internal[Models.Metadata.DatItem.TypeKey] = value.AsStringValue<ItemType>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -42,8 +42,8 @@ namespace SabreTools.DatItems.Formats
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public ChipType ChipType
|
||||
{
|
||||
get => _internal.ReadString(Models.Metadata.Chip.ChipTypeKey).AsChipType();
|
||||
set => _internal[Models.Metadata.Chip.ChipTypeKey] = value.FromChipType();
|
||||
get => _internal.ReadString(Models.Metadata.Chip.ChipTypeKey).AsEnumValue<ChipType>();
|
||||
set => _internal[Models.Metadata.Chip.ChipTypeKey] = value.AsStringValue<ChipType>();
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
|
||||
@@ -42,8 +42,8 @@ namespace SabreTools.DatItems.Formats
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public Relation Relation
|
||||
{
|
||||
get => _internal.ReadString(Models.Metadata.Condition.RelationKey).AsRelation();
|
||||
set => _internal[Models.Metadata.Condition.RelationKey] = value.FromRelation();
|
||||
get => _internal.ReadString(Models.Metadata.Condition.RelationKey).AsEnumValue<Relation>();
|
||||
set => _internal[Models.Metadata.Condition.RelationKey] = value.AsStringValue<Relation>();
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace SabreTools.DatItems.Formats
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public ControlType ControlType
|
||||
{
|
||||
get => _internal.ReadString(Models.Metadata.Control.ControlTypeKey).AsControlType();
|
||||
set => _internal[Models.Metadata.Control.ControlTypeKey] = value.FromControlType();
|
||||
get => _internal.ReadString(Models.Metadata.Control.ControlTypeKey).AsEnumValue<ControlType>();
|
||||
set => _internal[Models.Metadata.Control.ControlTypeKey] = value.AsStringValue<ControlType>();
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
|
||||
@@ -57,8 +57,8 @@ namespace SabreTools.DatItems.Formats
|
||||
[JsonProperty("endianness", DefaultValueHandling = DefaultValueHandling.Ignore), XmlElement("endianness")]
|
||||
public Endianness Endianness
|
||||
{
|
||||
get => _internal.ReadString(Models.Metadata.DataArea.WidthKey).AsEndianness();
|
||||
set => _internal[Models.Metadata.DataArea.WidthKey] = value.FromEndianness();
|
||||
get => _internal.ReadString(Models.Metadata.DataArea.WidthKey).AsEnumValue<Endianness>();
|
||||
set => _internal[Models.Metadata.DataArea.WidthKey] = value.AsStringValue<Endianness>();
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
|
||||
@@ -24,8 +24,8 @@ namespace SabreTools.DatItems.Formats
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public DeviceType DeviceType
|
||||
{
|
||||
get => _internal.ReadString(Models.Metadata.Device.DeviceTypeKey).AsDeviceType();
|
||||
set => _internal[Models.Metadata.Device.DeviceTypeKey] = value.FromDeviceType();
|
||||
get => _internal.ReadString(Models.Metadata.Device.DeviceTypeKey).AsEnumValue<DeviceType>();
|
||||
set => _internal[Models.Metadata.Device.DeviceTypeKey] = value.AsStringValue<DeviceType>();
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
|
||||
@@ -98,8 +98,8 @@ namespace SabreTools.DatItems.Formats
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public ItemStatus ItemStatus
|
||||
{
|
||||
get => _internal.ReadString(Models.Metadata.Disk.StatusKey).AsItemStatus();
|
||||
set => _internal[Models.Metadata.Disk.StatusKey] = value.FromItemStatus(yesno: false);
|
||||
get => _internal.ReadString(Models.Metadata.Disk.StatusKey).AsEnumValue<ItemStatus>();
|
||||
set => _internal[Models.Metadata.Disk.StatusKey] = value.AsStringValue<ItemStatus>(useSecond: false);
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
|
||||
@@ -32,8 +32,8 @@ namespace SabreTools.DatItems.Formats
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public DisplayType DisplayType
|
||||
{
|
||||
get => _internal.ReadString(Models.Metadata.Display.DisplayTypeKey).AsDisplayType();
|
||||
set => _internal[Models.Metadata.Display.DisplayTypeKey] = value.FromDisplayType();
|
||||
get => _internal.ReadString(Models.Metadata.Display.DisplayTypeKey).AsEnumValue<DisplayType>();
|
||||
set => _internal[Models.Metadata.Display.DisplayTypeKey] = value.AsStringValue<DisplayType>();
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace SabreTools.DatItems.Formats
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public SupportStatus Status
|
||||
{
|
||||
get => _internal.ReadString(Models.Metadata.Driver.StatusKey).AsSupportStatus();
|
||||
set => _internal[Models.Metadata.Driver.StatusKey] = value.FromSupportStatus();
|
||||
get => _internal.ReadString(Models.Metadata.Driver.StatusKey).AsEnumValue<SupportStatus>();
|
||||
set => _internal[Models.Metadata.Driver.StatusKey] = value.AsStringValue<SupportStatus>();
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
@@ -39,8 +39,8 @@ namespace SabreTools.DatItems.Formats
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public SupportStatus Emulation
|
||||
{
|
||||
get => _internal.ReadString(Models.Metadata.Driver.EmulationKey).AsSupportStatus();
|
||||
set => _internal[Models.Metadata.Driver.EmulationKey] = value.FromSupportStatus();
|
||||
get => _internal.ReadString(Models.Metadata.Driver.EmulationKey).AsEnumValue<SupportStatus>();
|
||||
set => _internal[Models.Metadata.Driver.EmulationKey] = value.AsStringValue<SupportStatus>();
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
@@ -53,8 +53,8 @@ namespace SabreTools.DatItems.Formats
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public SupportStatus Cocktail
|
||||
{
|
||||
get => _internal.ReadString(Models.Metadata.Driver.CocktailKey).AsSupportStatus();
|
||||
set => _internal[Models.Metadata.Driver.CocktailKey] = value.FromSupportStatus();
|
||||
get => _internal.ReadString(Models.Metadata.Driver.CocktailKey).AsEnumValue<SupportStatus>();
|
||||
set => _internal[Models.Metadata.Driver.CocktailKey] = value.AsStringValue<SupportStatus>();
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
@@ -67,8 +67,8 @@ namespace SabreTools.DatItems.Formats
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public Supported SaveState
|
||||
{
|
||||
get => _internal.ReadString(Models.Metadata.Driver.SaveStateKey).AsSupported();
|
||||
set => _internal[Models.Metadata.Driver.SaveStateKey] = value.FromSupported(verbose: true);
|
||||
get => _internal.ReadString(Models.Metadata.Driver.SaveStateKey).AsEnumValue<Supported>();
|
||||
set => _internal[Models.Metadata.Driver.SaveStateKey] = value.AsStringValue<Supported>(useSecond: true);
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
|
||||
@@ -22,8 +22,8 @@ namespace SabreTools.DatItems.Formats
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public FeatureType Type
|
||||
{
|
||||
get => _internal.ReadString(Models.Metadata.Feature.FeatureTypeKey).AsFeatureType();
|
||||
set => _internal[Models.Metadata.Feature.FeatureTypeKey] = value.FromFeatureType();
|
||||
get => _internal.ReadString(Models.Metadata.Feature.FeatureTypeKey).AsEnumValue<FeatureType>();
|
||||
set => _internal[Models.Metadata.Feature.FeatureTypeKey] = value.AsStringValue<FeatureType>();
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
@@ -36,8 +36,8 @@ namespace SabreTools.DatItems.Formats
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public FeatureStatus Status
|
||||
{
|
||||
get => _internal.ReadString(Models.Metadata.Feature.StatusKey).AsFeatureStatus();
|
||||
set => _internal[Models.Metadata.Feature.StatusKey] = value.FromFeatureStatus();
|
||||
get => _internal.ReadString(Models.Metadata.Feature.StatusKey).AsEnumValue<FeatureStatus>();
|
||||
set => _internal[Models.Metadata.Feature.StatusKey] = value.AsStringValue<FeatureStatus>();
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
@@ -50,8 +50,8 @@ namespace SabreTools.DatItems.Formats
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public FeatureStatus Overall
|
||||
{
|
||||
get => _internal.ReadString(Models.Metadata.Feature.OverallKey).AsFeatureStatus();
|
||||
set => _internal[Models.Metadata.Feature.OverallKey] = value.FromFeatureStatus();
|
||||
get => _internal.ReadString(Models.Metadata.Feature.OverallKey).AsEnumValue<FeatureStatus>();
|
||||
set => _internal[Models.Metadata.Feature.OverallKey] = value.AsStringValue<FeatureStatus>();
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
|
||||
@@ -168,8 +168,8 @@ namespace SabreTools.DatItems.Formats
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public ItemStatus ItemStatus
|
||||
{
|
||||
get => _internal.ReadString(Models.Metadata.Rom.StatusKey).AsItemStatus();
|
||||
set => _internal[Models.Metadata.Rom.StatusKey] = value.FromItemStatus(yesno: false);
|
||||
get => _internal.ReadString(Models.Metadata.Rom.StatusKey).AsEnumValue<ItemStatus>();
|
||||
set => _internal[Models.Metadata.Rom.StatusKey] = value.AsStringValue<ItemStatus>(useSecond: false);
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
@@ -324,8 +324,8 @@ namespace SabreTools.DatItems.Formats
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public OpenMSXSubType OpenMSXSubType
|
||||
{
|
||||
get => _internal.ReadString(Models.Metadata.Rom.OpenMSXMediaType).AsOpenMSXSubType();
|
||||
set => _internal[Models.Metadata.Rom.OpenMSXMediaType] = value.FromOpenMSXSubType();
|
||||
get => _internal.ReadString(Models.Metadata.Rom.OpenMSXMediaType).AsEnumValue<OpenMSXSubType>();
|
||||
set => _internal[Models.Metadata.Rom.OpenMSXMediaType] = value.AsStringValue<OpenMSXSubType>();
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
@@ -398,8 +398,8 @@ namespace SabreTools.DatItems.Formats
|
||||
[JsonConverter(typeof(StringEnumConverter))]
|
||||
public LoadFlag LoadFlag
|
||||
{
|
||||
get => _internal.ReadString(Models.Metadata.Rom.LoadFlagKey).AsLoadFlag();
|
||||
set => _internal[Models.Metadata.Rom.LoadFlagKey] = value.FromLoadFlag();
|
||||
get => _internal.ReadString(Models.Metadata.Rom.LoadFlagKey).AsEnumValue<LoadFlag>();
|
||||
set => _internal[Models.Metadata.Rom.LoadFlagKey] = value.AsStringValue<LoadFlag>();
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
|
||||
@@ -48,8 +48,8 @@ namespace SabreTools.DatItems.Formats
|
||||
[XmlElement("status")]
|
||||
public SoftwareListStatus Status
|
||||
{
|
||||
get => _internal.ReadString(Models.Metadata.SoftwareList.StatusKey).AsSoftwareListStatus();
|
||||
set => _internal[Models.Metadata.SoftwareList.StatusKey] = value.FromSoftwareListStatus();
|
||||
get => _internal.ReadString(Models.Metadata.SoftwareList.StatusKey).AsEnumValue<SoftwareListStatus>();
|
||||
set => _internal[Models.Metadata.SoftwareList.StatusKey] = value.AsStringValue<SoftwareListStatus>();
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
|
||||
@@ -293,8 +293,8 @@ namespace SabreTools.DatItems
|
||||
[XmlElement("runnable")]
|
||||
public Runnable Runnable
|
||||
{
|
||||
get => _machine.ReadString(Models.Metadata.Machine.RunnableKey).AsRunnable();
|
||||
set => _machine[Models.Metadata.Machine.RunnableKey] = value.FromRunnable();
|
||||
get => _machine.ReadString(Models.Metadata.Machine.RunnableKey).AsEnumValue<Runnable>();
|
||||
set => _machine[Models.Metadata.Machine.RunnableKey] = value.AsStringValue<Runnable>();
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
@@ -467,8 +467,8 @@ namespace SabreTools.DatItems
|
||||
[XmlElement("supported")]
|
||||
public Supported Supported
|
||||
{
|
||||
get => _machine.ReadString(Models.Metadata.Machine.SupportedKey).AsSupported();
|
||||
set => _machine[Models.Metadata.Machine.SupportedKey] = value.FromSupported(verbose: true);
|
||||
get => _machine.ReadString(Models.Metadata.Machine.SupportedKey).AsEnumValue<Supported>();
|
||||
set => _machine[Models.Metadata.Machine.SupportedKey] = value.AsStringValue<Supported>(useSecond: true);
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
@@ -689,7 +689,7 @@ namespace SabreTools.DatItems
|
||||
case MachineField.Score: Score = value; return true;
|
||||
case MachineField.Subgenre: Subgenre = value; return true;
|
||||
case MachineField.TitleID: TitleID = value; return true;
|
||||
case MachineField.Type: MachineType = value.AsMachineType(); return true;
|
||||
case MachineField.Type: MachineType = value.AsEnumValue<MachineType>(); return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -210,9 +210,9 @@ namespace SabreTools.Filtering
|
||||
|
||||
case DatItemField.AreaEndianness:
|
||||
if (negate)
|
||||
AreaEndianness.Negative |= value.AsEndianness();
|
||||
AreaEndianness.Negative |= value.AsEnumValue<Endianness>();
|
||||
else
|
||||
AreaEndianness.Positive |= value.AsEndianness();
|
||||
AreaEndianness.Positive |= value.AsEnumValue<Endianness>();
|
||||
break;
|
||||
|
||||
case DatItemField.AreaName:
|
||||
@@ -245,9 +245,9 @@ namespace SabreTools.Filtering
|
||||
|
||||
case DatItemField.ChipType:
|
||||
if (negate)
|
||||
ChipType.Negative |= value.AsChipType();
|
||||
ChipType.Negative |= value.AsEnumValue<ChipType>();
|
||||
else
|
||||
ChipType.Positive |= value.AsChipType();
|
||||
ChipType.Positive |= value.AsEnumValue<ChipType>();
|
||||
break;
|
||||
|
||||
case DatItemField.Clock:
|
||||
@@ -260,9 +260,9 @@ namespace SabreTools.Filtering
|
||||
|
||||
case DatItemField.CocktailStatus:
|
||||
if (negate)
|
||||
CocktailStatus.Negative |= value.AsSupportStatus();
|
||||
CocktailStatus.Negative |= value.AsEnumValue<SupportStatus>();
|
||||
else
|
||||
CocktailStatus.Positive |= value.AsSupportStatus();
|
||||
CocktailStatus.Positive |= value.AsEnumValue<SupportStatus>();
|
||||
break;
|
||||
|
||||
case DatItemField.Coins:
|
||||
@@ -279,9 +279,9 @@ namespace SabreTools.Filtering
|
||||
|
||||
case DatItemField.Condition_Relation:
|
||||
if (negate)
|
||||
Condition_Relation.Negative |= value.AsRelation();
|
||||
Condition_Relation.Negative |= value.AsEnumValue<Relation>();
|
||||
else
|
||||
Condition_Relation.Positive |= value.AsRelation();
|
||||
Condition_Relation.Positive |= value.AsEnumValue<Relation>();
|
||||
break;
|
||||
|
||||
case DatItemField.Condition_Tag:
|
||||
@@ -331,9 +331,9 @@ namespace SabreTools.Filtering
|
||||
case DatItemField.Control_Type:
|
||||
|
||||
if (negate)
|
||||
Control_Type.Negative |= value.AsControlType();
|
||||
Control_Type.Negative |= value.AsEnumValue<ControlType>();
|
||||
else
|
||||
Control_Type.Positive |= value.AsControlType();
|
||||
Control_Type.Positive |= value.AsEnumValue<ControlType>();
|
||||
break;
|
||||
|
||||
case DatItemField.Control_Ways:
|
||||
@@ -366,9 +366,9 @@ namespace SabreTools.Filtering
|
||||
|
||||
case DatItemField.DeviceType:
|
||||
if (negate)
|
||||
DeviceType.Negative |= value.AsDeviceType();
|
||||
DeviceType.Negative |= value.AsEnumValue<DeviceType>();
|
||||
else
|
||||
DeviceType.Positive |= value.AsDeviceType();
|
||||
DeviceType.Positive |= value.AsEnumValue<DeviceType>();
|
||||
break;
|
||||
|
||||
case DatItemField.DevStatus:
|
||||
@@ -377,16 +377,16 @@ namespace SabreTools.Filtering
|
||||
|
||||
case DatItemField.DisplayType:
|
||||
if (negate)
|
||||
DisplayType.Negative |= value.AsDisplayType();
|
||||
DisplayType.Negative |= value.AsEnumValue<DisplayType>();
|
||||
else
|
||||
DisplayType.Positive |= value.AsDisplayType();
|
||||
DisplayType.Positive |= value.AsEnumValue<DisplayType>();
|
||||
break;
|
||||
|
||||
case DatItemField.EmulationStatus:
|
||||
if (negate)
|
||||
EmulationStatus.Negative |= value.AsSupportStatus();
|
||||
EmulationStatus.Negative |= value.AsEnumValue<SupportStatus>();
|
||||
else
|
||||
EmulationStatus.Positive |= value.AsSupportStatus();
|
||||
EmulationStatus.Positive |= value.AsEnumValue<SupportStatus>();
|
||||
break;
|
||||
|
||||
case DatItemField.Extension_Name:
|
||||
@@ -395,23 +395,23 @@ namespace SabreTools.Filtering
|
||||
|
||||
case DatItemField.FeatureOverall:
|
||||
if (negate)
|
||||
FeatureOverall.Negative |= value.AsFeatureStatus();
|
||||
FeatureOverall.Negative |= value.AsEnumValue<FeatureStatus>();
|
||||
else
|
||||
FeatureOverall.Positive |= value.AsFeatureStatus();
|
||||
FeatureOverall.Positive |= value.AsEnumValue<FeatureStatus>();
|
||||
break;
|
||||
|
||||
case DatItemField.FeatureStatus:
|
||||
if (negate)
|
||||
FeatureStatus.Negative |= value.AsFeatureStatus();
|
||||
FeatureStatus.Negative |= value.AsEnumValue<FeatureStatus>();
|
||||
else
|
||||
FeatureStatus.Positive |= value.AsFeatureStatus();
|
||||
FeatureStatus.Positive |= value.AsEnumValue<FeatureStatus>();
|
||||
break;
|
||||
|
||||
case DatItemField.FeatureType:
|
||||
if (negate)
|
||||
FeatureType.Negative |= value.AsFeatureType();
|
||||
FeatureType.Negative |= value.AsEnumValue<FeatureType>();
|
||||
else
|
||||
FeatureType.Positive |= value.AsFeatureType();
|
||||
FeatureType.Positive |= value.AsEnumValue<FeatureType>();
|
||||
break;
|
||||
|
||||
case DatItemField.Filter:
|
||||
@@ -476,9 +476,9 @@ namespace SabreTools.Filtering
|
||||
|
||||
case DatItemField.LoadFlag:
|
||||
if (negate)
|
||||
LoadFlag.Negative |= value.AsLoadFlag();
|
||||
LoadFlag.Negative |= value.AsEnumValue<LoadFlag>();
|
||||
else
|
||||
LoadFlag.Positive |= value.AsLoadFlag();
|
||||
LoadFlag.Positive |= value.AsEnumValue<LoadFlag>();
|
||||
break;
|
||||
|
||||
case DatItemField.Location_Inverted:
|
||||
@@ -531,9 +531,9 @@ namespace SabreTools.Filtering
|
||||
|
||||
case DatItemField.OpenMSXSubType:
|
||||
if (negate)
|
||||
OpenMSXSubType.Negative |= value.AsOpenMSXSubType();
|
||||
OpenMSXSubType.Negative |= value.AsEnumValue<OpenMSXSubType>();
|
||||
else
|
||||
OpenMSXSubType.Positive |= value.AsOpenMSXSubType();
|
||||
OpenMSXSubType.Positive |= value.AsEnumValue<OpenMSXSubType>();
|
||||
break;
|
||||
|
||||
case DatItemField.OpenMSXType:
|
||||
@@ -594,9 +594,9 @@ namespace SabreTools.Filtering
|
||||
|
||||
case DatItemField.Relation:
|
||||
if (negate)
|
||||
Relation.Negative |= value.AsRelation();
|
||||
Relation.Negative |= value.AsEnumValue<Relation>();
|
||||
else
|
||||
Relation.Positive |= value.AsRelation();
|
||||
Relation.Positive |= value.AsEnumValue<Relation>();
|
||||
break;
|
||||
|
||||
case DatItemField.Remark:
|
||||
@@ -617,9 +617,9 @@ namespace SabreTools.Filtering
|
||||
|
||||
case DatItemField.SaveStateStatus:
|
||||
if (negate)
|
||||
SaveStateStatus.Negative |= value.AsSupported();
|
||||
SaveStateStatus.Negative |= value.AsEnumValue<Supported>();
|
||||
else
|
||||
SaveStateStatus.Positive |= value.AsSupported();
|
||||
SaveStateStatus.Positive |= value.AsEnumValue<Supported>();
|
||||
break;
|
||||
|
||||
case DatItemField.Service:
|
||||
@@ -672,9 +672,9 @@ namespace SabreTools.Filtering
|
||||
|
||||
case DatItemField.SoftwareListStatus:
|
||||
if (negate)
|
||||
SoftwareListStatus.Negative |= value.AsSoftwareListStatus();
|
||||
SoftwareListStatus.Negative |= value.AsEnumValue<SoftwareListStatus>();
|
||||
else
|
||||
SoftwareListStatus.Positive |= value.AsSoftwareListStatus();
|
||||
SoftwareListStatus.Positive |= value.AsEnumValue<SoftwareListStatus>();
|
||||
break;
|
||||
|
||||
case DatItemField.SpamSum:
|
||||
@@ -683,9 +683,9 @@ namespace SabreTools.Filtering
|
||||
|
||||
case DatItemField.Status:
|
||||
if (negate)
|
||||
Status.Negative |= value.AsItemStatus();
|
||||
Status.Negative |= value.AsEnumValue<ItemStatus>();
|
||||
else
|
||||
Status.Positive |= value.AsItemStatus();
|
||||
Status.Positive |= value.AsEnumValue<ItemStatus>();
|
||||
break;
|
||||
|
||||
case DatItemField.Summation:
|
||||
@@ -694,9 +694,9 @@ namespace SabreTools.Filtering
|
||||
|
||||
case DatItemField.SupportStatus:
|
||||
if (negate)
|
||||
SupportStatus.Negative |= value.AsSupportStatus();
|
||||
SupportStatus.Negative |= value.AsEnumValue<SupportStatus>();
|
||||
else
|
||||
SupportStatus.Positive |= value.AsSupportStatus();
|
||||
SupportStatus.Positive |= value.AsEnumValue<SupportStatus>();
|
||||
break;
|
||||
|
||||
case DatItemField.Tag:
|
||||
@@ -708,7 +708,7 @@ namespace SabreTools.Filtering
|
||||
break;
|
||||
|
||||
case DatItemField.Type:
|
||||
if (value.AsItemType() == ItemType.NULL)
|
||||
if (value.AsEnumValue<ItemType>() == ItemType.NULL)
|
||||
return;
|
||||
|
||||
SetStringFilter(Type, value, negate);
|
||||
|
||||
@@ -220,9 +220,9 @@ namespace SabreTools.Filtering
|
||||
|
||||
case MachineField.Runnable:
|
||||
if (negate)
|
||||
Runnable.Negative |= value.AsRunnable();
|
||||
Runnable.Negative |= value.AsEnumValue<Runnable>();
|
||||
else
|
||||
Runnable.Positive |= value.AsRunnable();
|
||||
Runnable.Positive |= value.AsEnumValue<Runnable>();
|
||||
break;
|
||||
|
||||
case MachineField.SampleOf:
|
||||
@@ -247,9 +247,9 @@ namespace SabreTools.Filtering
|
||||
|
||||
case MachineField.Supported:
|
||||
if (negate)
|
||||
Supported.Negative |= value.AsSupported();
|
||||
Supported.Negative |= value.AsEnumValue<Supported>();
|
||||
else
|
||||
Supported.Positive |= value.AsSupported();
|
||||
Supported.Positive |= value.AsEnumValue<Supported>();
|
||||
break;
|
||||
|
||||
case MachineField.System:
|
||||
@@ -262,9 +262,9 @@ namespace SabreTools.Filtering
|
||||
|
||||
case MachineField.Type:
|
||||
if (negate)
|
||||
Type.Negative |= value.AsMachineType();
|
||||
Type.Negative |= value.AsEnumValue<MachineType>();
|
||||
else
|
||||
Type.Positive |= value.AsMachineType();
|
||||
Type.Positive |= value.AsEnumValue<MachineType>();
|
||||
break;
|
||||
|
||||
case MachineField.Year:
|
||||
|
||||
@@ -14,7 +14,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("audio", ChipType.Audio)]
|
||||
public void AsChipTypeTest(string? field, ChipType expected)
|
||||
{
|
||||
ChipType actual = field.AsChipType();
|
||||
ChipType actual = field.AsEnumValue<ChipType>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("gambling", ControlType.Gambling)]
|
||||
public void AsControlTypeTest(string? field, ControlType expected)
|
||||
{
|
||||
ControlType actual = field.AsControlType();
|
||||
ControlType actual = field.AsEnumValue<ControlType>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("vidfile", DeviceType.VidFile)]
|
||||
public void AsDeviceTypeTest(string? field, DeviceType expected)
|
||||
{
|
||||
DeviceType actual = field.AsDeviceType();
|
||||
DeviceType actual = field.AsEnumValue<DeviceType>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -123,7 +123,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("unknown", DisplayType.Unknown)]
|
||||
public void AsDisplayTypeTest(string? field, DisplayType expected)
|
||||
{
|
||||
DisplayType actual = field.AsDisplayType();
|
||||
DisplayType actual = field.AsEnumValue<DisplayType>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -133,7 +133,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("little", Endianness.Little)]
|
||||
public void AsEndiannessTest(string? field, Endianness expected)
|
||||
{
|
||||
Endianness actual = field.AsEndianness();
|
||||
Endianness actual = field.AsEnumValue<Endianness>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -143,7 +143,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("imperfect", FeatureStatus.Imperfect)]
|
||||
public void AsFeatureStatusTest(string? field, FeatureStatus expected)
|
||||
{
|
||||
FeatureStatus actual = field.AsFeatureStatus();
|
||||
FeatureStatus actual = field.AsEnumValue<FeatureStatus>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("timing", FeatureType.Timing)]
|
||||
public void AsFeatureTypeTest(string? field, FeatureType expected)
|
||||
{
|
||||
FeatureType actual = field.AsFeatureType();
|
||||
FeatureType actual = field.AsEnumValue<FeatureType>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -180,7 +180,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("verified", ItemStatus.Verified)]
|
||||
public void AsItemStatusTest(string? field, ItemStatus expected)
|
||||
{
|
||||
ItemStatus actual = field.AsItemStatus();
|
||||
ItemStatus actual = field.AsEnumValue<ItemStatus>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -241,7 +241,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("source_details", ItemType.SourceDetails)]
|
||||
public void AsItemTypeTest(string? field, ItemType expected)
|
||||
{
|
||||
ItemType actual = field.AsItemType();
|
||||
ItemType actual = field.AsEnumValue<ItemType>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -263,7 +263,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("ignore", LoadFlag.Ignore)]
|
||||
public void AsLoadFlagTest(string? field, LoadFlag expected)
|
||||
{
|
||||
LoadFlag actual = field.AsLoadFlag();
|
||||
LoadFlag actual = field.AsEnumValue<LoadFlag>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -275,7 +275,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("error", LogLevel.ERROR)]
|
||||
public void AsLogLevelTest(string? field, LogLevel expected)
|
||||
{
|
||||
LogLevel actual = field.AsLogLevel();
|
||||
LogLevel actual = field.AsEnumValue<LogLevel>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -384,7 +384,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("mechanical", MachineType.Mechanical)]
|
||||
public void AsMachineTypeTest(string? field, MachineType expected)
|
||||
{
|
||||
MachineType actual = field.AsMachineType();
|
||||
MachineType actual = field.AsEnumValue<MachineType>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -404,7 +404,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("fullunmerged", MergingFlag.FullNonMerged)]
|
||||
public void AsMergingFlagTest(string? field, MergingFlag expected)
|
||||
{
|
||||
MergingFlag actual = field.AsMergingFlag();
|
||||
MergingFlag actual = field.AsEnumValue<MergingFlag>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -416,7 +416,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("ignore", NodumpFlag.Ignore)]
|
||||
public void AsNodumpFlagTest(string? field, NodumpFlag expected)
|
||||
{
|
||||
NodumpFlag actual = field.AsNodumpFlag();
|
||||
NodumpFlag actual = field.AsEnumValue<NodumpFlag>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -427,7 +427,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("sccpluscart", OpenMSXSubType.SCCPlusCart)]
|
||||
public void AsOpenMSXSubTypeTest(string? field, OpenMSXSubType expected)
|
||||
{
|
||||
OpenMSXSubType actual = field.AsOpenMSXSubType();
|
||||
OpenMSXSubType actual = field.AsEnumValue<OpenMSXSubType>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -442,7 +442,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("flat", PackingFlag.Flat)]
|
||||
public void AsPackingFlagTest(string? field, PackingFlag expected)
|
||||
{
|
||||
PackingFlag actual = field.AsPackingFlag();
|
||||
PackingFlag actual = field.AsEnumValue<PackingFlag>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -456,7 +456,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("ge", Relation.GreaterThanOrEqual)]
|
||||
public void AsRelationTest(string? field, Relation expected)
|
||||
{
|
||||
Relation actual = field.AsRelation();
|
||||
Relation actual = field.AsEnumValue<Relation>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -467,7 +467,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("yes", Runnable.Yes)]
|
||||
public void AsRunnableTest(string? field, Runnable expected)
|
||||
{
|
||||
Runnable actual = field.AsRunnable();
|
||||
Runnable actual = field.AsEnumValue<Runnable>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -478,7 +478,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("compatible", SoftwareListStatus.Compatible)]
|
||||
public void AsSoftwareListStatusTest(string? field, SoftwareListStatus expected)
|
||||
{
|
||||
SoftwareListStatus actual = field.AsSoftwareListStatus();
|
||||
SoftwareListStatus actual = field.AsEnumValue<SoftwareListStatus>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -491,7 +491,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("supported", Supported.Yes)]
|
||||
public void AsSupportedTest(string? field, Supported expected)
|
||||
{
|
||||
Supported actual = field.AsSupported();
|
||||
Supported actual = field.AsEnumValue<Supported>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -502,7 +502,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData("preliminary", SupportStatus.Preliminary)]
|
||||
public void AsSupportStatusTest(string? field, SupportStatus expected)
|
||||
{
|
||||
SupportStatus actual = field.AsSupportStatus();
|
||||
SupportStatus actual = field.AsEnumValue<SupportStatus>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -516,7 +516,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(ChipType.Audio, "audio")]
|
||||
public void FromChipTypeTest(ChipType field, string? expected)
|
||||
{
|
||||
string? actual = field.FromChipType();
|
||||
string? actual = field.AsStringValue<ChipType>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -539,7 +539,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(ControlType.Gambling, "gambling")]
|
||||
public void FromControlTypeTest(ControlType field, string? expected)
|
||||
{
|
||||
string? actual = field.FromControlType();
|
||||
string? actual = field.AsStringValue<ControlType>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -571,7 +571,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(DeviceType.VidFile, "vidfile")]
|
||||
public void FromDeviceTypeTest(DeviceType field, string? expected)
|
||||
{
|
||||
string? actual = field.FromDeviceType();
|
||||
string? actual = field.AsStringValue<DeviceType>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -584,7 +584,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(DisplayType.Unknown, "unknown")]
|
||||
public void FromDisplayTypeTest(DisplayType field, string? expected)
|
||||
{
|
||||
string? actual = field.FromDisplayType();
|
||||
string? actual = field.AsStringValue<DisplayType>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -594,7 +594,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(Endianness.Little, "little")]
|
||||
public void FromEndiannessTest(Endianness field, string? expected)
|
||||
{
|
||||
string? actual = field.FromEndianness();
|
||||
string? actual = field.AsStringValue<Endianness>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -604,7 +604,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(FeatureStatus.Imperfect, "imperfect")]
|
||||
public void FromFeatureStatusTest(FeatureStatus field, string? expected)
|
||||
{
|
||||
string? actual = field.FromFeatureStatus();
|
||||
string? actual = field.AsStringValue<FeatureStatus>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -626,7 +626,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(FeatureType.Timing, "timing")]
|
||||
public void FromFeatureTypeTest(FeatureType field, string? expected)
|
||||
{
|
||||
string? actual = field.FromFeatureType();
|
||||
string? actual = field.AsStringValue<FeatureType>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -643,9 +643,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(ItemStatus.Nodump, false, "nodump")]
|
||||
[InlineData(ItemStatus.Verified, true, "verified")]
|
||||
[InlineData(ItemStatus.Verified, false, "verified")]
|
||||
public void FromItemStatusTest(ItemStatus field, bool yesno, string? expected)
|
||||
public void FromItemStatusTest(ItemStatus field, bool useSecond, string? expected)
|
||||
{
|
||||
string? actual = field.FromItemStatus(yesno);
|
||||
string? actual = field.AsStringValue<ItemStatus>(useSecond);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -696,7 +696,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(ItemType.SourceDetails, "source_details")]
|
||||
public void FromItemTypeTest(ItemType field, string? expected)
|
||||
{
|
||||
string? actual = field.FromItemType();
|
||||
string? actual = field.AsStringValue<ItemType>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -718,7 +718,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(LoadFlag.Ignore, "ignore")]
|
||||
public void FromLoadFlagTest(LoadFlag field, string? expected)
|
||||
{
|
||||
string? actual = field.FromLoadFlag();
|
||||
string? actual = field.AsStringValue<LoadFlag>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -735,7 +735,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(MachineType.Mechanical, false, "mechanical")]
|
||||
public void FromMachineTypeTest(MachineType field, bool old, string? expected)
|
||||
{
|
||||
string? actual = field.FromMachineType(old);
|
||||
string? actual = field.AsStringValue<MachineType>(old);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -754,9 +754,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(MergingFlag.DeviceNonMerged, false, "device")]
|
||||
[InlineData(MergingFlag.FullNonMerged, true, "fullunmerged")]
|
||||
[InlineData(MergingFlag.FullNonMerged, false, "full")]
|
||||
public void FromMergingFlagTest(MergingFlag field, bool romcenter, string? expected)
|
||||
public void FromMergingFlagTest(MergingFlag field, bool useSecond, string? expected)
|
||||
{
|
||||
string? actual = field.FromMergingFlag(romcenter);
|
||||
string? actual = field.AsStringValue<MergingFlag>(useSecond);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -767,7 +767,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(NodumpFlag.Ignore, "ignore")]
|
||||
public void FromNodumpFlagTest(NodumpFlag field, string? expected)
|
||||
{
|
||||
string? actual = field.FromNodumpFlag();
|
||||
string? actual = field.AsStringValue<NodumpFlag>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -778,7 +778,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(OpenMSXSubType.SCCPlusCart, "sccpluscart")]
|
||||
public void FromOpenMSXSubTypeTest(OpenMSXSubType field, string? expected)
|
||||
{
|
||||
string? actual = field.FromOpenMSXSubType();
|
||||
string? actual = field.AsStringValue<OpenMSXSubType>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -793,9 +793,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(PackingFlag.Partial, false, "partial")]
|
||||
[InlineData(PackingFlag.Flat, true, "flat")]
|
||||
[InlineData(PackingFlag.Flat, false, "flat")]
|
||||
public void FromPackingFlagTest(PackingFlag field, bool yesno, string? expected)
|
||||
public void FromPackingFlagTest(PackingFlag field, bool useSecond, string? expected)
|
||||
{
|
||||
string? actual = field.FromPackingFlag(yesno);
|
||||
string? actual = field.AsStringValue<PackingFlag>(useSecond);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -809,7 +809,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(Relation.GreaterThanOrEqual, "ge")]
|
||||
public void FromRelationTest(Relation field, string? expected)
|
||||
{
|
||||
string? actual = field.FromRelation();
|
||||
string? actual = field.AsStringValue<Relation>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -820,7 +820,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(Runnable.Yes, "yes")]
|
||||
public void FromRunnableTest(Runnable field, string? expected)
|
||||
{
|
||||
string? actual = field.FromRunnable();
|
||||
string? actual = field.AsStringValue<Runnable>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -830,7 +830,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(SoftwareListStatus.Compatible, "compatible")]
|
||||
public void FromSoftwareListStatusTest(SoftwareListStatus field, string? expected)
|
||||
{
|
||||
string? actual = field.FromSoftwareListStatus();
|
||||
string? actual = field.AsStringValue<SoftwareListStatus>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -843,9 +843,9 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(Supported.Partial, false, "partial")]
|
||||
[InlineData(Supported.Yes, true, "supported")]
|
||||
[InlineData(Supported.Yes, false, "yes")]
|
||||
public void FromSupportedTest(Supported field, bool verbose, string? expected)
|
||||
public void FromSupportedTest(Supported field, bool useSecond, string? expected)
|
||||
{
|
||||
string? actual = field.FromSupported(verbose);
|
||||
string? actual = field.AsStringValue<Supported>(useSecond);
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
@@ -856,7 +856,7 @@ namespace SabreTools.Test.Core
|
||||
[InlineData(SupportStatus.Preliminary, "preliminary")]
|
||||
public void FromSupportStatusTest(SupportStatus field, string? expected)
|
||||
{
|
||||
string? actual = field.FromSupportStatus();
|
||||
string? actual = field.AsStringValue<SupportStatus>();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
|
||||
@@ -1901,7 +1901,7 @@ Some special strings that can be used:
|
||||
Filter = GetFilter(features);
|
||||
FilterRunner = GetFilterRunner(features);
|
||||
Header = GetDatHeader(features);
|
||||
LogLevel = GetString(features, LogLevelStringValue).AsLogLevel();
|
||||
LogLevel = GetString(features, LogLevelStringValue).AsEnumValue<LogLevel>();
|
||||
OutputDir = GetString(features, OutputDirStringValue)?.Trim('"');
|
||||
Remover = GetRemover(features);
|
||||
ScriptMode = GetBoolean(features, ScriptValue);
|
||||
@@ -2157,9 +2157,9 @@ Some special strings that can be used:
|
||||
Description = GetString(features, DescriptionStringValue),
|
||||
Email = GetString(features, EmailStringValue),
|
||||
FileName = GetString(features, FilenameStringValue),
|
||||
ForceMerging = GetString(features, ForceMergingStringValue).AsMergingFlag(),
|
||||
ForceNodump = GetString(features, ForceNodumpStringValue).AsNodumpFlag(),
|
||||
ForcePacking = GetString(features, ForcePackingStringValue).AsPackingFlag(),
|
||||
ForceMerging = GetString(features, ForceMergingStringValue).AsEnumValue<MergingFlag>(),
|
||||
ForceNodump = GetString(features, ForceNodumpStringValue).AsEnumValue<NodumpFlag>(),
|
||||
ForcePacking = GetString(features, ForcePackingStringValue).AsEnumValue<PackingFlag>(),
|
||||
GameName = GetBoolean(features, GamePrefixValue),
|
||||
HeaderSkipper = GetString(features, HeaderStringValue),
|
||||
Homepage = GetString(features, HomepageStringValue),
|
||||
|
||||
@@ -568,7 +568,7 @@ Reset the internal state: reset();";
|
||||
}
|
||||
|
||||
// Read in the individual arguments
|
||||
MergingFlag mergingFlag = Arguments[0].AsMergingFlag();
|
||||
MergingFlag mergingFlag = Arguments[0].AsEnumValue<MergingFlag>();
|
||||
|
||||
// If we had an invalid input, log and continue
|
||||
if (mergingFlag == MergingFlag.None)
|
||||
@@ -584,7 +584,7 @@ Reset the internal state: reset();";
|
||||
public override void Process(BatchState batchState)
|
||||
{
|
||||
// Read in the individual arguments
|
||||
MergingFlag mergingFlag = Arguments[0].AsMergingFlag();
|
||||
MergingFlag mergingFlag = Arguments[0].AsEnumValue<MergingFlag>();
|
||||
|
||||
// Apply the merging flag
|
||||
Filtering.Splitter splitter = new() { SplitType = mergingFlag };
|
||||
|
||||
Reference in New Issue
Block a user