diff --git a/SabreTools.Library/DatFiles/SoftwareList.cs b/SabreTools.Library/DatFiles/SoftwareList.cs
index a50bfa99..66103f24 100644
--- a/SabreTools.Library/DatFiles/SoftwareList.cs
+++ b/SabreTools.Library/DatFiles/SoftwareList.cs
@@ -44,8 +44,6 @@ namespace SabreTools.Library.DatFiles
/// True if full pathnames are to be kept, false otherwise (default)
/// True if game names are sanitized, false otherwise (default)
/// True if we should remove non-ASCII characters from output, false otherwise (default)
- ///
- ///
public override void ParseFile(
// Standard Dat parsing
string filename,
@@ -131,6 +129,7 @@ namespace SabreTools.Library.DatFiles
///
/// Read software information
///
+ /// XmlReader representing a software block
/// Name of the file to be parsed
/// System ID for the DAT
/// Source ID for the DAT
@@ -185,6 +184,7 @@ namespace SabreTools.Library.DatFiles
Supported = Utilities.GetYesNo(reader.GetAttribute("supported")), // (yes|partial|no) "yes"
CloneOf = reader.GetAttribute("cloneof") ?? "",
+ Infos = new List>(),
MachineType = (machineType == MachineType.NULL ? MachineType.None : machineType),
};
@@ -253,6 +253,8 @@ namespace SabreTools.Library.DatFiles
///
/// Read part information
///
+ /// XmlReader representing a part block
+ /// Machine information to pass to contained items
/// Name of the file to be parsed
/// System ID for the DAT
/// Source ID for the DAT
@@ -325,10 +327,95 @@ namespace SabreTools.Library.DatFiles
}
// string width = reader.GetAttribute("width"); // (8|16|32|64) "8"
// string endianness = reader.GetAttribute("endianness"); // endianness (big|little) "little"
-
+
+ containsItems = ReadDataArea(reader.ReadSubtree(), machine, features, areaname, areasize,
+ partname, partinterface, filename, sysid, srcid, keep, clean, remUnicode);
+
+ // Skip the dataarea now that we've processed it
+ reader.Skip();
+ break;
+ case "diskarea":
+ areaname = reader.GetAttribute("name");
+
+ containsItems = ReadDiskArea(reader.ReadSubtree(), machine, features, areaname, areasize,
+ partname, partinterface, filename, sysid, srcid, keep, clean, remUnicode);
+
+ // Skip the diskarea now that we've processed it
+ reader.Skip();
+ break;
+ case "dipswitch":
+ // string name = reader.GetAttribute("name");
+ // string tag = reader.GetAttribute("tag");
+ // string mask = reader.GetAttribute("mask");
+
+ // For every element...
+ // string name = reader.GetAttribute("name");
+ // string value = reader.GetAttribute("value");
+ // bool? default = Utilities.GetYesNo(reader.GetAttribute("default")); // (yes|no) "no"
+
reader.Read();
break;
- case "rom": // TODO: Put this in a proper subreader under dataarea
+ default:
+ reader.Read();
+ break;
+ }
+ }
+
+ return containsItems;
+ }
+
+ ///
+ /// Read dataarea information
+ ///
+ /// XmlReader representing a dataarea block
+ /// Machine information to pass to contained items
+ /// List of features from the parent part
+ /// Name of the containing area
+ /// Size of the containing area
+ /// Name of the containing part
+ /// Interface of the containing part
+ /// Name of the file to be parsed
+ /// System ID for the DAT
+ /// Source ID for the DAT
+ /// True if full pathnames are to be kept, false otherwise (default)
+ /// True if game names are sanitized, false otherwise (default)
+ /// True if we should remove non-ASCII characters from output, false otherwise (default)
+ private bool ReadDataArea(
+ XmlReader reader,
+ Machine machine,
+ List> features,
+ string areaname,
+ long? areasize,
+ string partname,
+ string partinterface,
+
+ // Standard Dat parsing
+ string filename,
+ int sysid,
+ int srcid,
+
+ // Miscellaneous
+ bool keep,
+ bool clean,
+ bool remUnicode)
+ {
+ string key = "";
+ string temptype = reader.Name;
+ bool containsItems = false;
+
+ while (!reader.EOF)
+ {
+ // We only want elements
+ if (reader.NodeType != XmlNodeType.Element)
+ {
+ reader.Read();
+ continue;
+ }
+
+ // Get the elements from the software
+ switch (reader.Name)
+ {
+ case "rom":
containsItems = true;
// If the rom is continue or ignore, add the size to the previous rom
@@ -379,12 +466,67 @@ namespace SabreTools.Library.DatFiles
reader.Read();
break;
- case "diskarea":
- areaname = reader.GetAttribute("name");
-
+ default:
reader.Read();
break;
- case "disk": // TODO: Put this in a proper subreader under diskarea
+ }
+ }
+
+ return containsItems;
+ }
+
+ ///
+ /// Read diskarea information
+ ///
+ /// XmlReader representing a diskarea block
+ /// Machine information to pass to contained items
+ /// List of features from the parent part
+ /// Name of the containing area
+ /// Size of the containing area
+ /// Name of the containing part
+ /// Interface of the containing part
+ /// Name of the file to be parsed
+ /// System ID for the DAT
+ /// Source ID for the DAT
+ /// True if full pathnames are to be kept, false otherwise (default)
+ /// True if game names are sanitized, false otherwise (default)
+ /// True if we should remove non-ASCII characters from output, false otherwise (default)
+ private bool ReadDiskArea(
+ XmlReader reader,
+ Machine machine,
+ List> features,
+ string areaname,
+ long? areasize,
+ string partname,
+ string partinterface,
+
+ // Standard Dat parsing
+ string filename,
+ int sysid,
+ int srcid,
+
+ // Miscellaneous
+ bool keep,
+ bool clean,
+ bool remUnicode)
+ {
+ string key = "";
+ string temptype = reader.Name;
+ bool containsItems = false;
+
+ while (!reader.EOF)
+ {
+ // We only want elements
+ if (reader.NodeType != XmlNodeType.Element)
+ {
+ reader.Read();
+ continue;
+ }
+
+ // Get the elements from the software
+ switch (reader.Name)
+ {
+ case "disk":
containsItems = true;
DatItem disk = new Disk
@@ -414,18 +556,6 @@ namespace SabreTools.Library.DatFiles
// Now process and add the rom
key = ParseAddHelper(disk, clean, remUnicode);
- reader.Read();
- break;
- case "dipswitch":
- // string name = reader.GetAttribute("name");
- // string tag = reader.GetAttribute("tag");
- // string mask = reader.GetAttribute("mask");
-
- // For every element...
- // string name = reader.GetAttribute("name");
- // string value = reader.GetAttribute("value");
- // bool? default = Utilities.GetYesNo(reader.GetAttribute("default")); // (yes|no) "no"
-
reader.Read();
break;
default: