[DatFile] Make runnable flag better

This commit is contained in:
Matt Nadareski
2017-02-02 23:04:24 -08:00
parent 4e30054d30
commit 04e5980e01
4 changed files with 19 additions and 7 deletions

View File

@@ -19,7 +19,7 @@ namespace SabreTools.Helper.Dats
protected string _cloneOf;
protected string _sampleOf;
protected string _sourceFile;
protected bool _runnable;
protected bool? _runnable;
protected string _board;
protected string _rebuildTo;
protected List<string> _devices;
@@ -75,7 +75,7 @@ namespace SabreTools.Helper.Dats
get { return _sourceFile; }
set { _sourceFile = value; }
}
public bool Runnable
public bool? Runnable
{
get { return _runnable; }
set { _runnable = value; }
@@ -112,7 +112,7 @@ namespace SabreTools.Helper.Dats
{
_name = "";
_description = "";
_runnable = true;
_runnable = null;
}
/// <summary>
@@ -124,7 +124,7 @@ namespace SabreTools.Helper.Dats
{
_name = name;
_description = description;
_runnable = true;
_runnable = null;
}
#endregion

View File

@@ -437,7 +437,6 @@ namespace SabreTools.Helper.Dats
{
Name = gamename,
Description = gamename,
Runnable = false,
};
}
else

View File

@@ -1274,7 +1274,6 @@ namespace SabreTools.Helper.Dats
xtr.GetAttribute("isdevice") == "yes" ? MachineType.Device :
xtr.GetAttribute("ismechanical") == "yes" ? MachineType.Mechanical :
MachineType.None,
Runnable = xtr.GetAttribute("runnable") == "yes" || xtr.GetAttribute("runnable") == null,
};
// Get the supported value from the reader
@@ -1291,6 +1290,20 @@ namespace SabreTools.Helper.Dats
}
}
// Get the runnable value from the reader
if (subreader.GetAttribute("runnable") != null)
{
switch (subreader.GetAttribute("runnable"))
{
case "no":
machine.Runnable = false;
break;
case "yes":
machine.Runnable = true;
break;
}
}
if (superdat && !keep)
{
string tempout = Regex.Match(machine.Name, @".*?\\(.*)").Groups[1].Value;

View File

@@ -488,7 +488,7 @@ namespace SabreTools.Helper.Dats
(rom.Machine.MachineType == MachineType.Bios ? " isbios=\"yes\"" : "") +
(rom.Machine.MachineType == MachineType.Device ? " isdevice=\"yes\"" : "") +
(rom.Machine.MachineType == MachineType.Mechanical ? " ismechanical=\"yes\"" : "") +
(rom.Machine.Runnable ? " runnable=\"yes\"" : "") +
(rom.Machine.Runnable == true ? " runnable=\"yes\"" : "") +
(String.IsNullOrEmpty(rom.Machine.CloneOf) || (rom.Machine.Name.ToLowerInvariant() == rom.Machine.CloneOf.ToLowerInvariant())
? ""
: " cloneof=\"" + HttpUtility.HtmlEncode(rom.Machine.CloneOf) + "\"") +