Add preliminary support for NonGood

This commit is contained in:
Matt Nadareski
2016-04-06 15:45:33 -07:00
parent 503b302828
commit 911ad165f6
4 changed files with 67 additions and 1 deletions

View File

@@ -24,6 +24,7 @@ namespace SabreTools
private static string _noIntroPattern = @"^(.*?) \((\d{8}-\d{6})_CM\)\.dat$";
private static string _noIntroNumberedPattern = @"(.*? - .*?) \(\d.*?_CM\).dat";
private static string _noIntroSpecialPattern = @"(.*? - .*?) \((\d{8})\)\.dat";
private static string _nonGoodPattern = @"(NonGood.*?)( .*)?.dat";
private static string _redumpPattern = @"^(.*?) \((\d{8} \d{2}-\d{2}-\d{2})\)\.dat$";
private static string _redumpBiosPattern = @"^(.*?) \(\d+\) \((\d{4}-\d{2}-\d{2})\)\.dat$";
private static string _tosecPattern = @"^(.*?) - .* \(TOSEC-v(\d{4}-\d{2}-\d{2})_CM\)\.dat$";
@@ -53,6 +54,7 @@ namespace SabreTools
Redump,
TOSEC,
TruRip,
NonGood,
}
// Public instance variables
@@ -115,6 +117,11 @@ namespace SabreTools
fileinfo = Regex.Match(filename, _noIntroSpecialPattern).Groups;
type = DatType.NoIntro;
}
else if (Regex.IsMatch(filename, _nonGoodPattern))
{
fileinfo = Regex.Match(filename, _nonGoodPattern).Groups;
type = DatType.NonGood;
}
else if (Regex.IsMatch(filename, _redumpPattern))
{
fileinfo = Regex.Match(filename, _redumpPattern).Groups;
@@ -201,6 +208,19 @@ namespace SabreTools
date = niDateInfo[1].Value + "-" + niDateInfo[2].Value + "-" + niDateInfo[3].Value + " 00:00:00";
}
break;
case DatType.NonGood:
if (!Remapping.NonGood.ContainsKey(fileinfo[1].Value))
{
_logger.Error("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again");
return false;
}
GroupCollection nonGoodInfo = Regex.Match(Remapping.NonGood[fileinfo[1].Value], _remappedPattern).Groups;
manufacturer = nonGoodInfo[1].Value;
system = nonGoodInfo[2].Value;
source = "NonGood";
date = File.GetLastWriteTime(_filepath).ToString("yyyy-MM-dd HH:mm:ss");
break;
case DatType.Redump:
if (!Remapping.Redump.ContainsKey(fileinfo[1].Value))
{