Make Reports similar to DatFiles with access

This commit is contained in:
Matt Nadareski
2025-02-19 13:24:12 -05:00
parent 7542a79a58
commit 5f76596aa5
7 changed files with 38 additions and 30 deletions

View File

@@ -1,7 +1,6 @@
using System.Collections.Generic;
using SabreTools.DatFiles;
using SabreTools.IO.Logging;
using SabreTools.Reports.Formats;
namespace SabreTools.Reports
{
@@ -30,26 +29,6 @@ namespace SabreTools.Reports
Statistics = statsList;
}
/// <summary>
/// Create a specific type of BaseReport to be used based on a format and user inputs
/// </summary>
/// <param name="statReportFormat">Format of the Statistics Report to be created</param>
/// <param name="statsList">List of statistics objects to set</param>
/// <returns>BaseReport of the specific internal type that corresponds to the inputs</returns>
public static BaseReport? Create(StatReportFormat statReportFormat, List<DatStatistics> statsList)
{
return statReportFormat switch
{
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),
StatReportFormat.TSV => new TabSeparatedValue(statsList),
_ => null,
};
}
/// <summary>
/// Create and open an output file for writing direct from a set of statistics
/// </summary>

View File

@@ -17,7 +17,7 @@ namespace SabreTools.Reports.Formats
/// HTML report format
/// </summary>
/// TODO: Make output standard width, without making the entire thing a table
internal class Html : BaseReport
public class Html : BaseReport
{
/// <summary>
/// Create a new report from the filename

View File

@@ -13,7 +13,7 @@ namespace SabreTools.Reports.Formats
/// <summary>
/// Separated-Value report format
/// </summary>
internal abstract class SeparatedValue : BaseReport
public abstract class SeparatedValue : BaseReport
{
// Private instance variables specific to Hashfile DATs
protected char _delim;
@@ -161,7 +161,7 @@ namespace SabreTools.Reports.Formats
/// <summary>
/// Represents a comma-separated value file
/// </summary>
internal sealed class CommaSeparatedValue : SeparatedValue
public sealed class CommaSeparatedValue : SeparatedValue
{
/// <summary>
/// Create a new report from the filename
@@ -176,7 +176,7 @@ namespace SabreTools.Reports.Formats
/// <summary>
/// Represents a semicolon-separated value file
/// </summary>
internal sealed class SemicolonSeparatedValue : SeparatedValue
public sealed class SemicolonSeparatedValue : SeparatedValue
{
/// <summary>
/// Create a new report from the filename
@@ -191,7 +191,7 @@ namespace SabreTools.Reports.Formats
/// <summary>
/// Represents a tab-separated value file
/// </summary>
internal sealed class TabSeparatedValue : SeparatedValue
public sealed class TabSeparatedValue : SeparatedValue
{
/// <summary>
/// Create a new report from the filename

View File

@@ -11,7 +11,7 @@ namespace SabreTools.Reports.Formats
/// <summary>
/// Textfile report format
/// </summary>
internal class Textfile : BaseReport
public class Textfile : BaseReport
{
protected bool _writeToConsole = false;
@@ -129,7 +129,7 @@ namespace SabreTools.Reports.Formats
/// <summary>
/// Console report format
/// </summary>
internal sealed class ConsoleOutput : Textfile
public sealed class ConsoleOutput : Textfile
{
/// <summary>
/// Create a new report from the filename