[Remapping] Clean up how remappings are handled

This commit is contained in:
Matt Nadareski
2016-06-13 20:17:30 -07:00
parent 5e6e7c6dbd
commit 65f8ed089a
4 changed files with 50 additions and 143 deletions

View File

@@ -148,37 +148,15 @@ namespace SabreTools
foreach (HeaderType test in Enum.GetValues(typeof(HeaderType))) foreach (HeaderType test in Enum.GetValues(typeof(HeaderType)))
{ {
Dictionary<string, int> tempDict = new Dictionary<string, int>(); Dictionary<string, int> tempDict = new Dictionary<string, int>();
switch (test)
// Try populating the dictionary from the master list
try
{ {
case HeaderType.A7800: tempDict = Remapping.HeaderMaps[test.ToString()];
tempDict = Remapping.A7800; }
break; catch
case HeaderType.FDS: {
tempDict = Remapping.FDS; logger.Warning("The mapping for '" + test.ToString() + "' cannot be found!");
break;
case HeaderType.Lynx:
tempDict = Remapping.Lynx;
break;
case HeaderType.PCE:
tempDict = Remapping.PCE;
break;
/*
case HeaderType.N64:
tempDict = Remapping.N64;
break;
*/
case HeaderType.NES:
tempDict = Remapping.NES;
break;
case HeaderType.PSID:
tempDict = Remapping.PSID;
break;
case HeaderType.SNES:
tempDict = Remapping.SNES;
break;
case HeaderType.SPC:
tempDict = Remapping.SPC;
break;
} }
// Loop over the dictionary and see if there are matches // Loop over the dictionary and see if there are matches

View File

@@ -10,27 +10,11 @@ namespace SabreTools.Helper
/// </summary> /// </summary>
public class Remapping public class Remapping
{ {
// Remapping classes represented by dictionaries (from, to) // Remapping classes represented by a dictionary of dictionaries (name, (from, to))
public static Dictionary<string, string> Good = new Dictionary<string, string>(); public static Dictionary<string, Dictionary<string, string>> DatMaps = new Dictionary<string, Dictionary<string, string>>();
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>();
public static Dictionary<string, string> TOSEC = new Dictionary<string, string>();
public static Dictionary<string, string> TruRip = new Dictionary<string, string>();
// Header skip classes represented by dictionaries (header, size)
public static Dictionary<string, int> A7800 = new Dictionary<string, int>();
public static Dictionary<string, int> FDS = new Dictionary<string, int>();
public static Dictionary<string, int> Lynx = new Dictionary<string, int>();
//public static Dictionary<string, int> N64 = new Dictionary<string, int>();
public static Dictionary<string, int> NES = new Dictionary<string, int>();
public static Dictionary<string, int> PCE = new Dictionary<string, int>();
public static Dictionary<string, int> PSID = new Dictionary<string, int>();
public static Dictionary<string, int> SNES = new Dictionary<string, int>();
public static Dictionary<string, int> SPC = new Dictionary<string, int>();
// Header skip classes represented by a dictionary of dictionaries (name, (header, size))
public static Dictionary<string, Dictionary<string, int>> HeaderMaps = new Dictionary<string, Dictionary<string, int>>();
/// <summary> /// <summary>
/// Create all remappings to be used by the program /// Create all remappings to be used by the program
@@ -46,6 +30,7 @@ namespace SabreTools.Helper
// Loop through and add all remappings // Loop through and add all remappings
foreach (string remapping in remappings) foreach (string remapping in remappings)
{ {
DatMaps.Add(remapping, new Dictionary<string, string>());
RemappingHelper(remapping); RemappingHelper(remapping);
} }
} }
@@ -91,33 +76,7 @@ namespace SabreTools.Helper
// Now read in the mappings // Now read in the mappings
while (node != null && node.Name == "mapping") while (node != null && node.Name == "mapping")
{ {
switch (mapping) DatMaps[mapping].Add(node.Attributes["from"].Value, node.Attributes["to"].Value);
{
case "Good":
Good.Add(node.Attributes["from"].Value, node.Attributes["to"].Value);
break;
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;
case "NonGood":
NonGood.Add(node.Attributes["from"].Value, node.Attributes["to"].Value);
break;
case "Redump":
Redump.Add(node.Attributes["from"].Value, node.Attributes["to"].Value);
break;
case "TOSEC":
TOSEC.Add(node.Attributes["from"].Value, node.Attributes["to"].Value);
break;
case "TruRip":
TruRip.Add(node.Attributes["from"].Value, node.Attributes["to"].Value);
break;
}
// Get the next node and skip over anything that's not an element // Get the next node and skip over anything that's not an element
node = node.NextSibling; node = node.NextSibling;
@@ -148,6 +107,7 @@ namespace SabreTools.Helper
// Loop through and add all remappings // Loop through and add all remappings
foreach (string skipper in skippers) foreach (string skipper in skippers)
{ {
HeaderMaps.Add(skipper, new Dictionary<string, int>());
SkipperHelper(skipper); SkipperHelper(skipper);
} }
} }
@@ -196,38 +156,7 @@ namespace SabreTools.Helper
header += child.Attributes["value"].Value; header += child.Attributes["value"].Value;
// Now add the header and value to the appropriate skipper dictionary // Now add the header and value to the appropriate skipper dictionary
switch (skipper) HeaderMaps[skipper].Add(header, size);
{
case "a7800":
A7800.Add(header, size);
break;
case "fds":
FDS.Add(header, size);
break;
case "lynx":
Lynx.Add(header, size);
break;
/*
case "n64":
N64.Add(header, size);
break;
*/
case "nes":
NES.Add(header, size);
break;
case "pce":
PCE.Add(header, size);
break;
case "psid":
PSID.Add(header, size);
break;
case "snes":
SNES.Add(header, size);
break;
case "spc":
SPC.Add(header, size);
break;
}
} }
} }

