mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
[DatFile] Add --out as parameter for stats
This commit is contained in:
@@ -240,6 +240,7 @@ namespace SabreTools.Helper.Data
|
|||||||
helptext.Add(" -bc, --baddump-col Add baddump stats to output");
|
helptext.Add(" -bc, --baddump-col Add baddump stats to output");
|
||||||
helptext.Add(" -csv, --csv Output in Comma-Separated Value format");
|
helptext.Add(" -csv, --csv Output in Comma-Separated Value format");
|
||||||
helptext.Add(" -f=, --filename= Set the filename for the output");
|
helptext.Add(" -f=, --filename= Set the filename for the output");
|
||||||
|
helptext.Add(" -out= Output directory");
|
||||||
helptext.Add(" -html, --html Output in HTML format");
|
helptext.Add(" -html, --html Output in HTML format");
|
||||||
helptext.Add(" -nc, --nodump-col Add nodump stats to output");
|
helptext.Add(" -nc, --nodump-col Add nodump stats to output");
|
||||||
helptext.Add(" -si, --single Show individual statistics");
|
helptext.Add(" -si, --single Show individual statistics");
|
||||||
|
|||||||
@@ -234,10 +234,23 @@ namespace SabreTools.Helper.Dats
|
|||||||
/// <param name="nodumpCol">True if nodumps should be included in output, false otherwise</param>
|
/// <param name="nodumpCol">True if nodumps should be included in output, false otherwise</param>
|
||||||
/// <param name="statDatFormat" > Set the statistics output format to use</param>
|
/// <param name="statDatFormat" > Set the statistics output format to use</param>
|
||||||
/// <param name="logger">Logger object for file and console output</param>
|
/// <param name="logger">Logger object for file and console output</param>
|
||||||
public static void OutputStats(List<string> inputs, string reportName, bool single, bool baddumpCol,
|
public static void OutputStats(List<string> inputs, string reportName, string outDir, bool single,
|
||||||
bool nodumpCol, StatDatFormat statDatFormat, Logger logger)
|
bool baddumpCol, bool nodumpCol, StatDatFormat statDatFormat, Logger logger)
|
||||||
{
|
{
|
||||||
reportName += OutputStatsGetExtension(statDatFormat);
|
// Get the proper output file name
|
||||||
|
if (String.IsNullOrEmpty(outDir))
|
||||||
|
{
|
||||||
|
outDir = Environment.CurrentDirectory;
|
||||||
|
}
|
||||||
|
if (String.IsNullOrEmpty(reportName))
|
||||||
|
{
|
||||||
|
reportName = "report";
|
||||||
|
}
|
||||||
|
outDir = Path.GetFullPath(outDir);
|
||||||
|
reportName = Style.GetFileNameWithoutExtension(reportName) + OutputStatsGetExtension(statDatFormat);
|
||||||
|
Path.Combine(outDir, reportName);
|
||||||
|
|
||||||
|
// Create the StreamWriter for this file
|
||||||
StreamWriter sw = new StreamWriter(File.Open(reportName, FileMode.Create, FileAccess.Write));
|
StreamWriter sw = new StreamWriter(File.Open(reportName, FileMode.Create, FileAccess.Write));
|
||||||
|
|
||||||
// Make sure we have all files
|
// Make sure we have all files
|
||||||
|
|||||||
@@ -505,6 +505,10 @@ Options:
|
|||||||
-f=, --filename= Set the filename for the output
|
-f=, --filename= Set the filename for the output
|
||||||
Set the filename (without extension) for the outputted report
|
Set the filename (without extension) for the outputted report
|
||||||
|
|
||||||
|
-out= Set the name of the output directory
|
||||||
|
This sets an output folder to be used when the files are created. If a path
|
||||||
|
is not defined, the application directory is used instead.
|
||||||
|
|
||||||
-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.
|
||||||
|
|
||||||
|
|||||||
@@ -341,13 +341,14 @@ namespace SabreTools
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="inputs">List of inputs to be used</param>
|
/// <param name="inputs">List of inputs to be used</param>
|
||||||
/// <param name="filename">Name of the file to output to, blank for default</param>
|
/// <param name="filename">Name of the file to output to, blank for default</param>
|
||||||
|
/// <param name="outDir">Output directory for the report files</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="baddumpCol">True if baddumps should be included in output, false otherwise</param>
|
/// <param name="baddumpCol">True if baddumps should be included in output, false otherwise</param>
|
||||||
/// <param name="nodumpCol">True if nodumps should be included in output, false otherwise</param>
|
/// <param name="nodumpCol">True if nodumps should be included in output, false otherwise</param>
|
||||||
/// <param name="statDatFormat">Set the statistics output format to use</param>
|
/// <param name="statDatFormat">Set the statistics output format to use</param>
|
||||||
private static void InitStats(List<string> inputs, string filename, bool single, bool baddumpCol, bool nodumpCol, StatDatFormat statDatFormat)
|
private static void InitStats(List<string> inputs, string filename, string outDir, bool single, bool baddumpCol, bool nodumpCol, StatDatFormat statDatFormat)
|
||||||
{
|
{
|
||||||
DatFile.OutputStats(inputs, (String.IsNullOrEmpty(filename) ? "report" : filename), single, baddumpCol, nodumpCol, statDatFormat, _logger);
|
DatFile.OutputStats(inputs, filename, outDir, single, baddumpCol, nodumpCol, statDatFormat, _logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -1021,7 +1021,7 @@ namespace SabreTools
|
|||||||
// Get statistics on input files
|
// Get statistics on input files
|
||||||
else if (stats)
|
else if (stats)
|
||||||
{
|
{
|
||||||
InitStats(inputs, filename, single, showBaddumpColumn, showNodumpColumn, statDatFormat);
|
InitStats(inputs, filename, outDir, single, showBaddumpColumn, showNodumpColumn, statDatFormat);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Convert, update, merge, diff, and filter a DAT or folder of DATs
|
// Convert, update, merge, diff, and filter a DAT or folder of DATs
|
||||||
|
|||||||
Reference in New Issue
Block a user