mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFile] Correct outputs, add filename flag
This commit is contained in:
@@ -145,7 +145,8 @@ namespace SabreTools.Helper
|
|||||||
helptext.Add(" -out= Output directory");
|
helptext.Add(" -out= Output directory");
|
||||||
helptext.Add(" -st, --stats Get statistics on all input DATs");
|
helptext.Add(" -st, --stats Get statistics on all input DATs");
|
||||||
helptext.Add(" -csv, --csv Output in Comma-Separated Value format");
|
helptext.Add(" -csv, --csv Output in Comma-Separated Value format");
|
||||||
helptext.Add(" -html, --html Write stats to HTML");
|
helptext.Add(" -f=, --filename= Set the filename for the output");
|
||||||
|
helptext.Add(" -html, --html Output in HTML format");
|
||||||
helptext.Add(" -si, --single Show individual statistics");
|
helptext.Add(" -si, --single Show individual statistics");
|
||||||
helptext.Add(" -tsv, --tsv Output in Tab-Separated Value format");
|
helptext.Add(" -tsv, --tsv Output in Tab-Separated Value format");
|
||||||
helptext.Add(" -ts, --type-split Split a DAT or folder by file types (rom/disk)");
|
helptext.Add(" -ts, --type-split Split a DAT or folder by file types (rom/disk)");
|
||||||
|
|||||||
@@ -5134,6 +5134,33 @@ namespace SabreTools.Helper
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Write the header, if any
|
||||||
|
string head = "";
|
||||||
|
switch (statOutputFormat)
|
||||||
|
{
|
||||||
|
case StatOutputFormat.CSV:
|
||||||
|
head = "\"File Name\",\"Total Size\",\"Games\",\"Roms\",\"Disks\",\"# with CRC\",\"# with MD5\",\"# with SHA-1\",\"Nodumps\"\n";
|
||||||
|
break;
|
||||||
|
case StatOutputFormat.HTML:
|
||||||
|
head = @"<!DOCTYPE html>
|
||||||
|
<html>
|
||||||
|
<header>
|
||||||
|
<title>DAT Statistics Report</title>
|
||||||
|
</header>
|
||||||
|
<body>
|
||||||
|
<table border=""1"" cellpadding=""5"" cellspacing=""0"">
|
||||||
|
<tr><th>File Name</th><th>Total Size</th><th>Games</th><th>Roms</th><th>Disks</th><th># with CRC</th>"
|
||||||
|
+ "<th># with MD5</th><th># with SHA-1</th><th>Nodumps</th></tr>\n";
|
||||||
|
break;
|
||||||
|
case StatOutputFormat.None:
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
case StatOutputFormat.TSV:
|
||||||
|
head = "\"File Name\"\t\"Total Size\"\t\"Games\"\t\"Roms\"\t\"Disks\"\t\"# with CRC\"\t\"# with MD5\"\t\"# with SHA-1\"\t\"Nodumps\"\n";
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
sw.Write(head);
|
||||||
|
|
||||||
// Init all total variables
|
// Init all total variables
|
||||||
long totalSize = 0;
|
long totalSize = 0;
|
||||||
long totalGame = 0;
|
long totalGame = 0;
|
||||||
@@ -5157,32 +5184,6 @@ namespace SabreTools.Helper
|
|||||||
logger.User("Adding stats for file '" + filename + "'\n", false);
|
logger.User("Adding stats for file '" + filename + "'\n", false);
|
||||||
if (single)
|
if (single)
|
||||||
{
|
{
|
||||||
string line = "";
|
|
||||||
switch (statOutputFormat)
|
|
||||||
{
|
|
||||||
case StatOutputFormat.CSV:
|
|
||||||
line = "\"File Name\",\"Total Size\",\"Games\",\"Roms\",\"Disks\",\"# with CRC\",\"# with MD5\",\"# with SHA-1\",\"Nodumps\"\n";
|
|
||||||
break;
|
|
||||||
case StatOutputFormat.HTML:
|
|
||||||
line = @"<!DOCTYPE html>
|
|
||||||
<html>
|
|
||||||
<header>
|
|
||||||
<title>DAT Statistics Report</title>
|
|
||||||
</header>
|
|
||||||
<body>
|
|
||||||
<table border=""1"" cellpadding=""5"" cellspacing=""0"">
|
|
||||||
<tr><th>File Name</th><th>Total Size</th><th>Games</th><th>Roms</th><th>Disks</th><th># with CRC</th>"
|
|
||||||
+ "<th># with MD5</th><th># with SHA-1</th><th>Nodumps</th></tr>\n";
|
|
||||||
break;
|
|
||||||
case StatOutputFormat.None:
|
|
||||||
default:
|
|
||||||
break;
|
|
||||||
case StatOutputFormat.TSV:
|
|
||||||
line = "\"File Name\"\t\"Total Size\"\t\"Games\"\t\"Roms\"\t\"Disks\"\t\"# with CRC\"\t\"# with MD5\"\t\"# with SHA-1\"\t\"Nodumps\"\n";
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
sw.Write(line);
|
|
||||||
|
|
||||||
datdata.OutputStats(sw, statOutputFormat, logger);
|
datdata.OutputStats(sw, statOutputFormat, logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -325,6 +325,9 @@ Options:
|
|||||||
-csv, --csv Write all statistics to CSV
|
-csv, --csv Write all statistics to CSV
|
||||||
Output all rom information in standardized CSV format
|
Output all rom information in standardized CSV format
|
||||||
|
|
||||||
|
-f=, --filename= Set the filename for the output
|
||||||
|
Set the filename (without extension) for the outputted report
|
||||||
|
|
||||||
-html, --html Write all statistics to HTML
|
-html, --html Write all statistics to HTML
|
||||||
This will output by default the combined statistics for all input DAT files.
|
This will output by default the combined statistics for all input DAT files.
|
||||||
|
|
||||||
|
|||||||
@@ -285,9 +285,9 @@ namespace SabreTools
|
|||||||
/// <param name="inputs">List of inputs to be used</param>
|
/// <param name="inputs">List of inputs to be used</param>
|
||||||
/// <param name="single">True to show individual DAT statistics, false otherwise</param>
|
/// <param name="single">True to show individual DAT statistics, false otherwise</param>
|
||||||
/// <param name="statOutputFormat">Set the statistics output format to use</param>
|
/// <param name="statOutputFormat">Set the statistics output format to use</param>
|
||||||
private static void InitStats(List<string> inputs, bool single, StatOutputFormat statOutputFormat)
|
private static void InitStats(List<string> inputs, string filename, bool single, StatOutputFormat statOutputFormat)
|
||||||
{
|
{
|
||||||
DatFile.OutputStats(inputs, "report", single, statOutputFormat, _logger);
|
DatFile.OutputStats(inputs, (String.IsNullOrEmpty(filename) ? "report" : filename), single, statOutputFormat, _logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -574,7 +574,7 @@ namespace SabreTools
|
|||||||
// Get statistics on input files
|
// Get statistics on input files
|
||||||
else if (stats)
|
else if (stats)
|
||||||
{
|
{
|
||||||
InitStats(inputs, single, statOutputFormat);
|
InitStats(inputs, filename, single, statOutputFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Split a DAT by item type
|
// Split a DAT by item type
|
||||||
|
|||||||
Reference in New Issue
Block a user