Remove unnecessary switch

This commit is contained in:
Matt Nadareski
2016-04-27 11:54:27 -07:00
parent 40b7d64303
commit 0d22715fa4

View File

@@ -455,11 +455,10 @@ namespace SabreTools.Helper
if (merge) if (merge)
{ {
// If the rom doesn't exist, add it to the database // If the rom doesn't exist, add it to the database
string query = @"SELECT sha1 FROM roms WHERE size=" + size + string query = @"SELECT id FROM roms WHERE size=" + size +
(xtr.GetAttribute("crc") != null ? " AND crc='" + xtr.GetAttribute("crc").ToLowerInvariant().Trim() + "'" : "") + (xtr.GetAttribute("crc") != null ? " AND (crc='" + xtr.GetAttribute("crc").ToLowerInvariant().Trim() + "' OR crc='')" : "") +
(xtr.GetAttribute("md5") != null ? " AND md5='" + xtr.GetAttribute("md5").ToLowerInvariant().Trim() + "'" : "") + (xtr.GetAttribute("md5") != null ? " AND (md5='" + xtr.GetAttribute("md5").ToLowerInvariant().Trim() + "' OR md5='')" : "") +
(xtr.GetAttribute("sha1") != null ? " AND sha1='" + xtr.GetAttribute("sha1").ToLowerInvariant().Trim() + "'" : "") + (xtr.GetAttribute("sha1") != null ? " AND (sha1='" + xtr.GetAttribute("sha1").ToLowerInvariant().Trim() + "' OR sha1='')" : "");
(merge ? "" : " AND game='" + tempname.Replace("'", "''") + "' AND name='" + xtr.GetAttribute("name").Replace("'", "''") + "' AND sysid=" + sysid + " AND srcid=" + srcid);
using (SqliteCommand slc = new SqliteCommand(query, dbc)) using (SqliteCommand slc = new SqliteCommand(query, dbc))
{ {
@@ -491,8 +490,7 @@ VALUES ('" + tempname.Replace("'", "''") + "', '" +
query = @"UPDATE roms SET dupe='true' WHERE size=" + size + query = @"UPDATE roms SET dupe='true' WHERE size=" + size +
(xtr.GetAttribute("crc") != null ? " AND crc='" + xtr.GetAttribute("crc").ToLowerInvariant().Trim() + "'" : "") + (xtr.GetAttribute("crc") != null ? " AND crc='" + xtr.GetAttribute("crc").ToLowerInvariant().Trim() + "'" : "") +
(xtr.GetAttribute("md5") != null ? " AND md5='" + xtr.GetAttribute("md5").ToLowerInvariant().Trim() + "'" : "") + (xtr.GetAttribute("md5") != null ? " AND md5='" + xtr.GetAttribute("md5").ToLowerInvariant().Trim() + "'" : "") +
(xtr.GetAttribute("sha1") != null ? " AND sha1='" + xtr.GetAttribute("sha1").ToLowerInvariant().Trim() + "'" : "") + (xtr.GetAttribute("sha1") != null ? " AND sha1='" + xtr.GetAttribute("sha1").ToLowerInvariant().Trim() + "'" : "");
(merge ? "" : " AND game='" + tempname.Replace("'", "''") + "' AND name='" + xtr.GetAttribute("name").Replace("'", "''") + "' AND sysid=" + sysid + " AND srcid=" + srcid);
using (SqliteCommand sslc = new SqliteCommand(query, dbc)) using (SqliteCommand sslc = new SqliteCommand(query, dbc))
{ {