[Enums, DatFile, Machine] Machine types never overlap

This commit is contained in:
Matt Nadareski
2017-01-08 22:48:19 -08:00
parent 6419f8af5f
commit 37b6a4303d
3 changed files with 27 additions and 23 deletions

View File

@@ -282,7 +282,18 @@
BadDump = 2, BadDump = 2,
Nodump = 3, Nodump = 3,
Verified = 4, Verified = 4,
NotNodump = 5, // This is a fake flag that is used for filter only }
/// <summary>
/// Determine what type of machine it is
/// </summary>
public enum MachineType
{
NULL = -1, // This is a fake flag used for filter only
None = 0,
Bios = 1,
Device = 2,
Mechanical = 3,
} }
#endregion #endregion

View File

@@ -1,4 +1,6 @@
namespace SabreTools.Helper.Dats using SabreTools.Helper.Data;
namespace SabreTools.Helper.Dats
{ {
public class Machine public class Machine
{ {
@@ -14,12 +16,10 @@
protected string _cloneOf; protected string _cloneOf;
protected string _sampleOf; protected string _sampleOf;
protected string _sourceFile; protected string _sourceFile;
protected bool _isBios;
protected bool _isDevice;
protected bool _isMechanical;
protected bool _runnable; protected bool _runnable;
protected string _board; protected string _board;
protected string _rebuildTo; protected string _rebuildTo;
protected MachineType _machineType;
#endregion #endregion
@@ -71,21 +71,6 @@
get { return _sourceFile; } get { return _sourceFile; }
set { _sourceFile = value; } set { _sourceFile = value; }
} }
public bool IsBios
{
get { return _isBios; }
set { _isBios = value; }
}
public bool IsDevice
{
get { return _isDevice; }
set { _isDevice = value; }
}
public bool IsMechanical
{
get { return _isMechanical; }
set { _isMechanical = value; }
}
public bool Runnable public bool Runnable
{ {
get { return _runnable; } get { return _runnable; }
@@ -101,6 +86,11 @@
get { return _rebuildTo; } get { return _rebuildTo; }
set { _rebuildTo = value; } set { _rebuildTo = value; }
} }
public MachineType MachineType
{
get { return _machineType; }
set { _machineType = value; }
}
#endregion #endregion

View File

@@ -1249,9 +1249,11 @@ namespace SabreTools.Helper.Dats
CloneOf = xtr.GetAttribute("cloneof") ?? "", CloneOf = xtr.GetAttribute("cloneof") ?? "",
SampleOf = xtr.GetAttribute("sampleof") ?? "", SampleOf = xtr.GetAttribute("sampleof") ?? "",
IsBios = xtr.GetAttribute("isbios") == "yes", MachineType =
IsDevice = xtr.GetAttribute("isdevice") == "yes", xtr.GetAttribute("isbios") == "yes" ? MachineType.Bios :
IsMechanical = xtr.GetAttribute("ismechanical") == "yes", xtr.GetAttribute("isdevice") == "yes" ? MachineType.Device :
xtr.GetAttribute("ismechanical") == "yes" ? MachineType.Mechanical :
MachineType.None,
Runnable = xtr.GetAttribute("runnable") == "yes", Runnable = xtr.GetAttribute("runnable") == "yes",
}; };
@@ -1268,6 +1270,7 @@ namespace SabreTools.Helper.Dats
} }
} }
if (superdat && !keep) if (superdat && !keep)
{ {
string tempout = Regex.Match(machine.Name, @".*?\\(.*)").Groups[1].Value; string tempout = Regex.Match(machine.Name, @".*?\\(.*)").Groups[1].Value;