mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Separate out console write as well
This commit is contained in:
@@ -40,8 +40,8 @@ namespace SabreTools.Reports
|
||||
{
|
||||
return statReportFormat switch
|
||||
{
|
||||
StatReportFormat.None => new Textfile(statsList, true),
|
||||
StatReportFormat.Textfile => new Textfile(statsList, false),
|
||||
StatReportFormat.None => new ConsoleOutput(statsList),
|
||||
StatReportFormat.Textfile => new Textfile(statsList),
|
||||
StatReportFormat.CSV => new CommaSeparatedValue(statsList),
|
||||
StatReportFormat.HTML => new Html(statsList),
|
||||
StatReportFormat.SSV => new SemicolonSeparatedValue(statsList),
|
||||
|
||||
@@ -13,17 +13,15 @@ namespace SabreTools.Reports.Formats
|
||||
/// </summary>
|
||||
internal class Textfile : BaseReport
|
||||
{
|
||||
private readonly bool _writeToConsole;
|
||||
protected bool _writeToConsole = false;
|
||||
|
||||
/// <summary>
|
||||
/// Create a new report from the filename
|
||||
/// </summary>
|
||||
/// <param name="statsList">List of statistics objects to set</param>
|
||||
/// <param name="writeToConsole">True to write to consoke output, false otherwise</param>
|
||||
public Textfile(List<DatStatistics> statsList, bool writeToConsole)
|
||||
public Textfile(List<DatStatistics> statsList)
|
||||
: base(statsList)
|
||||
{
|
||||
_writeToConsole = writeToConsole;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -127,4 +125,19 @@ namespace SabreTools.Reports.Formats
|
||||
sw.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Console report format
|
||||
/// </summary>
|
||||
internal sealed class ConsoleOutput : Textfile
|
||||
{
|
||||
/// <summary>
|
||||
/// Create a new report from the filename
|
||||
/// </summary>
|
||||
/// <param name="statsList">List of statistics objects to set</param>
|
||||
public ConsoleOutput(List<DatStatistics> statsList) : base(statsList)
|
||||
{
|
||||
_writeToConsole = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user