mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Add skeleton for Good for @tractivo
This commit is contained in:
@@ -22,6 +22,8 @@ namespace SabreTools
|
|||||||
// Regex File Name Patterns
|
// Regex File Name Patterns
|
||||||
private static string _defaultPattern = @"^(.+?) - (.+?) \((.*) (.*)\)\.dat$";
|
private static string _defaultPattern = @"^(.+?) - (.+?) \((.*) (.*)\)\.dat$";
|
||||||
private static string _defaultSpecialPattern = @"^(.+?) - (.+?) \((.*) (.*)\)\.xml$";
|
private static string _defaultSpecialPattern = @"^(.+?) - (.+?) \((.*) (.*)\)\.xml$";
|
||||||
|
private static string _goodPattern = @"^(Good.*?)_.*\.dat";
|
||||||
|
private static string _goodXmlPattern = @"^(Good.*?)_.*\.xml";
|
||||||
private static string _mamePattern = @"^(.*)\.xml$";
|
private static string _mamePattern = @"^(.*)\.xml$";
|
||||||
private static string _maybeIntroPattern = @"(.*?) \[T-En\].*\((\d{8})\)\.dat$";
|
private static string _maybeIntroPattern = @"(.*?) \[T-En\].*\((\d{8})\)\.dat$";
|
||||||
private static string _noIntroPattern = @"^(.*?) \((\d{8}-\d{6})_CM\)\.dat$";
|
private static string _noIntroPattern = @"^(.*?) \((\d{8}-\d{6})_CM\)\.dat$";
|
||||||
@@ -88,6 +90,16 @@ namespace SabreTools
|
|||||||
fileinfo = Regex.Match(filename, _nonGoodSpecialPattern).Groups;
|
fileinfo = Regex.Match(filename, _nonGoodSpecialPattern).Groups;
|
||||||
type = DatType.NonGood;
|
type = DatType.NonGood;
|
||||||
}
|
}
|
||||||
|
else if (Regex.IsMatch(filename, _goodPattern))
|
||||||
|
{
|
||||||
|
fileinfo = Regex.Match(filename, _goodPattern).Groups;
|
||||||
|
type = DatType.Good;
|
||||||
|
}
|
||||||
|
else if (Regex.IsMatch(filename, _goodXmlPattern))
|
||||||
|
{
|
||||||
|
fileinfo = Regex.Match(filename, _goodXmlPattern).Groups;
|
||||||
|
type = DatType.Good;
|
||||||
|
}
|
||||||
else if (Regex.IsMatch(filename, _maybeIntroPattern))
|
else if (Regex.IsMatch(filename, _maybeIntroPattern))
|
||||||
{
|
{
|
||||||
fileinfo = Regex.Match(filename, _maybeIntroPattern).Groups;
|
fileinfo = Regex.Match(filename, _maybeIntroPattern).Groups;
|
||||||
@@ -170,6 +182,19 @@ namespace SabreTools
|
|||||||
|
|
||||||
switch (type)
|
switch (type)
|
||||||
{
|
{
|
||||||
|
case DatType.Good:
|
||||||
|
if (!Remapping.Good.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 goodInfo = Regex.Match(Remapping.Good[fileinfo[1].Value], _remappedPattern).Groups;
|
||||||
|
|
||||||
|
manufacturer = goodInfo[1].Value;
|
||||||
|
system = goodInfo[2].Value;
|
||||||
|
source = "Good";
|
||||||
|
date = File.GetLastWriteTime(_filepath).ToString("yyyy-MM-dd HH:mm:ss");
|
||||||
|
break;
|
||||||
case DatType.MAME:
|
case DatType.MAME:
|
||||||
if (!Remapping.MAME.ContainsKey(fileinfo[1].Value))
|
if (!Remapping.MAME.ContainsKey(fileinfo[1].Value))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ namespace SabreTools.Helper
|
|||||||
TruRip,
|
TruRip,
|
||||||
NonGood,
|
NonGood,
|
||||||
MaybeIntro,
|
MaybeIntro,
|
||||||
|
Good,
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
5
SabreHelper/Mappings/Good.xml
Normal file
5
SabreHelper/Mappings/Good.xml
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8" ?>
|
||||||
|
|
||||||
|
<mappings>
|
||||||
|
|
||||||
|
</mappings>
|
||||||
@@ -11,6 +11,7 @@ namespace SabreTools.Helper
|
|||||||
public class Remapping
|
public class Remapping
|
||||||
{
|
{
|
||||||
// Remapping classes represented by dictionaries (from, to)
|
// Remapping classes represented by dictionaries (from, to)
|
||||||
|
public static Dictionary<string, string> Good = new Dictionary<string, string>();
|
||||||
public static Dictionary<string, string> MAME = new 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> MaybeIntro = new Dictionary<string, string>();
|
||||||
public static Dictionary<string, string> NoIntro = new Dictionary<string, string>();
|
public static Dictionary<string, string> NoIntro = new Dictionary<string, string>();
|
||||||
@@ -36,7 +37,7 @@ namespace SabreTools.Helper
|
|||||||
// Create array of dictionary names
|
// Create array of dictionary names
|
||||||
string[] remappings =
|
string[] remappings =
|
||||||
{
|
{
|
||||||
"MAME", "MaybeIntro", "NoIntro", "NonGood", "Redump", "TOSEC", "TruRip",
|
"Good", "MAME", "MaybeIntro", "NoIntro", "NonGood", "Redump", "TOSEC", "TruRip",
|
||||||
};
|
};
|
||||||
|
|
||||||
// Loop through and add all remappings
|
// Loop through and add all remappings
|
||||||
@@ -83,6 +84,9 @@ namespace SabreTools.Helper
|
|||||||
{
|
{
|
||||||
switch (mapping)
|
switch (mapping)
|
||||||
{
|
{
|
||||||
|
case "Good":
|
||||||
|
Good.Add(node.Attributes["from"].Value, node.Attributes["to"].Value);
|
||||||
|
break;
|
||||||
case "MAME":
|
case "MAME":
|
||||||
MAME.Add(node.Attributes["from"].Value, node.Attributes["to"].Value);
|
MAME.Add(node.Attributes["from"].Value, node.Attributes["to"].Value);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -92,6 +92,9 @@
|
|||||||
<None Include="packages.config" />
|
<None Include="packages.config" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<Content Include="Mappings\Good.xml">
|
||||||
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
|
</Content>
|
||||||
<Content Include="Mappings\MAME.xml">
|
<Content Include="Mappings\MAME.xml">
|
||||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||||
</Content>
|
</Content>
|
||||||
|
|||||||
Reference in New Issue
Block a user