Remove DatItemField enum

This commit is contained in:
Matt Nadareski
2024-03-05 23:41:00 -05:00
parent e90c74e145
commit b9f6a6862d
23 changed files with 232 additions and 792 deletions

View File

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