Add maybe-intro mappings

This commit is contained in:
Matt Nadareski
2016-04-07 12:37:23 -07:00
parent 42d6c7bf04
commit c19b5ba1b2
4 changed files with 66 additions and 1 deletions

View File

@@ -84,6 +84,9 @@
<Content Include="Mappings\MAME.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Mappings\MaybeIntro.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>
<Content Include="Mappings\NoIntro.xml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</Content>

View File

@@ -21,6 +21,7 @@ namespace SabreTools
// Regex File Name Patterns
private static string _defaultPattern = @"^(.+?) - (.+?) \((.*) (.*)\)\.dat$";
private static string _mamePattern = @"^(.*)\.xml$";
private static string _maybeIntroPattern = @"(.*?) \[T-En\].*\((\d{8})\)\.dat$";
private static string _noIntroPattern = @"^(.*?) \((\d{8}-\d{6})_CM\)\.dat$";
private static string _noIntroNumberedPattern = @"(.*? - .*?) \(\d.*?_CM\).dat";
private static string _noIntroSpecialPattern = @"(.*? - .*?) \((\d{8})\)\.dat";
@@ -56,6 +57,7 @@ namespace SabreTools
TOSEC,
TruRip,
NonGood,
MaybeIntro,
}
// Public instance variables
@@ -101,6 +103,11 @@ namespace SabreTools
fileinfo = Regex.Match(filename, _mamePattern).Groups;
type = DatType.MAME;
}
else if (Regex.IsMatch(filename, _maybeIntroPattern))
{
fileinfo = Regex.Match(filename, _maybeIntroPattern).Groups;
type = DatType.MaybeIntro;
}
else if (Regex.IsMatch(filename, _noIntroPattern))
{
fileinfo = Regex.Match(filename, _noIntroPattern).Groups;
@@ -186,6 +193,21 @@ namespace SabreTools
source = "MAME";
date = File.GetLastWriteTime(_filepath).ToString("yyyy-MM-dd HH:mm:ss");
break;
case DatType.MaybeIntro:
if (!Remapping.MaybeIntro.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 maybeIntroInfo = Regex.Match(Remapping.MaybeIntro[fileinfo[1].Value], _remappedPattern).Groups;
manufacturer = maybeIntroInfo[1].Value;
system = maybeIntroInfo[2].Value;
source = "Maybe-Intro";
datestring = fileinfo[2].Value;
GroupCollection miDateInfo = Regex.Match(datestring, _noIntroSpecialDatePattern).Groups;
date = miDateInfo[1].Value + "-" + miDateInfo[2].Value + "-" + miDateInfo[3].Value + " 00:00:00";
break;
case DatType.NoIntro:
if (!Remapping.NoIntro.ContainsKey(fileinfo[1].Value))
{

View File

@@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8" ?>
<mappings>
<mapping from="Bandai WonderSwan Color" to="Bandai - WonderSwan Color" />
<mapping from="Fujitsu FM Towns" to="Fujitsu - FM Towns" />
<mapping from="MSX (Cartridges)" to="Microsoft - MSX, MSX 2" />
<mapping from="MSX (Disks)" to="Microsoft - MSX, MSX 2" />
<mapping from="MSX 2 (Cartridges)" to="Microsoft - MSX, MSX 2" />
<mapping from="MSX 2 (Disks)" to="Microsoft - MSX, MSX 2" />
<mapping from="MSX Turbo-R (Disks)" to="Microsoft - MSX, MSX 2" />
<mapping from="NEC PC Engine CD" to="NEC - PC Engine CD, TurboGrafx 16 CD" />
<mapping from="NEC PC Engine" to="NEC - PC Engine, TurboGrafx 16" />
<mapping from="NEC PC-6001" to="NEC - PC-6001" />
<mapping from="NEC PC-8801" to="NEC - PC-8801" />
<mapping from="NEC PC-9801" to="NEC - PC-9801" />
<mapping from="Nintendo 64" to="Nintendo - Nintendo 64" />
<mapping from="Nintendo DS" to="Nintendo - Nintendo DS" />
<mapping from="Nintendo Famicom Disk System" to="Nintendo - Famicom Disk System" />
<mapping from="Nintendo Famicom" to="Nintendo - Nintendo Entertainment System" />
<mapping from="Nintendo Game Boy Advance" to="Nintendo - Game Boy Advance" />
<mapping from="Nintendo Game Boy Color" to="Nintendo - Game Boy Color" />
<mapping from="Nintendo Game Boy" to="Nintendo - Game Boy" />
<mapping from="Nintendo Super Famicom" to="Nintendo - Super Nintendo Entertainment System" />
<mapping from="Nintendo Virtual Boy" to="Nintendo - Virtual Boy" />
<mapping from="Sega Dreamcast" to="Sega - Dreamcast" />
<mapping from="Sega Game Gear" to="Sega - Game Gear" />
<mapping from="Sega Master System" to="Sega - Master System, Mark III" />
<mapping from="Sega Mega Drive" to="Sega - Mega Drive, Genesis" />
<mapping from="Sega Mega-CD" to="Sega - Mega-CD, Sega CD" />
<mapping from="Sega Saturn" to="Sega - Saturn" />
<mapping from="Sega SG-1000" to="Sega - SG-1000, SC-3000, SF-7000, Othello Multivision" />
<mapping from="Sharp X68000" to="Sharp - X68000" />
<mapping from="SNK Neo Geo Pocket Color" to="SNK - Neo Geo Pocket Color" />
<mapping from="Sony PlayStation 2" to="Sony - PlayStation 2" />
<mapping from="Sony PlayStation" to="Sony - PlayStation" />
</mappings>

View File

@@ -12,6 +12,7 @@ namespace SabreTools.Helper
{
// Remapping classes represented by dictionaries
public static Dictionary<string, string> MAME = new Dictionary<string, string>();
public static Dictionary<string, string> MaybeIntro = new Dictionary<string, string>();
public static Dictionary<string, string> NoIntro = new Dictionary<string, string>();
public static Dictionary<string, string> NonGood = new Dictionary<string, string>();
public static Dictionary<string, string> Redump = new Dictionary<string, string>();
@@ -26,7 +27,7 @@ namespace SabreTools.Helper
// Create array of dictionary names
string[] remappings =
{
"MAME", "NoIntro", "NonGood", "Redump", "TOSEC", "TruRip",
"MAME", "MaybeIntro", "NoIntro", "NonGood", "Redump", "TOSEC", "TruRip",
};
// Loop through and add all remappings
@@ -76,6 +77,9 @@ namespace SabreTools.Helper
case "MAME":
MAME.Add(node.Attributes["from"].Value, node.Attributes["to"].Value);
break;
case "MaybeIntro":
MaybeIntro.Add(node.Attributes["from"].Value, node.Attributes["to"].Value);
break;
case "NoIntro":
NoIntro.Add(node.Attributes["from"].Value, node.Attributes["to"].Value);
break;