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
|
return statReportFormat switch
|
||||||
{
|
{
|
||||||
StatReportFormat.None => new Textfile(statsList, true),
|
StatReportFormat.None => new ConsoleOutput(statsList),
|
||||||
StatReportFormat.Textfile => new Textfile(statsList, false),
|
StatReportFormat.Textfile => new Textfile(statsList),
|
||||||
StatReportFormat.CSV => new CommaSeparatedValue(statsList),
|
StatReportFormat.CSV => new CommaSeparatedValue(statsList),
|
||||||
StatReportFormat.HTML => new Html(statsList),
|
StatReportFormat.HTML => new Html(statsList),
|
||||||
StatReportFormat.SSV => new SemicolonSeparatedValue(statsList),
|
StatReportFormat.SSV => new SemicolonSeparatedValue(statsList),
|
||||||
|
|||||||
@@ -13,17 +13,15 @@ namespace SabreTools.Reports.Formats
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
internal class Textfile : BaseReport
|
internal class Textfile : BaseReport
|
||||||
{
|
{
|
||||||
private readonly bool _writeToConsole;
|
protected bool _writeToConsole = false;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Create a new report from the filename
|
/// Create a new report from the filename
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="statsList">List of statistics objects to set</param>
|
/// <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)
|
||||||
public Textfile(List<DatStatistics> statsList, bool writeToConsole)
|
|
||||||
: base(statsList)
|
: base(statsList)
|
||||||
{
|
{
|
||||||
_writeToConsole = writeToConsole;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
@@ -127,4 +125,19 @@ namespace SabreTools.Reports.Formats
|
|||||||
sw.Flush();
|
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