diff --git a/SabreTools.Library/DatFiles/Listxml.cs b/SabreTools.Library/DatFiles/Listxml.cs index 332cdc31..3f8aa897 100644 --- a/SabreTools.Library/DatFiles/Listxml.cs +++ b/SabreTools.Library/DatFiles/Listxml.cs @@ -1003,7 +1003,7 @@ namespace SabreTools.Library.DatFiles // If we have a different game and we're not at the start of the list, output the end of last item if (lastgame != null && lastgame.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant()) - WriteEndGame(xtw); + WriteEndGame(xtw, rom); // If we have a new game, output the beginning of the new item if (lastgame == null || lastgame.ToLowerInvariant() != rom.Machine.Name.ToLowerInvariant()) @@ -1107,9 +1107,9 @@ namespace SabreTools.Library.DatFiles xtw.WriteOptionalElementString("description", datItem.Machine.Description); xtw.WriteOptionalElementString("year", datItem.Machine.Year); - xtw.WriteOptionalElementString("publisher", datItem.Machine.Publisher); - xtw.WriteOptionalElementString("category", datItem.Machine.Category); + xtw.WriteOptionalElementString("manufacturer", datItem.Machine.Manufacturer); + // TODO: These should go *after* the datitems if (datItem.Machine.DeviceReferences != null) { foreach (var deviceReference in datItem.Machine.DeviceReferences) @@ -1230,17 +1230,17 @@ namespace SabreTools.Library.DatFiles } if (datItem.Machine.DipSwitches != null) { - foreach (var dipSwitches in datItem.Machine.DipSwitches) + foreach (var dipSwitch in datItem.Machine.DipSwitches) { xtw.WriteStartElement("dipswitch"); - xtw.WriteOptionalAttributeString("name", dipSwitches.Name); - xtw.WriteOptionalAttributeString("tag", dipSwitches.Tag); - xtw.WriteOptionalAttributeString("mask", dipSwitches.Mask); + xtw.WriteOptionalAttributeString("name", dipSwitch.Name); + xtw.WriteOptionalAttributeString("tag", dipSwitch.Tag); + xtw.WriteOptionalAttributeString("mask", dipSwitch.Mask); - if (dipSwitches.Locations != null) + if (dipSwitch.Locations != null) { - foreach (var location in dipSwitches.Locations) + foreach (var location in dipSwitch.Locations) { xtw.WriteStartElement("diplocation"); @@ -1252,9 +1252,9 @@ namespace SabreTools.Library.DatFiles xtw.WriteEndElement(); } } - if (dipSwitches.Values != null) + if (dipSwitch.Values != null) { - foreach (var value in dipSwitches.Values) + foreach (var value in dipSwitch.Values) { xtw.WriteStartElement("dipvalue"); @@ -1508,8 +1508,9 @@ namespace SabreTools.Library.DatFiles /// Write out Game start using the supplied StreamWriter /// /// XmlTextWriter to output to + /// DatItem object to be output /// True if the data was written, false on error - private bool WriteEndGame(XmlTextWriter xtw) + private bool WriteEndGame(XmlTextWriter xtw, DatItem datItem) { try { diff --git a/SabreTools.Library/DatFiles/Logiqx.cs b/SabreTools.Library/DatFiles/Logiqx.cs index 6c0a93cc..6881355e 100644 --- a/SabreTools.Library/DatFiles/Logiqx.cs +++ b/SabreTools.Library/DatFiles/Logiqx.cs @@ -620,7 +620,7 @@ namespace SabreTools.Library.DatFiles break; case "crc": - machine.HasCrc = reader.ReadElementContentAsString().AsYesNo(); + machine.Crc = reader.ReadElementContentAsString().AsYesNo(); break; case "source": @@ -873,7 +873,7 @@ namespace SabreTools.Library.DatFiles || datItem.Machine.Ratings != null || datItem.Machine.Score != null || datItem.Machine.Enabled != null - || datItem.Machine.HasCrc != null + || datItem.Machine.Crc != null || datItem.Machine.RelatedTo != null) { xtw.WriteStartElement("trurip"); @@ -889,7 +889,7 @@ namespace SabreTools.Library.DatFiles xtw.WriteOptionalElementString("players", datItem.Machine.Players); xtw.WriteOptionalElementString("enabled", datItem.Machine.Enabled); xtw.WriteOptionalElementString("titleid", datItem.Machine.TitleID); - xtw.WriteOptionalElementString("crc", datItem.Machine.HasCrc.FromYesNo()); + xtw.WriteOptionalElementString("crc", datItem.Machine.Crc.FromYesNo()); xtw.WriteOptionalElementString("source", datItem.Machine.SourceFile); xtw.WriteOptionalElementString("cloneof", datItem.Machine.CloneOf); xtw.WriteOptionalElementString("relatedto", datItem.Machine.RelatedTo); diff --git a/SabreTools.Library/DatItems/Auxiliary.cs b/SabreTools.Library/DatItems/Auxiliary.cs index e56c552d..70fdca38 100644 --- a/SabreTools.Library/DatItems/Auxiliary.cs +++ b/SabreTools.Library/DatItems/Auxiliary.cs @@ -40,6 +40,7 @@ namespace SabreTools.Library.DatItems /// /// Represents one ListXML chip /// + /// TODO: Promote this to the same level as Sample [JsonObject("chip")] public class ListXmlChip { @@ -203,6 +204,7 @@ namespace SabreTools.Library.DatItems /// /// Represents one ListXML deviceref /// + /// TODO: Promote this to the same level as Sample [JsonObject("deviceref")] public class ListXmlDeviceReference { @@ -450,6 +452,7 @@ namespace SabreTools.Library.DatItems /// /// Represents one ListXML softwarelist /// + /// TODO: Promote this to the same level as Sample? [JsonObject("softwarelist")] public class ListXmlSoftwareList { diff --git a/SabreTools.Library/DatItems/Machine.cs b/SabreTools.Library/DatItems/Machine.cs index 2376ce40..1f69fa76 100644 --- a/SabreTools.Library/DatItems/Machine.cs +++ b/SabreTools.Library/DatItems/Machine.cs @@ -317,7 +317,7 @@ namespace SabreTools.Library.DatItems /// Does the game have a CRC check /// [JsonProperty("hascrc", DefaultValueHandling = DefaultValueHandling.Ignore)] - public bool? HasCrc { get; set; } = null; + public bool? Crc { get; set; } = null; /// /// Machine relations @@ -505,7 +505,7 @@ namespace SabreTools.Library.DatItems Enabled = mappings[Field.Machine_Enabled]; if (mappings.Keys.Contains(Field.Machine_CRC)) - HasCrc = mappings[Field.Machine_CRC].AsYesNo(); + Crc = mappings[Field.Machine_CRC].AsYesNo(); if (mappings.Keys.Contains(Field.Machine_RelatedTo)) RelatedTo = mappings[Field.Machine_RelatedTo]; @@ -582,6 +582,7 @@ namespace SabreTools.Library.DatItems RomOf = this.RomOf, CloneOf = this.CloneOf, SampleOf = this.SampleOf, + MachineType = this.MachineType, #endregion @@ -602,9 +603,21 @@ namespace SabreTools.Library.DatItems SourceFile = this.SourceFile, Runnable = this.Runnable, DeviceReferences = this.DeviceReferences, + Chips = this.Chips, + Displays = this.Displays, + Sounds = this.Sounds, + Conditions = this.Conditions, + Inputs = this.Inputs, + DipSwitches = this.DipSwitches, + Configurations = this.Configurations, + Ports = this.Ports, + Adjusters = this.Adjusters, + Drivers = this.Drivers, + Features = this.Features, + Devices = this.Devices, Slots = this.Slots, - Infos = this.Infos, - MachineType = this.MachineType, + SoftwareLists = this.SoftwareLists, + RamOptions = this.RamOptions, #endregion @@ -624,7 +637,7 @@ namespace SabreTools.Library.DatItems Ratings = this.Ratings, Score = this.Score, Enabled = this.Enabled, - HasCrc = this.HasCrc, + Crc = this.Crc, RelatedTo = this.RelatedTo, #endregion @@ -640,8 +653,8 @@ namespace SabreTools.Library.DatItems #region SoftwareList Supported = this.Supported, + Infos = this.Infos, SharedFeatures = this.SharedFeatures, - DipSwitches = this.DipSwitches, #endregion }; @@ -1401,7 +1414,7 @@ namespace SabreTools.Library.DatItems return false; // Machine_CRC - if (filter.Machine_CRC.MatchesNeutral(null, HasCrc) == false) + if (filter.Machine_CRC.MatchesNeutral(null, Crc) == false) return false; // Machine_RelatedTo @@ -1547,6 +1560,7 @@ namespace SabreTools.Library.DatItems /// Remove fields from the Machine /// /// List of Fields to remove + /// TODO: Add new ListXML and SoftwareList fields public void RemoveFields(List fields) { #region Common @@ -1664,7 +1678,7 @@ namespace SabreTools.Library.DatItems Enabled = null; if (fields.Contains(Field.Machine_CRC)) - HasCrc = null; + Crc = null; if (fields.Contains(Field.Machine_RelatedTo)) RelatedTo = null; @@ -1708,6 +1722,7 @@ namespace SabreTools.Library.DatItems /// DatItem to pull new information from /// List of Fields representing what should be updated /// True if descriptions should only be replaced if the game name is the same, false otherwise + /// TODO: Add new ListXML and SoftwareList fields public void ReplaceFields(Machine machine, List fields, bool onlySame) { #region Common @@ -1828,7 +1843,7 @@ namespace SabreTools.Library.DatItems Enabled = machine.Enabled; if (fields.Contains(Field.Machine_CRC)) - HasCrc = machine.HasCrc; + Crc = machine.Crc; if (fields.Contains(Field.Machine_RelatedTo)) RelatedTo = machine.RelatedTo;