mirror of
https://github.com/SabreTools/SabreTools.Serialization.git
synced 2026-07-08 18:06:41 +00:00
This enum no longer has use
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
using Xunit;
|
||||
|
||||
namespace SabreTools.Metadata.DatItems.Test
|
||||
{
|
||||
public class ExtensionsTests
|
||||
{
|
||||
#region String to Enum
|
||||
|
||||
[Theory]
|
||||
[InlineData(null, MachineType.None)]
|
||||
[InlineData("none", MachineType.None)]
|
||||
[InlineData("bios", MachineType.Bios)]
|
||||
[InlineData("dev", MachineType.Device)]
|
||||
[InlineData("device", MachineType.Device)]
|
||||
[InlineData("mech", MachineType.Mechanical)]
|
||||
[InlineData("mechanical", MachineType.Mechanical)]
|
||||
public void AsMachineTypeTest(string? field, MachineType expected)
|
||||
{
|
||||
MachineType actual = field.AsMachineType();
|
||||
Assert.Equal(expected, actual);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -40,23 +40,4 @@ namespace SabreTools.Metadata.DatItems
|
||||
SHA512,
|
||||
SpamSum,
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determine what type of machine it is
|
||||
/// </summary>
|
||||
[Flags]
|
||||
public enum MachineType
|
||||
{
|
||||
/// <summary>"none"</summary>
|
||||
None = 0,
|
||||
|
||||
/// <summary>"bios"</summary>
|
||||
Bios = 1 << 0,
|
||||
|
||||
/// <summary>"device", "dev"</summary>
|
||||
Device = 1 << 1,
|
||||
|
||||
/// <summary>"mechanical", "mech"</summary>
|
||||
Mechanical = 1 << 2,
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,26 +0,0 @@
|
||||
namespace SabreTools.Metadata.DatItems
|
||||
{
|
||||
public static class Extensions
|
||||
{
|
||||
#region String to Enum
|
||||
|
||||
/// <summary>
|
||||
/// Get the enum value for an input string, if possible
|
||||
/// </summary>
|
||||
/// <param name="value">String value to parse/param>
|
||||
/// <returns>Enum value representing the input, default on error</returns>
|
||||
public static MachineType AsMachineType(this string? value)
|
||||
{
|
||||
return value?.ToLowerInvariant() switch
|
||||
{
|
||||
"none" => MachineType.None,
|
||||
"bios" => MachineType.Bios,
|
||||
"device" or "dev" => MachineType.Device,
|
||||
"mechanical" or "mech" => MachineType.Mechanical,
|
||||
_ => MachineType.None,
|
||||
};
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user