Remove MachineType.None (dupe of NULL)

This commit is contained in:
Matt Nadareski
2020-08-24 13:53:53 -07:00
parent 85dc985c67
commit 77cdda1c6e
8 changed files with 13 additions and 16 deletions

View File

@@ -199,7 +199,7 @@ namespace SabreTools.Library.DatFiles
bool containsItems = false; bool containsItems = false;
Machine machine = new Machine() Machine machine = new Machine()
{ {
MachineType = (resource ? MachineType.Bios : MachineType.None), MachineType = (resource ? MachineType.Bios : MachineType.NULL),
}; };
// If there's no subtree to the header, skip it // If there's no subtree to the header, skip it

View File

@@ -150,7 +150,7 @@ namespace SabreTools.Library.DatFiles
bool containsItems = false; bool containsItems = false;
Machine machine = new Machine() Machine machine = new Machine()
{ {
MachineType = MachineType.None, MachineType = MachineType.NULL,
}; };
// If there's no subtree to the header, skip it // If there's no subtree to the header, skip it

View File

@@ -145,7 +145,7 @@ namespace SabreTools.Library.DatFiles
CloneOf = reader.GetAttribute("cloneof"), CloneOf = reader.GetAttribute("cloneof"),
RomOf = reader.GetAttribute("romof"), RomOf = reader.GetAttribute("romof"),
SampleOf = reader.GetAttribute("sampleof"), SampleOf = reader.GetAttribute("sampleof"),
MachineType = (machineType == MachineType.NULL ? MachineType.None : machineType), MachineType = (machineType == MachineType.NULL ? MachineType.NULL : machineType),
SourceFile = reader.GetAttribute("sourcefile"), SourceFile = reader.GetAttribute("sourcefile"),
Runnable = reader.GetAttribute("runnable").AsRunnable(), Runnable = reader.GetAttribute("runnable").AsRunnable(),

View File

@@ -321,7 +321,7 @@ namespace SabreTools.Library.DatFiles
RomOf = reader.GetAttribute("romof"), RomOf = reader.GetAttribute("romof"),
SampleOf = reader.GetAttribute("sampleof"), SampleOf = reader.GetAttribute("sampleof"),
MachineType = (machineType == MachineType.NULL ? MachineType.None : machineType), MachineType = (machineType == MachineType.NULL ? MachineType.NULL : machineType),
}; };
if (Header.Type == "SuperDAT" && !keep) if (Header.Type == "SuperDAT" && !keep)

View File

@@ -149,7 +149,7 @@ namespace SabreTools.Library.DatFiles
SharedFeatures = new List<SoftwareListSharedFeature>(), SharedFeatures = new List<SoftwareListSharedFeature>(),
DipSwitches = new List<ListXmlDipSwitch>(), DipSwitches = new List<ListXmlDipSwitch>(),
MachineType = (machineType == MachineType.NULL ? MachineType.None : machineType), MachineType = (machineType != MachineType.NULL ? machineType : MachineType.NULL),
}; };
while (!reader.EOF) while (!reader.EOF)

View File

@@ -236,15 +236,10 @@ namespace SabreTools.Library.DatItems
[Flags] [Flags]
public enum MachineType public enum MachineType
{ {
/// <summary>
/// This is a fake flag that is used for filter only
/// </summary>
NULL = 0x00, NULL = 0x00,
Bios = 1 << 0,
None = 1 << 0, Device = 1 << 1,
Bios = 1 << 1, Mechanical = 1 << 2,
Device = 1 << 2,
Mechanical = 1 << 3,
} }
/// <summary> /// <summary>

View File

@@ -5,6 +5,7 @@ using System.Linq;
using SabreTools.Library.Filtering; using SabreTools.Library.Filtering;
using SabreTools.Library.Tools; using SabreTools.Library.Tools;
using Newtonsoft.Json; using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
namespace SabreTools.Library.DatItems namespace SabreTools.Library.DatItems
{ {
@@ -83,6 +84,7 @@ namespace SabreTools.Library.DatItems
/// Type of the machine /// Type of the machine
/// </summary> /// </summary>
[JsonProperty("type", DefaultValueHandling = DefaultValueHandling.Ignore)] [JsonProperty("type", DefaultValueHandling = DefaultValueHandling.Ignore)]
[JsonConverter(typeof(StringEnumConverter))]
public MachineType MachineType { get; set; } = MachineType.NULL; public MachineType MachineType { get; set; } = MachineType.NULL;
#endregion #endregion

View File

@@ -603,7 +603,7 @@ namespace SabreTools.Library.Tools
return MachineType.Mechanical; return MachineType.Mechanical;
case "none": case "none":
default: default:
return MachineType.None; return MachineType.NULL;
} }
#else #else
return gametype?.ToLowerInvariant() switch return gametype?.ToLowerInvariant() switch
@@ -613,8 +613,8 @@ namespace SabreTools.Library.Tools
"device" => MachineType.Device, "device" => MachineType.Device,
"mech" => MachineType.Mechanical, "mech" => MachineType.Mechanical,
"mechanical" => MachineType.Mechanical, "mechanical" => MachineType.Mechanical,
"none" => MachineType.None, "none" => MachineType.NULL,
_ => MachineType.None, _ => MachineType.NULL,
}; };
#endif #endif
} }