View File

@@ -151,12 +151,12 @@ namespace SabreTools
switch (type) switch (type)
{ {
case DatType.Good: case DatType.Good:
if (!Remapping.Good.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["Good"].ContainsKey(fileinfo[1].Value))
{ {
_logger.Warning("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again"); _logger.Warning("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again");
return false; return false;
} }
GroupCollection goodInfo = Regex.Match(Remapping.Good[fileinfo[1].Value], Constants.RemappedPattern).Groups; GroupCollection goodInfo = Regex.Match(Remapping.DatMaps["Good"][fileinfo[1].Value], Constants.RemappedPattern).Groups;
manufacturer = goodInfo[1].Value; manufacturer = goodInfo[1].Value;
system = goodInfo[2].Value; system = goodInfo[2].Value;
@@ -164,12 +164,12 @@ namespace SabreTools
date = File.GetLastWriteTime(_filepath).ToString("yyyy-MM-dd HH:mm:ss"); date = File.GetLastWriteTime(_filepath).ToString("yyyy-MM-dd HH:mm:ss");
break; break;
case DatType.MAME: case DatType.MAME:
if (!Remapping.MAME.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["MAME"].ContainsKey(fileinfo[1].Value))
{ {
_logger.Warning("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again"); _logger.Warning("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again");
return false; return false;
} }
GroupCollection mameInfo = Regex.Match(Remapping.MAME[fileinfo[1].Value], Constants.RemappedPattern).Groups; GroupCollection mameInfo = Regex.Match(Remapping.DatMaps["MAME"][fileinfo[1].Value], Constants.RemappedPattern).Groups;
manufacturer = mameInfo[1].Value; manufacturer = mameInfo[1].Value;
system = mameInfo[2].Value; system = mameInfo[2].Value;
@@ -177,12 +177,12 @@ namespace SabreTools
date = File.GetLastWriteTime(_filepath).ToString("yyyy-MM-dd HH:mm:ss"); date = File.GetLastWriteTime(_filepath).ToString("yyyy-MM-dd HH:mm:ss");
break; break;
case DatType.MaybeIntro: case DatType.MaybeIntro:
if (!Remapping.MaybeIntro.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["MaybeIntro"].ContainsKey(fileinfo[1].Value))
{ {
_logger.Warning("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again"); _logger.Warning("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again");
return false; return false;
} }
GroupCollection maybeIntroInfo = Regex.Match(Remapping.MaybeIntro[fileinfo[1].Value], Constants.RemappedPattern).Groups; GroupCollection maybeIntroInfo = Regex.Match(Remapping.DatMaps["MaybeIntro"][fileinfo[1].Value], Constants.RemappedPattern).Groups;
manufacturer = maybeIntroInfo[1].Value; manufacturer = maybeIntroInfo[1].Value;
system = maybeIntroInfo[2].Value; system = maybeIntroInfo[2].Value;
@@ -192,12 +192,12 @@ namespace SabreTools
date = miDateInfo[1].Value + "-" + miDateInfo[2].Value + "-" + miDateInfo[3].Value + " 00:00:00"; date = miDateInfo[1].Value + "-" + miDateInfo[2].Value + "-" + miDateInfo[3].Value + " 00:00:00";
break; break;
case DatType.NoIntro: case DatType.NoIntro:
if (!Remapping.NoIntro.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["NoIntro"].ContainsKey(fileinfo[1].Value))
{ {
_logger.Warning("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again"); _logger.Warning("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again");
return false; return false;
} }
GroupCollection nointroInfo = Regex.Match(Remapping.NoIntro[fileinfo[1].Value], Constants.RemappedPattern).Groups; GroupCollection nointroInfo = Regex.Match(Remapping.DatMaps["NoIntro"][fileinfo[1].Value], Constants.RemappedPattern).Groups;
manufacturer = nointroInfo[1].Value; manufacturer = nointroInfo[1].Value;
system = nointroInfo[2].Value; system = nointroInfo[2].Value;
@@ -221,12 +221,12 @@ namespace SabreTools
} }
break; break;
case DatType.NonGood: case DatType.NonGood:
if (!Remapping.NonGood.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["NonGood"].ContainsKey(fileinfo[1].Value))
{ {
_logger.Warning("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again"); _logger.Warning("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again");
return false; return false;
} }
GroupCollection nonGoodInfo = Regex.Match(Remapping.NonGood[fileinfo[1].Value], Constants.RemappedPattern).Groups; GroupCollection nonGoodInfo = Regex.Match(Remapping.DatMaps["NonGood"][fileinfo[1].Value], Constants.RemappedPattern).Groups;
manufacturer = nonGoodInfo[1].Value; manufacturer = nonGoodInfo[1].Value;
system = nonGoodInfo[2].Value; system = nonGoodInfo[2].Value;
@@ -234,18 +234,18 @@ namespace SabreTools
date = File.GetLastWriteTime(_filepath).ToString("yyyy-MM-dd HH:mm:ss"); date = File.GetLastWriteTime(_filepath).ToString("yyyy-MM-dd HH:mm:ss");
break; break;
case DatType.Redump: case DatType.Redump:
if (!Remapping.Redump.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["Redump"].ContainsKey(fileinfo[1].Value))
{ {
// Handle special case mappings found only in Redump // Handle special case mappings found only in Redump
fileinfo = Regex.Match(filename, Constants.RedumpBiosPattern).Groups; fileinfo = Regex.Match(filename, Constants.RedumpBiosPattern).Groups;
if (!Remapping.Redump.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["Redump"].ContainsKey(fileinfo[1].Value))
{ {
_logger.Warning("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again"); _logger.Warning("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again");
return false; return false;
} }
} }
GroupCollection redumpInfo = Regex.Match(Remapping.Redump[fileinfo[1].Value], Constants.RemappedPattern).Groups; GroupCollection redumpInfo = Regex.Match(Remapping.DatMaps["Redump"][fileinfo[1].Value], Constants.RemappedPattern).Groups;
manufacturer = redumpInfo[1].Value; manufacturer = redumpInfo[1].Value;
system = redumpInfo[2].Value; system = redumpInfo[2].Value;
@@ -265,23 +265,23 @@ namespace SabreTools
break; break;
case DatType.TOSEC: case DatType.TOSEC:
if (!Remapping.TOSEC.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["TOSEC"].ContainsKey(fileinfo[1].Value))
{ {
// Handle special case mappings found only in TOSEC // Handle special case mappings found only in TOSEC
fileinfo = Regex.Match(filename, Constants.TosecSpecialPatternA).Groups; fileinfo = Regex.Match(filename, Constants.TosecSpecialPatternA).Groups;
if (!Remapping.TOSEC.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["TOSEC"].ContainsKey(fileinfo[1].Value))
{ {
fileinfo = Regex.Match(filename, Constants.TosecSpecialPatternB).Groups; fileinfo = Regex.Match(filename, Constants.TosecSpecialPatternB).Groups;
if (!Remapping.TOSEC.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["TOSEC"].ContainsKey(fileinfo[1].Value))
{ {
_logger.Warning("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again"); _logger.Warning("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again");
return false; return false;
} }
} }
} }
GroupCollection tosecInfo = Regex.Match(Remapping.TOSEC[fileinfo[1].Value], Constants.RemappedPattern).Groups; GroupCollection tosecInfo = Regex.Match(Remapping.DatMaps["TOSEC"][fileinfo[1].Value], Constants.RemappedPattern).Groups;
manufacturer = tosecInfo[1].Value; manufacturer = tosecInfo[1].Value;
system = tosecInfo[2].Value; system = tosecInfo[2].Value;
@@ -291,12 +291,12 @@ namespace SabreTools
date = toDateInfo[1].Value + "-" + toDateInfo[2].Value + "-" + toDateInfo[3].Value + " 00:00:00"; date = toDateInfo[1].Value + "-" + toDateInfo[2].Value + "-" + toDateInfo[3].Value + " 00:00:00";
break; break;
case DatType.TruRip: case DatType.TruRip:
if (!Remapping.TruRip.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["TruRip"].ContainsKey(fileinfo[1].Value))
{ {
_logger.Warning("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again"); _logger.Warning("The filename " + fileinfo[1].Value + " could not be mapped! Please check the mappings and try again");
return false; return false;
} }
GroupCollection truripInfo = Regex.Match(Remapping.TruRip[fileinfo[1].Value], Constants.RemappedPattern).Groups; GroupCollection truripInfo = Regex.Match(Remapping.DatMaps["TruRip"][fileinfo[1].Value], Constants.RemappedPattern).Groups;
manufacturer = truripInfo[1].Value; manufacturer = truripInfo[1].Value;
system = truripInfo[2].Value; system = truripInfo[2].Value;

