mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatTools, RomTools] Fix type-split output, make parsing for MAME listxml better
This commit is contained in:
@@ -900,6 +900,15 @@ namespace SabreTools.Helper
|
||||
|
||||
switch (xtr.Name)
|
||||
{
|
||||
// Handle MAME listxml since they're halfway between a SL and a Logiqx XML
|
||||
case "mame":
|
||||
if (xtr.GetAttribute("build") != null)
|
||||
{
|
||||
datdata.Name = (String.IsNullOrEmpty(datdata.Name) ? xtr.GetAttribute("build") : datdata.Name);
|
||||
datdata.Description = (String.IsNullOrEmpty(datdata.Description) ? datdata.Name : datdata.Name);
|
||||
}
|
||||
xtr.Read();
|
||||
break;
|
||||
// New software lists have this behavior
|
||||
case "softwarelist":
|
||||
if (xtr.GetAttribute("name") != null)
|
||||
@@ -920,6 +929,7 @@ namespace SabreTools.Helper
|
||||
{
|
||||
datdata.Version = (String.IsNullOrEmpty(datdata.Version) ? xtr.GetAttribute("version") : datdata.Version);
|
||||
}
|
||||
xtr.Read();
|
||||
break;
|
||||
// We want to process the entire subtree of the header
|
||||
case "header":
|
||||
|
||||
@@ -235,6 +235,8 @@ namespace SabreTools.Helper
|
||||
if (x.Metadata.SourceID == y.Metadata.SourceID)
|
||||
{
|
||||
if (x.Machine.Name == y.Machine.Name)
|
||||
{
|
||||
if ((x.Type == ItemType.Rom || x.Type == ItemType.Disk) && (y.Type == ItemType.Rom || y.Type == ItemType.Disk))
|
||||
{
|
||||
if (Path.GetDirectoryName(x.Name) == Path.GetDirectoryName(y.Name))
|
||||
{
|
||||
@@ -242,6 +244,23 @@ namespace SabreTools.Helper
|
||||
}
|
||||
return Style.CompareNumeric(Path.GetDirectoryName(x.Name), Path.GetDirectoryName(y.Name));
|
||||
}
|
||||
else if ((x.Type == ItemType.Rom || x.Type == ItemType.Disk) && (y.Type != ItemType.Rom && y.Type != ItemType.Disk))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
else if ((x.Type != ItemType.Rom && x.Type != ItemType.Disk) && (y.Type == ItemType.Rom || y.Type == ItemType.Disk))
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (Path.GetDirectoryName(x.Name) == Path.GetDirectoryName(y.Name))
|
||||
{
|
||||
return Style.CompareNumeric(Path.GetFileName(x.Name), Path.GetFileName(y.Name));
|
||||
}
|
||||
return Style.CompareNumeric(Path.GetDirectoryName(x.Name), Path.GetDirectoryName(y.Name));
|
||||
}
|
||||
}
|
||||
return Style.CompareNumeric(x.Machine.Name, y.Machine.Name);
|
||||
}
|
||||
return (norename ? String.Compare(x.Machine.Name, y.Machine.Name) : x.Metadata.SourceID - y.Metadata.SourceID);
|
||||
|
||||
@@ -499,13 +499,13 @@ namespace SabreTools
|
||||
{
|
||||
if (File.Exists(input))
|
||||
{
|
||||
DatTools.SplitByType(Path.GetFullPath(input), outdir, Path.GetDirectoryName(input), _logger);
|
||||
DatTools.SplitByType(Path.GetFullPath(input), outdir, Path.GetFullPath(Path.GetDirectoryName(input)), _logger);
|
||||
}
|
||||
else if (Directory.Exists(input))
|
||||
{
|
||||
foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories))
|
||||
{
|
||||
DatTools.SplitByType(file, outdir, (input.EndsWith(Path.DirectorySeparatorChar.ToString()) ? input : input + Path.DirectorySeparatorChar), _logger);
|
||||
DatTools.SplitByType(file, outdir, Path.GetFullPath((input.EndsWith(Path.DirectorySeparatorChar.ToString()) ? input : input + Path.DirectorySeparatorChar)), _logger);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user