So many fields and TODOs...

This commit is contained in:
Matt Nadareski
2020-08-24 22:25:47 -07:00
parent 3c7d80fa05
commit dab673246e
24 changed files with 1026 additions and 705 deletions

View File

@@ -93,7 +93,7 @@ contents of any changed dats.";
} }
} }
datroot.Items.BucketBy(Field.MachineName, DedupeType.None, norename: true); datroot.Items.BucketBy(Field.Machine_Name, DedupeType.None, norename: true);
watch.Stop(); watch.Stop();

View File

@@ -14,16 +14,8 @@ namespace SabreTools.Library.DatFiles
{ {
public string Name { get; set; } public string Name { get; set; }
public bool? Visible { get; set; } public bool? Visible { get; set; }
public bool? IsNamingOption { get; set; } public bool? InNamingOption { get; set; }
public bool? Default { get; set; } public bool? Default { get; set; }
public OfflineListInfo(string name, bool? visible, bool? isNamingOption, bool? def)
{
Name = name;
Visible = visible;
IsNamingOption = isNamingOption;
Default = def;
}
} }
#endregion #endregion

View File

@@ -286,8 +286,8 @@ namespace SabreTools.Library.DatFiles
if (updateFields.Intersect(DatItem.MachineFields).Any()) if (updateFields.Intersect(DatItem.MachineFields).Any())
{ {
// For comparison's sake, we want to use Machine Name as the base bucketing // For comparison's sake, we want to use Machine Name as the base bucketing
Items.BucketBy(Field.MachineName, DedupeType.Full); Items.BucketBy(Field.Machine_Name, DedupeType.Full);
intDat.Items.BucketBy(Field.MachineName, DedupeType.None); intDat.Items.BucketBy(Field.Machine_Name, DedupeType.None);
// Then we do a namewise comparison against the base DAT // Then we do a namewise comparison against the base DAT
Parallel.ForEach(intDat.Items.Keys, Globals.ParallelOptions, key => Parallel.ForEach(intDat.Items.Keys, Globals.ParallelOptions, key =>
@@ -360,7 +360,7 @@ namespace SabreTools.Library.DatFiles
{ {
// For comparison's sake, we want to use a base ordering // For comparison's sake, we want to use a base ordering
if (useGames) if (useGames)
Items.BucketBy(Field.MachineName, DedupeType.None); Items.BucketBy(Field.Machine_Name, DedupeType.None);
else else
Items.BucketBy(Field.CRC, DedupeType.None); Items.BucketBy(Field.CRC, DedupeType.None);
@@ -377,7 +377,7 @@ namespace SabreTools.Library.DatFiles
// For comparison's sake, we want to a the base bucketing // For comparison's sake, we want to a the base bucketing
if (useGames) if (useGames)
intDat.Items.BucketBy(Field.MachineName, DedupeType.None); intDat.Items.BucketBy(Field.Machine_Name, DedupeType.None);
else else
intDat.Items.BucketBy(Field.CRC, DedupeType.Full); intDat.Items.BucketBy(Field.CRC, DedupeType.Full);
@@ -943,7 +943,7 @@ namespace SabreTools.Library.DatFiles
try try
{ {
// Bucket by game first // Bucket by game first
Items.BucketBy(Field.MachineName, DedupeType.None); Items.BucketBy(Field.Machine_Name, DedupeType.None);
// Create a new set of mappings based on the items // Create a new set of mappings based on the items
var map = new Dictionary<string, Dictionary<Field, string>>(); var map = new Dictionary<string, Dictionary<Field, string>>();
@@ -1193,7 +1193,7 @@ namespace SabreTools.Library.DatFiles
public void OneGamePerRegion() public void OneGamePerRegion()
{ {
// For sake of ease, the first thing we want to do is bucket by game // For sake of ease, the first thing we want to do is bucket by game
Items.BucketBy(Field.MachineName, DedupeType.None, norename: true); Items.BucketBy(Field.Machine_Name, DedupeType.None, norename: true);
// Then we want to get a mapping of all machines to parents // Then we want to get a mapping of all machines to parents
Dictionary<string, List<string>> parents = new Dictionary<string, List<string>>(); Dictionary<string, List<string>> parents = new Dictionary<string, List<string>>();
@@ -1382,7 +1382,7 @@ namespace SabreTools.Library.DatFiles
Globals.Logger.User("Creating device non-merged sets from the DAT"); Globals.Logger.User("Creating device non-merged sets from the DAT");
// For sake of ease, the first thing we want to do is bucket by game // For sake of ease, the first thing we want to do is bucket by game
Items.BucketBy(Field.MachineName, mergeroms, norename: true); Items.BucketBy(Field.Machine_Name, mergeroms, norename: true);
// Now we want to loop through all of the games and set the correct information // Now we want to loop through all of the games and set the correct information
while (AddRomsFromDevices(false, false)) ; while (AddRomsFromDevices(false, false)) ;
@@ -1401,7 +1401,7 @@ namespace SabreTools.Library.DatFiles
Globals.Logger.User("Creating fully non-merged sets from the DAT"); Globals.Logger.User("Creating fully non-merged sets from the DAT");
// For sake of ease, the first thing we want to do is bucket by game // For sake of ease, the first thing we want to do is bucket by game
Items.BucketBy(Field.MachineName, mergeroms, norename: true); Items.BucketBy(Field.Machine_Name, mergeroms, norename: true);
// Now we want to loop through all of the games and set the correct information // Now we want to loop through all of the games and set the correct information
while (AddRomsFromDevices(true, true)) ; while (AddRomsFromDevices(true, true)) ;
@@ -1424,7 +1424,7 @@ namespace SabreTools.Library.DatFiles
Globals.Logger.User("Creating merged sets from the DAT"); Globals.Logger.User("Creating merged sets from the DAT");
// For sake of ease, the first thing we want to do is bucket by game // For sake of ease, the first thing we want to do is bucket by game
Items.BucketBy(Field.MachineName, mergeroms, norename: true); Items.BucketBy(Field.Machine_Name, mergeroms, norename: true);
// Now we want to loop through all of the games and set the correct information // Now we want to loop through all of the games and set the correct information
AddRomsFromChildren(); AddRomsFromChildren();
@@ -1446,7 +1446,7 @@ namespace SabreTools.Library.DatFiles
Globals.Logger.User("Creating non-merged sets from the DAT"); Globals.Logger.User("Creating non-merged sets from the DAT");
// For sake of ease, the first thing we want to do is bucket by game // For sake of ease, the first thing we want to do is bucket by game
Items.BucketBy(Field.MachineName, mergeroms, norename: true); Items.BucketBy(Field.Machine_Name, mergeroms, norename: true);
// Now we want to loop through all of the games and set the correct information // Now we want to loop through all of the games and set the correct information
AddRomsFromParent(); AddRomsFromParent();
@@ -1468,7 +1468,7 @@ namespace SabreTools.Library.DatFiles
Globals.Logger.User("Creating split sets from the DAT"); Globals.Logger.User("Creating split sets from the DAT");
// For sake of ease, the first thing we want to do is bucket by game // For sake of ease, the first thing we want to do is bucket by game
Items.BucketBy(Field.MachineName, mergeroms, norename: true); Items.BucketBy(Field.Machine_Name, mergeroms, norename: true);
// Now we want to loop through all of the games and set the correct information // Now we want to loop through all of the games and set the correct information
RemoveRomsFromChild(); RemoveRomsFromChild();
@@ -3501,7 +3501,7 @@ namespace SabreTools.Library.DatFiles
public bool SplitByLevel(string outDir, bool shortname, bool basedat) public bool SplitByLevel(string outDir, bool shortname, bool basedat)
{ {
// First, bucket by games so that we can do the right thing // First, bucket by games so that we can do the right thing
Items.BucketBy(Field.MachineName, DedupeType.None, lower: false, norename: true); Items.BucketBy(Field.Machine_Name, DedupeType.None, lower: false, norename: true);
// Create a temporary DAT to add things to // Create a temporary DAT to add things to
DatFile tempDat = Create(Header); DatFile tempDat = Create(Header);
@@ -3762,7 +3762,7 @@ namespace SabreTools.Library.DatFiles
if (Items.RomCount + Items.DiskCount == 0) if (Items.RomCount + Items.DiskCount == 0)
Items.RecalculateStats(); Items.RecalculateStats();
Items.BucketBy(Field.MachineName, DedupeType.None, norename: true); Items.BucketBy(Field.Machine_Name, DedupeType.None, norename: true);
var consoleOutput = BaseReport.Create(StatReportFormat.None, null, true, true); var consoleOutput = BaseReport.Create(StatReportFormat.None, null, true, true);
consoleOutput.ReplaceStatistics(Header.FileName, Items.Keys.Count(), Items); consoleOutput.ReplaceStatistics(Header.FileName, Items.Keys.Count(), Items);
@@ -3772,10 +3772,10 @@ namespace SabreTools.Library.DatFiles
if (Header.DedupeRoms == DedupeType.Full) if (Header.DedupeRoms == DedupeType.Full)
Items.BucketBy(Field.CRC, Header.DedupeRoms, norename: norename); Items.BucketBy(Field.CRC, Header.DedupeRoms, norename: norename);
else if (Header.DedupeRoms == DedupeType.Game) else if (Header.DedupeRoms == DedupeType.Game)
Items.BucketBy(Field.MachineName, Header.DedupeRoms, norename: norename); Items.BucketBy(Field.Machine_Name, Header.DedupeRoms, norename: norename);
// Bucket roms by game name, if not already // Bucket roms by game name, if not already
Items.BucketBy(Field.MachineName, DedupeType.None, norename: norename); Items.BucketBy(Field.Machine_Name, DedupeType.None, norename: norename);
// Output the number of items we're going to be writing // Output the number of items we're going to be writing
Globals.Logger.User($"A total of {Items.TotalCount} items will be written out to '{Header.FileName}'"); Globals.Logger.User($"A total of {Items.TotalCount} items will be written out to '{Header.FileName}'");

View File

@@ -126,54 +126,6 @@ namespace SabreTools.Library.DatFiles
[JsonIgnore] [JsonIgnore]
public DatFormat DatFormat { get; set; } public DatFormat DatFormat { get; set; }
/// <summary>
/// Dictionary of fields in machine and items to exclude from writing
/// </summary>
[JsonIgnore]
public List<Field> ExcludeFields { get; set; } = new List<Field>();
/// <summary>
/// Enable "One Rom, One Region (1G1R)" mode
/// </summary>
[JsonIgnore]
public bool OneGamePerRegion { get; set; }
/// <summary>
/// Ordered list of regions for "One Rom, One Region (1G1R)" mode
/// </summary>
[JsonIgnore]
public List<string> RegionList { get; set; }
/// <summary>
/// Ensure each rom is in their own game
/// </summary>
[JsonIgnore]
public bool OneRomPerGame { get; set; }
/// <summary>
/// Keep machines that don't contain any items
/// </summary>
[JsonIgnore]
public bool KeepEmptyGames { get; set; }
/// <summary>
/// Remove scene dates from the beginning of machine names
/// </summary>
[JsonIgnore]
public bool SceneDateStrip { get; set; }
/// <summary>
/// Deduplicate items using the given method
/// </summary>
[JsonIgnore]
public DedupeType DedupeRoms { get; set; }
/// <summary>
/// Strip hash types from items
/// </summary>
[JsonIgnore]
public Hash StripHash { get; private set; }
#endregion #endregion
#region ListXML Fields #region ListXML Fields
@@ -309,6 +261,59 @@ namespace SabreTools.Library.DatFiles
[JsonProperty("rcversion", DefaultValueHandling = DefaultValueHandling.Ignore)] [JsonProperty("rcversion", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string RomCenterVersion { get; set; } public string RomCenterVersion { get; set; }
#endregion
#region Filtering Fields
/// <summary>
/// Dictionary of fields in machine and items to exclude from writing
/// </summary>
[JsonIgnore]
public List<Field> ExcludeFields { get; set; } = new List<Field>();
/// <summary>
/// Enable "One Rom, One Region (1G1R)" mode
/// </summary>
[JsonIgnore]
public bool OneGamePerRegion { get; set; }
/// <summary>
/// Ordered list of regions for "One Rom, One Region (1G1R)" mode
/// </summary>
[JsonIgnore]
public List<string> RegionList { get; set; }
/// <summary>
/// Ensure each rom is in their own game
/// </summary>
[JsonIgnore]
public bool OneRomPerGame { get; set; }
/// <summary>
/// Keep machines that don't contain any items
/// </summary>
[JsonIgnore]
public bool KeepEmptyGames { get; set; }
/// <summary>
/// Remove scene dates from the beginning of machine names
/// </summary>
[JsonIgnore]
public bool SceneDateStrip { get; set; }
/// <summary>
/// Deduplicate items using the given method
/// </summary>
[JsonIgnore]
public DedupeType DedupeRoms { get; set; }
/// <summary>
/// Strip hash types from items
/// </summary>
[JsonIgnore]
public Hash StripHash { get; private set; }
#endregion #endregion
#region Write pre-processing #region Write pre-processing

View File

@@ -647,7 +647,7 @@ namespace SabreTools.Library.DatFiles
DatItem.Sort(ref sortedlist, false); DatItem.Sort(ref sortedlist, false);
// If we're merging the roms, do so // If we're merging the roms, do so
if (dedupeType == DedupeType.Full || (dedupeType == DedupeType.Game && bucketBy == Field.MachineName)) if (dedupeType == DedupeType.Full || (dedupeType == DedupeType.Game && bucketBy == Field.Machine_Name))
sortedlist = DatItem.Merge(sortedlist); sortedlist = DatItem.Merge(sortedlist);
// Add the list back to the dictionary // Add the list back to the dictionary
@@ -1027,7 +1027,7 @@ namespace SabreTools.Library.DatFiles
Globals.Logger.Verbose($"Beginning stat collection for '{file}'", false); Globals.Logger.Verbose($"Beginning stat collection for '{file}'", false);
List<string> games = new List<string>(); List<string> games = new List<string>();
DatFile datdata = DatFile.CreateAndParse(file.CurrentPath); DatFile datdata = DatFile.CreateAndParse(file.CurrentPath);
datdata.Items.BucketBy(Field.MachineName, DedupeType.None, norename: true); datdata.Items.BucketBy(Field.Machine_Name, DedupeType.None, norename: true);
// Output single DAT stats (if asked) // Output single DAT stats (if asked)
Globals.Logger.User($"Adding stats for file '{file}'\n", false); Globals.Logger.User($"Adding stats for file '{file}'\n", false);

View File

@@ -148,15 +148,6 @@ namespace SabreTools.Library.DatFiles
SourceFile = reader.GetAttribute("sourcefile"), SourceFile = reader.GetAttribute("sourcefile"),
Runnable = reader.GetAttribute("runnable").AsRunnable(), Runnable = reader.GetAttribute("runnable").AsRunnable(),
DeviceReferences = new List<ListXmlDeviceReference>(),
Chips = new List<ListXmlChip>(),
Displays = new List<ListXmlDisplay>(),
Sounds = new List<ListXmlSound>(),
Conditions = new List<ListXmlCondition>(),
Inputs = new List<ListXmlInput>(),
DipSwitches = new List<ListXmlDipSwitch>(),
Configurations = new List<ListXmlConfiguration>(),
Slots = new List<ListXmlSlot>(),
}; };
// Get list for new DatItems // Get list for new DatItems
@@ -267,6 +258,10 @@ namespace SabreTools.Library.DatFiles
var deviceReference = new ListXmlDeviceReference(); var deviceReference = new ListXmlDeviceReference();
deviceReference.Name = reader.GetAttribute("name"); deviceReference.Name = reader.GetAttribute("name");
// Ensure the list exists
if (machine.DeviceReferences == null)
machine.DeviceReferences = new List<ListXmlDeviceReference>();
machine.DeviceReferences.Add(deviceReference); machine.DeviceReferences.Add(deviceReference);
reader.Read(); reader.Read();
@@ -294,6 +289,10 @@ namespace SabreTools.Library.DatFiles
chip.Type = reader.GetAttribute("type"); chip.Type = reader.GetAttribute("type");
chip.Clock = reader.GetAttribute("clock"); chip.Clock = reader.GetAttribute("clock");
// Ensure the list exists
if (machine.DeviceReferences == null)
machine.DeviceReferences = new List<ListXmlDeviceReference>();
machine.Chips.Add(chip); machine.Chips.Add(chip);
reader.Read(); reader.Read();
@@ -310,11 +309,15 @@ namespace SabreTools.Library.DatFiles
display.Refresh = reader.GetAttribute("refresh"); display.Refresh = reader.GetAttribute("refresh");
display.PixClock = reader.GetAttribute("pixclock"); display.PixClock = reader.GetAttribute("pixclock");
display.HTotal = reader.GetAttribute("htotal"); display.HTotal = reader.GetAttribute("htotal");
display.HBend = reader.GetAttribute("hbend"); display.HBEnd = reader.GetAttribute("hbend");
display.HStart = reader.GetAttribute("hstart"); display.HBStart = reader.GetAttribute("hstart");
display.VTotal = reader.GetAttribute("vtotal"); display.VTotal = reader.GetAttribute("vtotal");
display.VBend = reader.GetAttribute("vbend"); display.VBEnd = reader.GetAttribute("vbend");
display.VStart = reader.GetAttribute("vstart"); display.VBStart = reader.GetAttribute("vstart");
// Ensure the list exists
if (machine.DeviceReferences == null)
machine.DeviceReferences = new List<ListXmlDeviceReference>();
machine.Displays.Add(display); machine.Displays.Add(display);
@@ -325,6 +328,10 @@ namespace SabreTools.Library.DatFiles
var sound = new ListXmlSound(); var sound = new ListXmlSound();
sound.Channels = reader.GetAttribute("channels"); sound.Channels = reader.GetAttribute("channels");
// Ensure the list exists
if (machine.DeviceReferences == null)
machine.DeviceReferences = new List<ListXmlDeviceReference>();
machine.Sounds.Add(sound); machine.Sounds.Add(sound);
reader.Read(); reader.Read();
@@ -337,6 +344,10 @@ namespace SabreTools.Library.DatFiles
condition.Relation = reader.GetAttribute("relation"); condition.Relation = reader.GetAttribute("relation");
condition.Value = reader.GetAttribute("value"); condition.Value = reader.GetAttribute("value");
// Ensure the list exists
if (machine.DeviceReferences == null)
machine.DeviceReferences = new List<ListXmlDeviceReference>();
machine.Conditions.Add(condition); machine.Conditions.Add(condition);
reader.Read(); reader.Read();
@@ -352,6 +363,10 @@ namespace SabreTools.Library.DatFiles
// Now read the internal tags // Now read the internal tags
ReadInput(reader.ReadSubtree(), input); ReadInput(reader.ReadSubtree(), input);
// Ensure the list exists
if (machine.DeviceReferences == null)
machine.DeviceReferences = new List<ListXmlDeviceReference>();
machine.Inputs.Add(input); machine.Inputs.Add(input);
// Skip the input now that we've processed it // Skip the input now that we've processed it
@@ -367,6 +382,10 @@ namespace SabreTools.Library.DatFiles
// Now read the internal tags // Now read the internal tags
ReadDipSwitch(reader.ReadSubtree(), dipSwitch); ReadDipSwitch(reader.ReadSubtree(), dipSwitch);
// Ensure the list exists
if (machine.DeviceReferences == null)
machine.DeviceReferences = new List<ListXmlDeviceReference>();
machine.DipSwitches.Add(dipSwitch); machine.DipSwitches.Add(dipSwitch);
// Skip the dipswitch now that we've processed it // Skip the dipswitch now that we've processed it
@@ -382,6 +401,10 @@ namespace SabreTools.Library.DatFiles
// Now read the internal tags // Now read the internal tags
ReadConfiguration(reader.ReadSubtree(), configuration); ReadConfiguration(reader.ReadSubtree(), configuration);
// Ensure the list exists
if (machine.DeviceReferences == null)
machine.DeviceReferences = new List<ListXmlDeviceReference>();
machine.Configurations.Add(configuration); machine.Configurations.Add(configuration);
// Skip the configuration now that we've processed it // Skip the configuration now that we've processed it
@@ -389,19 +412,23 @@ namespace SabreTools.Library.DatFiles
break; break;
case "port": case "port":
// TODO: Use these ports
var port = new ListXmlPort(); var port = new ListXmlPort();
port.Tag = reader.GetAttribute("tag"); port.Tag = reader.GetAttribute("tag");
// Now read the internal tags // Now read the internal tags
ReadPort(reader.ReadSubtree(), port); ReadPort(reader.ReadSubtree(), port);
// Ensure the list exists
if (machine.DeviceReferences == null)
machine.DeviceReferences = new List<ListXmlDeviceReference>();
machine.Ports.Add(port);
// Skip the port now that we've processed it // Skip the port now that we've processed it
reader.Skip(); reader.Skip();
break; break;
case "adjuster": case "adjuster":
// TODO: Use these adjusters
var adjuster = new ListXmlAdjuster(); var adjuster = new ListXmlAdjuster();
adjuster.Name = reader.GetAttribute("name"); adjuster.Name = reader.GetAttribute("name");
adjuster.Default = reader.GetAttribute("default").AsYesNo(); adjuster.Default = reader.GetAttribute("default").AsYesNo();
@@ -409,33 +436,48 @@ namespace SabreTools.Library.DatFiles
// Now read the internal tags // Now read the internal tags
ReadAdjuster(reader.ReadSubtree(), adjuster); ReadAdjuster(reader.ReadSubtree(), adjuster);
// Ensure the list exists
if (machine.Adjusters == null)
machine.Adjusters = new List<ListXmlAdjuster>();
machine.Adjusters.Add(adjuster);
// Skip the adjuster now that we've processed it // Skip the adjuster now that we've processed it
reader.Skip(); reader.Skip();
break; break;
case "driver": case "driver":
// TODO: Use these drivers
var driver = new ListXmlDriver(); var driver = new ListXmlDriver();
driver.Status = reader.GetAttribute("status"); driver.Status = reader.GetAttribute("status");
driver.Emulation = reader.GetAttribute("emulation"); driver.Emulation = reader.GetAttribute("emulation");
driver.Cocktail = reader.GetAttribute("cocktail"); driver.Cocktail = reader.GetAttribute("cocktail");
driver.SaveState = reader.GetAttribute("savestate"); driver.SaveState = reader.GetAttribute("savestate");
// Ensure the list exists
if (machine.Drivers == null)
machine.Drivers = new List<ListXmlDriver>();
machine.Drivers.Add(driver);
reader.Read(); reader.Read();
break; break;
case "feature": case "feature":
// TODO: Use these features
var feature = new ListXmlFeature(); var feature = new ListXmlFeature();
feature.Type = reader.GetAttribute("type"); feature.Type = reader.GetAttribute("type");
feature.Status = reader.GetAttribute("status"); feature.Status = reader.GetAttribute("status");
feature.Overall = reader.GetAttribute("overall"); feature.Overall = reader.GetAttribute("overall");
// Ensure the list exists
if (machine.Features == null)
machine.Features = new List<ListXmlFeature>();
machine.Features.Add(feature);
reader.Read(); reader.Read();
break; break;
case "device": case "device":
// TODO: Use these devices
var device = new ListXmlDevice(); var device = new ListXmlDevice();
device.Type = reader.GetAttribute("type"); device.Type = reader.GetAttribute("type");
device.Tag = reader.GetAttribute("tag"); device.Tag = reader.GetAttribute("tag");
@@ -446,6 +488,12 @@ namespace SabreTools.Library.DatFiles
// Now read the internal tags // Now read the internal tags
ReadDevice(reader.ReadSubtree(), device); ReadDevice(reader.ReadSubtree(), device);
// Ensure the list exists
if (machine.Devices == null)
machine.Devices = new List<ListXmlDevice>();
machine.Devices.Add(device);
// Skip the device now that we've processed it // Skip the device now that we've processed it
reader.Skip(); reader.Skip();
break; break;
@@ -456,6 +504,11 @@ namespace SabreTools.Library.DatFiles
// Now read the internal tags // Now read the internal tags
ReadSlot(reader.ReadSubtree(), slot, machine); ReadSlot(reader.ReadSubtree(), slot, machine);
// Ensure the list exists
if (machine.Slots == null)
machine.Slots = new List<ListXmlSlot>();
machine.Slots.Add(slot); machine.Slots.Add(slot);
// Skip the slot now that we've processed it // Skip the slot now that we've processed it
@@ -463,20 +516,30 @@ namespace SabreTools.Library.DatFiles
break; break;
case "softwarelist": case "softwarelist":
// TODO: Use these softwarelists
var softwareList = new ListXmlSoftwareList(); var softwareList = new ListXmlSoftwareList();
softwareList.Name = reader.GetAttribute("name"); softwareList.Name = reader.GetAttribute("name");
softwareList.Status = reader.GetAttribute("status"); softwareList.Status = reader.GetAttribute("status");
softwareList.Filter = reader.GetAttribute("filter"); softwareList.Filter = reader.GetAttribute("filter");
// Ensure the list exists
if (machine.SoftwareLists == null)
machine.SoftwareLists = new List<ListXmlSoftwareList>();
machine.SoftwareLists.Add(softwareList);
reader.Read(); reader.Read();
break; break;
case "ramoption": case "ramoption":
// TODO: Use these ramoptions
var ramOption = new ListXmlRamOption(); var ramOption = new ListXmlRamOption();
ramOption.Default = reader.GetAttribute("default").AsYesNo(); ramOption.Default = reader.GetAttribute("default").AsYesNo();
// Ensure the list exists
if (machine.RamOptions == null)
machine.RamOptions = new List<ListXmlRamOption>();
machine.RamOptions.Add(ramOption);
reader.Read(); reader.Read();
break; break;
@@ -1047,17 +1110,6 @@ namespace SabreTools.Library.DatFiles
xtw.WriteOptionalAttributeString("publisher", datItem.Machine.Publisher); xtw.WriteOptionalAttributeString("publisher", datItem.Machine.Publisher);
xtw.WriteOptionalAttributeString("category", datItem.Machine.Category); xtw.WriteOptionalAttributeString("category", datItem.Machine.Category);
if (datItem.Machine.Infos != null && datItem.Machine.Infos.Count > 0)
{
foreach (ListXmlInfo kvp in datItem.Machine.Infos)
{
xtw.WriteStartElement("info");
xtw.WriteRequiredAttributeString("name", kvp.Name);
xtw.WriteRequiredAttributeString("value", kvp.Value);
xtw.WriteEndElement();
}
}
xtw.Flush(); xtw.Flush();
} }
catch (Exception ex) catch (Exception ex)

View File

@@ -224,12 +224,24 @@ namespace SabreTools.Library.DatFiles
} }
// Add all infos to the info list // Add all infos to the info list
Header.Infos.Add(new OfflineListInfo( switch (reader.Name.ToLowerInvariant())
reader.Name.ToLowerInvariant(), {
reader.GetAttribute("visible").AsYesNo(), case "info":
reader.GetAttribute("inNamingOption").AsYesNo(), var info = new OfflineListInfo();
reader.GetAttribute("default").AsYesNo())); info.Name = reader.Name.ToLowerInvariant();
reader.Read(); info.Visible = reader.GetAttribute("visible").AsYesNo();
info.InNamingOption = reader.GetAttribute("inNamingOption").AsYesNo();
info.Default = reader.GetAttribute("default").AsYesNo();
Header.Infos.Add(info);
reader.Read();
break;
default:
reader.Read();
break;
}
} }
} }
@@ -787,7 +799,7 @@ namespace SabreTools.Library.DatFiles
{ {
xtw.WriteStartElement(info.Name); xtw.WriteStartElement(info.Name);
xtw.WriteAttributeString("visible", info.Visible.ToString()); xtw.WriteAttributeString("visible", info.Visible.ToString());
xtw.WriteAttributeString("inNamingOption", info.IsNamingOption.ToString()); xtw.WriteAttributeString("inNamingOption", info.InNamingOption.ToString());
xtw.WriteAttributeString("default", info.Default.ToString()); xtw.WriteAttributeString("default", info.Default.ToString());
xtw.WriteEndElement(); xtw.WriteEndElement();
} }

View File

@@ -392,13 +392,13 @@ namespace SabreTools.Library.DatFiles
// TODO: Add Machine.Slot // TODO: Add Machine.Slot
case "Machine.Infos": case "Machine.Infos":
machine.Infos = new List<ListXmlInfo>(); machine.Infos = new List<SoftwareListInfo>();
var infos = value.Split(';'); var infos = value.Split(';');
foreach (var info in infos) foreach (var info in infos)
{ {
var infoPair = info.Split('='); var infoPair = info.Split('=');
var infoObj = new ListXmlInfo(); var infoObj = new SoftwareListInfo();
infoObj.Name = infoPair[0]; infoObj.Name = infoPair[0];
infoObj.Value = infoPair[1]; infoObj.Value = infoPair[1];
@@ -725,8 +725,7 @@ namespace SabreTools.Library.DatFiles
Remark = remark, Remark = remark,
Boot = boot, Boot = boot,
PartName = partName, Part = new SoftwareListPart() { Name = partName, Interface = partInterface },
PartInterface = partInterface,
Features = features, Features = features,
AreaName = areaName, AreaName = areaName,
AreaSize = areaSize, AreaSize = areaSize,
@@ -760,8 +759,7 @@ namespace SabreTools.Library.DatFiles
Remark = remark, Remark = remark,
Boot = boot, Boot = boot,
PartName = partName, Part = new SoftwareListPart() { Name = partName, Interface = partInterface },
PartInterface = partInterface,
Features = features, Features = features,
AreaName = areaName, AreaName = areaName,
AreaSize = areaSize, AreaSize = areaSize,
@@ -798,8 +796,7 @@ namespace SabreTools.Library.DatFiles
Remark = remark, Remark = remark,
Boot = boot, Boot = boot,
PartName = partName, Part = new SoftwareListPart() { Name = partName, Interface = partInterface },
PartInterface = partInterface,
Features = features, Features = features,
AreaName = areaName, AreaName = areaName,
AreaSize = areaSize, AreaSize = areaSize,
@@ -848,8 +845,7 @@ namespace SabreTools.Library.DatFiles
Remark = remark, Remark = remark,
Boot = boot, Boot = boot,
PartName = partName, Part = new SoftwareListPart() { Name = partName, Interface = partInterface },
PartInterface = partInterface,
Features = features, Features = features,
AreaName = areaName, AreaName = areaName,
AreaSize = areaSize, AreaSize = areaSize,
@@ -888,8 +884,7 @@ namespace SabreTools.Library.DatFiles
Remark = remark, Remark = remark,
Boot = boot, Boot = boot,
PartName = partName, Part = new SoftwareListPart() { Name = partName, Interface = partInterface },
PartInterface = partInterface,
Features = features, Features = features,
AreaName = areaName, AreaName = areaName,
AreaSize = areaSize, AreaSize = areaSize,
@@ -942,8 +937,7 @@ namespace SabreTools.Library.DatFiles
Remark = remark, Remark = remark,
Boot = boot, Boot = boot,
PartName = partName, Part = new SoftwareListPart() { Name = partName, Interface = partInterface },
PartInterface = partInterface,
Features = features, Features = features,
AreaName = areaName, AreaName = areaName,
AreaSize = areaSize, AreaSize = areaSize,
@@ -969,6 +963,7 @@ namespace SabreTools.Library.DatFiles
/// <summary> /// <summary>
/// Get normalized header value for a given separated value header field /// Get normalized header value for a given separated value header field
/// </summary> /// </summary>
/// TODO: Have this return Field (actually, replace with existing convert at that point)
private string GetNormalizedHeader(string header) private string GetNormalizedHeader(string header)
{ {
switch (header.ToLowerInvariant()) switch (header.ToLowerInvariant())

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.IO; using System.IO;
using System.Linq;
using System.Text; using System.Text;
using System.Xml; using System.Xml;
@@ -145,10 +146,6 @@ namespace SabreTools.Library.DatFiles
Supported = reader.GetAttribute("supported").AsSupported(), Supported = reader.GetAttribute("supported").AsSupported(),
CloneOf = reader.GetAttribute("cloneof"), CloneOf = reader.GetAttribute("cloneof"),
Infos = new List<ListXmlInfo>(),
SharedFeatures = new List<SoftwareListSharedFeature>(),
DipSwitches = new List<ListXmlDipSwitch>(),
MachineType = (machineType != MachineType.NULL ? machineType : MachineType.NULL), MachineType = (machineType != MachineType.NULL ? machineType : MachineType.NULL),
}; };
@@ -181,10 +178,14 @@ namespace SabreTools.Library.DatFiles
break; break;
case "info": case "info":
var info = new ListXmlInfo(); var info = new SoftwareListInfo();
info.Name = reader.GetAttribute("name"); info.Name = reader.GetAttribute("name");
info.Value = reader.GetAttribute("value"); info.Value = reader.GetAttribute("value");
// Ensure the list exists
if (machine.Infos == null)
machine.Infos = new List<SoftwareListInfo>();
machine.Infos.Add(info); machine.Infos.Add(info);
reader.Read(); reader.Read();
@@ -195,6 +196,10 @@ namespace SabreTools.Library.DatFiles
sharedFeature.Name = reader.GetAttribute("name"); sharedFeature.Name = reader.GetAttribute("name");
sharedFeature.Value = reader.GetAttribute("value"); sharedFeature.Value = reader.GetAttribute("value");
// Ensure the list exists
if (machine.SharedFeatures == null)
machine.SharedFeatures = new List<SoftwareListSharedFeature>();
machine.SharedFeatures.Add(sharedFeature); machine.SharedFeatures.Add(sharedFeature);
reader.Read(); reader.Read();
@@ -252,13 +257,12 @@ namespace SabreTools.Library.DatFiles
bool keep) bool keep)
{ {
string areaname, string areaname,
partname = string.Empty,
partinterface = string.Empty,
areaWidth, areaWidth,
areaEndinaness; areaEndinaness;
long? areasize = null; long? areasize = null;
var features = new List<SoftwareListFeature>(); SoftwareListPart part = null;
bool containsItems = false; List<SoftwareListFeature> features = null;
List<DatItem> items = new List<DatItem>();
while (!reader.EOF) while (!reader.EOF)
{ {
@@ -267,9 +271,8 @@ namespace SabreTools.Library.DatFiles
{ {
if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "part") if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "part")
{ {
partname = string.Empty; part = null;
partinterface = string.Empty; features = null;
features = new List<SoftwareListFeature>();
} }
if (reader.NodeType == XmlNodeType.EndElement && (reader.Name == "dataarea" || reader.Name == "diskarea")) if (reader.NodeType == XmlNodeType.EndElement && (reader.Name == "dataarea" || reader.Name == "diskarea"))
@@ -283,8 +286,9 @@ namespace SabreTools.Library.DatFiles
switch (reader.Name) switch (reader.Name)
{ {
case "part": case "part":
partname = reader.GetAttribute("name"); part = new SoftwareListPart();
partinterface = reader.GetAttribute("interface"); part.Name = reader.GetAttribute("name");
part.Interface = reader.GetAttribute("interface");
reader.Read(); reader.Read();
break; break;
@@ -293,6 +297,10 @@ namespace SabreTools.Library.DatFiles
feature.Name = reader.GetAttribute("name"); feature.Name = reader.GetAttribute("name");
feature.Value = reader.GetAttribute("value"); feature.Value = reader.GetAttribute("value");
// Ensure the list exists
if (features == null)
features = new List<SoftwareListFeature>();
features.Add(feature); features.Add(feature);
reader.Read(); reader.Read();
@@ -309,20 +317,18 @@ namespace SabreTools.Library.DatFiles
areaWidth = reader.GetAttribute("width"); areaWidth = reader.GetAttribute("width");
areaEndinaness = reader.GetAttribute("endianness"); areaEndinaness = reader.GetAttribute("endianness");
containsItems = ReadDataArea( List<DatItem> roms = ReadDataArea(
reader.ReadSubtree(), reader.ReadSubtree(),
machine,
partname,
partinterface,
features,
areaname, areaname,
areasize, areasize,
areaWidth, areaWidth,
areaEndinaness, areaEndinaness,
filename,
indexId,
keep); keep);
// If we got valid roms, add them to the list
if (roms != null)
items.AddRange(roms);
// Skip the dataarea now that we've processed it // Skip the dataarea now that we've processed it
reader.Skip(); reader.Skip();
break; break;
@@ -330,24 +336,21 @@ namespace SabreTools.Library.DatFiles
case "diskarea": case "diskarea":
areaname = reader.GetAttribute("name"); areaname = reader.GetAttribute("name");
containsItems = ReadDiskArea( List<DatItem> disks = ReadDiskArea(
reader.ReadSubtree(), reader.ReadSubtree(),
machine,
partname,
partinterface,
features,
areaname, areaname,
areasize, areasize,
filename,
indexId,
keep); keep);
// If we got valid disks, add them to the list
if (disks != null)
items.AddRange(disks);
// Skip the diskarea now that we've processed it // Skip the diskarea now that we've processed it
reader.Skip(); reader.Skip();
break; break;
case "dipswitch": case "dipswitch":
// TODO: Use these dipswitches
var dipSwitch = new ListXmlDipSwitch(); var dipSwitch = new ListXmlDipSwitch();
dipSwitch.Name = reader.GetAttribute("name"); dipSwitch.Name = reader.GetAttribute("name");
dipSwitch.Tag = reader.GetAttribute("tag"); dipSwitch.Tag = reader.GetAttribute("tag");
@@ -356,6 +359,12 @@ namespace SabreTools.Library.DatFiles
// Now read the internal tags // Now read the internal tags
ReadDipSwitch(reader.ReadSubtree(), dipSwitch); ReadDipSwitch(reader.ReadSubtree(), dipSwitch);
// Ensure the list exists
if (machine.DipSwitches == null)
machine.DipSwitches = new List<ListXmlDipSwitch>();
machine.DipSwitches.Add(dipSwitch);
// Skip the dipswitch now that we've processed it // Skip the dipswitch now that we've processed it
reader.Skip(); reader.Skip();
break; break;
@@ -366,45 +375,44 @@ namespace SabreTools.Library.DatFiles
} }
} }
return containsItems; // Loop over all of the items, if they exist
foreach (DatItem item in items)
{
// Add all missing information
item.Features = features;
item.Part = part;
item.Source = new Source(indexId, filename);
item.CopyMachineInformation(machine);
// Finally add each item
ParseAddHelper(item);
}
return items.Any();
} }
/// <summary> /// <summary>
/// Read dataarea information /// Read dataarea information
/// </summary> /// </summary>
/// <param name="reader">XmlReader representing a dataarea block</param> /// <param name="reader">XmlReader representing a dataarea block</param>
/// <param name="machine">Machine information to pass to contained items</param>
/// <param name="partName">Name of the containing part</param>
/// <param name="partInterface">Interface of the containing part</param>
/// <param name="features">List of features from the parent part</param>
/// <param name="areaName">Name of the containing area</param> /// <param name="areaName">Name of the containing area</param>
/// <param name="areaSize">Size of the containing area</param> /// <param name="areaSize">Size of the containing area</param>
/// <param name="areaWidth">Byte width of the containing area</param> /// <param name="areaWidth">Byte width of the containing area</param>
/// <param name="areaEndianness">Endianness of the containing area</param> /// <param name="areaEndianness">Endianness of the containing area</param>
/// <param name="filename">Name of the file to be parsed</param>
/// <param name="indexId">Index ID for the DAT</param>
/// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param> /// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param>
private bool ReadDataArea( private List<DatItem> ReadDataArea(
XmlReader reader, XmlReader reader,
Machine machine,
string partName,
string partInterface,
List<SoftwareListFeature> features,
string areaName, string areaName,
long? areaSize, long? areaSize,
string areaWidth, string areaWidth,
string areaEndianness, string areaEndianness,
// Standard Dat parsing
string filename,
int indexId,
// Miscellaneous // Miscellaneous
bool keep) bool keep)
{ {
string key = string.Empty; string key = string.Empty;
string temptype = reader.Name; string temptype = reader.Name;
bool containsItems = false; List<DatItem> items = new List<DatItem>();
while (!reader.EOF) while (!reader.EOF)
{ {
@@ -419,8 +427,6 @@ namespace SabreTools.Library.DatFiles
switch (reader.Name) switch (reader.Name)
{ {
case "rom": case "rom":
containsItems = true;
// If the rom is continue or ignore, add the size to the previous rom // If the rom is continue or ignore, add the size to the previous rom
if (reader.GetAttribute("loadflag") == "continue" || reader.GetAttribute("loadflag") == "ignore") if (reader.GetAttribute("loadflag") == "continue" || reader.GetAttribute("loadflag") == "ignore")
{ {
@@ -453,28 +459,15 @@ namespace SabreTools.Library.DatFiles
Offset = reader.GetAttribute("offset"), Offset = reader.GetAttribute("offset"),
ItemStatus = reader.GetAttribute("status").AsItemStatus(), ItemStatus = reader.GetAttribute("status").AsItemStatus(),
PartName = partName,
PartInterface = partInterface,
Features = features,
AreaName = areaName, AreaName = areaName,
AreaSize = areaSize, AreaSize = areaSize,
AreaWidth = areaWidth, AreaWidth = areaWidth,
AreaEndianness = areaEndianness, AreaEndianness = areaEndianness,
Value = reader.GetAttribute("value"), Value = reader.GetAttribute("value"),
LoadFlag = reader.GetAttribute("loadflag"), LoadFlag = reader.GetAttribute("loadflag"),
Source = new Source
{
Index = indexId,
Name = filename,
},
}; };
rom.CopyMachineInformation(machine); items.Add(rom);
// Now process and add the rom
key = ParseAddHelper(rom);
reader.Read(); reader.Read();
break; break;
@@ -484,41 +477,27 @@ namespace SabreTools.Library.DatFiles
} }
} }
return containsItems; return items;
} }
/// <summary> /// <summary>
/// Read diskarea information /// Read diskarea information
/// </summary> /// </summary>
/// <param name="reader">XmlReader representing a diskarea block</param> /// <param name="reader">XmlReader representing a diskarea block</param>
/// <param name="machine">Machine information to pass to contained items</param>
/// <param name="partname">Name of the containing part</param>
/// <param name="partinterface">Interface of the containing part</param>
/// <param name="features">List of features from the parent part</param>
/// <param name="areaname">Name of the containing area</param> /// <param name="areaname">Name of the containing area</param>
/// <param name="areasize">Size of the containing area</param> /// <param name="areasize">Size of the containing area</param>
/// <param name="filename">Name of the file to be parsed</param>
/// <param name="indexId">Index ID for the DAT</param>
/// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param> /// <param name="keep">True if full pathnames are to be kept, false otherwise (default)</param>
private bool ReadDiskArea( private List<DatItem> ReadDiskArea(
XmlReader reader, XmlReader reader,
Machine machine,
string partname,
string partinterface,
List<SoftwareListFeature> features,
string areaname, string areaname,
long? areasize, long? areasize,
// Standard Dat parsing
string filename,
int indexId,
// Miscellaneous // Miscellaneous
bool keep) bool keep)
{ {
string key = string.Empty; string key = string.Empty;
string temptype = reader.Name; string temptype = reader.Name;
bool containsItems = false; List<DatItem> items = new List<DatItem>();
while (!reader.EOF) while (!reader.EOF)
{ {
@@ -533,8 +512,6 @@ namespace SabreTools.Library.DatFiles
switch (reader.Name) switch (reader.Name)
{ {
case "disk": case "disk":
containsItems = true;
DatItem disk = new Disk DatItem disk = new Disk
{ {
Name = reader.GetAttribute("name"), Name = reader.GetAttribute("name"),
@@ -549,24 +526,11 @@ namespace SabreTools.Library.DatFiles
ItemStatus = reader.GetAttribute("status").AsItemStatus(), ItemStatus = reader.GetAttribute("status").AsItemStatus(),
Writable = reader.GetAttribute("writable").AsYesNo(), Writable = reader.GetAttribute("writable").AsYesNo(),
PartName = partname,
PartInterface = partinterface,
Features = features,
AreaName = areaname, AreaName = areaname,
AreaSize = areasize, AreaSize = areasize,
Source = new Source
{
Index = indexId,
Name = filename,
},
}; };
disk.CopyMachineInformation(machine); items.Add(disk);
// Now process and add the rom
key = ParseAddHelper(disk);
reader.Read(); reader.Read();
break; break;
@@ -576,7 +540,7 @@ namespace SabreTools.Library.DatFiles
} }
} }
return containsItems; return items;
} }
/// <summary> /// <summary>
@@ -780,7 +744,7 @@ namespace SabreTools.Library.DatFiles
if (datItem.Machine.Infos != null && datItem.Machine.Infos.Count > 0) if (datItem.Machine.Infos != null && datItem.Machine.Infos.Count > 0)
{ {
foreach (ListXmlInfo kvp in datItem.Machine.Infos) foreach (SoftwareListInfo kvp in datItem.Machine.Infos)
{ {
xtw.WriteStartElement("info"); xtw.WriteStartElement("info");
xtw.WriteRequiredAttributeString("name", kvp.Name); xtw.WriteRequiredAttributeString("name", kvp.Name);
@@ -877,8 +841,8 @@ namespace SabreTools.Library.DatFiles
// Build the state // Build the state
xtw.WriteStartElement("part"); xtw.WriteStartElement("part");
xtw.WriteRequiredAttributeString("name", datItem.PartName); xtw.WriteRequiredAttributeString("name", datItem.Part?.Name);
xtw.WriteRequiredAttributeString("interface", datItem.PartInterface); xtw.WriteRequiredAttributeString("interface", datItem.Part?.Interface);
if (datItem.Features != null && datItem.Features.Count > 0) if (datItem.Features != null && datItem.Features.Count > 0)
{ {

View File

@@ -40,8 +40,7 @@ namespace SabreTools.Library.DatItems
Remark = this.Remark, Remark = this.Remark,
Boot = this.Boot, Boot = this.Boot,
PartName = this.PartName, Part = this.Part,
PartInterface = this.PartInterface,
Features = this.Features, Features = this.Features,
AreaName = this.AreaName, AreaName = this.AreaName,
AreaSize = this.AreaSize, AreaSize = this.AreaSize,

View File

@@ -244,19 +244,19 @@ namespace SabreTools.Library.DatItems
public string HTotal { get; set; } // TODO: Int32? Float? public string HTotal { get; set; } // TODO: Int32? Float?
[JsonProperty("hbend")] [JsonProperty("hbend")]
public string HBend { get; set; } // TODO: Int32? Float? public string HBEnd { get; set; } // TODO: Int32? Float?
[JsonProperty("hstart")] [JsonProperty("hbstart")]
public string HStart { get; set; } // TODO: Int32? Float? public string HBStart { get; set; } // TODO: Int32? Float?
[JsonProperty("vtotal")] [JsonProperty("vtotal")]
public string VTotal { get; set; } // TODO: Int32? Float? public string VTotal { get; set; } // TODO: Int32? Float?
[JsonProperty("vbend")] [JsonProperty("vbend")]
public string VBend { get; set; } // TODO: Int32? Float? public string VBEnd { get; set; } // TODO: Int32? Float?
[JsonProperty("vstart")] [JsonProperty("vbstart")]
public string VStart { get; set; } // TODO: Int32? Float? public string VBStart { get; set; } // TODO: Int32? Float?
} }
/// <summary> /// <summary>
@@ -360,19 +360,6 @@ namespace SabreTools.Library.DatItems
public string Overall { get; set; } // TODO: (unemulated|imperfect) public string Overall { get; set; } // TODO: (unemulated|imperfect)
} }
/// <summary>
/// Represents one ListXML info
/// </summary>
[JsonObject("info")]
public class ListXmlInfo
{
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("value")]
public string Value { get; set; }
}
/// <summary> /// <summary>
/// Represents one ListXML input /// Represents one ListXML input
/// </summary> /// </summary>
@@ -507,6 +494,19 @@ namespace SabreTools.Library.DatItems
#region SoftwareList #region SoftwareList
/// <summary>
/// Represents one SoftwareList info
/// </summary>
[JsonObject("info")]
public class SoftwareListInfo
{
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("value")]
public string Value { get; set; }
}
/// <summary> /// <summary>
/// Represents one SoftwareList shared feature object /// Represents one SoftwareList shared feature object
/// </summary> /// </summary>
@@ -541,6 +541,19 @@ namespace SabreTools.Library.DatItems
public string Value { get; set; } public string Value { get; set; }
} }
/// <summary>
/// Represents one SoftwareList part object
/// </summary>
[JsonObject("part")]
public class SoftwareListPart
{
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("interface")]
public string Interface { get; set; }
}
#endregion #endregion
#endregion //DatItem #endregion //DatItem

View File

@@ -82,8 +82,7 @@ namespace SabreTools.Library.DatItems
Remark = this.Remark, Remark = this.Remark,
Boot = this.Boot, Boot = this.Boot,
PartName = this.PartName, Part = this.Part,
PartInterface = this.PartInterface,
Features = this.Features, Features = this.Features,
AreaName = this.AreaName, AreaName = this.AreaName,
AreaSize = this.AreaSize, AreaSize = this.AreaSize,

View File

@@ -40,8 +40,7 @@ namespace SabreTools.Library.DatItems
Remark = this.Remark, Remark = this.Remark,
Boot = this.Boot, Boot = this.Boot,
PartName = this.PartName, Part = this.Part,
PartInterface = this.PartInterface,
Features = this.Features, Features = this.Features,
AreaName = this.AreaName, AreaName = this.AreaName,
AreaSize = this.AreaSize, AreaSize = this.AreaSize,

View File

@@ -114,14 +114,8 @@ namespace SabreTools.Library.DatItems
/// <summary> /// <summary>
/// Original hardware part associated with the item /// Original hardware part associated with the item
/// </summary> /// </summary>
[JsonProperty("partname", DefaultValueHandling = DefaultValueHandling.Ignore)] [JsonProperty("part", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string PartName { get; set; } public SoftwareListPart Part { get; set; }
/// <summary>
/// Original hardware interface associated with the item
/// </summary>
[JsonProperty("partinterface", DefaultValueHandling = DefaultValueHandling.Ignore)]
public string PartInterface { get; set; }
/// <summary> /// <summary>
/// Features provided to/by the item /// Features provided to/by the item
@@ -194,18 +188,18 @@ namespace SabreTools.Library.DatItems
public static readonly List<Field> DatItemFields = new List<Field>() public static readonly List<Field> DatItemFields = new List<Field>()
{ {
// Common // Common
Field.Name, Field.DatItem_Name,
// AttractMode // AttractMode
Field.AltName, Field.DatItem_AltName,
Field.AltTitle, Field.DatItem_AltTitle,
// OpenMSX // OpenMSX
Field.Original, Field.DatItem_Original,
Field.OpenMSXSubType, Field.DatItem_OpenMSXSubType,
Field.OpenMSXType, Field.DatItem_OpenMSXType,
Field.Remark, Field.DatItem_Remark,
Field.Boot, Field.DatItem_Boot,
//SoftwareList //SoftwareList
Field.PartName, Field.PartName,
@@ -256,57 +250,57 @@ namespace SabreTools.Library.DatItems
public static readonly List<Field> MachineFields = new List<Field>() public static readonly List<Field> MachineFields = new List<Field>()
{ {
// Common // Common
Field.MachineName, Field.Machine_Name,
Field.Comment, Field.Machine_Comment,
Field.Description, Field.Machine_Description,
Field.Year, Field.Machine_Year,
Field.Manufacturer, Field.Machine_Manufacturer,
Field.Publisher, Field.Machine_Publisher,
Field.RomOf, Field.Machine_RomOf,
Field.CloneOf, Field.Machine_CloneOf,
Field.SampleOf, Field.Machine_SampleOf,
Field.MachineType, Field.Machine_Type,
// AttractMode // AttractMode
Field.Players, Field.Machine_Players,
Field.Rotation, Field.Machine_Rotation,
Field.Control, Field.Machine_Control,
Field.SupportStatus, Field.Machine_SupportStatus,
Field.DisplayCount, Field.Machine_DisplayCount,
Field.DisplayType, Field.Machine_DisplayType,
Field.Buttons, Field.Machine_Buttons,
// ListXML // ListXML
Field.SourceFile, Field.Machine_SourceFile,
Field.Runnable, Field.Machine_Runnable,
Field.DeviceReferences, Field.Machine_DeviceReference_Name,
Field.Slots, Field.Machine_Slots,
Field.Infos, Field.Machine_Infos,
// Logiqx // Logiqx
Field.Board, Field.Machine_Board,
Field.RebuildTo, Field.Machine_RebuildTo,
// Logiqx EmuArc // Logiqx EmuArc
Field.TitleID, Field.Machine_TitleID,
Field.Developer, Field.Machine_Developer,
Field.Genre, Field.Machine_Genre,
Field.Subgenre, Field.Machine_Subgenre,
Field.Ratings, Field.Machine_Ratings,
Field.Score, Field.Machine_Score,
Field.Enabled, Field.Machine_Enabled,
Field.HasCrc, Field.Machine_HasCrc,
Field.RelatedTo, Field.Machine_RelatedTo,
// OpenMSX // OpenMSX
Field.GenMSXID, Field.Machine_GenMSXID,
Field.System, Field.Machine_System,
Field.Country, Field.Machine_Country,
// SoftwareList // SoftwareList
Field.Supported, Field.Machine_Supported,
Field.SharedFeatures, Field.Machine_SharedFeatures,
Field.DipSwitches, Field.Machine_DipSwitches,
}; };
#endregion #endregion
@@ -328,47 +322,57 @@ namespace SabreTools.Library.DatItems
#region Common #region Common
if (mappings.Keys.Contains(Field.Name)) if (mappings.Keys.Contains(Field.DatItem_Name))
Name = mappings[Field.Name]; Name = mappings[Field.DatItem_Name];
#endregion #endregion
#region AttractMode #region AttractMode
if (mappings.Keys.Contains(Field.AltName)) if (mappings.Keys.Contains(Field.DatItem_AltName))
AltName = mappings[Field.AltName]; AltName = mappings[Field.DatItem_AltName];
if (mappings.Keys.Contains(Field.AltTitle)) if (mappings.Keys.Contains(Field.DatItem_AltTitle))
AltTitle = mappings[Field.AltTitle]; AltTitle = mappings[Field.DatItem_AltTitle];
#endregion #endregion
#region OpenMSX #region OpenMSX
if (mappings.Keys.Contains(Field.Original)) if (mappings.Keys.Contains(Field.DatItem_Original))
Original = new OpenMSXOriginal() { Content = mappings[Field.Original] }; Original = new OpenMSXOriginal() { Content = mappings[Field.DatItem_Original] };
if (mappings.Keys.Contains(Field.OpenMSXSubType)) if (mappings.Keys.Contains(Field.DatItem_OpenMSXSubType))
OpenMSXSubType = mappings[Field.OpenMSXSubType].AsOpenMSXSubType(); OpenMSXSubType = mappings[Field.DatItem_OpenMSXSubType].AsOpenMSXSubType();
if (mappings.Keys.Contains(Field.OpenMSXType)) if (mappings.Keys.Contains(Field.DatItem_OpenMSXType))
OpenMSXType = mappings[Field.OpenMSXType]; OpenMSXType = mappings[Field.DatItem_OpenMSXType];
if (mappings.Keys.Contains(Field.Remark)) if (mappings.Keys.Contains(Field.DatItem_Remark))
Remark = mappings[Field.Remark]; Remark = mappings[Field.DatItem_Remark];
if (mappings.Keys.Contains(Field.Boot)) if (mappings.Keys.Contains(Field.DatItem_Boot))
Boot = mappings[Field.Boot]; Boot = mappings[Field.DatItem_Boot];
#endregion #endregion
#region SoftwareList #region SoftwareList
if (mappings.Keys.Contains(Field.PartName)) if (mappings.Keys.Contains(Field.PartName))
PartName = mappings[Field.PartName]; {
if (Part == null)
Part = new SoftwareListPart();
Part.Name = mappings[Field.PartName];
}
if (mappings.Keys.Contains(Field.PartInterface)) if (mappings.Keys.Contains(Field.PartInterface))
PartInterface = mappings[Field.PartInterface]; {
if (Part == null)
Part = new SoftwareListPart();
Part.Interface = mappings[Field.PartInterface];
}
if (mappings.Keys.Contains(Field.Features)) if (mappings.Keys.Contains(Field.Features))
{ {
@@ -668,15 +672,15 @@ namespace SabreTools.Library.DatItems
#region SoftwareList #region SoftwareList
// Filter on part name // Filter on part name
if (filter.PartName.MatchesPositiveSet(PartName) == false) if (filter.PartName.MatchesPositiveSet(Part?.Name) == false)
return false; return false;
if (filter.PartName.MatchesNegativeSet(PartName) == true) if (filter.PartName.MatchesNegativeSet(Part?.Name) == true)
return false; return false;
// Filter on part interface // Filter on part interface
if (filter.PartInterface.MatchesPositiveSet(PartInterface) == false) if (filter.PartInterface.MatchesPositiveSet(Part?.Interface) == false)
return false; return false;
if (filter.PartInterface.MatchesNegativeSet(PartInterface) == true) if (filter.PartInterface.MatchesNegativeSet(Part?.Interface) == true)
return false; return false;
// Filter on area name // Filter on area name
@@ -733,47 +737,47 @@ namespace SabreTools.Library.DatItems
#region Common #region Common
if (fields.Contains(Field.Name)) if (fields.Contains(Field.DatItem_Name))
Name = null; Name = null;
#endregion #endregion
#region AttractMode #region AttractMode
if (fields.Contains(Field.AltName)) if (fields.Contains(Field.DatItem_AltName))
AltName = null; AltName = null;
if (fields.Contains(Field.AltTitle)) if (fields.Contains(Field.DatItem_AltTitle))
AltTitle = null; AltTitle = null;
#endregion #endregion
#region OpenMSX #region OpenMSX
if (fields.Contains(Field.Original)) if (fields.Contains(Field.DatItem_Original))
Original = null; Original = null;
if (fields.Contains(Field.OpenMSXSubType)) if (fields.Contains(Field.DatItem_OpenMSXSubType))
OpenMSXSubType = OpenMSXSubType.NULL; OpenMSXSubType = OpenMSXSubType.NULL;
if (fields.Contains(Field.OpenMSXType)) if (fields.Contains(Field.DatItem_OpenMSXType))
OpenMSXType = null; OpenMSXType = null;
if (fields.Contains(Field.Remark)) if (fields.Contains(Field.DatItem_Remark))
Remark = null; Remark = null;
if (fields.Contains(Field.Boot)) if (fields.Contains(Field.DatItem_Boot))
Boot = null; Boot = null;
#endregion #endregion
#region SoftwareList #region SoftwareList
if (fields.Contains(Field.PartName)) if (fields.Contains(Field.PartName) && Part != null)
PartName = null; Part.Name = null;
if (fields.Contains(Field.PartInterface)) if (fields.Contains(Field.PartInterface) && Part != null)
PartInterface = null; Part.Interface = null;
if (fields.Contains(Field.Features)) if (fields.Contains(Field.Features))
Features = null; Features = null;
@@ -823,7 +827,7 @@ namespace SabreTools.Library.DatItems
key = Constants.CRCZero; key = Constants.CRCZero;
break; break;
case Field.MachineName: case Field.Machine_Name:
key = (norename ? string.Empty key = (norename ? string.Empty
: Source.Index.ToString().PadLeft(10, '0') : Source.Index.ToString().PadLeft(10, '0')
+ "-") + "-")
@@ -882,36 +886,36 @@ namespace SabreTools.Library.DatItems
{ {
#region Common #region Common
if (fields.Contains(Field.Name)) if (fields.Contains(Field.DatItem_Name))
Name = item.Name; Name = item.Name;
#endregion #endregion
#region AttractMode #region AttractMode
if (fields.Contains(Field.AltName)) if (fields.Contains(Field.DatItem_AltName))
AltName = item.AltName; AltName = item.AltName;
if (fields.Contains(Field.AltTitle)) if (fields.Contains(Field.DatItem_AltTitle))
AltTitle = item.AltTitle; AltTitle = item.AltTitle;
#endregion #endregion
#region OpenMSX #region OpenMSX
if (fields.Contains(Field.Original)) if (fields.Contains(Field.DatItem_Original))
Original = item.Original; Original = item.Original;
if (fields.Contains(Field.OpenMSXSubType)) if (fields.Contains(Field.DatItem_OpenMSXSubType))
OpenMSXSubType = item.OpenMSXSubType; OpenMSXSubType = item.OpenMSXSubType;
if (fields.Contains(Field.OpenMSXType)) if (fields.Contains(Field.DatItem_OpenMSXType))
OpenMSXType = item.OpenMSXType; OpenMSXType = item.OpenMSXType;
if (fields.Contains(Field.Remark)) if (fields.Contains(Field.DatItem_Remark))
Remark = item.Remark; Remark = item.Remark;
if (fields.Contains(Field.Boot)) if (fields.Contains(Field.DatItem_Boot))
Boot = item.Boot; Boot = item.Boot;
#endregion #endregion
@@ -919,10 +923,20 @@ namespace SabreTools.Library.DatItems
#region SoftwareList #region SoftwareList
if (fields.Contains(Field.PartName)) if (fields.Contains(Field.PartName))
PartName = item.PartName; {
if (Part == null)
Part = new SoftwareListPart();
Part.Name = item.Part?.Name;
}
if (fields.Contains(Field.PartInterface)) if (fields.Contains(Field.PartInterface))
PartInterface = item.PartInterface; {
if (Part == null)
Part = new SoftwareListPart();
Part.Interface = item.Part?.Interface;
}
if (fields.Contains(Field.Features)) if (fields.Contains(Field.Features))
Features = item.Features; Features = item.Features;

View File

@@ -239,8 +239,7 @@ namespace SabreTools.Library.DatItems
Remark = this.Remark, Remark = this.Remark,
Boot = this.Boot, Boot = this.Boot,
PartName = this.PartName, Part = this.Part,
PartInterface = this.PartInterface,
Features = this.Features, Features = this.Features,
AreaName = this.AreaName, AreaName = this.AreaName,
AreaSize = this.AreaSize, AreaSize = this.AreaSize,
@@ -291,8 +290,7 @@ namespace SabreTools.Library.DatItems
Remark = this.Remark, Remark = this.Remark,
Boot = this.Boot, Boot = this.Boot,
PartName = this.PartName, Part = this.Part,
PartInterface = this.PartInterface,
Features = this.Features, Features = this.Features,
AreaName = this.AreaName, AreaName = this.AreaName,
AreaSize = this.AreaSize, AreaSize = this.AreaSize,

View File

@@ -1,7 +1,5 @@
using System; using System;
using Newtonsoft.Json;
namespace SabreTools.Library.DatItems namespace SabreTools.Library.DatItems
{ {
/// <summary> /// <summary>
@@ -22,90 +20,326 @@ namespace SabreTools.Library.DatItems
/// <summary> /// <summary>
/// List of valid field types within a DatItem/Machine /// List of valid field types within a DatItem/Machine
/// </summary> /// </summary>
/// TODO: Should this be split into MachineField and DatItemField? /// TODO: Move this to a more common location
/// TODO: Should there also be a DatFileField? /// TODO: Should this be split into separate enums?
public enum Field : int public enum Field : int
{ {
NULL = 0, NULL = 0,
#region Machine #region DatHeader
#region Common #region Common
MachineName, DatHeader_FileName,
Comment, DatHeader_Name,
Description, DatHeader_Description,
Year, DatHeader_RootDir,
Manufacturer, DatHeader_Category,
Publisher, DatHeader_Version,
Category, DatHeader_Date,
RomOf, DatHeader_Author,
CloneOf, DatHeader_Email,
SampleOf, DatHeader_Homepage,
MachineType, DatHeader_Url,
DatHeader_Comment,
#endregion DatHeader_HeaderSkipper,
DatHeader_Type,
#region AttractMode DatHeader_ForceMerging,
DatHeader_ForceNodump,
Players, DatHeader_ForcePacking,
Rotation,
Control,
SupportStatus,
DisplayCount,
DisplayType,
Buttons,
#endregion #endregion
#region ListXML #region ListXML
SourceFile, DatHeader_Debug,
Runnable, DatHeader_MameConfig,
DeviceReferences, // TODO: Double-check DeviceReferences usage
Chips, // TODO: Implement Chips usage
Displays, // TODO: Implement Displays usage
Sounds, // TODO: Implement Sounds usage
Conditions, // TODO: Implement Conditions usage
Slots, // TODO: Fix Slots usage
Infos,
#endregion #endregion
#region Logiqx #region Logiqx
Board, DatHeader_Build,
RebuildTo, DatHeader_RomMode,
DatHeader_BiosMode,
DatHeader_SampleMode,
DatHeader_LockRomMode,
DatHeader_LockBiosMode,
DatHeader_LockSampleMode,
#endregion
#region OfflineList
DatHeader_System,
DatHeader_ScreenshotsWidth,
DatHeader_ScreenshotsHeight,
DatHeader_CanOpen,
DatHeader_RomTitle,
// Infos
DatHeader_Infos,
DatHeader_Info_Name,
DatHeader_Info_Visible,
DatHeader_Info_IsNamingOption,
DatHeader_Info_Default,
#endregion
#region RomCenter
DatHeader_RomCenterVersion,
#endregion
#endregion // DatHeader
#region Machine
#region Common
Machine_Name,
Machine_Comment,
Machine_Description,
Machine_Year,
Machine_Manufacturer,
Machine_Publisher,
Machine_Category,
Machine_RomOf,
Machine_CloneOf,
Machine_SampleOf,
Machine_Type,
#endregion
#region AttractMode
Machine_Players,
Machine_Rotation,
Machine_Control,
Machine_SupportStatus,
Machine_DisplayCount,
Machine_DisplayType,
Machine_Buttons,
#endregion
#region ListXML
Machine_SourceFile,
Machine_Runnable,
// DeviceReferences
Machine_DeviceReferences, // TODO: Double-check DeviceReferences usage
Machine_DeviceReference_Name,
// Chips
Machine_Chips, // TODO: Implement Chips usage
Machine_Chip_Name,
Machine_Chip_Tag,
Machine_Chip_Type,
Machine_Chip_Clock,
// Displays
Machine_Displays, // TODO: Implement Displays usage
Machine_Display_Tag,
Machine_Display_Type,
Machine_Display_Rotate,
Machine_Display_FlipX,
Machine_Display_Width,
Machine_Display_Height,
Machine_Display_Refresh,
Machine_Display_PixClock,
Machine_Display_HTotal,
Machine_Display_HBEnd,
Machine_Display_HBStart,
Machine_Display_VTotal,
Machine_Display_VBEnd,
Machine_Display_VBStart,
// Sounds
Machine_Sounds, // TODO: Implement Sounds usage
Machine_Sound_Channels,
// Conditions
Machine_Conditions, // TODO: Implement Conditions usage
Machine_Condition_Tag,
Machine_Condition_Mask,
Machine_Condition_Relation,
Machine_Condition_Value,
// Inputs
Machine_Inputs, // TODO: Implement Inputs usage
Machine_InputService,
Machine_InputTilt,
Machine_InputPlayers,
Machine_InputCoins,
// Inputs.Controls
Machine_InputControls,
Machine_InputControl_Type,
Machine_InputControl_Player,
Machine_InputControl_Buttons,
Machine_InputControl_RegButtons,
Machine_InputControl_Minimum,
Machine_InputControl_Maximum,
Machine_InputControl_Sensitivity,
Machine_InputControl_KeyDelta,
Machine_InputControl_Reverse,
Machine_InputControl_Ways,
Machine_InputControl_Ways2,
Machine_InputControl_Ways3,
// DipSwitches
Machine_DipSwitches, // TODO: Implement DipSwitches usage
Machine_DipSwitch_Name,
Machine_DipSwitch_Tag,
Machine_DipSwitch_Mask,
// DipSwitches.Locations
Machine_DipSwitch_Locations,
Machine_DipSwitch_Location_Name,
Machine_DipSwitch_Location_Number,
Machine_DipSwitch_Location_Inverted,
// DipSwitches.Values
Machine_DipSwitch_Values,
Machine_DipSwitch_Value_Name,
Machine_DipSwitch_Value_Value,
Machine_DipSwitch_Value_Default,
// Configurations
Machine_Configurations, // TODO: Implement Configurations usage
Machine_Configuration_Name,
Machine_Configuration_Tag,
Machine_Configuration_Mask,
// Configurations.Locations
Machine_Configuration_Locations,
Machine_Configuration_Location_Name,
Machine_Configuration_Location_Number,
Machine_Configuration_Location_Inverted,
// Configurations.Settings
Machine_Configuration_Settings,
Machine_Configuration_Setting_Name,
Machine_Configuration_Setting_Value,
Machine_Configuration_Setting_Default,
// Ports
Machine_Ports, // TODO: Implement Ports usage
Machine_Ports_Tag,
// Ports.Analogs
Machine_Ports_Analogs,
Machine_Ports_Analog_Mask,
// Adjusters
Machine_Adjusters, // TODO: Implement Adjusters usage
Machine_Adjuster_Name,
Machine_Adjuster_Default,
// Adjusters.Conditions
Machine_Adjuster_Conditions,
Machine_Adjuster_Condition_Tag,
Machine_Adjuster_Condition_Mask,
Machine_Adjuster_Condition_Relation,
Machine_Adjuster_Condition_Value,
// Drivers
Machine_Drivers, // TODO: Implement Drivers usage
Machine_Driver_Status,
Machine_Driver_Emulation,
Machine_Driver_Cocktail,
Machine_Driver_SaveState,
// Features
Machine_Features, // TODO: Implement Features usage
Machine_Feature_Type,
Machine_Feature_Status,
Machine_Feature_Overall,
// Devices
Machine_Devices, // TODO: Implement Devices usage
Machine_Device_Type,
Machine_Device_Tag,
Machine_Device_FixedImage,
Machine_Device_Mandatory,
Machine_Device_Interface,
// Devices.Instances
Machine_Device_Instances,
Machine_Device_Instance_Name,
Machine_Device_Instance_BriefName,
// Devices.Extensions
Machine_Device_Extensions,
Machine_Device_Extension_Name,
// Slots
Machine_Slots, // TODO: Fix Slots usage
Machine_Slot_Name,
// Slots.SlotOptions
Machine_Slot_SlotOptions,
Machine_Slot_SlotOption_Name,
Machine_Slot_SlotOption_DeviceName,
Machine_Slot_SlotOption_Default,
// SoftwareLists
Machine_SoftwareLists, // TODO: Implement SoftwareLists usage
Machine_SoftwareList_Name,
Machine_SoftwareList_Status,
Machine_SoftwareList_Filter,
// RamOptions
Machine_RamOptions, // TODO: Implement RamOptions usage
Machine_RamOption_Default,
#endregion
#region Logiqx
Machine_Board,
Machine_RebuildTo,
#endregion #endregion
#region Logiqx EmuArc #region Logiqx EmuArc
TitleID, Machine_TitleID,
Developer, Machine_Developer,
Genre, Machine_Genre,
Subgenre, Machine_Subgenre,
Ratings, Machine_Ratings,
Score, Machine_Score,
Enabled, Machine_Enabled,
HasCrc, Machine_HasCrc,
RelatedTo, Machine_RelatedTo,
#endregion #endregion
#region OpenMSX #region OpenMSX
GenMSXID, Machine_GenMSXID,
System, Machine_System,
Country, Machine_Country,
#endregion #endregion
#region SoftwareList #region SoftwareList
Supported, Machine_Supported,
SharedFeatures,
DipSwitches, // Infos
Machine_Infos, // TODO: Fix usage of Infos
Machine_Info_Name,
Machine_Info_Value,
// SharedFeatures
Machine_SharedFeatures, // TODO: Fix usage of SharedFeatures
Machine_SharedFeature_Name,
Machine_SharedFeature_Value,
#endregion #endregion
@@ -115,28 +349,29 @@ namespace SabreTools.Library.DatItems
#region Common #region Common
Name, DatItem_Name,
ItemType, DatItem_Type,
#endregion #endregion
#region AttractMode #region AttractMode
AltName, DatItem_AltName,
AltTitle, DatItem_AltTitle,
#endregion #endregion
#region OpenMSX #region OpenMSX
Original, DatItem_Original,
OpenMSXSubType, DatItem_OpenMSXSubType,
OpenMSXType, DatItem_OpenMSXType,
Remark, DatItem_Remark,
Boot, DatItem_Boot,
#endregion #endregion
// TODO: Left off here on renaming
#region SoftwareList #region SoftwareList
PartName, PartName,

View File

@@ -136,6 +136,7 @@ namespace SabreTools.Library.DatItems
#endregion #endregion
// TODO: Ensure read/write for all fields here
#region ListXML Fields #region ListXML Fields
/// <summary> /// <summary>
@@ -202,6 +203,36 @@ namespace SabreTools.Library.DatItems
[JsonProperty("configurations", DefaultValueHandling = DefaultValueHandling.Ignore)] [JsonProperty("configurations", DefaultValueHandling = DefaultValueHandling.Ignore)]
public List<ListXmlConfiguration> Configurations { get; set; } = null; public List<ListXmlConfiguration> Configurations { get; set; } = null;
/// <summary>
/// List of associated ports
/// </summary>
[JsonProperty("ports", DefaultValueHandling = DefaultValueHandling.Ignore)]
public List<ListXmlPort> Ports { get; set; } = null;
/// <summary>
/// List of associated adjusters
/// </summary>
[JsonProperty("adjusters", DefaultValueHandling = DefaultValueHandling.Ignore)]
public List<ListXmlAdjuster> Adjusters { get; set; } = null;
/// <summary>
/// List of associated drivers
/// </summary>
[JsonProperty("drivers", DefaultValueHandling = DefaultValueHandling.Ignore)]
public List<ListXmlDriver> Drivers { get; set; } = null;
/// <summary>
/// List of associated features
/// </summary>
[JsonProperty("features", DefaultValueHandling = DefaultValueHandling.Ignore)]
public List<ListXmlFeature> Features { get; set; } = null;
/// <summary>
/// List of associated devices
/// </summary>
[JsonProperty("devices", DefaultValueHandling = DefaultValueHandling.Ignore)]
public List<ListXmlDevice> Devices { get; set; } = null;
/// <summary> /// <summary>
/// List of slot options /// List of slot options
/// </summary> /// </summary>
@@ -209,11 +240,16 @@ namespace SabreTools.Library.DatItems
public List<ListXmlSlot> Slots { get; set; } = null; public List<ListXmlSlot> Slots { get; set; } = null;
/// <summary> /// <summary>
/// List of info items /// List of software lists
/// </summary> /// </summary>
/// <remarks>Also in SoftwareList</remarks> [JsonProperty("softwarelists", DefaultValueHandling = DefaultValueHandling.Ignore)]
[JsonProperty("infos", DefaultValueHandling = DefaultValueHandling.Ignore)] public List<ListXmlSoftwareList> SoftwareLists { get; set; } = null;
public List<ListXmlInfo> Infos { get; set; } = null;
/// <summary>
/// List of ramoptions
/// </summary>
[JsonProperty("ramoptions", DefaultValueHandling = DefaultValueHandling.Ignore)]
public List<ListXmlRamOption> RamOptions { get; set; } = null;
#endregion #endregion
@@ -233,6 +269,7 @@ namespace SabreTools.Library.DatItems
#endregion #endregion
// TODO: Should this be a separate object for TruRip?
#region Logiqx EmuArc Fields #region Logiqx EmuArc Fields
/// <summary> /// <summary>
@@ -313,6 +350,7 @@ namespace SabreTools.Library.DatItems
#endregion #endregion
// TODO: Ensure read/write for all fields here
#region SoftwareList Fields #region SoftwareList Fields
/// <summary> /// <summary>
@@ -321,6 +359,13 @@ namespace SabreTools.Library.DatItems
[JsonProperty("supported", DefaultValueHandling = DefaultValueHandling.Ignore)] [JsonProperty("supported", DefaultValueHandling = DefaultValueHandling.Ignore)]
public Supported Supported { get; set; } = Supported.NULL; public Supported Supported { get; set; } = Supported.NULL;
/// <summary>
/// List of info items
/// </summary>
/// <remarks>Also in SoftwareList</remarks>
[JsonProperty("infos", DefaultValueHandling = DefaultValueHandling.Ignore)]
public List<SoftwareListInfo> Infos { get; set; } = null;
/// <summary> /// <summary>
/// List of shared feature items /// List of shared feature items
/// </summary> /// </summary>
@@ -341,96 +386,96 @@ namespace SabreTools.Library.DatItems
{ {
#region Common #region Common
if (mappings.Keys.Contains(Field.MachineName)) if (mappings.Keys.Contains(Field.Machine_Name))
Name = mappings[Field.MachineName]; Name = mappings[Field.Machine_Name];
if (mappings.Keys.Contains(Field.Comment)) if (mappings.Keys.Contains(Field.Machine_Comment))
Comment = mappings[Field.Comment]; Comment = mappings[Field.Machine_Comment];
if (mappings.Keys.Contains(Field.Description)) if (mappings.Keys.Contains(Field.Machine_Description))
Description = mappings[Field.Description]; Description = mappings[Field.Machine_Description];
if (mappings.Keys.Contains(Field.Year)) if (mappings.Keys.Contains(Field.Machine_Year))
Year = mappings[Field.Year]; Year = mappings[Field.Machine_Year];
if (mappings.Keys.Contains(Field.Manufacturer)) if (mappings.Keys.Contains(Field.Machine_Manufacturer))
Manufacturer = mappings[Field.Manufacturer]; Manufacturer = mappings[Field.Machine_Manufacturer];
if (mappings.Keys.Contains(Field.Publisher)) if (mappings.Keys.Contains(Field.Machine_Publisher))
Publisher = mappings[Field.Publisher]; Publisher = mappings[Field.Machine_Publisher];
if (mappings.Keys.Contains(Field.Category)) if (mappings.Keys.Contains(Field.Machine_Category))
Category = mappings[Field.Category]; Category = mappings[Field.Machine_Category];
if (mappings.Keys.Contains(Field.RomOf)) if (mappings.Keys.Contains(Field.Machine_RomOf))
RomOf = mappings[Field.RomOf]; RomOf = mappings[Field.Machine_RomOf];
if (mappings.Keys.Contains(Field.CloneOf)) if (mappings.Keys.Contains(Field.Machine_CloneOf))
CloneOf = mappings[Field.CloneOf]; CloneOf = mappings[Field.Machine_CloneOf];
if (mappings.Keys.Contains(Field.SampleOf)) if (mappings.Keys.Contains(Field.Machine_SampleOf))
SampleOf = mappings[Field.SampleOf]; SampleOf = mappings[Field.Machine_SampleOf];
if (mappings.Keys.Contains(Field.MachineType)) if (mappings.Keys.Contains(Field.Machine_Type))
MachineType = mappings[Field.MachineType].AsMachineType(); MachineType = mappings[Field.Machine_Type].AsMachineType();
#endregion #endregion
#region AttractMode #region AttractMode
if (mappings.Keys.Contains(Field.Players)) if (mappings.Keys.Contains(Field.Machine_Players))
Players = mappings[Field.Players]; Players = mappings[Field.Machine_Players];
if (mappings.Keys.Contains(Field.Rotation)) if (mappings.Keys.Contains(Field.Machine_Rotation))
Rotation = mappings[Field.Rotation]; Rotation = mappings[Field.Machine_Rotation];
if (mappings.Keys.Contains(Field.Control)) if (mappings.Keys.Contains(Field.Machine_Control))
Control = mappings[Field.Control]; Control = mappings[Field.Machine_Control];
if (mappings.Keys.Contains(Field.SupportStatus)) if (mappings.Keys.Contains(Field.Machine_SupportStatus))
Status = mappings[Field.SupportStatus]; Status = mappings[Field.Machine_SupportStatus];
if (mappings.Keys.Contains(Field.DisplayCount)) if (mappings.Keys.Contains(Field.Machine_DisplayCount))
DisplayCount = mappings[Field.DisplayCount]; DisplayCount = mappings[Field.Machine_DisplayCount];
if (mappings.Keys.Contains(Field.DisplayType)) if (mappings.Keys.Contains(Field.Machine_DisplayType))
DisplayType = mappings[Field.DisplayType]; DisplayType = mappings[Field.Machine_DisplayType];
if (mappings.Keys.Contains(Field.Buttons)) if (mappings.Keys.Contains(Field.Machine_Buttons))
Buttons = mappings[Field.Buttons]; Buttons = mappings[Field.Machine_Buttons];
#endregion #endregion
#region ListXML #region ListXML
if (mappings.Keys.Contains(Field.SourceFile)) if (mappings.Keys.Contains(Field.Machine_SourceFile))
SourceFile = mappings[Field.SourceFile]; SourceFile = mappings[Field.Machine_SourceFile];
if (mappings.Keys.Contains(Field.Runnable)) if (mappings.Keys.Contains(Field.Machine_Runnable))
Runnable = mappings[Field.Runnable].AsRunnable(); Runnable = mappings[Field.Machine_Runnable].AsRunnable();
if (mappings.Keys.Contains(Field.DeviceReferences)) if (mappings.Keys.Contains(Field.Machine_DeviceReference_Name))
{ {
if (DeviceReferences == null) if (DeviceReferences == null)
DeviceReferences = new List<ListXmlDeviceReference>(); DeviceReferences = new List<ListXmlDeviceReference>();
var devices = mappings[Field.DeviceReferences].Split(';').Select(d => new ListXmlDeviceReference() { Name = d, }); var devices = mappings[Field.Machine_DeviceReference_Name].Split(';').Select(d => new ListXmlDeviceReference() { Name = d, });
DeviceReferences.AddRange(devices); DeviceReferences.AddRange(devices);
} }
// TODO: Add Field.Slot // TODO: Add Field.Slot
if (mappings.Keys.Contains(Field.Infos)) if (mappings.Keys.Contains(Field.Machine_Infos))
{ {
if (Infos == null) if (Infos == null)
Infos = new List<ListXmlInfo>(); Infos = new List<SoftwareListInfo>();
string[] pairs = mappings[Field.Infos].Split(';'); string[] pairs = mappings[Field.Machine_Infos].Split(';');
foreach (string pair in pairs) foreach (string pair in pairs)
{ {
string[] split = pair.Split('='); string[] split = pair.Split('=');
var infoObj = new ListXmlInfo(); var infoObj = new SoftwareListInfo();
infoObj.Name = split[0]; infoObj.Name = split[0];
infoObj.Value = split[1]; infoObj.Value = split[1];
@@ -442,69 +487,69 @@ namespace SabreTools.Library.DatItems
#region Logiqx #region Logiqx
if (mappings.Keys.Contains(Field.Board)) if (mappings.Keys.Contains(Field.Machine_Board))
Board = mappings[Field.Board]; Board = mappings[Field.Machine_Board];
if (mappings.Keys.Contains(Field.RebuildTo)) if (mappings.Keys.Contains(Field.Machine_RebuildTo))
RebuildTo = mappings[Field.RebuildTo]; RebuildTo = mappings[Field.Machine_RebuildTo];
#endregion #endregion
#region Logiqx EmuArc #region Logiqx EmuArc
if (mappings.Keys.Contains(Field.TitleID)) if (mappings.Keys.Contains(Field.Machine_TitleID))
TitleID = mappings[Field.TitleID]; TitleID = mappings[Field.Machine_TitleID];
if (mappings.Keys.Contains(Field.Developer)) if (mappings.Keys.Contains(Field.Machine_Developer))
Developer = mappings[Field.Developer]; Developer = mappings[Field.Machine_Developer];
if (mappings.Keys.Contains(Field.Genre)) if (mappings.Keys.Contains(Field.Machine_Genre))
Genre = mappings[Field.Genre]; Genre = mappings[Field.Machine_Genre];
if (mappings.Keys.Contains(Field.Subgenre)) if (mappings.Keys.Contains(Field.Machine_Subgenre))
Subgenre = mappings[Field.Subgenre]; Subgenre = mappings[Field.Machine_Subgenre];
if (mappings.Keys.Contains(Field.Ratings)) if (mappings.Keys.Contains(Field.Machine_Ratings))
Ratings = mappings[Field.Ratings]; Ratings = mappings[Field.Machine_Ratings];
if (mappings.Keys.Contains(Field.Score)) if (mappings.Keys.Contains(Field.Machine_Score))
Score = mappings[Field.Score]; Score = mappings[Field.Machine_Score];
if (mappings.Keys.Contains(Field.Enabled)) if (mappings.Keys.Contains(Field.Machine_Enabled))
Enabled = mappings[Field.Enabled]; Enabled = mappings[Field.Machine_Enabled];
if (mappings.Keys.Contains(Field.HasCrc)) if (mappings.Keys.Contains(Field.Machine_HasCrc))
HasCrc = mappings[Field.HasCrc].AsYesNo(); HasCrc = mappings[Field.Machine_HasCrc].AsYesNo();
if (mappings.Keys.Contains(Field.RelatedTo)) if (mappings.Keys.Contains(Field.Machine_RelatedTo))
RelatedTo = mappings[Field.RelatedTo]; RelatedTo = mappings[Field.Machine_RelatedTo];
#endregion #endregion
#region OpenMSX #region OpenMSX
if (mappings.Keys.Contains(Field.GenMSXID)) if (mappings.Keys.Contains(Field.Machine_GenMSXID))
GenMSXID = mappings[Field.GenMSXID]; GenMSXID = mappings[Field.Machine_GenMSXID];
if (mappings.Keys.Contains(Field.System)) if (mappings.Keys.Contains(Field.Machine_System))
System = mappings[Field.System]; System = mappings[Field.Machine_System];
if (mappings.Keys.Contains(Field.Country)) if (mappings.Keys.Contains(Field.Machine_Country))
Country = mappings[Field.Country]; Country = mappings[Field.Machine_Country];
#endregion #endregion
#region SoftwareList #region SoftwareList
if (mappings.Keys.Contains(Field.Supported)) if (mappings.Keys.Contains(Field.Machine_Supported))
Supported = mappings[Field.Supported].AsSupported(); Supported = mappings[Field.Machine_Supported].AsSupported();
if (mappings.Keys.Contains(Field.SharedFeatures)) if (mappings.Keys.Contains(Field.Machine_SharedFeatures))
{ {
if (SharedFeatures == null) if (SharedFeatures == null)
SharedFeatures = new List<SoftwareListSharedFeature>(); SharedFeatures = new List<SoftwareListSharedFeature>();
string[] pairs = mappings[Field.SharedFeatures].Split(';'); string[] pairs = mappings[Field.Machine_SharedFeatures].Split(';');
foreach (string pair in pairs) foreach (string pair in pairs)
{ {
string[] split = pair.Split('='); string[] split = pair.Split('=');
@@ -517,7 +562,7 @@ namespace SabreTools.Library.DatItems
} }
} }
if (mappings.Keys.Contains(Field.DipSwitches)) if (mappings.Keys.Contains(Field.Machine_DipSwitches))
{ {
if (DipSwitches == null) if (DipSwitches == null)
DipSwitches = new List<ListXmlDipSwitch>(); DipSwitches = new List<ListXmlDipSwitch>();
@@ -927,148 +972,148 @@ namespace SabreTools.Library.DatItems
{ {
#region Common #region Common
if (fields.Contains(Field.MachineName)) if (fields.Contains(Field.Machine_Name))
Name = null; Name = null;
if (fields.Contains(Field.Comment)) if (fields.Contains(Field.Machine_Comment))
Comment = null; Comment = null;
if (fields.Contains(Field.Description)) if (fields.Contains(Field.Machine_Description))
Description = null; Description = null;
if (fields.Contains(Field.Year)) if (fields.Contains(Field.Machine_Year))
Year = null; Year = null;
if (fields.Contains(Field.Manufacturer)) if (fields.Contains(Field.Machine_Manufacturer))
Manufacturer = null; Manufacturer = null;
if (fields.Contains(Field.Publisher)) if (fields.Contains(Field.Machine_Publisher))
Publisher = null; Publisher = null;
if (fields.Contains(Field.Category)) if (fields.Contains(Field.Machine_Category))
Category = null; Category = null;
if (fields.Contains(Field.RomOf)) if (fields.Contains(Field.Machine_RomOf))
RomOf = null; RomOf = null;
if (fields.Contains(Field.CloneOf)) if (fields.Contains(Field.Machine_CloneOf))
CloneOf = null; CloneOf = null;
if (fields.Contains(Field.SampleOf)) if (fields.Contains(Field.Machine_SampleOf))
SampleOf = null; SampleOf = null;
if (fields.Contains(Field.MachineType)) if (fields.Contains(Field.Machine_Type))
MachineType = MachineType.NULL; MachineType = MachineType.NULL;
#endregion #endregion
#region AttractMode #region AttractMode
if (fields.Contains(Field.Players)) if (fields.Contains(Field.Machine_Players))
Players = null; Players = null;
if (fields.Contains(Field.Rotation)) if (fields.Contains(Field.Machine_Rotation))
Rotation = null; Rotation = null;
if (fields.Contains(Field.Control)) if (fields.Contains(Field.Machine_Control))
Control = null; Control = null;
if (fields.Contains(Field.SupportStatus)) if (fields.Contains(Field.Machine_SupportStatus))
Status = null; Status = null;
if (fields.Contains(Field.DisplayCount)) if (fields.Contains(Field.Machine_DisplayCount))
DisplayCount = null; DisplayCount = null;
if (fields.Contains(Field.DisplayType)) if (fields.Contains(Field.Machine_DisplayType))
DisplayType = null; DisplayType = null;
if (fields.Contains(Field.Buttons)) if (fields.Contains(Field.Machine_Buttons))
Buttons = null; Buttons = null;
#endregion #endregion
#region ListXML #region ListXML
if (fields.Contains(Field.SourceFile)) if (fields.Contains(Field.Machine_SourceFile))
SourceFile = null; SourceFile = null;
if (fields.Contains(Field.Runnable)) if (fields.Contains(Field.Machine_Runnable))
Runnable = Runnable.NULL; Runnable = Runnable.NULL;
if (fields.Contains(Field.DeviceReferences)) if (fields.Contains(Field.Machine_DeviceReferences))
DeviceReferences = null; DeviceReferences = null;
if (fields.Contains(Field.Slots)) if (fields.Contains(Field.Machine_Slots))
Slots = null; Slots = null;
if (fields.Contains(Field.Infos)) if (fields.Contains(Field.Machine_Infos))
Infos = null; Infos = null;
#endregion #endregion
#region Logiqx #region Logiqx
if (fields.Contains(Field.Board)) if (fields.Contains(Field.Machine_Board))
Board = null; Board = null;
if (fields.Contains(Field.RebuildTo)) if (fields.Contains(Field.Machine_RebuildTo))
RebuildTo = null; RebuildTo = null;
#endregion #endregion
#region Logiqx EmuArc #region Logiqx EmuArc
if (fields.Contains(Field.TitleID)) if (fields.Contains(Field.Machine_TitleID))
TitleID = null; TitleID = null;
if (fields.Contains(Field.Developer)) if (fields.Contains(Field.Machine_Developer))
Developer = null; Developer = null;
if (fields.Contains(Field.Genre)) if (fields.Contains(Field.Machine_Genre))
Genre = null; Genre = null;
if (fields.Contains(Field.Subgenre)) if (fields.Contains(Field.Machine_Subgenre))
Subgenre = null; Subgenre = null;
if (fields.Contains(Field.Ratings)) if (fields.Contains(Field.Machine_Ratings))
Ratings = null; Ratings = null;
if (fields.Contains(Field.Score)) if (fields.Contains(Field.Machine_Score))
Score = null; Score = null;
if (fields.Contains(Field.Enabled)) if (fields.Contains(Field.Machine_Enabled))
Enabled = null; Enabled = null;
if (fields.Contains(Field.HasCrc)) if (fields.Contains(Field.Machine_HasCrc))
HasCrc = null; HasCrc = null;
if (fields.Contains(Field.RelatedTo)) if (fields.Contains(Field.Machine_RelatedTo))
RelatedTo = null; RelatedTo = null;
#endregion #endregion
#region OpenMSX #region OpenMSX
if (fields.Contains(Field.GenMSXID)) if (fields.Contains(Field.Machine_GenMSXID))
GenMSXID = null; GenMSXID = null;
if (fields.Contains(Field.System)) if (fields.Contains(Field.Machine_System))
System = null; System = null;
if (fields.Contains(Field.Country)) if (fields.Contains(Field.Machine_Country))
Country = null; Country = null;
#endregion #endregion
#region SoftwareList #region SoftwareList
if (fields.Contains(Field.Supported)) if (fields.Contains(Field.Machine_Supported))
Supported = Supported.NULL; Supported = Supported.NULL;
if (fields.Contains(Field.SharedFeatures)) if (fields.Contains(Field.Machine_SharedFeatures))
SharedFeatures = null; SharedFeatures = null;
if (fields.Contains(Field.DipSwitches)) if (fields.Contains(Field.Machine_DipSwitches))
DipSwitches = null; DipSwitches = null;
#endregion #endregion
@@ -1088,151 +1133,151 @@ namespace SabreTools.Library.DatItems
{ {
#region Common #region Common
if (fields.Contains(Field.MachineName)) if (fields.Contains(Field.Machine_Name))
Name = machine.Name; Name = machine.Name;
if (fields.Contains(Field.Comment)) if (fields.Contains(Field.Machine_Comment))
Comment = machine.Comment; Comment = machine.Comment;
if (fields.Contains(Field.Description)) if (fields.Contains(Field.Machine_Description))
{ {
if (!onlySame || (onlySame && Name == Description)) if (!onlySame || (onlySame && Name == Description))
Description = machine.Description; Description = machine.Description;
} }
if (fields.Contains(Field.Year)) if (fields.Contains(Field.Machine_Year))
Year = machine.Year; Year = machine.Year;
if (fields.Contains(Field.Manufacturer)) if (fields.Contains(Field.Machine_Manufacturer))
Manufacturer = machine.Manufacturer; Manufacturer = machine.Manufacturer;
if (fields.Contains(Field.Publisher)) if (fields.Contains(Field.Machine_Publisher))
Publisher = machine.Publisher; Publisher = machine.Publisher;
if (fields.Contains(Field.Category)) if (fields.Contains(Field.Machine_Category))
Category = machine.Category; Category = machine.Category;
if (fields.Contains(Field.RomOf)) if (fields.Contains(Field.Machine_RomOf))
RomOf = machine.RomOf; RomOf = machine.RomOf;
if (fields.Contains(Field.CloneOf)) if (fields.Contains(Field.Machine_CloneOf))
CloneOf = machine.CloneOf; CloneOf = machine.CloneOf;
if (fields.Contains(Field.SampleOf)) if (fields.Contains(Field.Machine_SampleOf))
SampleOf = machine.SampleOf; SampleOf = machine.SampleOf;
if (fields.Contains(Field.MachineType)) if (fields.Contains(Field.Machine_Type))
MachineType = machine.MachineType; MachineType = machine.MachineType;
#endregion #endregion
#region AttractMode #region AttractMode
if (fields.Contains(Field.Players)) if (fields.Contains(Field.Machine_Players))
Players = machine.Players; Players = machine.Players;
if (fields.Contains(Field.Rotation)) if (fields.Contains(Field.Machine_Rotation))
Rotation = machine.Rotation; Rotation = machine.Rotation;
if (fields.Contains(Field.Control)) if (fields.Contains(Field.Machine_Control))
Control = machine.Control; Control = machine.Control;
if (fields.Contains(Field.SupportStatus)) if (fields.Contains(Field.Machine_SupportStatus))
Status = machine.Status; Status = machine.Status;
if (fields.Contains(Field.DisplayCount)) if (fields.Contains(Field.Machine_DisplayCount))
DisplayCount = machine.DisplayCount; DisplayCount = machine.DisplayCount;
if (fields.Contains(Field.DisplayType)) if (fields.Contains(Field.Machine_DisplayType))
DisplayType = machine.DisplayType; DisplayType = machine.DisplayType;
if (fields.Contains(Field.Buttons)) if (fields.Contains(Field.Machine_Buttons))
Buttons = machine.Buttons; Buttons = machine.Buttons;
#endregion #endregion
#region ListXML #region ListXML
if (fields.Contains(Field.SourceFile)) if (fields.Contains(Field.Machine_SourceFile))
SourceFile = machine.SourceFile; SourceFile = machine.SourceFile;
if (fields.Contains(Field.Runnable)) if (fields.Contains(Field.Machine_Runnable))
Runnable = machine.Runnable; Runnable = machine.Runnable;
if (fields.Contains(Field.DeviceReferences)) if (fields.Contains(Field.Machine_DeviceReferences))
DeviceReferences = machine.DeviceReferences; DeviceReferences = machine.DeviceReferences;
if (fields.Contains(Field.Slots)) if (fields.Contains(Field.Machine_Slots))
Slots = machine.Slots; Slots = machine.Slots;
if (fields.Contains(Field.Infos)) if (fields.Contains(Field.Machine_Infos))
Infos = machine.Infos; Infos = machine.Infos;
#endregion #endregion
#region Logiqx #region Logiqx
if (fields.Contains(Field.Board)) if (fields.Contains(Field.Machine_Board))
Board = machine.Board; Board = machine.Board;
if (fields.Contains(Field.RebuildTo)) if (fields.Contains(Field.Machine_RebuildTo))
RebuildTo = machine.RebuildTo; RebuildTo = machine.RebuildTo;
#endregion #endregion
#region Logiqx EmuArc #region Logiqx EmuArc
if (fields.Contains(Field.TitleID)) if (fields.Contains(Field.Machine_TitleID))
TitleID = machine.TitleID; TitleID = machine.TitleID;
if (fields.Contains(Field.Developer)) if (fields.Contains(Field.Machine_Developer))
Developer = machine.Developer; Developer = machine.Developer;
if (fields.Contains(Field.Genre)) if (fields.Contains(Field.Machine_Genre))
Genre = machine.Genre; Genre = machine.Genre;
if (fields.Contains(Field.Subgenre)) if (fields.Contains(Field.Machine_Subgenre))
Subgenre = machine.Subgenre; Subgenre = machine.Subgenre;
if (fields.Contains(Field.Ratings)) if (fields.Contains(Field.Machine_Ratings))
Ratings = machine.Ratings; Ratings = machine.Ratings;
if (fields.Contains(Field.Score)) if (fields.Contains(Field.Machine_Score))
Score = machine.Score; Score = machine.Score;
if (fields.Contains(Field.Enabled)) if (fields.Contains(Field.Machine_Enabled))
Enabled = machine.Enabled; Enabled = machine.Enabled;
if (fields.Contains(Field.HasCrc)) if (fields.Contains(Field.Machine_HasCrc))
HasCrc = machine.HasCrc; HasCrc = machine.HasCrc;
if (fields.Contains(Field.RelatedTo)) if (fields.Contains(Field.Machine_RelatedTo))
RelatedTo = machine.RelatedTo; RelatedTo = machine.RelatedTo;
#endregion #endregion
#region OpenMSX #region OpenMSX
if (fields.Contains(Field.GenMSXID)) if (fields.Contains(Field.Machine_GenMSXID))
GenMSXID = machine.GenMSXID; GenMSXID = machine.GenMSXID;
if (fields.Contains(Field.System)) if (fields.Contains(Field.Machine_System))
System = machine.System; System = machine.System;
if (fields.Contains(Field.Country)) if (fields.Contains(Field.Machine_Country))
Country = machine.Country; Country = machine.Country;
#endregion #endregion
#region SoftwareList #region SoftwareList
if (fields.Contains(Field.Supported)) if (fields.Contains(Field.Machine_Supported))
Supported = machine.Supported; Supported = machine.Supported;
if (fields.Contains(Field.SharedFeatures)) if (fields.Contains(Field.Machine_SharedFeatures))
SharedFeatures = machine.SharedFeatures; SharedFeatures = machine.SharedFeatures;
if (fields.Contains(Field.DipSwitches)) if (fields.Contains(Field.Machine_DipSwitches))
DipSwitches = machine.DipSwitches; DipSwitches = machine.DipSwitches;
#endregion #endregion

View File

@@ -104,8 +104,7 @@ namespace SabreTools.Library.DatItems
Remark = this.Remark, Remark = this.Remark,
Boot = this.Boot, Boot = this.Boot,
PartName = this.PartName, Part = this.Part,
PartInterface = this.PartInterface,
Features = this.Features, Features = this.Features,
AreaName = this.AreaName, AreaName = this.AreaName,
AreaSize = this.AreaSize, AreaSize = this.AreaSize,

View File

@@ -308,8 +308,7 @@ namespace SabreTools.Library.DatItems
Remark = this.Remark, Remark = this.Remark,
Boot = this.Boot, Boot = this.Boot,
PartName = this.PartName, Part = this.Part,
PartInterface = this.PartInterface,
Features = this.Features, Features = this.Features,
AreaName = this.AreaName, AreaName = this.AreaName,
AreaSize = this.AreaSize, AreaSize = this.AreaSize,

View File

@@ -40,8 +40,7 @@ namespace SabreTools.Library.DatItems
Remark = this.Remark, Remark = this.Remark,
Boot = this.Boot, Boot = this.Boot,
PartName = this.PartName, Part = this.Part,
PartInterface = this.PartInterface,
Features = this.Features, Features = this.Features,
AreaName = this.AreaName, AreaName = this.AreaName,
AreaSize = this.AreaSize, AreaSize = this.AreaSize,

View File

@@ -12,6 +12,7 @@ namespace SabreTools.Library.Filtering
/// Represents the filtering operations that need to be performed on a set of items, usually a DAT /// Represents the filtering operations that need to be performed on a set of items, usually a DAT
/// </summary> /// </summary>
/// TODO: Can clever use of Filtering allow for easier external splitting methods? /// TODO: Can clever use of Filtering allow for easier external splitting methods?
/// TODO: Field name for filter population needs to be overhauled
public class Filter public class Filter
{ {
#region Fields #region Fields
@@ -561,77 +562,77 @@ namespace SabreTools.Library.Filtering
#region Common #region Common
case Field.MachineName: case Field.Machine_Name:
if (negate) if (negate)
MachineName.NegativeSet.Add(value); MachineName.NegativeSet.Add(value);
else else
MachineName.PositiveSet.Add(value); MachineName.PositiveSet.Add(value);
break; break;
case Field.Comment: case Field.Machine_Comment:
if (negate) if (negate)
Comment.NegativeSet.Add(value); Comment.NegativeSet.Add(value);
else else
Comment.PositiveSet.Add(value); Comment.PositiveSet.Add(value);
break; break;
case Field.Description: case Field.Machine_Description:
if (negate) if (negate)
MachineDescription.NegativeSet.Add(value); MachineDescription.NegativeSet.Add(value);
else else
MachineDescription.PositiveSet.Add(value); MachineDescription.PositiveSet.Add(value);
break; break;
case Field.Year: case Field.Machine_Year:
if (negate) if (negate)
Year.NegativeSet.Add(value); Year.NegativeSet.Add(value);
else else
Year.PositiveSet.Add(value); Year.PositiveSet.Add(value);
break; break;
case Field.Manufacturer: case Field.Machine_Manufacturer:
if (negate) if (negate)
Manufacturer.NegativeSet.Add(value); Manufacturer.NegativeSet.Add(value);
else else
Manufacturer.PositiveSet.Add(value); Manufacturer.PositiveSet.Add(value);
break; break;
case Field.Publisher: case Field.Machine_Publisher:
if (negate) if (negate)
Publisher.NegativeSet.Add(value); Publisher.NegativeSet.Add(value);
else else
Publisher.PositiveSet.Add(value); Publisher.PositiveSet.Add(value);
break; break;
case Field.Category: case Field.Machine_Category:
if (negate) if (negate)
Category.NegativeSet.Add(value); Category.NegativeSet.Add(value);
else else
Category.PositiveSet.Add(value); Category.PositiveSet.Add(value);
break; break;
case Field.RomOf: case Field.Machine_RomOf:
if (negate) if (negate)
RomOf.NegativeSet.Add(value); RomOf.NegativeSet.Add(value);
else else
RomOf.PositiveSet.Add(value); RomOf.PositiveSet.Add(value);
break; break;
case Field.CloneOf: case Field.Machine_CloneOf:
if (negate) if (negate)
CloneOf.NegativeSet.Add(value); CloneOf.NegativeSet.Add(value);
else else
CloneOf.PositiveSet.Add(value); CloneOf.PositiveSet.Add(value);
break; break;
case Field.SampleOf: case Field.Machine_SampleOf:
if (negate) if (negate)
SampleOf.NegativeSet.Add(value); SampleOf.NegativeSet.Add(value);
else else
SampleOf.PositiveSet.Add(value); SampleOf.PositiveSet.Add(value);
break; break;
case Field.MachineType: case Field.Machine_Type:
if (negate) if (negate)
MachineTypes.Negative |= value.AsMachineType(); MachineTypes.Negative |= value.AsMachineType();
else else
@@ -642,49 +643,49 @@ namespace SabreTools.Library.Filtering
#region AttractMode #region AttractMode
case Field.Players: case Field.Machine_Players:
if (negate) if (negate)
Players.NegativeSet.Add(value); Players.NegativeSet.Add(value);
else else
Players.PositiveSet.Add(value); Players.PositiveSet.Add(value);
break; break;
case Field.Rotation: case Field.Machine_Rotation:
if (negate) if (negate)
Rotation.NegativeSet.Add(value); Rotation.NegativeSet.Add(value);
else else
Rotation.PositiveSet.Add(value); Rotation.PositiveSet.Add(value);
break; break;
case Field.Control: case Field.Machine_Control:
if (negate) if (negate)
Control.NegativeSet.Add(value); Control.NegativeSet.Add(value);
else else
Control.PositiveSet.Add(value); Control.PositiveSet.Add(value);
break; break;
case Field.SupportStatus: case Field.Machine_SupportStatus:
if (negate) if (negate)
SupportStatus.NegativeSet.Add(value); SupportStatus.NegativeSet.Add(value);
else else
SupportStatus.PositiveSet.Add(value); SupportStatus.PositiveSet.Add(value);
break; break;
case Field.DisplayCount: case Field.Machine_DisplayCount:
if (negate) if (negate)
DisplayCount.NegativeSet.Add(value); DisplayCount.NegativeSet.Add(value);
else else
DisplayCount.PositiveSet.Add(value); DisplayCount.PositiveSet.Add(value);
break; break;
case Field.DisplayType: case Field.Machine_DisplayType:
if (negate) if (negate)
DisplayType.NegativeSet.Add(value); DisplayType.NegativeSet.Add(value);
else else
DisplayType.PositiveSet.Add(value); DisplayType.PositiveSet.Add(value);
break; break;
case Field.Buttons: case Field.Machine_Buttons:
if (negate) if (negate)
Buttons.NegativeSet.Add(value); Buttons.NegativeSet.Add(value);
else else
@@ -695,28 +696,28 @@ namespace SabreTools.Library.Filtering
#region ListXML #region ListXML
case Field.SourceFile: case Field.Machine_SourceFile:
if (negate) if (negate)
SourceFile.NegativeSet.Add(value); SourceFile.NegativeSet.Add(value);
else else
SourceFile.PositiveSet.Add(value); SourceFile.PositiveSet.Add(value);
break; break;
case Field.Runnable: case Field.Machine_Runnable:
if (negate) if (negate)
Runnables.Negative |= value.AsRunnable(); Runnables.Negative |= value.AsRunnable();
else else
Runnables.Positive |= value.AsRunnable(); Runnables.Positive |= value.AsRunnable();
break; break;
case Field.DeviceReferences: case Field.Machine_DeviceReference_Name:
if (negate) if (negate)
Devices.NegativeSet.Add(value); Devices.NegativeSet.Add(value);
else else
Devices.PositiveSet.Add(value); Devices.PositiveSet.Add(value);
break; break;
case Field.Slots: case Field.Machine_Slots:
if (negate) if (negate)
SlotOptions.NegativeSet.Add(value); SlotOptions.NegativeSet.Add(value);
else else
@@ -727,14 +728,14 @@ namespace SabreTools.Library.Filtering
#region Logiqx #region Logiqx
case Field.Board: case Field.Machine_Board:
if (negate) if (negate)
Board.NegativeSet.Add(value); Board.NegativeSet.Add(value);
else else
Board.PositiveSet.Add(value); Board.PositiveSet.Add(value);
break; break;
case Field.RebuildTo: case Field.Machine_RebuildTo:
if (negate) if (negate)
RebuildTo.NegativeSet.Add(value); RebuildTo.NegativeSet.Add(value);
else else
@@ -745,63 +746,63 @@ namespace SabreTools.Library.Filtering
#region Logiqx EmuArc #region Logiqx EmuArc
case Field.TitleID: case Field.Machine_TitleID:
if (negate) if (negate)
TitleID.NegativeSet.Add(value); TitleID.NegativeSet.Add(value);
else else
TitleID.PositiveSet.Add(value); TitleID.PositiveSet.Add(value);
break; break;
case Field.Developer: case Field.Machine_Developer:
if (negate) if (negate)
Developer.NegativeSet.Add(value); Developer.NegativeSet.Add(value);
else else
Developer.PositiveSet.Add(value); Developer.PositiveSet.Add(value);
break; break;
case Field.Genre: case Field.Machine_Genre:
if (negate) if (negate)
Genre.NegativeSet.Add(value); Genre.NegativeSet.Add(value);
else else
Genre.PositiveSet.Add(value); Genre.PositiveSet.Add(value);
break; break;
case Field.Subgenre: case Field.Machine_Subgenre:
if (negate) if (negate)
Subgenre.NegativeSet.Add(value); Subgenre.NegativeSet.Add(value);
else else
Subgenre.PositiveSet.Add(value); Subgenre.PositiveSet.Add(value);
break; break;
case Field.Ratings: case Field.Machine_Ratings:
if (negate) if (negate)
Ratings.NegativeSet.Add(value); Ratings.NegativeSet.Add(value);
else else
Ratings.PositiveSet.Add(value); Ratings.PositiveSet.Add(value);
break; break;
case Field.Score: case Field.Machine_Score:
if (negate) if (negate)
Score.NegativeSet.Add(value); Score.NegativeSet.Add(value);
else else
Score.PositiveSet.Add(value); Score.PositiveSet.Add(value);
break; break;
case Field.Enabled: case Field.Machine_Enabled:
if (negate) if (negate)
Enabled.NegativeSet.Add(value); Enabled.NegativeSet.Add(value);
else else
Enabled.PositiveSet.Add(value); Enabled.PositiveSet.Add(value);
break; break;
case Field.HasCrc: case Field.Machine_HasCrc:
if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase)) if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase))
HasCrc.Neutral = false; HasCrc.Neutral = false;
else else
HasCrc.Neutral = true; HasCrc.Neutral = true;
break; break;
case Field.RelatedTo: case Field.Machine_RelatedTo:
if (negate) if (negate)
RelatedTo.NegativeSet.Add(value); RelatedTo.NegativeSet.Add(value);
else else
@@ -812,21 +813,21 @@ namespace SabreTools.Library.Filtering
#region OpenMSX #region OpenMSX
case Field.GenMSXID: case Field.Machine_GenMSXID:
if (negate) if (negate)
GenMSXID.NegativeSet.Add(value); GenMSXID.NegativeSet.Add(value);
else else
GenMSXID.PositiveSet.Add(value); GenMSXID.PositiveSet.Add(value);
break; break;
case Field.System: case Field.Machine_System:
if (negate) if (negate)
System.NegativeSet.Add(value); System.NegativeSet.Add(value);
else else
System.PositiveSet.Add(value); System.PositiveSet.Add(value);
break; break;
case Field.Country: case Field.Machine_Country:
if (negate) if (negate)
Country.NegativeSet.Add(value); Country.NegativeSet.Add(value);
else else
@@ -837,7 +838,7 @@ namespace SabreTools.Library.Filtering
#region SoftwareList #region SoftwareList
case Field.Supported: case Field.Machine_Supported:
if (negate) if (negate)
SupportedStatus.Negative |= value.AsSupported(); SupportedStatus.Negative |= value.AsSupported();
else else
@@ -852,14 +853,14 @@ namespace SabreTools.Library.Filtering
#region Common #region Common
case Field.Name: case Field.DatItem_Name:
if (negate) if (negate)
ItemName.NegativeSet.Add(value); ItemName.NegativeSet.Add(value);
else else
ItemName.PositiveSet.Add(value); ItemName.PositiveSet.Add(value);
break; break;
case Field.ItemType: case Field.DatItem_Type:
if (value.AsItemType() == null) if (value.AsItemType() == null)
return; return;
@@ -873,14 +874,14 @@ namespace SabreTools.Library.Filtering
#region AttractMode #region AttractMode
case Field.AltName: case Field.DatItem_AltName:
if (negate) if (negate)
AltName.NegativeSet.Add(value); AltName.NegativeSet.Add(value);
else else
AltName.PositiveSet.Add(value); AltName.PositiveSet.Add(value);
break; break;
case Field.AltTitle: case Field.DatItem_AltTitle:
if (negate) if (negate)
AltTitle.NegativeSet.Add(value); AltTitle.NegativeSet.Add(value);
else else
@@ -891,35 +892,35 @@ namespace SabreTools.Library.Filtering
#region OpenMSX #region OpenMSX
case Field.Original: case Field.DatItem_Original:
if (negate) if (negate)
Original.NegativeSet.Add(value); Original.NegativeSet.Add(value);
else else
Original.PositiveSet.Add(value); Original.PositiveSet.Add(value);
break; break;
case Field.OpenMSXSubType: case Field.DatItem_OpenMSXSubType:
if (negate) if (negate)
SubType.Negative |= value.AsOpenMSXSubType(); SubType.Negative |= value.AsOpenMSXSubType();
else else
SubType.Positive |= value.AsOpenMSXSubType(); SubType.Positive |= value.AsOpenMSXSubType();
break; break;
case Field.OpenMSXType: case Field.DatItem_OpenMSXType:
if (negate) if (negate)
OpenMSXType.NegativeSet.Add(value); OpenMSXType.NegativeSet.Add(value);
else else
OpenMSXType.PositiveSet.Add(value); OpenMSXType.PositiveSet.Add(value);
break; break;
case Field.Remark: case Field.DatItem_Remark:
if (negate) if (negate)
Remark.NegativeSet.Add(value); Remark.NegativeSet.Add(value);
else else
Remark.PositiveSet.Add(value); Remark.PositiveSet.Add(value);
break; break;
case Field.Boot: case Field.DatItem_Boot:
if (negate) if (negate)
Boot.NegativeSet.Add(value); Boot.NegativeSet.Add(value);
else else

View File

@@ -125,6 +125,7 @@ namespace SabreTools.Library.Tools
/// </summary> /// </summary>
/// <param name="input">String to get value from</param> /// <param name="input">String to get value from</param>
/// <returns>Field value corresponding to the string</returns> /// <returns>Field value corresponding to the string</returns>
/// TODO: Needs to be SEVERELY overhauled. Start using dot notation for fields... (where possible)
public static Field AsField(this string input) public static Field AsField(this string input)
{ {
switch (input?.ToLowerInvariant()) switch (input?.ToLowerInvariant())
@@ -139,11 +140,11 @@ namespace SabreTools.Library.Tools
case "machine": case "machine":
case "machinename": case "machinename":
case "machine-name": case "machine-name":
return Field.MachineName; return Field.Machine_Name;
case "comment": case "comment":
case "extra": case "extra":
return Field.Comment; return Field.Machine_Comment;
case "desc": case "desc":
case "description": case "description":
@@ -155,32 +156,32 @@ namespace SabreTools.Library.Tools
case "machinedescription": case "machinedescription":
case "machine-description": case "machine-description":
case "machine description": case "machine description":
return Field.Description; return Field.Machine_Description;
case "year": case "year":
return Field.Year; return Field.Machine_Year;
case "manufacturer": case "manufacturer":
return Field.Manufacturer; return Field.Machine_Manufacturer;
case "publisher": case "publisher":
return Field.Publisher; return Field.Machine_Publisher;
case "category": case "category":
case "gamecategory": case "gamecategory":
case "game-category": case "game-category":
case "machinecategory": case "machinecategory":
case "machine-category": case "machine-category":
return Field.Category; return Field.Machine_Category;
case "romof": case "romof":
return Field.RomOf; return Field.Machine_RomOf;
case "cloneof": case "cloneof":
return Field.CloneOf; return Field.Machine_CloneOf;
case "sampleof": case "sampleof":
return Field.SampleOf; return Field.Machine_SampleOf;
case "gametype": case "gametype":
case "game type": case "game type":
@@ -188,20 +189,20 @@ namespace SabreTools.Library.Tools
case "machinetype": case "machinetype":
case "machine type": case "machine type":
case "machine-type": case "machine-type":
return Field.MachineType; return Field.Machine_Type;
#endregion #endregion
#region AttractMode #region AttractMode
case "players": case "players":
return Field.Players; return Field.Machine_Players;
case "rotation": case "rotation":
return Field.Rotation; return Field.Machine_Rotation;
case "control": case "control":
return Field.Control; return Field.Machine_Control;
case "amstatus": case "amstatus":
case "am-status": case "am-status":
@@ -211,19 +212,19 @@ namespace SabreTools.Library.Tools
case "machine-status": case "machine-status":
case "supportstatus": case "supportstatus":
case "support-status": case "support-status":
return Field.SupportStatus; return Field.Machine_SupportStatus;
case "displaycount": case "displaycount":
case "display-count": case "display-count":
case "displays": case "displays":
return Field.DisplayCount; return Field.Machine_DisplayCount;
case "displaytype": case "displaytype":
case "display-type": case "display-type":
return Field.DisplayType; return Field.Machine_DisplayType;
case "buttons": case "buttons":
return Field.Buttons; return Field.Machine_Buttons;
#endregion #endregion
@@ -232,33 +233,33 @@ namespace SabreTools.Library.Tools
case "sourcefile": case "sourcefile":
case "source file": case "source file":
case "source-file": case "source-file":
return Field.SourceFile; return Field.Machine_SourceFile;
case "runnable": case "runnable":
return Field.Runnable; return Field.Machine_Runnable;
case "devices": case "devices":
return Field.DeviceReferences; return Field.Machine_DeviceReference_Name;
case "slotoptions": case "slotoptions":
case "slot options": case "slot options":
case "slot-options": case "slot-options":
return Field.Slots; return Field.Machine_Slots;
case "infos": case "infos":
return Field.Infos; return Field.Machine_Infos;
#endregion #endregion
#region Logiqx #region Logiqx
case "board": case "board":
return Field.Board; return Field.Machine_Board;
case "rebuildto": case "rebuildto":
case "rebuild to": case "rebuild to":
case "rebuild-to": case "rebuild-to":
return Field.RebuildTo; return Field.Machine_RebuildTo;
#endregion #endregion
@@ -267,35 +268,35 @@ namespace SabreTools.Library.Tools
case "titleid": case "titleid":
case "title id": case "title id":
case "title-id": case "title-id":
return Field.TitleID; return Field.Machine_TitleID;
case "developer": case "developer":
return Field.Developer; return Field.Machine_Developer;
case "genre": case "genre":
return Field.Genre; return Field.Machine_Genre;
case "subgenre": case "subgenre":
return Field.Subgenre; return Field.Machine_Subgenre;
case "ratings": case "ratings":
return Field.Ratings; return Field.Machine_Ratings;
case "score": case "score":
return Field.Score; return Field.Machine_Score;
case "enabled": case "enabled":
return Field.Enabled; return Field.Machine_Enabled;
case "hascrc": case "hascrc":
case "has crc": case "has crc":
case "has-crc": case "has-crc":
return Field.HasCrc; return Field.Machine_HasCrc;
case "relatedto": case "relatedto":
case "related to": case "related to":
case "related-to": case "related-to":
return Field.RelatedTo; return Field.Machine_RelatedTo;
#endregion #endregion
@@ -306,23 +307,23 @@ namespace SabreTools.Library.Tools
case "genmsx-id": case "genmsx-id":
case "gen msx id": case "gen msx id":
case "gen-msx-id": case "gen-msx-id":
return Field.GenMSXID; return Field.Machine_GenMSXID;
case "system": case "system":
case "msxsystem": case "msxsystem":
case "msx system": case "msx system":
case "msx-system": case "msx-system":
return Field.System; return Field.Machine_System;
case "country": case "country":
return Field.Country; return Field.Machine_Country;
#endregion #endregion
#region SoftwareList #region SoftwareList
case "supported": case "supported":
return Field.Supported; return Field.Machine_Supported;
case "sharedfeat": case "sharedfeat":
case "shared feat": case "shared feat":
case "shared-feat": case "shared-feat":
@@ -332,14 +333,14 @@ namespace SabreTools.Library.Tools
case "sharedfeatures": case "sharedfeatures":
case "shared features": case "shared features":
case "shared-features": case "shared-features":
return Field.SharedFeatures; return Field.Machine_SharedFeatures;
case "dipswitch": case "dipswitch":
case "dip switch": case "dip switch":
case "dip-switch": case "dip-switch":
case "dipswitches": case "dipswitches":
case "dip switches": case "dip switches":
case "dip-switches": case "dip-switches":
return Field.DipSwitches; return Field.Machine_DipSwitches;
#endregion #endregion
@@ -352,11 +353,11 @@ namespace SabreTools.Library.Tools
case "itemname": case "itemname":
case "item-name": case "item-name":
case "name": case "name":
return Field.Name; return Field.DatItem_Name;
case "itemtype": case "itemtype":
case "item-type": case "item-type":
case "type": case "type":
return Field.ItemType; return Field.DatItem_Type;
#endregion #endregion
@@ -368,32 +369,32 @@ namespace SabreTools.Library.Tools
case "altromname": case "altromname":
case "alt romname": case "alt romname":
case "alt-romname": case "alt-romname":
return Field.AltName; return Field.DatItem_AltName;
case "alttitle": case "alttitle":
case "alt title": case "alt title":
case "alt-title": case "alt-title":
case "altromtitle": case "altromtitle":
case "alt romtitle": case "alt romtitle":
case "alt-romtitle": case "alt-romtitle":
return Field.AltTitle; return Field.DatItem_AltTitle;
#endregion #endregion
#region OpenMSX #region OpenMSX
case "original": case "original":
return Field.Original; return Field.DatItem_Original;
case "subtype": case "subtype":
case "sub type": case "sub type":
case "sub-type": case "sub-type":
case "openmsx_subtype": case "openmsx_subtype":
return Field.OpenMSXSubType; return Field.DatItem_OpenMSXSubType;
case "openmsx_type": case "openmsx_type":
return Field.OpenMSXType; return Field.DatItem_OpenMSXType;
case "remark": case "remark":
return Field.Remark; return Field.DatItem_Remark;
case "boot": case "boot":
return Field.Boot; return Field.DatItem_Boot;
#endregion #endregion

View File

@@ -2548,13 +2548,13 @@ Some special strings that can be used:
if (GetBoolean(features, UpdateDescriptionValue)) if (GetBoolean(features, UpdateDescriptionValue))
{ {
Globals.Logger.User($"This flag '{(UpdateDescriptionValue)}' is deprecated, please use {(string.Join(", ", UpdateFieldListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details."); Globals.Logger.User($"This flag '{(UpdateDescriptionValue)}' is deprecated, please use {(string.Join(", ", UpdateFieldListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details.");
updateFields.Add(Field.Description); updateFields.Add(Field.Machine_Description);
} }
if (GetBoolean(features, UpdateGameTypeValue)) if (GetBoolean(features, UpdateGameTypeValue))
{ {
Globals.Logger.User($"This flag '{(UpdateGameTypeValue)}' is deprecated, please use {(string.Join(", ", UpdateFieldListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details."); Globals.Logger.User($"This flag '{(UpdateGameTypeValue)}' is deprecated, please use {(string.Join(", ", UpdateFieldListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details.");
updateFields.Add(Field.MachineType); updateFields.Add(Field.Machine_Type);
} }
if (GetBoolean(features, UpdateHashesValue)) if (GetBoolean(features, UpdateHashesValue))
@@ -2574,27 +2574,27 @@ Some special strings that can be used:
if (GetBoolean(features, UpdateManufacturerValue)) if (GetBoolean(features, UpdateManufacturerValue))
{ {
Globals.Logger.User($"This flag '{(UpdateManufacturerValue)}' is deprecated, please use {(string.Join(", ", UpdateFieldListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details."); Globals.Logger.User($"This flag '{(UpdateManufacturerValue)}' is deprecated, please use {(string.Join(", ", UpdateFieldListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details.");
updateFields.Add(Field.Manufacturer); updateFields.Add(Field.Machine_Manufacturer);
} }
if (GetBoolean(features, UpdateNamesValue)) if (GetBoolean(features, UpdateNamesValue))
{ {
Globals.Logger.User($"This flag '{(UpdateNamesValue)}' is deprecated, please use {(string.Join(", ", UpdateFieldListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details."); Globals.Logger.User($"This flag '{(UpdateNamesValue)}' is deprecated, please use {(string.Join(", ", UpdateFieldListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details.");
updateFields.Add(Field.Name); updateFields.Add(Field.DatItem_Name);
} }
if (GetBoolean(features, UpdateParentsValue)) if (GetBoolean(features, UpdateParentsValue))
{ {
Globals.Logger.User($"This flag '{(UpdateParentsValue)}' is deprecated, please use {(string.Join(", ", UpdateFieldListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details."); Globals.Logger.User($"This flag '{(UpdateParentsValue)}' is deprecated, please use {(string.Join(", ", UpdateFieldListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details.");
updateFields.Add(Field.CloneOf); updateFields.Add(Field.Machine_CloneOf);
updateFields.Add(Field.RomOf); updateFields.Add(Field.Machine_RomOf);
updateFields.Add(Field.SampleOf); updateFields.Add(Field.Machine_SampleOf);
} }
if (GetBoolean(features, UpdateYearValue)) if (GetBoolean(features, UpdateYearValue))
{ {
Globals.Logger.User($"This flag '{(UpdateYearValue)}' is deprecated, please use {(string.Join(", ", UpdateFieldListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details."); Globals.Logger.User($"This flag '{(UpdateYearValue)}' is deprecated, please use {(string.Join(", ", UpdateFieldListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details.");
updateFields.Add(Field.Year); updateFields.Add(Field.Machine_Year);
} }
foreach (string fieldName in GetList(features, UpdateFieldListValue)) foreach (string fieldName in GetList(features, UpdateFieldListValue))
@@ -2756,12 +2756,12 @@ Some special strings that can be used:
if (features.ContainsKey(NotCategoryListValue)) if (features.ContainsKey(NotCategoryListValue))
{ {
Globals.Logger.User($"This flag '{(NotCategoryListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details."); Globals.Logger.User($"This flag '{(NotCategoryListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details.");
filter.SetFilter(Field.Category, GetList(features, NotCategoryListValue), true); filter.SetFilter(Field.Machine_Category, GetList(features, NotCategoryListValue), true);
} }
if (features.ContainsKey(CategoryListValue)) if (features.ContainsKey(CategoryListValue))
{ {
Globals.Logger.User($"This flag '{(CategoryListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details."); Globals.Logger.User($"This flag '{(CategoryListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details.");
filter.SetFilter(Field.Category, GetList(features, CategoryListValue), false); filter.SetFilter(Field.Machine_Category, GetList(features, CategoryListValue), false);
} }
// CRC // CRC
@@ -2780,12 +2780,12 @@ Some special strings that can be used:
if (features.ContainsKey(NotItemNameListValue)) if (features.ContainsKey(NotItemNameListValue))
{ {
Globals.Logger.User($"This flag '{(NotItemNameListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details."); Globals.Logger.User($"This flag '{(NotItemNameListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details.");
filter.SetFilter(Field.Name, GetList(features, NotItemNameListValue), true); filter.SetFilter(Field.DatItem_Name, GetList(features, NotItemNameListValue), true);
} }
if (features.ContainsKey(ItemNameListValue)) if (features.ContainsKey(ItemNameListValue))
{ {
Globals.Logger.User($"This flag '{(ItemNameListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details."); Globals.Logger.User($"This flag '{(ItemNameListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details.");
filter.SetFilter(Field.Name, GetList(features, ItemNameListValue), false); filter.SetFilter(Field.DatItem_Name, GetList(features, ItemNameListValue), false);
} }
// Item status // Item status
@@ -2804,48 +2804,48 @@ Some special strings that can be used:
if (features.ContainsKey(NotItemTypeListValue)) if (features.ContainsKey(NotItemTypeListValue))
{ {
Globals.Logger.User($"This flag '{(NotItemTypeListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details."); Globals.Logger.User($"This flag '{(NotItemTypeListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details.");
filter.SetFilter(Field.ItemType, GetList(features, NotItemTypeListValue), true); filter.SetFilter(Field.DatItem_Type, GetList(features, NotItemTypeListValue), true);
} }
if (features.ContainsKey(ItemTypeListValue)) if (features.ContainsKey(ItemTypeListValue))
{ {
Globals.Logger.User($"This flag '{(ItemTypeListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details."); Globals.Logger.User($"This flag '{(ItemTypeListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details.");
filter.SetFilter(Field.ItemType, GetList(features, ItemTypeListValue), false); filter.SetFilter(Field.DatItem_Type, GetList(features, ItemTypeListValue), false);
} }
// Machine description // Machine description
if (features.ContainsKey(NotGameDescriptionListValue)) if (features.ContainsKey(NotGameDescriptionListValue))
{ {
Globals.Logger.User($"This flag '{(NotGameDescriptionListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details."); Globals.Logger.User($"This flag '{(NotGameDescriptionListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details.");
filter.SetFilter(Field.Description, GetList(features, NotGameDescriptionListValue), true); filter.SetFilter(Field.Machine_Description, GetList(features, NotGameDescriptionListValue), true);
} }
if (features.ContainsKey(GameDescriptionListValue)) if (features.ContainsKey(GameDescriptionListValue))
{ {
Globals.Logger.User($"This flag '{(GameDescriptionListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details."); Globals.Logger.User($"This flag '{(GameDescriptionListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details.");
filter.SetFilter(Field.Description, GetList(features, GameDescriptionListValue), false); filter.SetFilter(Field.Machine_Description, GetList(features, GameDescriptionListValue), false);
} }
// Machine name // Machine name
if (features.ContainsKey(NotGameNameListValue)) if (features.ContainsKey(NotGameNameListValue))
{ {
Globals.Logger.User($"This flag '{(NotGameNameListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details."); Globals.Logger.User($"This flag '{(NotGameNameListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details.");
filter.SetFilter(Field.MachineName, GetList(features, NotGameNameListValue), true); filter.SetFilter(Field.Machine_Name, GetList(features, NotGameNameListValue), true);
} }
if (features.ContainsKey(GameNameListValue)) if (features.ContainsKey(GameNameListValue))
{ {
Globals.Logger.User($"This flag '{(GameNameListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details."); Globals.Logger.User($"This flag '{(GameNameListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details.");
filter.SetFilter(Field.MachineName, GetList(features, GameNameListValue), false); filter.SetFilter(Field.Machine_Name, GetList(features, GameNameListValue), false);
} }
// Machine type // Machine type
if (features.ContainsKey(NotGameTypeListValue)) if (features.ContainsKey(NotGameTypeListValue))
{ {
Globals.Logger.User($"This flag '{(NotGameTypeListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details."); Globals.Logger.User($"This flag '{(NotGameTypeListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details.");
filter.SetFilter(Field.MachineType, GetList(features, NotGameTypeListValue), true); filter.SetFilter(Field.Machine_Type, GetList(features, NotGameTypeListValue), true);
} }
if (features.ContainsKey(GameTypeListValue)) if (features.ContainsKey(GameTypeListValue))
{ {
Globals.Logger.User($"This flag '{(GameTypeListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details."); Globals.Logger.User($"This flag '{(GameTypeListValue)}' is deprecated, please use {(string.Join(", ", FilterListInput.Flags))} instead. Please refer to README.1ST or the help feature for more details.");
filter.SetFilter(Field.MachineType, GetList(features, GameTypeListValue), false); filter.SetFilter(Field.Machine_Type, GetList(features, GameTypeListValue), false);
} }
// MD5 // MD5
@@ -2878,12 +2878,12 @@ Some special strings that can be used:
if (features.ContainsKey(NotRunnableValue)) if (features.ContainsKey(NotRunnableValue))
{ {
Globals.Logger.User($"This flag '{NotRunnableValue}' is deprecated, please use {string.Join(", ", FilterListInput.Flags)} instead. Please refer to README.1ST or the help feature for more details."); Globals.Logger.User($"This flag '{NotRunnableValue}' is deprecated, please use {string.Join(", ", FilterListInput.Flags)} instead. Please refer to README.1ST or the help feature for more details.");
filter.SetFilter(Field.Runnable, string.Empty, true); filter.SetFilter(Field.Machine_Runnable, string.Empty, true);
} }
if (features.ContainsKey(RunnableValue)) if (features.ContainsKey(RunnableValue))
{ {
Globals.Logger.User($"This flag '{RunnableValue}' is deprecated, please use {string.Join(", ", FilterListInput.Flags)} instead. Please refer to README.1ST or the help feature for more details."); Globals.Logger.User($"This flag '{RunnableValue}' is deprecated, please use {string.Join(", ", FilterListInput.Flags)} instead. Please refer to README.1ST or the help feature for more details.");
filter.SetFilter(Field.Runnable, string.Empty, false); filter.SetFilter(Field.Machine_Runnable, string.Empty, false);
} }
// SHA1 // SHA1

View File

@@ -143,7 +143,7 @@ namespace SabreTools.Features
// If no update fields are set, default to Names // If no update fields are set, default to Names
if (updateFields == null || updateFields.Count == 0) if (updateFields == null || updateFields.Count == 0)
updateFields = new List<Field>() { Field.Name }; updateFields = new List<Field>() { Field.DatItem_Name };
// Ensure we only have files in the inputs // Ensure we only have files in the inputs
List<ParentablePath> inputFileNames = DirectoryExtensions.GetFilesOnly(Inputs, appendparent: true); List<ParentablePath> inputFileNames = DirectoryExtensions.GetFilesOnly(Inputs, appendparent: true);