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)
|
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
|
// New software lists have this behavior
|
||||||
case "softwarelist":
|
case "softwarelist":
|
||||||
if (xtr.GetAttribute("name") != null)
|
if (xtr.GetAttribute("name") != null)
|
||||||
@@ -920,6 +929,7 @@ namespace SabreTools.Helper
|
|||||||
{
|
{
|
||||||
datdata.Version = (String.IsNullOrEmpty(datdata.Version) ? xtr.GetAttribute("version") : datdata.Version);
|
datdata.Version = (String.IsNullOrEmpty(datdata.Version) ? xtr.GetAttribute("version") : datdata.Version);
|
||||||
}
|
}
|
||||||
|
xtr.Read();
|
||||||
break;
|
break;
|
||||||
// We want to process the entire subtree of the header
|
// We want to process the entire subtree of the header
|
||||||
case "header":
|
case "header":
|
||||||
|
|||||||
@@ -236,11 +236,30 @@ namespace SabreTools.Helper
|
|||||||
{
|
{
|
||||||
if (x.Machine.Name == y.Machine.Name)
|
if (x.Machine.Name == y.Machine.Name)
|
||||||
{
|
{
|
||||||
if (Path.GetDirectoryName(x.Name) == Path.GetDirectoryName(y.Name))
|
if ((x.Type == ItemType.Rom || x.Type == ItemType.Disk) && (y.Type == ItemType.Rom || y.Type == ItemType.Disk))
|
||||||
{
|
{
|
||||||
return Style.CompareNumeric(Path.GetFileName(x.Name), Path.GetFileName(y.Name));
|
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));
|
||||||
|
}
|
||||||
|
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(Path.GetDirectoryName(x.Name), Path.GetDirectoryName(y.Name));
|
|
||||||
}
|
}
|
||||||
return Style.CompareNumeric(x.Machine.Name, y.Machine.Name);
|
return Style.CompareNumeric(x.Machine.Name, y.Machine.Name);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -499,13 +499,13 @@ namespace SabreTools
|
|||||||
{
|
{
|
||||||
if (File.Exists(input))
|
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))
|
else if (Directory.Exists(input))
|
||||||
{
|
{
|
||||||
foreach (string file in Directory.EnumerateFiles(input, "*", SearchOption.AllDirectories))
|
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
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user