Remove MachineField enum

This commit is contained in:
Matt Nadareski
2024-03-05 22:59:41 -05:00
parent 03c6fb641c
commit e90c74e145
4 changed files with 26 additions and 320 deletions

View File

@@ -69,36 +69,6 @@ namespace SabreTools.Core.Tools
return AsEnumValue<DatItemField>(itemInput);
}
/// <summary>
/// Get MachineField value from input string
/// </summary>
/// <param name="input">String to get value from</param>
/// <returns>MachineField value corresponding to the string</returns>
public static MachineField AsMachineField(this string? input)
{
// If the input is empty, we return null
if (string.IsNullOrEmpty(input))
return MachineField.NULL;
// Normalize the input
input = input!.ToLowerInvariant();
// Create regex
string machineRegex = @"^(game|machine)[.\-_\s]";
// If we don't have a machine field, skip
if (!Regex.IsMatch(input, machineRegex))
return MachineField.NULL;
// Replace the match and re-normalize
string machineInput = Regex.Replace(input, machineRegex, string.Empty)
.Replace(' ', '_')
.Replace('-', '_')
.Replace('.', '_');
return AsEnumValue<MachineField>(machineInput);
}
/// <summary>
/// Get bool? value from input string
/// </summary>