[SabreTools, Flags, DatFile, DatSTats] StatReportFormat stuff

This commit is contained in:
Matt Nadareski
2017-11-08 01:00:21 -08:00
parent 77e2d9704f
commit 6dc907a6e8
4 changed files with 43 additions and 11 deletions

View File

@@ -752,6 +752,27 @@ namespace SabreTools.Library.DatFiles
} }
// Statistical data related to the DAT // Statistical data related to the DAT
public StatReportFormat ReportFormat
{
get
{
if (_datStats == null)
{
_datStats = new DatStats();
}
return _datStats.ReportFormat;
}
set
{
if (_datStats == null)
{
_datStats = new DatStats();
}
_datStats.ReportFormat = value;
}
}
public long Count public long Count
{ {
get get
@@ -5884,9 +5905,9 @@ namespace SabreTools.Library.DatFiles
bool baddumpCol, bool nodumpCol, StatReportFormat statDatFormat) bool baddumpCol, bool nodumpCol, StatReportFormat statDatFormat)
{ {
// If there's no output format, set the default // If there's no output format, set the default
if (statDatFormat == 0x0) if (statDatFormat == StatReportFormat.None)
{ {
statDatFormat = StatReportFormat.None; statDatFormat = StatReportFormat.Textfile;
} }
// Get the proper output file name // Get the proper output file name
@@ -5916,7 +5937,7 @@ namespace SabreTools.Library.DatFiles
BaseReport report = null; BaseReport report = null;
switch (kvp.Key) switch (kvp.Key)
{ {
case StatReportFormat.None: case StatReportFormat.Textfile:
report = new Textfile(null, kvp.Value, baddumpCol, nodumpCol); report = new Textfile(null, kvp.Value, baddumpCol, nodumpCol);
break; break;
case StatReportFormat.CSV: case StatReportFormat.CSV:
@@ -6071,9 +6092,9 @@ Please check the log folder if the stats scrolled offscreen", false);
} }
// For each output format, get the appropriate stream writer // For each output format, get the appropriate stream writer
if ((statDatFormat & StatReportFormat.None) != 0) if ((statDatFormat & StatReportFormat.Textfile) != 0)
{ {
output.Add(StatReportFormat.None, CreateOutStatsNamesHelper(outDir, ".txt", reportName, overwrite)); output.Add(StatReportFormat.Textfile, CreateOutStatsNamesHelper(outDir, ".txt", reportName, overwrite));
} }
if ((statDatFormat & StatReportFormat.CSV) != 0) if ((statDatFormat & StatReportFormat.CSV) != 0)
{ {

View File

@@ -12,6 +12,9 @@ namespace SabreTools.Library.DatFiles
{ {
#region Private instance variables #region Private instance variables
// Statistics report format
private StatReportFormat _reportFormat = StatReportFormat.None;
// Object used to lock stats updates // Object used to lock stats updates
private object _lockObject = new object(); private object _lockObject = new object();
@@ -50,6 +53,13 @@ namespace SabreTools.Library.DatFiles
#region Publicly facing variables #region Publicly facing variables
// Statistics report format
public StatReportFormat ReportFormat
{
get { return _reportFormat; }
set { _reportFormat = value; }
}
// Overall item count // Overall item count
public long Count public long Count
{ {

View File

@@ -245,15 +245,16 @@ namespace SabreTools.Library.Data
/// <summary> /// <summary>
/// Determine which format to output Stats to /// Determine which format to output Stats to
/// </summary> /// </summary>
/// [Flags] [Flags]
public enum StatReportFormat public enum StatReportFormat
{ {
None = 0x01, None = 0x0,
HTML = None << 1, Textfile = 0x01,
HTML = Textfile << 1,
CSV = HTML << 1, CSV = HTML << 1,
TSV = CSV << 1, TSV = CSV << 1,
All = None | HTML | CSV | TSV, All = Textfile | HTML | CSV | TSV,
} }
/// <summary> /// <summary>

View File

@@ -127,7 +127,7 @@ namespace SabreTools
OutputFormat outputFormat = OutputFormat.Folder; OutputFormat outputFormat = OutputFormat.Folder;
SkipFileType skipFileType = SkipFileType.None; SkipFileType skipFileType = SkipFileType.None;
SplitType splitType = SplitType.None; SplitType splitType = SplitType.None;
StatReportFormat statDatFormat = 0x0; StatReportFormat statDatFormat = StatReportFormat.None;
UpdateMode updateMode = UpdateMode.None; UpdateMode updateMode = UpdateMode.None;
// User inputs // User inputs
@@ -638,7 +638,7 @@ namespace SabreTools
break; break;
case "-txt": case "-txt":
case "--text": case "--text":
statDatFormat |= StatReportFormat.None; statDatFormat |= StatReportFormat.Textfile;
break; break;
case "-tzip": case "-tzip":
case "--tzip": case "--tzip":