diff --git a/DATabase/Core/Import.cs b/DATabase/Core/Import.cs index 7769ef8e..73a508ae 100644 --- a/DATabase/Core/Import.cs +++ b/DATabase/Core/Import.cs @@ -1,4 +1,5 @@ using System; +using System.Collections.Generic; using System.Data.SQLite; using System.IO; using System.Text.RegularExpressions; @@ -47,7 +48,8 @@ namespace SabreTools private static string _defaultPattern = @"^(.+?) - (.+?) \((.*) (.*)\)\.dat$"; private static string _mamePattern = @"^(.*)\.xml$"; private static string _nointroPattern = @"^(.*?) \((\d{8}-\d{6})_CM\)\.dat$"; - private static string _noIntroSpecialPattern = @"(.*? - .*?) \((\d{8}\)\.dat"; + private static string _noIntroNumberedPattern = @"(.*? - .*?) \(.*?_CM\).dat"; + private static string _noIntroSpecialPattern = @"(.*? - .*?) \(((\d{8})\)\.dat"; private static string _redumpPattern = @"^(.*?) \((\d{8} \d{2}-\d{2}-\d{2})\)\.dat$"; private static string _tosecPattern = @"^(.*?) - .* \(TOSEC-v(\d{4}-\d{2}-\d{2})_CM\)\.dat$"; private static string _tosecSpecialPattern = @"^(.*? - .*? - .*?) - .* \(TOSEC-v(\d{4}-\d{2}-\d{2})_CM\)\.dat$"; @@ -124,6 +126,12 @@ namespace SabreTools fileinfo = Regex.Match(filename, _nointroPattern).Groups; type = DatType.NoIntro; } + // For numbered DATs only + else if (Regex.IsMatch(filename, _noIntroNumberedPattern)) + { + fileinfo = Regex.Match(filename, _noIntroNumberedPattern).Groups; + type = DatType.NoIntro; + } // For N-Gage and Gizmondo only else if (Regex.IsMatch(filename, _noIntroSpecialPattern)) { @@ -190,10 +198,17 @@ namespace SabreTools manufacturer = nointroInfo[1].Value; system = nointroInfo[2].Value; source = "no-Intro"; - datestring = fileinfo[2].Value; - GroupCollection niDateInfo = Regex.Match(datestring, _nointroDatePattern).Groups; - date = niDateInfo[1].Value + "-" + niDateInfo[2].Value + "-" + niDateInfo[3].Value + " " + - niDateInfo[4].Value + ":" + niDateInfo[5].Value + ":" + niDateInfo[6].Value; + if (fileinfo.Count < 2) + { + date = File.GetLastWriteTime(_filepath).ToString("yyyy-MM-dd HH:mm:ss"); + } + else + { + datestring = fileinfo[2].Value; + GroupCollection niDateInfo = Regex.Match(datestring, _nointroDatePattern).Groups; + date = niDateInfo[1].Value + "-" + niDateInfo[2].Value + "-" + niDateInfo[3].Value + " " + + niDateInfo[4].Value + ":" + niDateInfo[5].Value + ":" + niDateInfo[6].Value; + } break; case DatType.Redump: if (!Remapping.Redump.ContainsKey(fileinfo[1].Value))