From a6536fd65ecc69bc268d64adf78d5391590b178d Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Wed, 27 Apr 2016 21:27:41 -0700 Subject: [PATCH] Fix some finicky XML DATs and how the name is read --- SabreHelper/RomManipulation.cs | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/SabreHelper/RomManipulation.cs b/SabreHelper/RomManipulation.cs index aa8b9d4a..b2987789 100644 --- a/SabreHelper/RomManipulation.cs +++ b/SabreHelper/RomManipulation.cs @@ -388,7 +388,8 @@ namespace SabreTools.Helper break; case "header": xtr.ReadToDescendant("name"); - superdat = (xtr.ReadElementContentAsString() != null ? xtr.ReadElementContentAsString().Contains(" - SuperDAT") : false); + string content = xtr.ReadElementContentAsString(); + superdat = (content != null ? content.Contains(" - SuperDAT") : false); while (xtr.Name != "header") { xtr.Read(); @@ -454,6 +455,26 @@ namespace SabreTools.Helper // If we're in merged mode, check before adding if (merge) { + /* + string query = @"INSERT OR UPDATE INTO roms +(game, name, type, sysid, srcid, size, crc, md5, sha1, dupe) +VALUES ('" + tempname.Replace("'", "''") + "', '" + + xtr.GetAttribute("name").Replace("'", "''") + "', '" + + xtr.Name + "', " + + sysid + ", " + + srcid + ", " + + size + + (xtr.GetAttribute("crc") != null ? ", '" + xtr.GetAttribute("crc").ToLowerInvariant().Trim() + "'" : ", ''") + + (xtr.GetAttribute("md5") != null ? ", '" + xtr.GetAttribute("md5").ToLowerInvariant().Trim() + "'" : ", ''") + + (xtr.GetAttribute("sha1") != null ? ", '" + xtr.GetAttribute("sha1").ToLowerInvariant().Trim() + "'" : ", ''") + + ", '" + filename + "'" + + ")"; + using (SqliteCommand slc = new SqliteCommand(query, dbc)) + { + slc.ExecuteNonQuery(); + } + */ + // If the rom doesn't exist, add it to the database string query = @"SELECT id FROM roms WHERE size=" + size + (xtr.GetAttribute("crc") != null ? " AND (crc='" + xtr.GetAttribute("crc").ToLowerInvariant().Trim() + "' OR crc='')" : "") +