From 90ea3ba25d85e010ffeae4080929c66a1bc23aaf Mon Sep 17 00:00:00 2001 From: Matt Nadareski Date: Fri, 18 Mar 2016 17:37:07 -0700 Subject: [PATCH] Found out (and fixed) that if a value isn't added with an explicit value, it's automatically NULL for SQLite. This was now fixed as seen in the MAME SL case. --- DATabase/Importer.cs | 66 ++++++++++++++++++++++++++++++-------------- 1 file changed, 45 insertions(+), 21 deletions(-) diff --git a/DATabase/Importer.cs b/DATabase/Importer.cs index 1392f8cb..a63a57d1 100644 --- a/DATabase/Importer.cs +++ b/DATabase/Importer.cs @@ -119,6 +119,11 @@ namespace DATabase switch (type) { case DatType.mame: + if (!Remapping.MAME.ContainsKey(fileinfo[1].Value)) + { + Console.WriteLine("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again"); + return false; + } GroupCollection mameInfo = Regex.Match(Remapping.MAME[fileinfo[1].Value], _remappedPattern).Groups; manufacturer = mameInfo[1].Value; @@ -127,6 +132,11 @@ namespace DATabase date = File.GetLastWriteTime(_filepath).ToString("Y-m-d G:i:s"); break; case DatType.nointro: + if (!Remapping.NoIntro.ContainsKey(fileinfo[1].Value)) + { + Console.WriteLine("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again"); + return false; + } GroupCollection nointroInfo = Regex.Match(Remapping.NoIntro[fileinfo[1].Value], _remappedPattern).Groups; manufacturer = nointroInfo[1].Value; @@ -138,6 +148,11 @@ namespace DATabase niDateInfo[4].Value + ":" + niDateInfo[5].Value + ":" + niDateInfo[6].Value; break; case DatType.redump: + if (!Remapping.Redump.ContainsKey(fileinfo[1].Value)) + { + Console.WriteLine("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again"); + return false; + } GroupCollection redumpInfo = Regex.Match(Remapping.Redump[fileinfo[1].Value], _remappedPattern).Groups; manufacturer = redumpInfo[1].Value; @@ -149,6 +164,11 @@ namespace DATabase rdDateInfo[4].Value + ":" + rdDateInfo[5].Value + ":" + rdDateInfo[6].Value; break; case DatType.tosec: + if (!Remapping.TOSEC.ContainsKey(fileinfo[1].Value)) + { + Console.WriteLine("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again"); + return false; + } GroupCollection tosecInfo = Regex.Match(Remapping.TOSEC[fileinfo[1].Value], _remappedPattern).Groups; manufacturer = tosecInfo[1].Value; @@ -159,6 +179,11 @@ namespace DATabase date = toDateInfo[1].Value + "-" + toDateInfo[2].Value + "-" + toDateInfo[3].Value + " 00:00:00"; break; case DatType.trurip: + if (!Remapping.TruRip.ContainsKey(fileinfo[1].Value)) + { + Console.WriteLine("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again"); + return false; + } GroupCollection truripInfo = Regex.Match(Remapping.TruRip[fileinfo[1].Value], _remappedPattern).Groups; manufacturer = truripInfo[1].Value; @@ -308,12 +333,14 @@ namespace DATabase // Process SoftwareList XML-derived DATs else if (format == "softwarelist" && !comment) { - if (line.IndexOf("" : "")); - machinename = xml.Attribute("name").Value; + } + else if (line.IndexOf("