diff --git a/SabreTools.Helper/Objects/Dat/DatFile.cs b/SabreTools.Helper/Objects/Dat/DatFile.cs index 2b91c340..8c453da0 100644 --- a/SabreTools.Helper/Objects/Dat/DatFile.cs +++ b/SabreTools.Helper/Objects/Dat/DatFile.cs @@ -2324,9 +2324,13 @@ namespace SabreTools.Helper case "machine": case "game": case "software": - string temptype = xtr.Name; - string tempname = "", gamedesc = "", romof = "", - cloneof = "", sampleof = "", year = "", manufacturer = ""; + string temptype = xtr.Name, tempname = "", gamedesc = "", romof = "", + cloneof = "", sampleof = "", year = "", manufacturer = "", publisher = "", + partname = "", partinterface = "", areaname = ""; + bool? supported = null; + long? areasize = null; + Dictionary infos = new Dictionary(); + Dictionary features = new Dictionary(); // We want to process the entire subtree of the game subreader = xtr.ReadSubtree(); @@ -2343,19 +2347,22 @@ namespace SabreTools.Helper // Otherwise, add what is possible subreader.MoveToContent(); - if (!softlist && temptype == "software" && subreader.ReadToFollowing("description")) + + tempname = xtr.GetAttribute("name"); + romof = (xtr.GetAttribute("romof") != null ? xtr.GetAttribute("romof") : ""); + cloneof = (xtr.GetAttribute("cloneof") != null ? xtr.GetAttribute("cloneof") : ""); + sampleof = (xtr.GetAttribute("sampleof") != null ? xtr.GetAttribute("sampleof") : ""); + if (subreader.GetAttribute("supported") != null) { - tempname = subreader.ReadElementContentAsString(); - gamedesc = tempname; - tempname = tempname.Replace('/', '_').Replace("\"", "''"); - software = true; - } - else - { - tempname = xtr.GetAttribute("name"); - romof = (xtr.GetAttribute("romof") != null ? xtr.GetAttribute("romof") : ""); - cloneof = (xtr.GetAttribute("cloneof") != null ? xtr.GetAttribute("cloneof") : ""); - sampleof = (xtr.GetAttribute("sampleof") != null ? xtr.GetAttribute("sampleof") : ""); + switch (subreader.GetAttribute("supported")) + { + case "no": + supported = false; + break; + case "yes": + supported = true; + break; + } } if (superdat && !keep) @@ -2415,9 +2422,41 @@ namespace SabreTools.Helper ParseAddHelper(olrom, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, itemStatus, trim, single, root, clean, logger, out key); break; + // For Software List only + case "publisher": + publisher = subreader.ReadElementContentAsString(); + break; + case "info": + infos.Add(subreader.GetAttribute("name"), subreader.GetAttribute("value")); + subreader.Read(); + break; + case "part": + partname = subreader.GetAttribute("name"); + partinterface = subreader.GetAttribute("interface"); + subreader.Read(); + break; + case "feature": + features.Add(subreader.GetAttribute("name"), subreader.GetAttribute("value")); + subreader.Read(); + break; + case "dataarea": + case "diskarea": + areaname = subreader.GetAttribute("name"); + long areasizetemp = -1; + if (Int64.TryParse(subreader.GetAttribute("size"), out areasizetemp)) + { + areasize = areasizetemp; + } + subreader.Read(); + break; + // For Logiqx, SabreDAT, and Software List case "description": gamedesc = subreader.ReadElementContentAsString(); + if (softlist) + { + tempname = gamedesc.Replace('/', '_').Replace("\"", "''"); + } break; case "year": year = subreader.ReadElementContentAsString(); @@ -2442,6 +2481,15 @@ namespace SabreTools.Helper } DatItem relrom = new Release(subreader.GetAttribute("name"), subreader.GetAttribute("region"), subreader.GetAttribute("language"), date, defaultrel); + relrom.Supported = supported; + relrom.Year = year; + relrom.Publisher = publisher; + relrom.Infos = infos; + relrom.PartName = partname; + relrom.PartInterface = partinterface; + relrom.Features = features; + relrom.AreaName = areaname; + relrom.AreaSize = areasize; // Now process and add the rom ParseAddHelper(relrom, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, itemStatus, trim, single, root, clean, logger, out key); @@ -2466,6 +2514,15 @@ namespace SabreTools.Helper DatItem biosrom = new BiosSet(subreader.GetAttribute("name"), subreader.GetAttribute("description"), defaultbios, tempname, null, gamedesc, null, null, romof, cloneof, sampleof, null, false, null, null, sysid, filename, srcid, null); + biosrom.Supported = supported; + biosrom.Year = year; + biosrom.Publisher = publisher; + biosrom.Infos = infos; + biosrom.PartName = partname; + biosrom.PartInterface = partinterface; + biosrom.Features = features; + biosrom.AreaName = areaname; + biosrom.AreaSize = areasize; // Now process and add the rom ParseAddHelper(biosrom, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, itemStatus, trim, single, root, clean, logger, out key); @@ -2477,6 +2534,15 @@ namespace SabreTools.Helper DatItem archiverom = new Archive(subreader.GetAttribute("name"), tempname, null, gamedesc, null, null, romof, cloneof, sampleof, null, false, null, null, sysid, filename, srcid, null); + archiverom.Supported = supported; + archiverom.Year = year; + archiverom.Publisher = publisher; + archiverom.Infos = infos; + archiverom.PartName = partname; + archiverom.PartInterface = partinterface; + archiverom.Features = features; + archiverom.AreaName = areaname; + archiverom.AreaSize = areasize; // Now process and add the rom ParseAddHelper(archiverom, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, itemStatus, trim, single, root, clean, logger, out key); @@ -2488,6 +2554,15 @@ namespace SabreTools.Helper DatItem samplerom = new Sample(subreader.GetAttribute("name"), tempname, null, gamedesc, null, null, romof, cloneof, sampleof, null, false, null, null, sysid, filename, srcid, null); + samplerom.Supported = supported; + samplerom.Year = year; + samplerom.Publisher = publisher; + samplerom.Infos = infos; + samplerom.PartName = partname; + samplerom.PartInterface = partinterface; + samplerom.Features = features; + samplerom.AreaName = areaname; + samplerom.AreaSize = areasize; // Now process and add the rom ParseAddHelper(samplerom, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, itemStatus, trim, single, root, clean, logger, out key); @@ -2583,6 +2658,15 @@ namespace SabreTools.Helper null, false, null, null, sysid, filename, srcid, null); break; } + inrom.Supported = supported; + inrom.Year = year; + inrom.Publisher = publisher; + inrom.Infos = infos; + inrom.PartName = partname; + inrom.PartInterface = partinterface; + inrom.Features = features; + inrom.AreaName = areaname; + inrom.AreaSize = areasize; // Now process and add the rom ParseAddHelper(inrom, gamename, romname, romtype, sgt, slt, seq, crc, md5, sha1, itemStatus, trim, single, root, clean, logger, out key); @@ -4576,10 +4660,23 @@ namespace SabreTools.Helper depth = depth - (last == -1 ? 0 : last) + newsplit.Count; break; case OutputFormat.SoftwareList: - state += "\t\n" + state += "\t\n" + "\t\t" + HttpUtility.HtmlEncode(rom.MachineDescription) + "\n" + (rom.Year != null ? "\t\t" + HttpUtility.HtmlEncode(rom.Year) + "\n" : "") - + "\t\t\n"; + + (rom.Publisher != null ? "\t\t" + HttpUtility.HtmlEncode(rom.Publisher) + "\n" : ""); + + foreach (KeyValuePair kvp in rom.Infos) + { + state += "\t\t\n"; + } + + state += "\t\t\n"; + + foreach (KeyValuePair kvp in rom.Features) + { + state += "\t\t\t\n"; + } break; case OutputFormat.Logiqx: state += "\t\n" + state += "\t\t\t\n" + "\t\t\t\t\n" + "\t\t\t\n"; break; case ItemType.BiosSet: - state += "\t\t\t\n" + state += "\t\t\t\n" + "\t\t\t\t\n"; break; case ItemType.Disk: - state += "\t\t\t\n" + state += "\t\t\t\n" + "\t\t\t\t\n"; break; case ItemType.Release: - state += "\t\t\t\n" + state += "\t\t\t\n" + "\t\t\t\t\n"; break; case ItemType.Rom: - state += "\t\t\t\n" + state += "\t\t\t\n" + "\t\t\t\t\n"; break; case ItemType.Sample: - state += "\t\t\t\n" - + "\t\t\t\t\n" + + "\t\t\t\t\n" + "\t\t\t\n"; break; diff --git a/SabreTools.Helper/Objects/Dat/DatItem.cs b/SabreTools.Helper/Objects/Dat/DatItem.cs index 691611d0..41c16138 100644 --- a/SabreTools.Helper/Objects/Dat/DatItem.cs +++ b/SabreTools.Helper/Objects/Dat/DatItem.cs @@ -28,6 +28,16 @@ namespace SabreTools.Helper protected string _board; protected string _rebuildTo; + // Software list information + protected bool? _supported; + protected string _publisher; + protected Dictionary _infos; + protected string _partName; + protected string _partInterface; + protected Dictionary _features; + protected string _areaName; + protected long? _areaSize; + // Source metadata information protected int _systemId; protected string _systemName; @@ -117,6 +127,48 @@ namespace SabreTools.Helper set { _rebuildTo = value; } } + // Software list information + public bool? Supported + { + get { return _supported; } + set { _supported = value; } + } + public string Publisher + { + get { return _publisher; } + set { _publisher = value; } + } + public Dictionary Infos + { + get { return _infos; } + set { _infos = value; } + } + public string PartName + { + get { return _partName; } + set { _partName = value; } + } + public string PartInterface + { + get { return _partInterface; } + set { _partInterface = value; } + } + public Dictionary Features + { + get { return _features; } + set { _features = value; } + } + public string AreaName + { + get { return _areaName; } + set { _areaName = value; } + } + public long? AreaSize + { + get { return _areaSize; } + set { _areaSize = value; } + } + // Source metadata information public int SystemID {