View File

@@ -294,7 +294,7 @@ COMMIT;";
if (Regex.IsMatch(filename, Constants.NonGoodPattern)) if (Regex.IsMatch(filename, Constants.NonGoodPattern))
{ {
fileinfo = Regex.Match(filename, Constants.NonGoodPattern).Groups; fileinfo = Regex.Match(filename, Constants.NonGoodPattern).Groups;
if (!Remapping.NonGood.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["NonGood"].ContainsKey(fileinfo[1].Value))
{ {
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as NonGood but could not be mapped."); _logger.Warning("The filename " + fileinfo[1].Value + " was matched as NonGood but could not be mapped.");
return source; return source;
@@ -304,7 +304,7 @@ COMMIT;";
else if (Regex.IsMatch(filename, Constants.NonGoodSpecialPattern)) else if (Regex.IsMatch(filename, Constants.NonGoodSpecialPattern))
{ {
fileinfo = Regex.Match(filename, Constants.NonGoodSpecialPattern).Groups; fileinfo = Regex.Match(filename, Constants.NonGoodSpecialPattern).Groups;
if (!Remapping.NonGood.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["NonGood"].ContainsKey(fileinfo[1].Value))
{ {
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as NonGood but could not be mapped."); _logger.Warning("The filename " + fileinfo[1].Value + " was matched as NonGood but could not be mapped.");
return source; return source;
@@ -314,7 +314,7 @@ COMMIT;";
else if (Regex.IsMatch(filename, Constants.GoodPattern)) else if (Regex.IsMatch(filename, Constants.GoodPattern))
{ {
fileinfo = Regex.Match(filename, Constants.GoodPattern).Groups; fileinfo = Regex.Match(filename, Constants.GoodPattern).Groups;
if (!Remapping.Good.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["Good"].ContainsKey(fileinfo[1].Value))
{ {
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as Good but could not be mapped."); _logger.Warning("The filename " + fileinfo[1].Value + " was matched as Good but could not be mapped.");
return source; return source;
@@ -324,7 +324,7 @@ COMMIT;";
else if (Regex.IsMatch(filename, Constants.GoodXmlPattern)) else if (Regex.IsMatch(filename, Constants.GoodXmlPattern))
{ {
fileinfo = Regex.Match(filename, Constants.GoodXmlPattern).Groups; fileinfo = Regex.Match(filename, Constants.GoodXmlPattern).Groups;
if (!Remapping.Good.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["Good"].ContainsKey(fileinfo[1].Value))
{ {
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as Good but could not be mapped."); _logger.Warning("The filename " + fileinfo[1].Value + " was matched as Good but could not be mapped.");
return source; return source;
@@ -334,7 +334,7 @@ COMMIT;";
else if (Regex.IsMatch(filename, Constants.MaybeIntroPattern)) else if (Regex.IsMatch(filename, Constants.MaybeIntroPattern))
{ {
fileinfo = Regex.Match(filename, Constants.MaybeIntroPattern).Groups; fileinfo = Regex.Match(filename, Constants.MaybeIntroPattern).Groups;
if (!Remapping.MaybeIntro.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["MaybeIntro"].ContainsKey(fileinfo[1].Value))
{ {
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as Maybe-Intro but could not be mapped."); _logger.Warning("The filename " + fileinfo[1].Value + " was matched as Maybe-Intro but could not be mapped.");
return source; return source;
@@ -344,7 +344,7 @@ COMMIT;";
else if (Regex.IsMatch(filename, Constants.NoIntroPattern)) else if (Regex.IsMatch(filename, Constants.NoIntroPattern))
{ {
fileinfo = Regex.Match(filename, Constants.NoIntroPattern).Groups; fileinfo = Regex.Match(filename, Constants.NoIntroPattern).Groups;
if (!Remapping.NoIntro.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["NoIntro"].ContainsKey(fileinfo[1].Value))
{ {
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as No-Intro but could not be mapped."); _logger.Warning("The filename " + fileinfo[1].Value + " was matched as No-Intro but could not be mapped.");
return source; return source;
@@ -355,7 +355,7 @@ COMMIT;";
else if (Regex.IsMatch(filename, Constants.NoIntroNumberedPattern)) else if (Regex.IsMatch(filename, Constants.NoIntroNumberedPattern))
{ {
fileinfo = Regex.Match(filename, Constants.NoIntroNumberedPattern).Groups; fileinfo = Regex.Match(filename, Constants.NoIntroNumberedPattern).Groups;
if (!Remapping.NoIntro.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["NoIntro"].ContainsKey(fileinfo[1].Value))
{ {
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as No-Intro but could not be mapped."); _logger.Warning("The filename " + fileinfo[1].Value + " was matched as No-Intro but could not be mapped.");
return source; return source;
@@ -366,7 +366,7 @@ COMMIT;";
else if (Regex.IsMatch(filename, Constants.NoIntroSpecialPattern)) else if (Regex.IsMatch(filename, Constants.NoIntroSpecialPattern))
{ {
fileinfo = Regex.Match(filename, Constants.NoIntroSpecialPattern).Groups; fileinfo = Regex.Match(filename, Constants.NoIntroSpecialPattern).Groups;
if (!Remapping.NoIntro.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["NoIntro"].ContainsKey(fileinfo[1].Value))
{ {
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as No-Intro but could not be mapped."); _logger.Warning("The filename " + fileinfo[1].Value + " was matched as No-Intro but could not be mapped.");
return source; return source;
@@ -376,7 +376,7 @@ COMMIT;";
else if (Regex.IsMatch(filename, Constants.RedumpPattern)) else if (Regex.IsMatch(filename, Constants.RedumpPattern))
{ {
fileinfo = Regex.Match(filename, Constants.RedumpPattern).Groups; fileinfo = Regex.Match(filename, Constants.RedumpPattern).Groups;
if (!Remapping.Redump.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["Redump"].ContainsKey(fileinfo[1].Value))
{ {
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as Redump but could not be mapped."); _logger.Warning("The filename " + fileinfo[1].Value + " was matched as Redump but could not be mapped.");
return source; return source;
@@ -387,7 +387,7 @@ COMMIT;";
else if (Regex.IsMatch(filename, Constants.RedumpBiosPattern)) else if (Regex.IsMatch(filename, Constants.RedumpBiosPattern))
{ {
fileinfo = Regex.Match(filename, Constants.RedumpBiosPattern).Groups; fileinfo = Regex.Match(filename, Constants.RedumpBiosPattern).Groups;
if (!Remapping.Redump.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["Redump"].ContainsKey(fileinfo[1].Value))
{ {
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as Redump but could not be mapped."); _logger.Warning("The filename " + fileinfo[1].Value + " was matched as Redump but could not be mapped.");
return source; return source;
@@ -397,16 +397,16 @@ COMMIT;";
else if (Regex.IsMatch(filename, Constants.TosecPattern)) else if (Regex.IsMatch(filename, Constants.TosecPattern))
{ {
fileinfo = Regex.Match(filename, Constants.TosecPattern).Groups; fileinfo = Regex.Match(filename, Constants.TosecPattern).Groups;
if (!Remapping.TOSEC.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["TOSEC"].ContainsKey(fileinfo[1].Value))
{ {
// Handle special case mappings found only in TOSEC // Handle special case mappings found only in TOSEC
fileinfo = Regex.Match(filename, Constants.TosecSpecialPatternA).Groups; fileinfo = Regex.Match(filename, Constants.TosecSpecialPatternA).Groups;
if (!Remapping.TOSEC.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["TOSEC"].ContainsKey(fileinfo[1].Value))
{ {
fileinfo = Regex.Match(filename, Constants.TosecSpecialPatternB).Groups; fileinfo = Regex.Match(filename, Constants.TosecSpecialPatternB).Groups;
if (!Remapping.TOSEC.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["TOSEC"].ContainsKey(fileinfo[1].Value))
{ {
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as TOSEC but could not be mapped."); _logger.Warning("The filename " + fileinfo[1].Value + " was matched as TOSEC but could not be mapped.");
return source; return source;
@@ -418,7 +418,7 @@ COMMIT;";
else if (Regex.IsMatch(filename, Constants.TruripPattern)) else if (Regex.IsMatch(filename, Constants.TruripPattern))
{ {
fileinfo = Regex.Match(filename, Constants.TruripPattern).Groups; fileinfo = Regex.Match(filename, Constants.TruripPattern).Groups;
if (!Remapping.TruRip.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["TruRip"].ContainsKey(fileinfo[1].Value))
{ {
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as TruRip but could not be mapped."); _logger.Warning("The filename " + fileinfo[1].Value + " was matched as TruRip but could not be mapped.");
return source; return source;
@@ -442,7 +442,7 @@ COMMIT;";
else if (Regex.IsMatch(filename, Constants.MamePattern)) else if (Regex.IsMatch(filename, Constants.MamePattern))
{ {
fileinfo = Regex.Match(filename, Constants.MamePattern).Groups; fileinfo = Regex.Match(filename, Constants.MamePattern).Groups;
if (!Remapping.MAME.ContainsKey(fileinfo[1].Value)) if (!Remapping.DatMaps["MAME"].ContainsKey(fileinfo[1].Value))
{ {
_logger.Warning("The filename " + fileinfo[1].Value + " was matched as MAME but could not be mapped."); _logger.Warning("The filename " + fileinfo[1].Value + " was matched as MAME but could not be mapped.");
return source; return source;