diff --git a/RombaSharp/Features/RefreshDats.cs b/RombaSharp/Features/RefreshDats.cs index 6bd4132c..3bbfe3f9 100644 --- a/RombaSharp/Features/RefreshDats.cs +++ b/RombaSharp/Features/RefreshDats.cs @@ -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(); diff --git a/SabreTools.Library/DatFiles/Auxiliary.cs b/SabreTools.Library/DatFiles/Auxiliary.cs index c9a0cca2..94d66c4f 100644 --- a/SabreTools.Library/DatFiles/Auxiliary.cs +++ b/SabreTools.Library/DatFiles/Auxiliary.cs @@ -14,16 +14,8 @@ namespace SabreTools.Library.DatFiles { public string Name { get; set; } public bool? Visible { get; set; } - public bool? IsNamingOption { get; set; } + public bool? InNamingOption { 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 diff --git a/SabreTools.Library/DatFiles/DatFile.cs b/SabreTools.Library/DatFiles/DatFile.cs index 20eb3b02..10ec44bc 100644 --- a/SabreTools.Library/DatFiles/DatFile.cs +++ b/SabreTools.Library/DatFiles/DatFile.cs @@ -286,8 +286,8 @@ namespace SabreTools.Library.DatFiles if (updateFields.Intersect(DatItem.MachineFields).Any()) { // For comparison's sake, we want to use Machine Name as the base bucketing - Items.BucketBy(Field.MachineName, DedupeType.Full); - intDat.Items.BucketBy(Field.MachineName, DedupeType.None); + Items.BucketBy(Field.Machine_Name, DedupeType.Full); + intDat.Items.BucketBy(Field.Machine_Name, DedupeType.None); // Then we do a namewise comparison against the base DAT 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 if (useGames) - Items.BucketBy(Field.MachineName, DedupeType.None); + Items.BucketBy(Field.Machine_Name, DedupeType.None); else 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 if (useGames) - intDat.Items.BucketBy(Field.MachineName, DedupeType.None); + intDat.Items.BucketBy(Field.Machine_Name, DedupeType.None); else intDat.Items.BucketBy(Field.CRC, DedupeType.Full); @@ -943,7 +943,7 @@ namespace SabreTools.Library.DatFiles try { // 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 var map = new Dictionary>(); @@ -1193,7 +1193,7 @@ namespace SabreTools.Library.DatFiles public void OneGamePerRegion() { // 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 Dictionary> parents = new Dictionary>(); @@ -1382,7 +1382,7 @@ namespace SabreTools.Library.DatFiles 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 - 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 while (AddRomsFromDevices(false, false)) ; @@ -1401,7 +1401,7 @@ namespace SabreTools.Library.DatFiles 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 - 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 while (AddRomsFromDevices(true, true)) ; @@ -1424,7 +1424,7 @@ namespace SabreTools.Library.DatFiles Globals.Logger.User("Creating merged sets from the DAT"); // 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 AddRomsFromChildren(); @@ -1446,7 +1446,7 @@ namespace SabreTools.Library.DatFiles 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 - 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 AddRomsFromParent(); @@ -1468,7 +1468,7 @@ namespace SabreTools.Library.DatFiles Globals.Logger.User("Creating split sets from the DAT"); // 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 RemoveRomsFromChild(); @@ -3501,7 +3501,7 @@ namespace SabreTools.Library.DatFiles public bool SplitByLevel(string outDir, bool shortname, bool basedat) { // 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 DatFile tempDat = Create(Header); @@ -3762,7 +3762,7 @@ namespace SabreTools.Library.DatFiles if (Items.RomCount + Items.DiskCount == 0) 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); consoleOutput.ReplaceStatistics(Header.FileName, Items.Keys.Count(), Items); @@ -3772,10 +3772,10 @@ namespace SabreTools.Library.DatFiles if (Header.DedupeRoms == DedupeType.Full) Items.BucketBy(Field.CRC, Header.DedupeRoms, norename: norename); 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 - 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 Globals.Logger.User($"A total of {Items.TotalCount} items will be written out to '{Header.FileName}'"); diff --git a/SabreTools.Library/DatFiles/DatHeader.cs b/SabreTools.Library/DatFiles/DatHeader.cs index d58fdeb5..66188cc9 100644 --- a/SabreTools.Library/DatFiles/DatHeader.cs +++ b/SabreTools.Library/DatFiles/DatHeader.cs @@ -126,54 +126,6 @@ namespace SabreTools.Library.DatFiles [JsonIgnore] public DatFormat DatFormat { get; set; } - /// - /// Dictionary of fields in machine and items to exclude from writing - /// - [JsonIgnore] - public List ExcludeFields { get; set; } = new List(); - - /// - /// Enable "One Rom, One Region (1G1R)" mode - /// - [JsonIgnore] - public bool OneGamePerRegion { get; set; } - - /// - /// Ordered list of regions for "One Rom, One Region (1G1R)" mode - /// - [JsonIgnore] - public List RegionList { get; set; } - - /// - /// Ensure each rom is in their own game - /// - [JsonIgnore] - public bool OneRomPerGame { get; set; } - - /// - /// Keep machines that don't contain any items - /// - [JsonIgnore] - public bool KeepEmptyGames { get; set; } - - /// - /// Remove scene dates from the beginning of machine names - /// - [JsonIgnore] - public bool SceneDateStrip { get; set; } - - /// - /// Deduplicate items using the given method - /// - [JsonIgnore] - public DedupeType DedupeRoms { get; set; } - - /// - /// Strip hash types from items - /// - [JsonIgnore] - public Hash StripHash { get; private set; } - #endregion #region ListXML Fields @@ -309,6 +261,59 @@ namespace SabreTools.Library.DatFiles [JsonProperty("rcversion", DefaultValueHandling = DefaultValueHandling.Ignore)] public string RomCenterVersion { get; set; } + #endregion + + #region Filtering Fields + + /// + /// Dictionary of fields in machine and items to exclude from writing + /// + [JsonIgnore] + public List ExcludeFields { get; set; } = new List(); + + /// + /// Enable "One Rom, One Region (1G1R)" mode + /// + [JsonIgnore] + public bool OneGamePerRegion { get; set; } + + /// + /// Ordered list of regions for "One Rom, One Region (1G1R)" mode + /// + [JsonIgnore] + public List RegionList { get; set; } + + /// + /// Ensure each rom is in their own game + /// + [JsonIgnore] + public bool OneRomPerGame { get; set; } + + /// + /// Keep machines that don't contain any items + /// + [JsonIgnore] + public bool KeepEmptyGames { get; set; } + + /// + /// Remove scene dates from the beginning of machine names + /// + [JsonIgnore] + public bool SceneDateStrip { get; set; } + + /// + /// Deduplicate items using the given method + /// + [JsonIgnore] + public DedupeType DedupeRoms { get; set; } + + /// + /// Strip hash types from items + /// + [JsonIgnore] + public Hash StripHash { get; private set; } + + #endregion #region Write pre-processing diff --git a/SabreTools.Library/DatFiles/ItemDictionary.cs b/SabreTools.Library/DatFiles/ItemDictionary.cs index 4d5f0dfd..aa278dcd 100644 --- a/SabreTools.Library/DatFiles/ItemDictionary.cs +++ b/SabreTools.Library/DatFiles/ItemDictionary.cs @@ -647,7 +647,7 @@ namespace SabreTools.Library.DatFiles DatItem.Sort(ref sortedlist, false); // 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); // Add the list back to the dictionary @@ -1027,7 +1027,7 @@ namespace SabreTools.Library.DatFiles Globals.Logger.Verbose($"Beginning stat collection for '{file}'", false); List games = new List(); 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) Globals.Logger.User($"Adding stats for file '{file}'\n", false); diff --git a/SabreTools.Library/DatFiles/Listxml.cs b/SabreTools.Library/DatFiles/Listxml.cs index e28a7ea9..810714ed 100644 --- a/SabreTools.Library/DatFiles/Listxml.cs +++ b/SabreTools.Library/DatFiles/Listxml.cs @@ -148,15 +148,6 @@ namespace SabreTools.Library.DatFiles SourceFile = reader.GetAttribute("sourcefile"), Runnable = reader.GetAttribute("runnable").AsRunnable(), - DeviceReferences = new List(), - Chips = new List(), - Displays = new List(), - Sounds = new List(), - Conditions = new List(), - Inputs = new List(), - DipSwitches = new List(), - Configurations = new List(), - Slots = new List(), }; // Get list for new DatItems @@ -267,6 +258,10 @@ namespace SabreTools.Library.DatFiles var deviceReference = new ListXmlDeviceReference(); deviceReference.Name = reader.GetAttribute("name"); + // Ensure the list exists + if (machine.DeviceReferences == null) + machine.DeviceReferences = new List(); + machine.DeviceReferences.Add(deviceReference); reader.Read(); @@ -294,6 +289,10 @@ namespace SabreTools.Library.DatFiles chip.Type = reader.GetAttribute("type"); chip.Clock = reader.GetAttribute("clock"); + // Ensure the list exists + if (machine.DeviceReferences == null) + machine.DeviceReferences = new List(); + machine.Chips.Add(chip); reader.Read(); @@ -310,11 +309,15 @@ namespace SabreTools.Library.DatFiles display.Refresh = reader.GetAttribute("refresh"); display.PixClock = reader.GetAttribute("pixclock"); display.HTotal = reader.GetAttribute("htotal"); - display.HBend = reader.GetAttribute("hbend"); - display.HStart = reader.GetAttribute("hstart"); + display.HBEnd = reader.GetAttribute("hbend"); + display.HBStart = reader.GetAttribute("hstart"); display.VTotal = reader.GetAttribute("vtotal"); - display.VBend = reader.GetAttribute("vbend"); - display.VStart = reader.GetAttribute("vstart"); + display.VBEnd = reader.GetAttribute("vbend"); + display.VBStart = reader.GetAttribute("vstart"); + + // Ensure the list exists + if (machine.DeviceReferences == null) + machine.DeviceReferences = new List(); machine.Displays.Add(display); @@ -325,6 +328,10 @@ namespace SabreTools.Library.DatFiles var sound = new ListXmlSound(); sound.Channels = reader.GetAttribute("channels"); + // Ensure the list exists + if (machine.DeviceReferences == null) + machine.DeviceReferences = new List(); + machine.Sounds.Add(sound); reader.Read(); @@ -337,6 +344,10 @@ namespace SabreTools.Library.DatFiles condition.Relation = reader.GetAttribute("relation"); condition.Value = reader.GetAttribute("value"); + // Ensure the list exists + if (machine.DeviceReferences == null) + machine.DeviceReferences = new List(); + machine.Conditions.Add(condition); reader.Read(); @@ -352,6 +363,10 @@ namespace SabreTools.Library.DatFiles // Now read the internal tags ReadInput(reader.ReadSubtree(), input); + // Ensure the list exists + if (machine.DeviceReferences == null) + machine.DeviceReferences = new List(); + machine.Inputs.Add(input); // Skip the input now that we've processed it @@ -367,6 +382,10 @@ namespace SabreTools.Library.DatFiles // Now read the internal tags ReadDipSwitch(reader.ReadSubtree(), dipSwitch); + // Ensure the list exists + if (machine.DeviceReferences == null) + machine.DeviceReferences = new List(); + machine.DipSwitches.Add(dipSwitch); // Skip the dipswitch now that we've processed it @@ -382,6 +401,10 @@ namespace SabreTools.Library.DatFiles // Now read the internal tags ReadConfiguration(reader.ReadSubtree(), configuration); + // Ensure the list exists + if (machine.DeviceReferences == null) + machine.DeviceReferences = new List(); + machine.Configurations.Add(configuration); // Skip the configuration now that we've processed it @@ -389,19 +412,23 @@ namespace SabreTools.Library.DatFiles break; case "port": - // TODO: Use these ports var port = new ListXmlPort(); port.Tag = reader.GetAttribute("tag"); // Now read the internal tags ReadPort(reader.ReadSubtree(), port); + // Ensure the list exists + if (machine.DeviceReferences == null) + machine.DeviceReferences = new List(); + + machine.Ports.Add(port); + // Skip the port now that we've processed it reader.Skip(); break; case "adjuster": - // TODO: Use these adjusters var adjuster = new ListXmlAdjuster(); adjuster.Name = reader.GetAttribute("name"); adjuster.Default = reader.GetAttribute("default").AsYesNo(); @@ -409,33 +436,48 @@ namespace SabreTools.Library.DatFiles // Now read the internal tags ReadAdjuster(reader.ReadSubtree(), adjuster); + // Ensure the list exists + if (machine.Adjusters == null) + machine.Adjusters = new List(); + + machine.Adjusters.Add(adjuster); + // Skip the adjuster now that we've processed it reader.Skip(); break; case "driver": - // TODO: Use these drivers var driver = new ListXmlDriver(); driver.Status = reader.GetAttribute("status"); driver.Emulation = reader.GetAttribute("emulation"); driver.Cocktail = reader.GetAttribute("cocktail"); driver.SaveState = reader.GetAttribute("savestate"); + // Ensure the list exists + if (machine.Drivers == null) + machine.Drivers = new List(); + + machine.Drivers.Add(driver); + reader.Read(); break; case "feature": - // TODO: Use these features var feature = new ListXmlFeature(); feature.Type = reader.GetAttribute("type"); feature.Status = reader.GetAttribute("status"); feature.Overall = reader.GetAttribute("overall"); + // Ensure the list exists + if (machine.Features == null) + machine.Features = new List(); + + machine.Features.Add(feature); + reader.Read(); break; case "device": - // TODO: Use these devices var device = new ListXmlDevice(); device.Type = reader.GetAttribute("type"); device.Tag = reader.GetAttribute("tag"); @@ -446,6 +488,12 @@ namespace SabreTools.Library.DatFiles // Now read the internal tags ReadDevice(reader.ReadSubtree(), device); + // Ensure the list exists + if (machine.Devices == null) + machine.Devices = new List(); + + machine.Devices.Add(device); + // Skip the device now that we've processed it reader.Skip(); break; @@ -456,6 +504,11 @@ namespace SabreTools.Library.DatFiles // Now read the internal tags ReadSlot(reader.ReadSubtree(), slot, machine); + + // Ensure the list exists + if (machine.Slots == null) + machine.Slots = new List(); + machine.Slots.Add(slot); // Skip the slot now that we've processed it @@ -463,20 +516,30 @@ namespace SabreTools.Library.DatFiles break; case "softwarelist": - // TODO: Use these softwarelists var softwareList = new ListXmlSoftwareList(); softwareList.Name = reader.GetAttribute("name"); softwareList.Status = reader.GetAttribute("status"); softwareList.Filter = reader.GetAttribute("filter"); + // Ensure the list exists + if (machine.SoftwareLists == null) + machine.SoftwareLists = new List(); + + machine.SoftwareLists.Add(softwareList); + reader.Read(); break; case "ramoption": - // TODO: Use these ramoptions var ramOption = new ListXmlRamOption(); ramOption.Default = reader.GetAttribute("default").AsYesNo(); + // Ensure the list exists + if (machine.RamOptions == null) + machine.RamOptions = new List(); + + machine.RamOptions.Add(ramOption); + reader.Read(); break; @@ -1047,17 +1110,6 @@ namespace SabreTools.Library.DatFiles xtw.WriteOptionalAttributeString("publisher", datItem.Machine.Publisher); 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(); } catch (Exception ex) diff --git a/SabreTools.Library/DatFiles/OfflineList.cs b/SabreTools.Library/DatFiles/OfflineList.cs index 9adbc3c2..f91579bc 100644 --- a/SabreTools.Library/DatFiles/OfflineList.cs +++ b/SabreTools.Library/DatFiles/OfflineList.cs @@ -224,12 +224,24 @@ namespace SabreTools.Library.DatFiles } // Add all infos to the info list - Header.Infos.Add(new OfflineListInfo( - reader.Name.ToLowerInvariant(), - reader.GetAttribute("visible").AsYesNo(), - reader.GetAttribute("inNamingOption").AsYesNo(), - reader.GetAttribute("default").AsYesNo())); - reader.Read(); + switch (reader.Name.ToLowerInvariant()) + { + case "info": + var info = new OfflineListInfo(); + info.Name = reader.Name.ToLowerInvariant(); + 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.WriteAttributeString("visible", info.Visible.ToString()); - xtw.WriteAttributeString("inNamingOption", info.IsNamingOption.ToString()); + xtw.WriteAttributeString("inNamingOption", info.InNamingOption.ToString()); xtw.WriteAttributeString("default", info.Default.ToString()); xtw.WriteEndElement(); } diff --git a/SabreTools.Library/DatFiles/SeparatedValue.cs b/SabreTools.Library/DatFiles/SeparatedValue.cs index 31cca2fe..7a6cacd5 100644 --- a/SabreTools.Library/DatFiles/SeparatedValue.cs +++ b/SabreTools.Library/DatFiles/SeparatedValue.cs @@ -392,13 +392,13 @@ namespace SabreTools.Library.DatFiles // TODO: Add Machine.Slot case "Machine.Infos": - machine.Infos = new List(); + machine.Infos = new List(); var infos = value.Split(';'); foreach (var info in infos) { var infoPair = info.Split('='); - var infoObj = new ListXmlInfo(); + var infoObj = new SoftwareListInfo(); infoObj.Name = infoPair[0]; infoObj.Value = infoPair[1]; @@ -725,8 +725,7 @@ namespace SabreTools.Library.DatFiles Remark = remark, Boot = boot, - PartName = partName, - PartInterface = partInterface, + Part = new SoftwareListPart() { Name = partName, Interface = partInterface }, Features = features, AreaName = areaName, AreaSize = areaSize, @@ -760,8 +759,7 @@ namespace SabreTools.Library.DatFiles Remark = remark, Boot = boot, - PartName = partName, - PartInterface = partInterface, + Part = new SoftwareListPart() { Name = partName, Interface = partInterface }, Features = features, AreaName = areaName, AreaSize = areaSize, @@ -798,8 +796,7 @@ namespace SabreTools.Library.DatFiles Remark = remark, Boot = boot, - PartName = partName, - PartInterface = partInterface, + Part = new SoftwareListPart() { Name = partName, Interface = partInterface }, Features = features, AreaName = areaName, AreaSize = areaSize, @@ -848,8 +845,7 @@ namespace SabreTools.Library.DatFiles Remark = remark, Boot = boot, - PartName = partName, - PartInterface = partInterface, + Part = new SoftwareListPart() { Name = partName, Interface = partInterface }, Features = features, AreaName = areaName, AreaSize = areaSize, @@ -888,8 +884,7 @@ namespace SabreTools.Library.DatFiles Remark = remark, Boot = boot, - PartName = partName, - PartInterface = partInterface, + Part = new SoftwareListPart() { Name = partName, Interface = partInterface }, Features = features, AreaName = areaName, AreaSize = areaSize, @@ -942,8 +937,7 @@ namespace SabreTools.Library.DatFiles Remark = remark, Boot = boot, - PartName = partName, - PartInterface = partInterface, + Part = new SoftwareListPart() { Name = partName, Interface = partInterface }, Features = features, AreaName = areaName, AreaSize = areaSize, @@ -969,6 +963,7 @@ namespace SabreTools.Library.DatFiles /// /// Get normalized header value for a given separated value header field /// + /// TODO: Have this return Field (actually, replace with existing convert at that point) private string GetNormalizedHeader(string header) { switch (header.ToLowerInvariant()) diff --git a/SabreTools.Library/DatFiles/SoftwareList.cs b/SabreTools.Library/DatFiles/SoftwareList.cs index 9c1c9b4d..72d6a176 100644 --- a/SabreTools.Library/DatFiles/SoftwareList.cs +++ b/SabreTools.Library/DatFiles/SoftwareList.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.IO; +using System.Linq; using System.Text; using System.Xml; @@ -145,10 +146,6 @@ namespace SabreTools.Library.DatFiles Supported = reader.GetAttribute("supported").AsSupported(), CloneOf = reader.GetAttribute("cloneof"), - Infos = new List(), - SharedFeatures = new List(), - DipSwitches = new List(), - MachineType = (machineType != MachineType.NULL ? machineType : MachineType.NULL), }; @@ -181,10 +178,14 @@ namespace SabreTools.Library.DatFiles break; case "info": - var info = new ListXmlInfo(); + var info = new SoftwareListInfo(); info.Name = reader.GetAttribute("name"); info.Value = reader.GetAttribute("value"); + // Ensure the list exists + if (machine.Infos == null) + machine.Infos = new List(); + machine.Infos.Add(info); reader.Read(); @@ -195,6 +196,10 @@ namespace SabreTools.Library.DatFiles sharedFeature.Name = reader.GetAttribute("name"); sharedFeature.Value = reader.GetAttribute("value"); + // Ensure the list exists + if (machine.SharedFeatures == null) + machine.SharedFeatures = new List(); + machine.SharedFeatures.Add(sharedFeature); reader.Read(); @@ -252,13 +257,12 @@ namespace SabreTools.Library.DatFiles bool keep) { string areaname, - partname = string.Empty, - partinterface = string.Empty, areaWidth, areaEndinaness; long? areasize = null; - var features = new List(); - bool containsItems = false; + SoftwareListPart part = null; + List features = null; + List items = new List(); while (!reader.EOF) { @@ -267,9 +271,8 @@ namespace SabreTools.Library.DatFiles { if (reader.NodeType == XmlNodeType.EndElement && reader.Name == "part") { - partname = string.Empty; - partinterface = string.Empty; - features = new List(); + part = null; + features = null; } if (reader.NodeType == XmlNodeType.EndElement && (reader.Name == "dataarea" || reader.Name == "diskarea")) @@ -283,8 +286,9 @@ namespace SabreTools.Library.DatFiles switch (reader.Name) { case "part": - partname = reader.GetAttribute("name"); - partinterface = reader.GetAttribute("interface"); + part = new SoftwareListPart(); + part.Name = reader.GetAttribute("name"); + part.Interface = reader.GetAttribute("interface"); reader.Read(); break; @@ -293,6 +297,10 @@ namespace SabreTools.Library.DatFiles feature.Name = reader.GetAttribute("name"); feature.Value = reader.GetAttribute("value"); + // Ensure the list exists + if (features == null) + features = new List(); + features.Add(feature); reader.Read(); @@ -309,20 +317,18 @@ namespace SabreTools.Library.DatFiles areaWidth = reader.GetAttribute("width"); areaEndinaness = reader.GetAttribute("endianness"); - containsItems = ReadDataArea( + List roms = ReadDataArea( reader.ReadSubtree(), - machine, - partname, - partinterface, - features, areaname, areasize, areaWidth, areaEndinaness, - filename, - indexId, 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 reader.Skip(); break; @@ -330,24 +336,21 @@ namespace SabreTools.Library.DatFiles case "diskarea": areaname = reader.GetAttribute("name"); - containsItems = ReadDiskArea( + List disks = ReadDiskArea( reader.ReadSubtree(), - machine, - partname, - partinterface, - features, areaname, areasize, - filename, - indexId, 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 reader.Skip(); break; case "dipswitch": - // TODO: Use these dipswitches var dipSwitch = new ListXmlDipSwitch(); dipSwitch.Name = reader.GetAttribute("name"); dipSwitch.Tag = reader.GetAttribute("tag"); @@ -356,6 +359,12 @@ namespace SabreTools.Library.DatFiles // Now read the internal tags ReadDipSwitch(reader.ReadSubtree(), dipSwitch); + // Ensure the list exists + if (machine.DipSwitches == null) + machine.DipSwitches = new List(); + + machine.DipSwitches.Add(dipSwitch); + // Skip the dipswitch now that we've processed it reader.Skip(); 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(); } /// /// Read dataarea information /// /// XmlReader representing a dataarea block - /// Machine information to pass to contained items - /// Name of the containing part - /// Interface of the containing part - /// List of features from the parent part /// Name of the containing area /// Size of the containing area /// Byte width of the containing area /// Endianness of the containing area - /// Name of the file to be parsed - /// Index ID for the DAT /// True if full pathnames are to be kept, false otherwise (default) - private bool ReadDataArea( + private List ReadDataArea( XmlReader reader, - Machine machine, - string partName, - string partInterface, - List features, string areaName, long? areaSize, string areaWidth, string areaEndianness, - // Standard Dat parsing - string filename, - int indexId, - // Miscellaneous bool keep) { string key = string.Empty; string temptype = reader.Name; - bool containsItems = false; + List items = new List(); while (!reader.EOF) { @@ -419,8 +427,6 @@ namespace SabreTools.Library.DatFiles switch (reader.Name) { case "rom": - containsItems = true; - // If the rom is continue or ignore, add the size to the previous rom if (reader.GetAttribute("loadflag") == "continue" || reader.GetAttribute("loadflag") == "ignore") { @@ -453,28 +459,15 @@ namespace SabreTools.Library.DatFiles Offset = reader.GetAttribute("offset"), ItemStatus = reader.GetAttribute("status").AsItemStatus(), - PartName = partName, - PartInterface = partInterface, - Features = features, AreaName = areaName, AreaSize = areaSize, AreaWidth = areaWidth, AreaEndianness = areaEndianness, Value = reader.GetAttribute("value"), LoadFlag = reader.GetAttribute("loadflag"), - - Source = new Source - { - Index = indexId, - Name = filename, - }, }; - rom.CopyMachineInformation(machine); - - // Now process and add the rom - key = ParseAddHelper(rom); - + items.Add(rom); reader.Read(); break; @@ -484,41 +477,27 @@ namespace SabreTools.Library.DatFiles } } - return containsItems; + return items; } /// /// Read diskarea information /// /// XmlReader representing a diskarea block - /// Machine information to pass to contained items - /// Name of the containing part - /// Interface of the containing part - /// List of features from the parent part /// Name of the containing area /// Size of the containing area - /// Name of the file to be parsed - /// Index ID for the DAT /// True if full pathnames are to be kept, false otherwise (default) - private bool ReadDiskArea( + private List ReadDiskArea( XmlReader reader, - Machine machine, - string partname, - string partinterface, - List features, string areaname, long? areasize, - // Standard Dat parsing - string filename, - int indexId, - // Miscellaneous bool keep) { string key = string.Empty; string temptype = reader.Name; - bool containsItems = false; + List items = new List(); while (!reader.EOF) { @@ -533,8 +512,6 @@ namespace SabreTools.Library.DatFiles switch (reader.Name) { case "disk": - containsItems = true; - DatItem disk = new Disk { Name = reader.GetAttribute("name"), @@ -549,24 +526,11 @@ namespace SabreTools.Library.DatFiles ItemStatus = reader.GetAttribute("status").AsItemStatus(), Writable = reader.GetAttribute("writable").AsYesNo(), - PartName = partname, - PartInterface = partinterface, - Features = features, AreaName = areaname, AreaSize = areasize, - - Source = new Source - { - Index = indexId, - Name = filename, - }, }; - disk.CopyMachineInformation(machine); - - // Now process and add the rom - key = ParseAddHelper(disk); - + items.Add(disk); reader.Read(); break; @@ -576,7 +540,7 @@ namespace SabreTools.Library.DatFiles } } - return containsItems; + return items; } /// @@ -780,7 +744,7 @@ namespace SabreTools.Library.DatFiles 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.WriteRequiredAttributeString("name", kvp.Name); @@ -877,8 +841,8 @@ namespace SabreTools.Library.DatFiles // Build the state xtw.WriteStartElement("part"); - xtw.WriteRequiredAttributeString("name", datItem.PartName); - xtw.WriteRequiredAttributeString("interface", datItem.PartInterface); + xtw.WriteRequiredAttributeString("name", datItem.Part?.Name); + xtw.WriteRequiredAttributeString("interface", datItem.Part?.Interface); if (datItem.Features != null && datItem.Features.Count > 0) { diff --git a/SabreTools.Library/DatItems/Archive.cs b/SabreTools.Library/DatItems/Archive.cs index b04e0be0..ebdf56da 100644 --- a/SabreTools.Library/DatItems/Archive.cs +++ b/SabreTools.Library/DatItems/Archive.cs @@ -40,8 +40,7 @@ namespace SabreTools.Library.DatItems Remark = this.Remark, Boot = this.Boot, - PartName = this.PartName, - PartInterface = this.PartInterface, + Part = this.Part, Features = this.Features, AreaName = this.AreaName, AreaSize = this.AreaSize, diff --git a/SabreTools.Library/DatItems/Auxiliary.cs b/SabreTools.Library/DatItems/Auxiliary.cs index 88ebab1b..b64c702b 100644 --- a/SabreTools.Library/DatItems/Auxiliary.cs +++ b/SabreTools.Library/DatItems/Auxiliary.cs @@ -244,19 +244,19 @@ namespace SabreTools.Library.DatItems public string HTotal { get; set; } // TODO: Int32? Float? [JsonProperty("hbend")] - public string HBend { get; set; } // TODO: Int32? Float? + public string HBEnd { get; set; } // TODO: Int32? Float? - [JsonProperty("hstart")] - public string HStart { get; set; } // TODO: Int32? Float? + [JsonProperty("hbstart")] + public string HBStart { get; set; } // TODO: Int32? Float? [JsonProperty("vtotal")] public string VTotal { get; set; } // TODO: Int32? Float? [JsonProperty("vbend")] - public string VBend { get; set; } // TODO: Int32? Float? + public string VBEnd { get; set; } // TODO: Int32? Float? - [JsonProperty("vstart")] - public string VStart { get; set; } // TODO: Int32? Float? + [JsonProperty("vbstart")] + public string VBStart { get; set; } // TODO: Int32? Float? } /// @@ -360,19 +360,6 @@ namespace SabreTools.Library.DatItems public string Overall { get; set; } // TODO: (unemulated|imperfect) } - /// - /// Represents one ListXML info - /// - [JsonObject("info")] - public class ListXmlInfo - { - [JsonProperty("name")] - public string Name { get; set; } - - [JsonProperty("value")] - public string Value { get; set; } - } - /// /// Represents one ListXML input /// @@ -507,6 +494,19 @@ namespace SabreTools.Library.DatItems #region SoftwareList + /// + /// Represents one SoftwareList info + /// + [JsonObject("info")] + public class SoftwareListInfo + { + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("value")] + public string Value { get; set; } + } + /// /// Represents one SoftwareList shared feature object /// @@ -541,6 +541,19 @@ namespace SabreTools.Library.DatItems public string Value { get; set; } } + /// + /// Represents one SoftwareList part object + /// + [JsonObject("part")] + public class SoftwareListPart + { + [JsonProperty("name")] + public string Name { get; set; } + + [JsonProperty("interface")] + public string Interface { get; set; } + } + #endregion #endregion //DatItem diff --git a/SabreTools.Library/DatItems/BiosSet.cs b/SabreTools.Library/DatItems/BiosSet.cs index 4c81a519..7301142f 100644 --- a/SabreTools.Library/DatItems/BiosSet.cs +++ b/SabreTools.Library/DatItems/BiosSet.cs @@ -82,8 +82,7 @@ namespace SabreTools.Library.DatItems Remark = this.Remark, Boot = this.Boot, - PartName = this.PartName, - PartInterface = this.PartInterface, + Part = this.Part, Features = this.Features, AreaName = this.AreaName, AreaSize = this.AreaSize, diff --git a/SabreTools.Library/DatItems/Blank.cs b/SabreTools.Library/DatItems/Blank.cs index 4c48be9e..5615774f 100644 --- a/SabreTools.Library/DatItems/Blank.cs +++ b/SabreTools.Library/DatItems/Blank.cs @@ -40,8 +40,7 @@ namespace SabreTools.Library.DatItems Remark = this.Remark, Boot = this.Boot, - PartName = this.PartName, - PartInterface = this.PartInterface, + Part = this.Part, Features = this.Features, AreaName = this.AreaName, AreaSize = this.AreaSize, diff --git a/SabreTools.Library/DatItems/DatItem.cs b/SabreTools.Library/DatItems/DatItem.cs index 9faa6cb5..726538a2 100644 --- a/SabreTools.Library/DatItems/DatItem.cs +++ b/SabreTools.Library/DatItems/DatItem.cs @@ -114,14 +114,8 @@ namespace SabreTools.Library.DatItems /// /// Original hardware part associated with the item /// - [JsonProperty("partname", DefaultValueHandling = DefaultValueHandling.Ignore)] - public string PartName { get; set; } - - /// - /// Original hardware interface associated with the item - /// - [JsonProperty("partinterface", DefaultValueHandling = DefaultValueHandling.Ignore)] - public string PartInterface { get; set; } + [JsonProperty("part", DefaultValueHandling = DefaultValueHandling.Ignore)] + public SoftwareListPart Part { get; set; } /// /// Features provided to/by the item @@ -194,18 +188,18 @@ namespace SabreTools.Library.DatItems public static readonly List DatItemFields = new List() { // Common - Field.Name, + Field.DatItem_Name, // AttractMode - Field.AltName, - Field.AltTitle, + Field.DatItem_AltName, + Field.DatItem_AltTitle, // OpenMSX - Field.Original, - Field.OpenMSXSubType, - Field.OpenMSXType, - Field.Remark, - Field.Boot, + Field.DatItem_Original, + Field.DatItem_OpenMSXSubType, + Field.DatItem_OpenMSXType, + Field.DatItem_Remark, + Field.DatItem_Boot, //SoftwareList Field.PartName, @@ -256,57 +250,57 @@ namespace SabreTools.Library.DatItems public static readonly List MachineFields = new List() { // Common - Field.MachineName, - Field.Comment, - Field.Description, - Field.Year, - Field.Manufacturer, - Field.Publisher, - Field.RomOf, - Field.CloneOf, - Field.SampleOf, - Field.MachineType, + Field.Machine_Name, + Field.Machine_Comment, + Field.Machine_Description, + Field.Machine_Year, + Field.Machine_Manufacturer, + Field.Machine_Publisher, + Field.Machine_RomOf, + Field.Machine_CloneOf, + Field.Machine_SampleOf, + Field.Machine_Type, // AttractMode - Field.Players, - Field.Rotation, - Field.Control, - Field.SupportStatus, - Field.DisplayCount, - Field.DisplayType, - Field.Buttons, + Field.Machine_Players, + Field.Machine_Rotation, + Field.Machine_Control, + Field.Machine_SupportStatus, + Field.Machine_DisplayCount, + Field.Machine_DisplayType, + Field.Machine_Buttons, // ListXML - Field.SourceFile, - Field.Runnable, - Field.DeviceReferences, - Field.Slots, - Field.Infos, + Field.Machine_SourceFile, + Field.Machine_Runnable, + Field.Machine_DeviceReference_Name, + Field.Machine_Slots, + Field.Machine_Infos, // Logiqx - Field.Board, - Field.RebuildTo, + Field.Machine_Board, + Field.Machine_RebuildTo, // Logiqx EmuArc - Field.TitleID, - Field.Developer, - Field.Genre, - Field.Subgenre, - Field.Ratings, - Field.Score, - Field.Enabled, - Field.HasCrc, - Field.RelatedTo, + Field.Machine_TitleID, + Field.Machine_Developer, + Field.Machine_Genre, + Field.Machine_Subgenre, + Field.Machine_Ratings, + Field.Machine_Score, + Field.Machine_Enabled, + Field.Machine_HasCrc, + Field.Machine_RelatedTo, // OpenMSX - Field.GenMSXID, - Field.System, - Field.Country, + Field.Machine_GenMSXID, + Field.Machine_System, + Field.Machine_Country, // SoftwareList - Field.Supported, - Field.SharedFeatures, - Field.DipSwitches, + Field.Machine_Supported, + Field.Machine_SharedFeatures, + Field.Machine_DipSwitches, }; #endregion @@ -328,47 +322,57 @@ namespace SabreTools.Library.DatItems #region Common - if (mappings.Keys.Contains(Field.Name)) - Name = mappings[Field.Name]; + if (mappings.Keys.Contains(Field.DatItem_Name)) + Name = mappings[Field.DatItem_Name]; #endregion #region AttractMode - if (mappings.Keys.Contains(Field.AltName)) - AltName = mappings[Field.AltName]; + if (mappings.Keys.Contains(Field.DatItem_AltName)) + AltName = mappings[Field.DatItem_AltName]; - if (mappings.Keys.Contains(Field.AltTitle)) - AltTitle = mappings[Field.AltTitle]; + if (mappings.Keys.Contains(Field.DatItem_AltTitle)) + AltTitle = mappings[Field.DatItem_AltTitle]; #endregion #region OpenMSX - if (mappings.Keys.Contains(Field.Original)) - Original = new OpenMSXOriginal() { Content = mappings[Field.Original] }; + if (mappings.Keys.Contains(Field.DatItem_Original)) + Original = new OpenMSXOriginal() { Content = mappings[Field.DatItem_Original] }; - if (mappings.Keys.Contains(Field.OpenMSXSubType)) - OpenMSXSubType = mappings[Field.OpenMSXSubType].AsOpenMSXSubType(); + if (mappings.Keys.Contains(Field.DatItem_OpenMSXSubType)) + OpenMSXSubType = mappings[Field.DatItem_OpenMSXSubType].AsOpenMSXSubType(); - if (mappings.Keys.Contains(Field.OpenMSXType)) - OpenMSXType = mappings[Field.OpenMSXType]; + if (mappings.Keys.Contains(Field.DatItem_OpenMSXType)) + OpenMSXType = mappings[Field.DatItem_OpenMSXType]; - if (mappings.Keys.Contains(Field.Remark)) - Remark = mappings[Field.Remark]; + if (mappings.Keys.Contains(Field.DatItem_Remark)) + Remark = mappings[Field.DatItem_Remark]; - if (mappings.Keys.Contains(Field.Boot)) - Boot = mappings[Field.Boot]; + if (mappings.Keys.Contains(Field.DatItem_Boot)) + Boot = mappings[Field.DatItem_Boot]; #endregion #region SoftwareList 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)) - PartInterface = mappings[Field.PartInterface]; + { + if (Part == null) + Part = new SoftwareListPart(); + + Part.Interface = mappings[Field.PartInterface]; + } if (mappings.Keys.Contains(Field.Features)) { @@ -668,15 +672,15 @@ namespace SabreTools.Library.DatItems #region SoftwareList // Filter on part name - if (filter.PartName.MatchesPositiveSet(PartName) == false) + if (filter.PartName.MatchesPositiveSet(Part?.Name) == false) return false; - if (filter.PartName.MatchesNegativeSet(PartName) == true) + if (filter.PartName.MatchesNegativeSet(Part?.Name) == true) return false; // Filter on part interface - if (filter.PartInterface.MatchesPositiveSet(PartInterface) == false) + if (filter.PartInterface.MatchesPositiveSet(Part?.Interface) == false) return false; - if (filter.PartInterface.MatchesNegativeSet(PartInterface) == true) + if (filter.PartInterface.MatchesNegativeSet(Part?.Interface) == true) return false; // Filter on area name @@ -733,47 +737,47 @@ namespace SabreTools.Library.DatItems #region Common - if (fields.Contains(Field.Name)) + if (fields.Contains(Field.DatItem_Name)) Name = null; #endregion #region AttractMode - if (fields.Contains(Field.AltName)) + if (fields.Contains(Field.DatItem_AltName)) AltName = null; - if (fields.Contains(Field.AltTitle)) + if (fields.Contains(Field.DatItem_AltTitle)) AltTitle = null; #endregion #region OpenMSX - if (fields.Contains(Field.Original)) + if (fields.Contains(Field.DatItem_Original)) Original = null; - if (fields.Contains(Field.OpenMSXSubType)) + if (fields.Contains(Field.DatItem_OpenMSXSubType)) OpenMSXSubType = OpenMSXSubType.NULL; - if (fields.Contains(Field.OpenMSXType)) + if (fields.Contains(Field.DatItem_OpenMSXType)) OpenMSXType = null; - if (fields.Contains(Field.Remark)) + if (fields.Contains(Field.DatItem_Remark)) Remark = null; - if (fields.Contains(Field.Boot)) + if (fields.Contains(Field.DatItem_Boot)) Boot = null; #endregion #region SoftwareList - if (fields.Contains(Field.PartName)) - PartName = null; + if (fields.Contains(Field.PartName) && Part != null) + Part.Name = null; - if (fields.Contains(Field.PartInterface)) - PartInterface = null; + if (fields.Contains(Field.PartInterface) && Part != null) + Part.Interface = null; if (fields.Contains(Field.Features)) Features = null; @@ -823,7 +827,7 @@ namespace SabreTools.Library.DatItems key = Constants.CRCZero; break; - case Field.MachineName: + case Field.Machine_Name: key = (norename ? string.Empty : Source.Index.ToString().PadLeft(10, '0') + "-") @@ -882,36 +886,36 @@ namespace SabreTools.Library.DatItems { #region Common - if (fields.Contains(Field.Name)) + if (fields.Contains(Field.DatItem_Name)) Name = item.Name; #endregion #region AttractMode - if (fields.Contains(Field.AltName)) + if (fields.Contains(Field.DatItem_AltName)) AltName = item.AltName; - if (fields.Contains(Field.AltTitle)) + if (fields.Contains(Field.DatItem_AltTitle)) AltTitle = item.AltTitle; #endregion #region OpenMSX - if (fields.Contains(Field.Original)) + if (fields.Contains(Field.DatItem_Original)) Original = item.Original; - if (fields.Contains(Field.OpenMSXSubType)) + if (fields.Contains(Field.DatItem_OpenMSXSubType)) OpenMSXSubType = item.OpenMSXSubType; - if (fields.Contains(Field.OpenMSXType)) + if (fields.Contains(Field.DatItem_OpenMSXType)) OpenMSXType = item.OpenMSXType; - if (fields.Contains(Field.Remark)) + if (fields.Contains(Field.DatItem_Remark)) Remark = item.Remark; - if (fields.Contains(Field.Boot)) + if (fields.Contains(Field.DatItem_Boot)) Boot = item.Boot; #endregion @@ -919,10 +923,20 @@ namespace SabreTools.Library.DatItems #region SoftwareList if (fields.Contains(Field.PartName)) - PartName = item.PartName; + { + if (Part == null) + Part = new SoftwareListPart(); + + Part.Name = item.Part?.Name; + } if (fields.Contains(Field.PartInterface)) - PartInterface = item.PartInterface; + { + if (Part == null) + Part = new SoftwareListPart(); + + Part.Interface = item.Part?.Interface; + } if (fields.Contains(Field.Features)) Features = item.Features; diff --git a/SabreTools.Library/DatItems/Disk.cs b/SabreTools.Library/DatItems/Disk.cs index aef981ae..eb6aa07e 100644 --- a/SabreTools.Library/DatItems/Disk.cs +++ b/SabreTools.Library/DatItems/Disk.cs @@ -239,8 +239,7 @@ namespace SabreTools.Library.DatItems Remark = this.Remark, Boot = this.Boot, - PartName = this.PartName, - PartInterface = this.PartInterface, + Part = this.Part, Features = this.Features, AreaName = this.AreaName, AreaSize = this.AreaSize, @@ -291,8 +290,7 @@ namespace SabreTools.Library.DatItems Remark = this.Remark, Boot = this.Boot, - PartName = this.PartName, - PartInterface = this.PartInterface, + Part = this.Part, Features = this.Features, AreaName = this.AreaName, AreaSize = this.AreaSize, diff --git a/SabreTools.Library/DatItems/Enums.cs b/SabreTools.Library/DatItems/Enums.cs index 423742e4..d9260e26 100644 --- a/SabreTools.Library/DatItems/Enums.cs +++ b/SabreTools.Library/DatItems/Enums.cs @@ -1,7 +1,5 @@ using System; -using Newtonsoft.Json; - namespace SabreTools.Library.DatItems { /// @@ -22,90 +20,326 @@ namespace SabreTools.Library.DatItems /// /// List of valid field types within a DatItem/Machine /// - /// TODO: Should this be split into MachineField and DatItemField? - /// TODO: Should there also be a DatFileField? + /// TODO: Move this to a more common location + /// TODO: Should this be split into separate enums? public enum Field : int { NULL = 0, - #region Machine + #region DatHeader #region Common - MachineName, - Comment, - Description, - Year, - Manufacturer, - Publisher, - Category, - RomOf, - CloneOf, - SampleOf, - MachineType, - - #endregion - - #region AttractMode - - Players, - Rotation, - Control, - SupportStatus, - DisplayCount, - DisplayType, - Buttons, + DatHeader_FileName, + DatHeader_Name, + DatHeader_Description, + DatHeader_RootDir, + DatHeader_Category, + DatHeader_Version, + DatHeader_Date, + DatHeader_Author, + DatHeader_Email, + DatHeader_Homepage, + DatHeader_Url, + DatHeader_Comment, + DatHeader_HeaderSkipper, + DatHeader_Type, + DatHeader_ForceMerging, + DatHeader_ForceNodump, + DatHeader_ForcePacking, #endregion #region ListXML - SourceFile, - Runnable, - 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, + DatHeader_Debug, + DatHeader_MameConfig, #endregion #region Logiqx - Board, - RebuildTo, + DatHeader_Build, + 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 #region Logiqx EmuArc - TitleID, - Developer, - Genre, - Subgenre, - Ratings, - Score, - Enabled, - HasCrc, - RelatedTo, + Machine_TitleID, + Machine_Developer, + Machine_Genre, + Machine_Subgenre, + Machine_Ratings, + Machine_Score, + Machine_Enabled, + Machine_HasCrc, + Machine_RelatedTo, #endregion #region OpenMSX - GenMSXID, - System, - Country, + Machine_GenMSXID, + Machine_System, + Machine_Country, #endregion #region SoftwareList - Supported, - SharedFeatures, - DipSwitches, + Machine_Supported, + + // 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 @@ -115,28 +349,29 @@ namespace SabreTools.Library.DatItems #region Common - Name, - ItemType, + DatItem_Name, + DatItem_Type, #endregion #region AttractMode - AltName, - AltTitle, + DatItem_AltName, + DatItem_AltTitle, #endregion #region OpenMSX - Original, - OpenMSXSubType, - OpenMSXType, - Remark, - Boot, + DatItem_Original, + DatItem_OpenMSXSubType, + DatItem_OpenMSXType, + DatItem_Remark, + DatItem_Boot, #endregion + // TODO: Left off here on renaming #region SoftwareList PartName, diff --git a/SabreTools.Library/DatItems/Machine.cs b/SabreTools.Library/DatItems/Machine.cs index 06e685fd..23d620ad 100644 --- a/SabreTools.Library/DatItems/Machine.cs +++ b/SabreTools.Library/DatItems/Machine.cs @@ -136,6 +136,7 @@ namespace SabreTools.Library.DatItems #endregion + // TODO: Ensure read/write for all fields here #region ListXML Fields /// @@ -202,6 +203,36 @@ namespace SabreTools.Library.DatItems [JsonProperty("configurations", DefaultValueHandling = DefaultValueHandling.Ignore)] public List Configurations { get; set; } = null; + /// + /// List of associated ports + /// + [JsonProperty("ports", DefaultValueHandling = DefaultValueHandling.Ignore)] + public List Ports { get; set; } = null; + + /// + /// List of associated adjusters + /// + [JsonProperty("adjusters", DefaultValueHandling = DefaultValueHandling.Ignore)] + public List Adjusters { get; set; } = null; + + /// + /// List of associated drivers + /// + [JsonProperty("drivers", DefaultValueHandling = DefaultValueHandling.Ignore)] + public List Drivers { get; set; } = null; + + /// + /// List of associated features + /// + [JsonProperty("features", DefaultValueHandling = DefaultValueHandling.Ignore)] + public List Features { get; set; } = null; + + /// + /// List of associated devices + /// + [JsonProperty("devices", DefaultValueHandling = DefaultValueHandling.Ignore)] + public List Devices { get; set; } = null; + /// /// List of slot options /// @@ -209,11 +240,16 @@ namespace SabreTools.Library.DatItems public List Slots { get; set; } = null; /// - /// List of info items + /// List of software lists /// - /// Also in SoftwareList - [JsonProperty("infos", DefaultValueHandling = DefaultValueHandling.Ignore)] - public List Infos { get; set; } = null; + [JsonProperty("softwarelists", DefaultValueHandling = DefaultValueHandling.Ignore)] + public List SoftwareLists { get; set; } = null; + + /// + /// List of ramoptions + /// + [JsonProperty("ramoptions", DefaultValueHandling = DefaultValueHandling.Ignore)] + public List RamOptions { get; set; } = null; #endregion @@ -233,6 +269,7 @@ namespace SabreTools.Library.DatItems #endregion + // TODO: Should this be a separate object for TruRip? #region Logiqx EmuArc Fields /// @@ -313,6 +350,7 @@ namespace SabreTools.Library.DatItems #endregion + // TODO: Ensure read/write for all fields here #region SoftwareList Fields /// @@ -321,6 +359,13 @@ namespace SabreTools.Library.DatItems [JsonProperty("supported", DefaultValueHandling = DefaultValueHandling.Ignore)] public Supported Supported { get; set; } = Supported.NULL; + /// + /// List of info items + /// + /// Also in SoftwareList + [JsonProperty("infos", DefaultValueHandling = DefaultValueHandling.Ignore)] + public List Infos { get; set; } = null; + /// /// List of shared feature items /// @@ -341,96 +386,96 @@ namespace SabreTools.Library.DatItems { #region Common - if (mappings.Keys.Contains(Field.MachineName)) - Name = mappings[Field.MachineName]; + if (mappings.Keys.Contains(Field.Machine_Name)) + Name = mappings[Field.Machine_Name]; - if (mappings.Keys.Contains(Field.Comment)) - Comment = mappings[Field.Comment]; + if (mappings.Keys.Contains(Field.Machine_Comment)) + Comment = mappings[Field.Machine_Comment]; - if (mappings.Keys.Contains(Field.Description)) - Description = mappings[Field.Description]; + if (mappings.Keys.Contains(Field.Machine_Description)) + Description = mappings[Field.Machine_Description]; - if (mappings.Keys.Contains(Field.Year)) - Year = mappings[Field.Year]; + if (mappings.Keys.Contains(Field.Machine_Year)) + Year = mappings[Field.Machine_Year]; - if (mappings.Keys.Contains(Field.Manufacturer)) - Manufacturer = mappings[Field.Manufacturer]; + if (mappings.Keys.Contains(Field.Machine_Manufacturer)) + Manufacturer = mappings[Field.Machine_Manufacturer]; - if (mappings.Keys.Contains(Field.Publisher)) - Publisher = mappings[Field.Publisher]; + if (mappings.Keys.Contains(Field.Machine_Publisher)) + Publisher = mappings[Field.Machine_Publisher]; - if (mappings.Keys.Contains(Field.Category)) - Category = mappings[Field.Category]; + if (mappings.Keys.Contains(Field.Machine_Category)) + Category = mappings[Field.Machine_Category]; - if (mappings.Keys.Contains(Field.RomOf)) - RomOf = mappings[Field.RomOf]; + if (mappings.Keys.Contains(Field.Machine_RomOf)) + RomOf = mappings[Field.Machine_RomOf]; - if (mappings.Keys.Contains(Field.CloneOf)) - CloneOf = mappings[Field.CloneOf]; + if (mappings.Keys.Contains(Field.Machine_CloneOf)) + CloneOf = mappings[Field.Machine_CloneOf]; - if (mappings.Keys.Contains(Field.SampleOf)) - SampleOf = mappings[Field.SampleOf]; + if (mappings.Keys.Contains(Field.Machine_SampleOf)) + SampleOf = mappings[Field.Machine_SampleOf]; - if (mappings.Keys.Contains(Field.MachineType)) - MachineType = mappings[Field.MachineType].AsMachineType(); + if (mappings.Keys.Contains(Field.Machine_Type)) + MachineType = mappings[Field.Machine_Type].AsMachineType(); #endregion #region AttractMode - if (mappings.Keys.Contains(Field.Players)) - Players = mappings[Field.Players]; + if (mappings.Keys.Contains(Field.Machine_Players)) + Players = mappings[Field.Machine_Players]; - if (mappings.Keys.Contains(Field.Rotation)) - Rotation = mappings[Field.Rotation]; + if (mappings.Keys.Contains(Field.Machine_Rotation)) + Rotation = mappings[Field.Machine_Rotation]; - if (mappings.Keys.Contains(Field.Control)) - Control = mappings[Field.Control]; + if (mappings.Keys.Contains(Field.Machine_Control)) + Control = mappings[Field.Machine_Control]; - if (mappings.Keys.Contains(Field.SupportStatus)) - Status = mappings[Field.SupportStatus]; + if (mappings.Keys.Contains(Field.Machine_SupportStatus)) + Status = mappings[Field.Machine_SupportStatus]; - if (mappings.Keys.Contains(Field.DisplayCount)) - DisplayCount = mappings[Field.DisplayCount]; + if (mappings.Keys.Contains(Field.Machine_DisplayCount)) + DisplayCount = mappings[Field.Machine_DisplayCount]; - if (mappings.Keys.Contains(Field.DisplayType)) - DisplayType = mappings[Field.DisplayType]; + if (mappings.Keys.Contains(Field.Machine_DisplayType)) + DisplayType = mappings[Field.Machine_DisplayType]; - if (mappings.Keys.Contains(Field.Buttons)) - Buttons = mappings[Field.Buttons]; + if (mappings.Keys.Contains(Field.Machine_Buttons)) + Buttons = mappings[Field.Machine_Buttons]; #endregion #region ListXML - if (mappings.Keys.Contains(Field.SourceFile)) - SourceFile = mappings[Field.SourceFile]; + if (mappings.Keys.Contains(Field.Machine_SourceFile)) + SourceFile = mappings[Field.Machine_SourceFile]; - if (mappings.Keys.Contains(Field.Runnable)) - Runnable = mappings[Field.Runnable].AsRunnable(); + if (mappings.Keys.Contains(Field.Machine_Runnable)) + Runnable = mappings[Field.Machine_Runnable].AsRunnable(); - if (mappings.Keys.Contains(Field.DeviceReferences)) + if (mappings.Keys.Contains(Field.Machine_DeviceReference_Name)) { if (DeviceReferences == null) DeviceReferences = new List(); - 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); } // TODO: Add Field.Slot - if (mappings.Keys.Contains(Field.Infos)) + if (mappings.Keys.Contains(Field.Machine_Infos)) { if (Infos == null) - Infos = new List(); + Infos = new List(); - string[] pairs = mappings[Field.Infos].Split(';'); + string[] pairs = mappings[Field.Machine_Infos].Split(';'); foreach (string pair in pairs) { string[] split = pair.Split('='); - var infoObj = new ListXmlInfo(); + var infoObj = new SoftwareListInfo(); infoObj.Name = split[0]; infoObj.Value = split[1]; @@ -442,69 +487,69 @@ namespace SabreTools.Library.DatItems #region Logiqx - if (mappings.Keys.Contains(Field.Board)) - Board = mappings[Field.Board]; + if (mappings.Keys.Contains(Field.Machine_Board)) + Board = mappings[Field.Machine_Board]; - if (mappings.Keys.Contains(Field.RebuildTo)) - RebuildTo = mappings[Field.RebuildTo]; + if (mappings.Keys.Contains(Field.Machine_RebuildTo)) + RebuildTo = mappings[Field.Machine_RebuildTo]; #endregion #region Logiqx EmuArc - if (mappings.Keys.Contains(Field.TitleID)) - TitleID = mappings[Field.TitleID]; + if (mappings.Keys.Contains(Field.Machine_TitleID)) + TitleID = mappings[Field.Machine_TitleID]; - if (mappings.Keys.Contains(Field.Developer)) - Developer = mappings[Field.Developer]; + if (mappings.Keys.Contains(Field.Machine_Developer)) + Developer = mappings[Field.Machine_Developer]; - if (mappings.Keys.Contains(Field.Genre)) - Genre = mappings[Field.Genre]; + if (mappings.Keys.Contains(Field.Machine_Genre)) + Genre = mappings[Field.Machine_Genre]; - if (mappings.Keys.Contains(Field.Subgenre)) - Subgenre = mappings[Field.Subgenre]; + if (mappings.Keys.Contains(Field.Machine_Subgenre)) + Subgenre = mappings[Field.Machine_Subgenre]; - if (mappings.Keys.Contains(Field.Ratings)) - Ratings = mappings[Field.Ratings]; + if (mappings.Keys.Contains(Field.Machine_Ratings)) + Ratings = mappings[Field.Machine_Ratings]; - if (mappings.Keys.Contains(Field.Score)) - Score = mappings[Field.Score]; + if (mappings.Keys.Contains(Field.Machine_Score)) + Score = mappings[Field.Machine_Score]; - if (mappings.Keys.Contains(Field.Enabled)) - Enabled = mappings[Field.Enabled]; + if (mappings.Keys.Contains(Field.Machine_Enabled)) + Enabled = mappings[Field.Machine_Enabled]; - if (mappings.Keys.Contains(Field.HasCrc)) - HasCrc = mappings[Field.HasCrc].AsYesNo(); + if (mappings.Keys.Contains(Field.Machine_HasCrc)) + HasCrc = mappings[Field.Machine_HasCrc].AsYesNo(); - if (mappings.Keys.Contains(Field.RelatedTo)) - RelatedTo = mappings[Field.RelatedTo]; + if (mappings.Keys.Contains(Field.Machine_RelatedTo)) + RelatedTo = mappings[Field.Machine_RelatedTo]; #endregion #region OpenMSX - if (mappings.Keys.Contains(Field.GenMSXID)) - GenMSXID = mappings[Field.GenMSXID]; + if (mappings.Keys.Contains(Field.Machine_GenMSXID)) + GenMSXID = mappings[Field.Machine_GenMSXID]; - if (mappings.Keys.Contains(Field.System)) - System = mappings[Field.System]; + if (mappings.Keys.Contains(Field.Machine_System)) + System = mappings[Field.Machine_System]; - if (mappings.Keys.Contains(Field.Country)) - Country = mappings[Field.Country]; + if (mappings.Keys.Contains(Field.Machine_Country)) + Country = mappings[Field.Machine_Country]; #endregion #region SoftwareList - if (mappings.Keys.Contains(Field.Supported)) - Supported = mappings[Field.Supported].AsSupported(); + if (mappings.Keys.Contains(Field.Machine_Supported)) + Supported = mappings[Field.Machine_Supported].AsSupported(); - if (mappings.Keys.Contains(Field.SharedFeatures)) + if (mappings.Keys.Contains(Field.Machine_SharedFeatures)) { if (SharedFeatures == null) SharedFeatures = new List(); - string[] pairs = mappings[Field.SharedFeatures].Split(';'); + string[] pairs = mappings[Field.Machine_SharedFeatures].Split(';'); foreach (string pair in pairs) { 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) DipSwitches = new List(); @@ -927,148 +972,148 @@ namespace SabreTools.Library.DatItems { #region Common - if (fields.Contains(Field.MachineName)) + if (fields.Contains(Field.Machine_Name)) Name = null; - if (fields.Contains(Field.Comment)) + if (fields.Contains(Field.Machine_Comment)) Comment = null; - if (fields.Contains(Field.Description)) + if (fields.Contains(Field.Machine_Description)) Description = null; - if (fields.Contains(Field.Year)) + if (fields.Contains(Field.Machine_Year)) Year = null; - if (fields.Contains(Field.Manufacturer)) + if (fields.Contains(Field.Machine_Manufacturer)) Manufacturer = null; - if (fields.Contains(Field.Publisher)) + if (fields.Contains(Field.Machine_Publisher)) Publisher = null; - if (fields.Contains(Field.Category)) + if (fields.Contains(Field.Machine_Category)) Category = null; - if (fields.Contains(Field.RomOf)) + if (fields.Contains(Field.Machine_RomOf)) RomOf = null; - if (fields.Contains(Field.CloneOf)) + if (fields.Contains(Field.Machine_CloneOf)) CloneOf = null; - if (fields.Contains(Field.SampleOf)) + if (fields.Contains(Field.Machine_SampleOf)) SampleOf = null; - if (fields.Contains(Field.MachineType)) + if (fields.Contains(Field.Machine_Type)) MachineType = MachineType.NULL; #endregion #region AttractMode - if (fields.Contains(Field.Players)) + if (fields.Contains(Field.Machine_Players)) Players = null; - if (fields.Contains(Field.Rotation)) + if (fields.Contains(Field.Machine_Rotation)) Rotation = null; - if (fields.Contains(Field.Control)) + if (fields.Contains(Field.Machine_Control)) Control = null; - if (fields.Contains(Field.SupportStatus)) + if (fields.Contains(Field.Machine_SupportStatus)) Status = null; - if (fields.Contains(Field.DisplayCount)) + if (fields.Contains(Field.Machine_DisplayCount)) DisplayCount = null; - if (fields.Contains(Field.DisplayType)) + if (fields.Contains(Field.Machine_DisplayType)) DisplayType = null; - if (fields.Contains(Field.Buttons)) + if (fields.Contains(Field.Machine_Buttons)) Buttons = null; #endregion #region ListXML - if (fields.Contains(Field.SourceFile)) + if (fields.Contains(Field.Machine_SourceFile)) SourceFile = null; - if (fields.Contains(Field.Runnable)) + if (fields.Contains(Field.Machine_Runnable)) Runnable = Runnable.NULL; - if (fields.Contains(Field.DeviceReferences)) + if (fields.Contains(Field.Machine_DeviceReferences)) DeviceReferences = null; - if (fields.Contains(Field.Slots)) + if (fields.Contains(Field.Machine_Slots)) Slots = null; - if (fields.Contains(Field.Infos)) + if (fields.Contains(Field.Machine_Infos)) Infos = null; #endregion #region Logiqx - if (fields.Contains(Field.Board)) + if (fields.Contains(Field.Machine_Board)) Board = null; - if (fields.Contains(Field.RebuildTo)) + if (fields.Contains(Field.Machine_RebuildTo)) RebuildTo = null; #endregion #region Logiqx EmuArc - if (fields.Contains(Field.TitleID)) + if (fields.Contains(Field.Machine_TitleID)) TitleID = null; - if (fields.Contains(Field.Developer)) + if (fields.Contains(Field.Machine_Developer)) Developer = null; - if (fields.Contains(Field.Genre)) + if (fields.Contains(Field.Machine_Genre)) Genre = null; - if (fields.Contains(Field.Subgenre)) + if (fields.Contains(Field.Machine_Subgenre)) Subgenre = null; - if (fields.Contains(Field.Ratings)) + if (fields.Contains(Field.Machine_Ratings)) Ratings = null; - if (fields.Contains(Field.Score)) + if (fields.Contains(Field.Machine_Score)) Score = null; - if (fields.Contains(Field.Enabled)) + if (fields.Contains(Field.Machine_Enabled)) Enabled = null; - if (fields.Contains(Field.HasCrc)) + if (fields.Contains(Field.Machine_HasCrc)) HasCrc = null; - if (fields.Contains(Field.RelatedTo)) + if (fields.Contains(Field.Machine_RelatedTo)) RelatedTo = null; #endregion #region OpenMSX - if (fields.Contains(Field.GenMSXID)) + if (fields.Contains(Field.Machine_GenMSXID)) GenMSXID = null; - if (fields.Contains(Field.System)) + if (fields.Contains(Field.Machine_System)) System = null; - if (fields.Contains(Field.Country)) + if (fields.Contains(Field.Machine_Country)) Country = null; #endregion #region SoftwareList - if (fields.Contains(Field.Supported)) + if (fields.Contains(Field.Machine_Supported)) Supported = Supported.NULL; - if (fields.Contains(Field.SharedFeatures)) + if (fields.Contains(Field.Machine_SharedFeatures)) SharedFeatures = null; - if (fields.Contains(Field.DipSwitches)) + if (fields.Contains(Field.Machine_DipSwitches)) DipSwitches = null; #endregion @@ -1088,151 +1133,151 @@ namespace SabreTools.Library.DatItems { #region Common - if (fields.Contains(Field.MachineName)) + if (fields.Contains(Field.Machine_Name)) Name = machine.Name; - if (fields.Contains(Field.Comment)) + if (fields.Contains(Field.Machine_Comment)) Comment = machine.Comment; - if (fields.Contains(Field.Description)) + if (fields.Contains(Field.Machine_Description)) { if (!onlySame || (onlySame && Name == Description)) Description = machine.Description; } - if (fields.Contains(Field.Year)) + if (fields.Contains(Field.Machine_Year)) Year = machine.Year; - if (fields.Contains(Field.Manufacturer)) + if (fields.Contains(Field.Machine_Manufacturer)) Manufacturer = machine.Manufacturer; - if (fields.Contains(Field.Publisher)) + if (fields.Contains(Field.Machine_Publisher)) Publisher = machine.Publisher; - if (fields.Contains(Field.Category)) + if (fields.Contains(Field.Machine_Category)) Category = machine.Category; - if (fields.Contains(Field.RomOf)) + if (fields.Contains(Field.Machine_RomOf)) RomOf = machine.RomOf; - if (fields.Contains(Field.CloneOf)) + if (fields.Contains(Field.Machine_CloneOf)) CloneOf = machine.CloneOf; - if (fields.Contains(Field.SampleOf)) + if (fields.Contains(Field.Machine_SampleOf)) SampleOf = machine.SampleOf; - if (fields.Contains(Field.MachineType)) + if (fields.Contains(Field.Machine_Type)) MachineType = machine.MachineType; #endregion #region AttractMode - if (fields.Contains(Field.Players)) + if (fields.Contains(Field.Machine_Players)) Players = machine.Players; - if (fields.Contains(Field.Rotation)) + if (fields.Contains(Field.Machine_Rotation)) Rotation = machine.Rotation; - if (fields.Contains(Field.Control)) + if (fields.Contains(Field.Machine_Control)) Control = machine.Control; - if (fields.Contains(Field.SupportStatus)) + if (fields.Contains(Field.Machine_SupportStatus)) Status = machine.Status; - if (fields.Contains(Field.DisplayCount)) + if (fields.Contains(Field.Machine_DisplayCount)) DisplayCount = machine.DisplayCount; - if (fields.Contains(Field.DisplayType)) + if (fields.Contains(Field.Machine_DisplayType)) DisplayType = machine.DisplayType; - if (fields.Contains(Field.Buttons)) + if (fields.Contains(Field.Machine_Buttons)) Buttons = machine.Buttons; #endregion #region ListXML - if (fields.Contains(Field.SourceFile)) + if (fields.Contains(Field.Machine_SourceFile)) SourceFile = machine.SourceFile; - if (fields.Contains(Field.Runnable)) + if (fields.Contains(Field.Machine_Runnable)) Runnable = machine.Runnable; - if (fields.Contains(Field.DeviceReferences)) + if (fields.Contains(Field.Machine_DeviceReferences)) DeviceReferences = machine.DeviceReferences; - if (fields.Contains(Field.Slots)) + if (fields.Contains(Field.Machine_Slots)) Slots = machine.Slots; - if (fields.Contains(Field.Infos)) + if (fields.Contains(Field.Machine_Infos)) Infos = machine.Infos; #endregion #region Logiqx - if (fields.Contains(Field.Board)) + if (fields.Contains(Field.Machine_Board)) Board = machine.Board; - if (fields.Contains(Field.RebuildTo)) + if (fields.Contains(Field.Machine_RebuildTo)) RebuildTo = machine.RebuildTo; #endregion #region Logiqx EmuArc - if (fields.Contains(Field.TitleID)) + if (fields.Contains(Field.Machine_TitleID)) TitleID = machine.TitleID; - if (fields.Contains(Field.Developer)) + if (fields.Contains(Field.Machine_Developer)) Developer = machine.Developer; - if (fields.Contains(Field.Genre)) + if (fields.Contains(Field.Machine_Genre)) Genre = machine.Genre; - if (fields.Contains(Field.Subgenre)) + if (fields.Contains(Field.Machine_Subgenre)) Subgenre = machine.Subgenre; - if (fields.Contains(Field.Ratings)) + if (fields.Contains(Field.Machine_Ratings)) Ratings = machine.Ratings; - if (fields.Contains(Field.Score)) + if (fields.Contains(Field.Machine_Score)) Score = machine.Score; - if (fields.Contains(Field.Enabled)) + if (fields.Contains(Field.Machine_Enabled)) Enabled = machine.Enabled; - if (fields.Contains(Field.HasCrc)) + if (fields.Contains(Field.Machine_HasCrc)) HasCrc = machine.HasCrc; - if (fields.Contains(Field.RelatedTo)) + if (fields.Contains(Field.Machine_RelatedTo)) RelatedTo = machine.RelatedTo; #endregion #region OpenMSX - if (fields.Contains(Field.GenMSXID)) + if (fields.Contains(Field.Machine_GenMSXID)) GenMSXID = machine.GenMSXID; - if (fields.Contains(Field.System)) + if (fields.Contains(Field.Machine_System)) System = machine.System; - if (fields.Contains(Field.Country)) + if (fields.Contains(Field.Machine_Country)) Country = machine.Country; #endregion #region SoftwareList - if (fields.Contains(Field.Supported)) + if (fields.Contains(Field.Machine_Supported)) Supported = machine.Supported; - if (fields.Contains(Field.SharedFeatures)) + if (fields.Contains(Field.Machine_SharedFeatures)) SharedFeatures = machine.SharedFeatures; - if (fields.Contains(Field.DipSwitches)) + if (fields.Contains(Field.Machine_DipSwitches)) DipSwitches = machine.DipSwitches; #endregion diff --git a/SabreTools.Library/DatItems/Release.cs b/SabreTools.Library/DatItems/Release.cs index 9bf2920e..866fd249 100644 --- a/SabreTools.Library/DatItems/Release.cs +++ b/SabreTools.Library/DatItems/Release.cs @@ -104,8 +104,7 @@ namespace SabreTools.Library.DatItems Remark = this.Remark, Boot = this.Boot, - PartName = this.PartName, - PartInterface = this.PartInterface, + Part = this.Part, Features = this.Features, AreaName = this.AreaName, AreaSize = this.AreaSize, diff --git a/SabreTools.Library/DatItems/Rom.cs b/SabreTools.Library/DatItems/Rom.cs index a024a3fd..92674057 100644 --- a/SabreTools.Library/DatItems/Rom.cs +++ b/SabreTools.Library/DatItems/Rom.cs @@ -308,8 +308,7 @@ namespace SabreTools.Library.DatItems Remark = this.Remark, Boot = this.Boot, - PartName = this.PartName, - PartInterface = this.PartInterface, + Part = this.Part, Features = this.Features, AreaName = this.AreaName, AreaSize = this.AreaSize, diff --git a/SabreTools.Library/DatItems/Sample.cs b/SabreTools.Library/DatItems/Sample.cs index 3a5ba1e0..24a1eded 100644 --- a/SabreTools.Library/DatItems/Sample.cs +++ b/SabreTools.Library/DatItems/Sample.cs @@ -40,8 +40,7 @@ namespace SabreTools.Library.DatItems Remark = this.Remark, Boot = this.Boot, - PartName = this.PartName, - PartInterface = this.PartInterface, + Part = this.Part, Features = this.Features, AreaName = this.AreaName, AreaSize = this.AreaSize, diff --git a/SabreTools.Library/Filtering/Filter.cs b/SabreTools.Library/Filtering/Filter.cs index 2921784b..67e3e680 100644 --- a/SabreTools.Library/Filtering/Filter.cs +++ b/SabreTools.Library/Filtering/Filter.cs @@ -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 /// /// 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 { #region Fields @@ -561,77 +562,77 @@ namespace SabreTools.Library.Filtering #region Common - case Field.MachineName: + case Field.Machine_Name: if (negate) MachineName.NegativeSet.Add(value); else MachineName.PositiveSet.Add(value); break; - case Field.Comment: + case Field.Machine_Comment: if (negate) Comment.NegativeSet.Add(value); else Comment.PositiveSet.Add(value); break; - case Field.Description: + case Field.Machine_Description: if (negate) MachineDescription.NegativeSet.Add(value); else MachineDescription.PositiveSet.Add(value); break; - case Field.Year: + case Field.Machine_Year: if (negate) Year.NegativeSet.Add(value); else Year.PositiveSet.Add(value); break; - case Field.Manufacturer: + case Field.Machine_Manufacturer: if (negate) Manufacturer.NegativeSet.Add(value); else Manufacturer.PositiveSet.Add(value); break; - case Field.Publisher: + case Field.Machine_Publisher: if (negate) Publisher.NegativeSet.Add(value); else Publisher.PositiveSet.Add(value); break; - case Field.Category: + case Field.Machine_Category: if (negate) Category.NegativeSet.Add(value); else Category.PositiveSet.Add(value); break; - case Field.RomOf: + case Field.Machine_RomOf: if (negate) RomOf.NegativeSet.Add(value); else RomOf.PositiveSet.Add(value); break; - case Field.CloneOf: + case Field.Machine_CloneOf: if (negate) CloneOf.NegativeSet.Add(value); else CloneOf.PositiveSet.Add(value); break; - case Field.SampleOf: + case Field.Machine_SampleOf: if (negate) SampleOf.NegativeSet.Add(value); else SampleOf.PositiveSet.Add(value); break; - case Field.MachineType: + case Field.Machine_Type: if (negate) MachineTypes.Negative |= value.AsMachineType(); else @@ -642,49 +643,49 @@ namespace SabreTools.Library.Filtering #region AttractMode - case Field.Players: + case Field.Machine_Players: if (negate) Players.NegativeSet.Add(value); else Players.PositiveSet.Add(value); break; - case Field.Rotation: + case Field.Machine_Rotation: if (negate) Rotation.NegativeSet.Add(value); else Rotation.PositiveSet.Add(value); break; - case Field.Control: + case Field.Machine_Control: if (negate) Control.NegativeSet.Add(value); else Control.PositiveSet.Add(value); break; - case Field.SupportStatus: + case Field.Machine_SupportStatus: if (negate) SupportStatus.NegativeSet.Add(value); else SupportStatus.PositiveSet.Add(value); break; - case Field.DisplayCount: + case Field.Machine_DisplayCount: if (negate) DisplayCount.NegativeSet.Add(value); else DisplayCount.PositiveSet.Add(value); break; - case Field.DisplayType: + case Field.Machine_DisplayType: if (negate) DisplayType.NegativeSet.Add(value); else DisplayType.PositiveSet.Add(value); break; - case Field.Buttons: + case Field.Machine_Buttons: if (negate) Buttons.NegativeSet.Add(value); else @@ -695,28 +696,28 @@ namespace SabreTools.Library.Filtering #region ListXML - case Field.SourceFile: + case Field.Machine_SourceFile: if (negate) SourceFile.NegativeSet.Add(value); else SourceFile.PositiveSet.Add(value); break; - case Field.Runnable: + case Field.Machine_Runnable: if (negate) Runnables.Negative |= value.AsRunnable(); else Runnables.Positive |= value.AsRunnable(); break; - case Field.DeviceReferences: + case Field.Machine_DeviceReference_Name: if (negate) Devices.NegativeSet.Add(value); else Devices.PositiveSet.Add(value); break; - case Field.Slots: + case Field.Machine_Slots: if (negate) SlotOptions.NegativeSet.Add(value); else @@ -727,14 +728,14 @@ namespace SabreTools.Library.Filtering #region Logiqx - case Field.Board: + case Field.Machine_Board: if (negate) Board.NegativeSet.Add(value); else Board.PositiveSet.Add(value); break; - case Field.RebuildTo: + case Field.Machine_RebuildTo: if (negate) RebuildTo.NegativeSet.Add(value); else @@ -745,63 +746,63 @@ namespace SabreTools.Library.Filtering #region Logiqx EmuArc - case Field.TitleID: + case Field.Machine_TitleID: if (negate) TitleID.NegativeSet.Add(value); else TitleID.PositiveSet.Add(value); break; - case Field.Developer: + case Field.Machine_Developer: if (negate) Developer.NegativeSet.Add(value); else Developer.PositiveSet.Add(value); break; - case Field.Genre: + case Field.Machine_Genre: if (negate) Genre.NegativeSet.Add(value); else Genre.PositiveSet.Add(value); break; - case Field.Subgenre: + case Field.Machine_Subgenre: if (negate) Subgenre.NegativeSet.Add(value); else Subgenre.PositiveSet.Add(value); break; - case Field.Ratings: + case Field.Machine_Ratings: if (negate) Ratings.NegativeSet.Add(value); else Ratings.PositiveSet.Add(value); break; - case Field.Score: + case Field.Machine_Score: if (negate) Score.NegativeSet.Add(value); else Score.PositiveSet.Add(value); break; - case Field.Enabled: + case Field.Machine_Enabled: if (negate) Enabled.NegativeSet.Add(value); else Enabled.PositiveSet.Add(value); break; - case Field.HasCrc: + case Field.Machine_HasCrc: if (negate || value.Equals("false", StringComparison.OrdinalIgnoreCase)) HasCrc.Neutral = false; else HasCrc.Neutral = true; break; - case Field.RelatedTo: + case Field.Machine_RelatedTo: if (negate) RelatedTo.NegativeSet.Add(value); else @@ -812,21 +813,21 @@ namespace SabreTools.Library.Filtering #region OpenMSX - case Field.GenMSXID: + case Field.Machine_GenMSXID: if (negate) GenMSXID.NegativeSet.Add(value); else GenMSXID.PositiveSet.Add(value); break; - case Field.System: + case Field.Machine_System: if (negate) System.NegativeSet.Add(value); else System.PositiveSet.Add(value); break; - case Field.Country: + case Field.Machine_Country: if (negate) Country.NegativeSet.Add(value); else @@ -837,7 +838,7 @@ namespace SabreTools.Library.Filtering #region SoftwareList - case Field.Supported: + case Field.Machine_Supported: if (negate) SupportedStatus.Negative |= value.AsSupported(); else @@ -852,14 +853,14 @@ namespace SabreTools.Library.Filtering #region Common - case Field.Name: + case Field.DatItem_Name: if (negate) ItemName.NegativeSet.Add(value); else ItemName.PositiveSet.Add(value); break; - case Field.ItemType: + case Field.DatItem_Type: if (value.AsItemType() == null) return; @@ -873,14 +874,14 @@ namespace SabreTools.Library.Filtering #region AttractMode - case Field.AltName: + case Field.DatItem_AltName: if (negate) AltName.NegativeSet.Add(value); else AltName.PositiveSet.Add(value); break; - case Field.AltTitle: + case Field.DatItem_AltTitle: if (negate) AltTitle.NegativeSet.Add(value); else @@ -891,35 +892,35 @@ namespace SabreTools.Library.Filtering #region OpenMSX - case Field.Original: + case Field.DatItem_Original: if (negate) Original.NegativeSet.Add(value); else Original.PositiveSet.Add(value); break; - case Field.OpenMSXSubType: + case Field.DatItem_OpenMSXSubType: if (negate) SubType.Negative |= value.AsOpenMSXSubType(); else SubType.Positive |= value.AsOpenMSXSubType(); break; - case Field.OpenMSXType: + case Field.DatItem_OpenMSXType: if (negate) OpenMSXType.NegativeSet.Add(value); else OpenMSXType.PositiveSet.Add(value); break; - case Field.Remark: + case Field.DatItem_Remark: if (negate) Remark.NegativeSet.Add(value); else Remark.PositiveSet.Add(value); break; - case Field.Boot: + case Field.DatItem_Boot: if (negate) Boot.NegativeSet.Add(value); else diff --git a/SabreTools.Library/Tools/Converters.cs b/SabreTools.Library/Tools/Converters.cs index 198bc785..f24a0734 100644 --- a/SabreTools.Library/Tools/Converters.cs +++ b/SabreTools.Library/Tools/Converters.cs @@ -125,6 +125,7 @@ namespace SabreTools.Library.Tools /// /// String to get value from /// Field value corresponding to the string + /// TODO: Needs to be SEVERELY overhauled. Start using dot notation for fields... (where possible) public static Field AsField(this string input) { switch (input?.ToLowerInvariant()) @@ -139,11 +140,11 @@ namespace SabreTools.Library.Tools case "machine": case "machinename": case "machine-name": - return Field.MachineName; + return Field.Machine_Name; case "comment": case "extra": - return Field.Comment; + return Field.Machine_Comment; case "desc": case "description": @@ -155,32 +156,32 @@ namespace SabreTools.Library.Tools case "machinedescription": case "machine-description": case "machine description": - return Field.Description; + return Field.Machine_Description; case "year": - return Field.Year; + return Field.Machine_Year; case "manufacturer": - return Field.Manufacturer; + return Field.Machine_Manufacturer; case "publisher": - return Field.Publisher; + return Field.Machine_Publisher; case "category": case "gamecategory": case "game-category": case "machinecategory": case "machine-category": - return Field.Category; + return Field.Machine_Category; case "romof": - return Field.RomOf; + return Field.Machine_RomOf; case "cloneof": - return Field.CloneOf; + return Field.Machine_CloneOf; case "sampleof": - return Field.SampleOf; + return Field.Machine_SampleOf; case "gametype": case "game type": @@ -188,20 +189,20 @@ namespace SabreTools.Library.Tools case "machinetype": case "machine type": case "machine-type": - return Field.MachineType; + return Field.Machine_Type; #endregion #region AttractMode case "players": - return Field.Players; + return Field.Machine_Players; case "rotation": - return Field.Rotation; + return Field.Machine_Rotation; case "control": - return Field.Control; + return Field.Machine_Control; case "amstatus": case "am-status": @@ -211,19 +212,19 @@ namespace SabreTools.Library.Tools case "machine-status": case "supportstatus": case "support-status": - return Field.SupportStatus; + return Field.Machine_SupportStatus; case "displaycount": case "display-count": case "displays": - return Field.DisplayCount; + return Field.Machine_DisplayCount; case "displaytype": case "display-type": - return Field.DisplayType; + return Field.Machine_DisplayType; case "buttons": - return Field.Buttons; + return Field.Machine_Buttons; #endregion @@ -232,33 +233,33 @@ namespace SabreTools.Library.Tools case "sourcefile": case "source file": case "source-file": - return Field.SourceFile; + return Field.Machine_SourceFile; case "runnable": - return Field.Runnable; + return Field.Machine_Runnable; case "devices": - return Field.DeviceReferences; + return Field.Machine_DeviceReference_Name; case "slotoptions": case "slot options": case "slot-options": - return Field.Slots; + return Field.Machine_Slots; case "infos": - return Field.Infos; + return Field.Machine_Infos; #endregion #region Logiqx case "board": - return Field.Board; + return Field.Machine_Board; case "rebuildto": case "rebuild to": case "rebuild-to": - return Field.RebuildTo; + return Field.Machine_RebuildTo; #endregion @@ -267,35 +268,35 @@ namespace SabreTools.Library.Tools case "titleid": case "title id": case "title-id": - return Field.TitleID; + return Field.Machine_TitleID; case "developer": - return Field.Developer; + return Field.Machine_Developer; case "genre": - return Field.Genre; + return Field.Machine_Genre; case "subgenre": - return Field.Subgenre; + return Field.Machine_Subgenre; case "ratings": - return Field.Ratings; + return Field.Machine_Ratings; case "score": - return Field.Score; + return Field.Machine_Score; case "enabled": - return Field.Enabled; + return Field.Machine_Enabled; case "hascrc": case "has crc": case "has-crc": - return Field.HasCrc; + return Field.Machine_HasCrc; case "relatedto": case "related to": case "related-to": - return Field.RelatedTo; + return Field.Machine_RelatedTo; #endregion @@ -306,23 +307,23 @@ namespace SabreTools.Library.Tools case "genmsx-id": case "gen msx id": case "gen-msx-id": - return Field.GenMSXID; + return Field.Machine_GenMSXID; case "system": case "msxsystem": case "msx system": case "msx-system": - return Field.System; + return Field.Machine_System; case "country": - return Field.Country; + return Field.Machine_Country; #endregion #region SoftwareList case "supported": - return Field.Supported; + return Field.Machine_Supported; case "sharedfeat": case "shared feat": case "shared-feat": @@ -332,14 +333,14 @@ namespace SabreTools.Library.Tools case "sharedfeatures": case "shared features": case "shared-features": - return Field.SharedFeatures; + return Field.Machine_SharedFeatures; case "dipswitch": case "dip switch": case "dip-switch": case "dipswitches": case "dip switches": case "dip-switches": - return Field.DipSwitches; + return Field.Machine_DipSwitches; #endregion @@ -352,11 +353,11 @@ namespace SabreTools.Library.Tools case "itemname": case "item-name": case "name": - return Field.Name; + return Field.DatItem_Name; case "itemtype": case "item-type": case "type": - return Field.ItemType; + return Field.DatItem_Type; #endregion @@ -368,32 +369,32 @@ namespace SabreTools.Library.Tools case "altromname": case "alt romname": case "alt-romname": - return Field.AltName; + return Field.DatItem_AltName; case "alttitle": case "alt title": case "alt-title": case "altromtitle": case "alt romtitle": case "alt-romtitle": - return Field.AltTitle; + return Field.DatItem_AltTitle; #endregion #region OpenMSX case "original": - return Field.Original; + return Field.DatItem_Original; case "subtype": case "sub type": case "sub-type": case "openmsx_subtype": - return Field.OpenMSXSubType; + return Field.DatItem_OpenMSXSubType; case "openmsx_type": - return Field.OpenMSXType; + return Field.DatItem_OpenMSXType; case "remark": - return Field.Remark; + return Field.DatItem_Remark; case "boot": - return Field.Boot; + return Field.DatItem_Boot; #endregion diff --git a/SabreTools/Features/BaseFeature.cs b/SabreTools/Features/BaseFeature.cs index 1427bb42..410c7c17 100644 --- a/SabreTools/Features/BaseFeature.cs +++ b/SabreTools/Features/BaseFeature.cs @@ -2548,13 +2548,13 @@ Some special strings that can be used: 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."); - updateFields.Add(Field.Description); + updateFields.Add(Field.Machine_Description); } 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."); - updateFields.Add(Field.MachineType); + updateFields.Add(Field.Machine_Type); } if (GetBoolean(features, UpdateHashesValue)) @@ -2574,27 +2574,27 @@ Some special strings that can be used: 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."); - updateFields.Add(Field.Manufacturer); + updateFields.Add(Field.Machine_Manufacturer); } 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."); - updateFields.Add(Field.Name); + updateFields.Add(Field.DatItem_Name); } 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."); - updateFields.Add(Field.CloneOf); - updateFields.Add(Field.RomOf); - updateFields.Add(Field.SampleOf); + updateFields.Add(Field.Machine_CloneOf); + updateFields.Add(Field.Machine_RomOf); + updateFields.Add(Field.Machine_SampleOf); } 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."); - updateFields.Add(Field.Year); + updateFields.Add(Field.Machine_Year); } foreach (string fieldName in GetList(features, UpdateFieldListValue)) @@ -2756,12 +2756,12 @@ Some special strings that can be used: 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."); - filter.SetFilter(Field.Category, GetList(features, NotCategoryListValue), true); + filter.SetFilter(Field.Machine_Category, GetList(features, NotCategoryListValue), true); } 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."); - filter.SetFilter(Field.Category, GetList(features, CategoryListValue), false); + filter.SetFilter(Field.Machine_Category, GetList(features, CategoryListValue), false); } // CRC @@ -2780,12 +2780,12 @@ Some special strings that can be used: 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."); - filter.SetFilter(Field.Name, GetList(features, NotItemNameListValue), true); + filter.SetFilter(Field.DatItem_Name, GetList(features, NotItemNameListValue), true); } 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."); - filter.SetFilter(Field.Name, GetList(features, ItemNameListValue), false); + filter.SetFilter(Field.DatItem_Name, GetList(features, ItemNameListValue), false); } // Item status @@ -2804,48 +2804,48 @@ Some special strings that can be used: 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."); - filter.SetFilter(Field.ItemType, GetList(features, NotItemTypeListValue), true); + filter.SetFilter(Field.DatItem_Type, GetList(features, NotItemTypeListValue), true); } 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."); - filter.SetFilter(Field.ItemType, GetList(features, ItemTypeListValue), false); + filter.SetFilter(Field.DatItem_Type, GetList(features, ItemTypeListValue), false); } // Machine description 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."); - filter.SetFilter(Field.Description, GetList(features, NotGameDescriptionListValue), true); + filter.SetFilter(Field.Machine_Description, GetList(features, NotGameDescriptionListValue), true); } 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."); - filter.SetFilter(Field.Description, GetList(features, GameDescriptionListValue), false); + filter.SetFilter(Field.Machine_Description, GetList(features, GameDescriptionListValue), false); } // Machine name 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."); - filter.SetFilter(Field.MachineName, GetList(features, NotGameNameListValue), true); + filter.SetFilter(Field.Machine_Name, GetList(features, NotGameNameListValue), true); } 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."); - filter.SetFilter(Field.MachineName, GetList(features, GameNameListValue), false); + filter.SetFilter(Field.Machine_Name, GetList(features, GameNameListValue), false); } // Machine type 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."); - filter.SetFilter(Field.MachineType, GetList(features, NotGameTypeListValue), true); + filter.SetFilter(Field.Machine_Type, GetList(features, NotGameTypeListValue), true); } 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."); - filter.SetFilter(Field.MachineType, GetList(features, GameTypeListValue), false); + filter.SetFilter(Field.Machine_Type, GetList(features, GameTypeListValue), false); } // MD5 @@ -2878,12 +2878,12 @@ Some special strings that can be used: 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."); - filter.SetFilter(Field.Runnable, string.Empty, true); + filter.SetFilter(Field.Machine_Runnable, string.Empty, true); } 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."); - filter.SetFilter(Field.Runnable, string.Empty, false); + filter.SetFilter(Field.Machine_Runnable, string.Empty, false); } // SHA1 diff --git a/SabreTools/Features/Update.cs b/SabreTools/Features/Update.cs index 2585421d..262f99a4 100644 --- a/SabreTools/Features/Update.cs +++ b/SabreTools/Features/Update.cs @@ -143,7 +143,7 @@ namespace SabreTools.Features // If no update fields are set, default to Names if (updateFields == null || updateFields.Count == 0) - updateFields = new List() { Field.Name }; + updateFields = new List() { Field.DatItem_Name }; // Ensure we only have files in the inputs List inputFileNames = DirectoryExtensions.GetFilesOnly(Inputs, appendparent: true);