mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFile, SimpleSort, FileTools] Make sure extensions are checked properly
This commit is contained in:
@@ -1189,7 +1189,11 @@ namespace SabreTools.Helper
|
|||||||
{
|
{
|
||||||
// Check the file extension first as a safeguard
|
// Check the file extension first as a safeguard
|
||||||
string ext = Path.GetExtension(filename).ToLowerInvariant();
|
string ext = Path.GetExtension(filename).ToLowerInvariant();
|
||||||
if (ext != ".txt" && ext != ".dat" && ext != ".xml")
|
if (ext.StartsWith("."))
|
||||||
|
{
|
||||||
|
ext = ext.Substring(1);
|
||||||
|
}
|
||||||
|
if (ext != "txt" && ext != "dat" && ext != "xml")
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -3013,7 +3017,7 @@ namespace SabreTools.Helper
|
|||||||
if (stats)
|
if (stats)
|
||||||
{
|
{
|
||||||
StreamWriter sw = new StreamWriter(new MemoryStream());
|
StreamWriter sw = new StreamWriter(new MemoryStream());
|
||||||
OutputStats(sw, StatOutputFormat.None, logger, (RomCount + DiskCount == 0));
|
OutputStats(sw, StatOutputFormat.None, logger, recalculate: (RomCount + DiskCount == 0), baddumpCol: true, nodumpCol: true);
|
||||||
sw.Dispose();
|
sw.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -263,7 +263,7 @@ namespace SabreTools.Helper
|
|||||||
Console.SetCursorPosition(0, Constants.HeaderHeight + 1);
|
Console.SetCursorPosition(0, Constants.HeaderHeight + 1);
|
||||||
_logger.User("Stats of the matched ROMs:");
|
_logger.User("Stats of the matched ROMs:");
|
||||||
StreamWriter sw = new StreamWriter(new MemoryStream());
|
StreamWriter sw = new StreamWriter(new MemoryStream());
|
||||||
_matched.OutputStats(sw, StatOutputFormat.None, _logger, true);
|
_matched.OutputStats(sw, StatOutputFormat.None, _logger, recalculate: true, baddumpCol: true, nodumpCol: true);
|
||||||
sw.Dispose();
|
sw.Dispose();
|
||||||
|
|
||||||
// Now output the fixdat based on the original input if asked
|
// Now output the fixdat based on the original input if asked
|
||||||
|
|||||||
@@ -22,7 +22,11 @@ namespace SabreTools.Helper
|
|||||||
{
|
{
|
||||||
// Limit the output formats based on extension
|
// Limit the output formats based on extension
|
||||||
string ext = Path.GetExtension(filename).ToLowerInvariant();
|
string ext = Path.GetExtension(filename).ToLowerInvariant();
|
||||||
if (ext != ".dat" && ext != ".xml")
|
if (ext.StartsWith("."))
|
||||||
|
{
|
||||||
|
ext = ext.Substring(1);
|
||||||
|
}
|
||||||
|
if (ext != "dat" && ext != "xml")
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user