[DatFile, DatItem] Software list items can have "duplicate keys"

This commit is contained in:
Matt Nadareski
2016-10-03 10:00:20 -07:00
parent 574bff9c2e
commit a3112681f2
2 changed files with 13 additions and 13 deletions

View File

@@ -2327,8 +2327,8 @@ namespace SabreTools.Helper
partname = "", partinterface = "", areaname = ""; partname = "", partinterface = "", areaname = "";
bool? supported = null; bool? supported = null;
long? areasize = null; long? areasize = null;
Dictionary<string, string> infos = new Dictionary<string, string>(); List<Tuple<string, string>> infos = new List<Tuple<string, string>>();
Dictionary<string, string> features = new Dictionary<string, string>(); List<Tuple<string, string>> features = new List<Tuple<string, string>>();
// We want to process the entire subtree of the game // We want to process the entire subtree of the game
subreader = xtr.ReadSubtree(); subreader = xtr.ReadSubtree();
@@ -2392,7 +2392,7 @@ namespace SabreTools.Helper
{ {
partname = ""; partname = "";
partinterface = ""; partinterface = "";
features = new Dictionary<string, string>(); features = new List<Tuple<string, string>>();
} }
if (subreader.NodeType == XmlNodeType.EndElement && (subreader.Name == "dataarea" || subreader.Name == "diskarea")) if (subreader.NodeType == XmlNodeType.EndElement && (subreader.Name == "dataarea" || subreader.Name == "diskarea"))
{ {
@@ -2437,7 +2437,7 @@ namespace SabreTools.Helper
publisher = subreader.ReadElementContentAsString(); publisher = subreader.ReadElementContentAsString();
break; break;
case "info": case "info":
infos.Add(subreader.GetAttribute("name"), subreader.GetAttribute("value")); infos.Add(Tuple.Create(subreader.GetAttribute("name"), subreader.GetAttribute("value")));
subreader.Read(); subreader.Read();
break; break;
case "part": case "part":
@@ -2446,7 +2446,7 @@ namespace SabreTools.Helper
subreader.Read(); subreader.Read();
break; break;
case "feature": case "feature":
features.Add(subreader.GetAttribute("name"), subreader.GetAttribute("value")); features.Add(Tuple.Create(subreader.GetAttribute("name"), subreader.GetAttribute("value")));
subreader.Read(); subreader.Read();
break; break;
case "dataarea": case "dataarea":
@@ -4635,9 +4635,9 @@ namespace SabreTools.Helper
+ (rom.Year != null ? "\t\t<year>" + HttpUtility.HtmlEncode(rom.Year) + "</year>\n" : "") + (rom.Year != null ? "\t\t<year>" + HttpUtility.HtmlEncode(rom.Year) + "</year>\n" : "")
+ (rom.Publisher != null ? "\t\t<publisher>" + HttpUtility.HtmlEncode(rom.Publisher) + "</publisher>\n" : ""); + (rom.Publisher != null ? "\t\t<publisher>" + HttpUtility.HtmlEncode(rom.Publisher) + "</publisher>\n" : "");
foreach (KeyValuePair<string, string> kvp in rom.Infos) foreach (Tuple<string, string> kvp in rom.Infos)
{ {
state += "\t\t<info name=\"" + kvp.Key + "\" value=\"" + kvp.Value + "\">\n"; state += "\t\t<info name=\"" + kvp.Item1 + "\" value=\"" + kvp.Item2 + "\">\n";
} }
break; break;
} }
@@ -5182,9 +5182,9 @@ namespace SabreTools.Helper
case OutputFormat.SoftwareList: case OutputFormat.SoftwareList:
state += "\t\t<part name=\"" + rom.PartName + "\" interface=\"" + rom.PartInterface + "\">\n"; state += "\t\t<part name=\"" + rom.PartName + "\" interface=\"" + rom.PartInterface + "\">\n";
foreach (KeyValuePair<string, string> kvp in rom.Features) foreach (Tuple<string, string> kvp in rom.Features)
{ {
state += "\t\t\t<feature name=\"" + kvp.Key + "\" value=\"" + kvp.Value + "\"/>\n"; state += "\t\t\t<feature name=\"" + kvp.Item1 + "\" value=\"" + kvp.Item2 + "\"/>\n";
} }
switch (rom.Type) switch (rom.Type)

View File

@@ -31,10 +31,10 @@ namespace SabreTools.Helper
// Software list information // Software list information
protected bool? _supported; protected bool? _supported;
protected string _publisher; protected string _publisher;
protected Dictionary<string, string> _infos; protected List<Tuple<string, string>> _infos;
protected string _partName; protected string _partName;
protected string _partInterface; protected string _partInterface;
protected Dictionary<string, string> _features; protected List<Tuple<string, string>> _features;
protected string _areaName; protected string _areaName;
protected long? _areaSize; protected long? _areaSize;
@@ -138,7 +138,7 @@ namespace SabreTools.Helper
get { return _publisher; } get { return _publisher; }
set { _publisher = value; } set { _publisher = value; }
} }
public Dictionary<string, string> Infos public List<Tuple<string, string>> Infos
{ {
get { return _infos; } get { return _infos; }
set { _infos = value; } set { _infos = value; }
@@ -153,7 +153,7 @@ namespace SabreTools.Helper
get { return _partInterface; } get { return _partInterface; }
set { _partInterface = value; } set { _partInterface = value; }
} }
public Dictionary<string, string> Features public List<Tuple<string, string>> Features
{ {
get { return _features; } get { return _features; }
set { _features = value; } set { _features = value; }