[Listxml] Fix read and write

This commit is contained in:
Matt Nadareski
2018-02-21 10:09:18 -08:00
parent 25c773bd31
commit 13af2442d3

View File

@@ -97,6 +97,7 @@ namespace SabreTools.Library.DatFiles
xtr.Read(); xtr.Read();
break; break;
// We want to process the entire subtree of the machine // We want to process the entire subtree of the machine
case "game": // Some older DATs still use "game"
case "machine": case "machine":
ReadMachine(xtr.ReadSubtree(), filename, sysid, srcid, keep, clean, remUnicode); ReadMachine(xtr.ReadSubtree(), filename, sysid, srcid, keep, clean, remUnicode);
@@ -717,10 +718,13 @@ namespace SabreTools.Library.DatFiles
+ (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" : "");
if (rom.Infos != null && rom.Infos.Count > 0)
{
foreach (Tuple<string, string> kvp in rom.Infos) foreach (Tuple<string, string> kvp in rom.Infos)
{ {
state += "\t\t<info name=\"" + HttpUtility.HtmlEncode(kvp.Item1) + "\" value=\"" + HttpUtility.HtmlEncode(kvp.Item2) + "\" />\n"; state += "\t\t<info name=\"" + HttpUtility.HtmlEncode(kvp.Item1) + "\" value=\"" + HttpUtility.HtmlEncode(kvp.Item2) + "\" />\n";
} }
}
sw.Write(state); sw.Write(state);
sw.Flush(); sw.Flush();