Add additional logic for numbered DATs

This commit is contained in:
Matt Nadareski
2016-04-04 16:20:08 -07:00
parent 74924a083e
commit 13813c32d7

View File

@@ -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";
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))