diff --git a/SabreTools.Helper/Data/Build.cs b/SabreTools.Helper/Data/Build.cs
index efaef197..d05b82e3 100644
--- a/SabreTools.Helper/Data/Build.cs
+++ b/SabreTools.Helper/Data/Build.cs
@@ -145,7 +145,8 @@ namespace SabreTools.Helper
helptext.Add(" -out= Output directory");
helptext.Add(" -st, --stats Get statistics on all input DATs");
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(" -tsv, --tsv Output in Tab-Separated Value format");
helptext.Add(" -ts, --type-split Split a DAT or folder by file types (rom/disk)");
diff --git a/SabreTools.Helper/Objects/Dat/DatFile.cs b/SabreTools.Helper/Objects/Dat/DatFile.cs
index 0771f6c9..4a0c70c9 100644
--- a/SabreTools.Helper/Objects/Dat/DatFile.cs
+++ b/SabreTools.Helper/Objects/Dat/DatFile.cs
@@ -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 = @"
+
+
+ DAT Statistics Report
+
+
+
+ | File Name | Total Size | Games | Roms | Disks | # with CRC | "
++ "# with MD5 | # with SHA-1 | Nodumps |
\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
long totalSize = 0;
long totalGame = 0;
@@ -5157,32 +5184,6 @@ namespace SabreTools.Helper
logger.User("Adding stats for file '" + filename + "'\n", false);
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 = @"
-
-
- DAT Statistics Report
-
-
-
- | File Name | Total Size | Games | Roms | Disks | # with CRC | "
-+ "# with MD5 | # with SHA-1 | Nodumps |
\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);
}
diff --git a/SabreTools.Helper/README.1ST b/SabreTools.Helper/README.1ST
index 20bf0f3d..00e9b2ed 100644
--- a/SabreTools.Helper/README.1ST
+++ b/SabreTools.Helper/README.1ST
@@ -325,6 +325,9 @@ Options:
-csv, --csv Write all statistics to CSV
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
This will output by default the combined statistics for all input DAT files.
diff --git a/SabreTools/Partials/SabreTools_Inits.cs b/SabreTools/Partials/SabreTools_Inits.cs
index d767d1a9..3a259f63 100644
--- a/SabreTools/Partials/SabreTools_Inits.cs
+++ b/SabreTools/Partials/SabreTools_Inits.cs
@@ -285,9 +285,9 @@ namespace SabreTools
/// List of inputs to be used
/// True to show individual DAT statistics, false otherwise
/// Set the statistics output format to use
- private static void InitStats(List inputs, bool single, StatOutputFormat statOutputFormat)
+ private static void InitStats(List 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);
}
///
diff --git a/SabreTools/SabreTools.cs b/SabreTools/SabreTools.cs
index a80ae7d7..ac8e9f09 100644
--- a/SabreTools/SabreTools.cs
+++ b/SabreTools/SabreTools.cs
@@ -574,7 +574,7 @@ namespace SabreTools
// Get statistics on input files
else if (stats)
{
- InitStats(inputs, single, statOutputFormat);
+ InitStats(inputs, filename, single, statOutputFormat);
}
// Split a DAT by item type