2021-02-18 11:13:11 -08:00
|
|
|
|
using System.Collections.Generic;
|
2024-03-13 01:22:59 -04:00
|
|
|
|
using SabreTools.DatFiles;
|
2024-10-24 00:36:44 -04:00
|
|
|
|
using SabreTools.IO.Logging;
|
2017-11-07 13:56:15 -08:00
|
|
|
|
|
2020-12-11 10:10:56 -08:00
|
|
|
|
namespace SabreTools.Reports
|
2017-11-07 13:56:15 -08:00
|
|
|
|
{
|
2019-02-08 20:53:13 -08:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Base class for a report output format
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
public abstract class BaseReport
|
|
|
|
|
|
{
|
2021-02-18 11:13:11 -08:00
|
|
|
|
#region Logging
|
2017-11-07 13:56:15 -08:00
|
|
|
|
|
2019-02-08 20:53:13 -08:00
|
|
|
|
/// <summary>
|
2021-02-18 11:13:11 -08:00
|
|
|
|
/// Logging object
|
2019-02-08 20:53:13 -08:00
|
|
|
|
/// </summary>
|
2025-01-08 16:59:44 -05:00
|
|
|
|
protected readonly Logger _logger = new();
|
2020-07-23 11:40:45 -07:00
|
|
|
|
|
2021-02-18 11:13:11 -08:00
|
|
|
|
#endregion
|
|
|
|
|
|
|
2025-02-19 13:26:53 -05:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Set of DatStatistics objects to use for formatting
|
|
|
|
|
|
/// </summary>
|
|
|
|
|
|
protected List<DatStatistics> _statistics;
|
2017-11-07 13:56:15 -08:00
|
|
|
|
|
2019-02-08 20:53:13 -08:00
|
|
|
|
/// <summary>
|
2021-02-18 11:13:11 -08:00
|
|
|
|
/// Create a new report from the filename
|
2019-02-08 20:53:13 -08:00
|
|
|
|
/// </summary>
|
2021-02-18 11:13:11 -08:00
|
|
|
|
/// <param name="statsList">List of statistics objects to set</param>
|
|
|
|
|
|
public BaseReport(List<DatStatistics> statsList)
|
2019-02-08 20:53:13 -08:00
|
|
|
|
{
|
2025-02-19 13:26:53 -05:00
|
|
|
|
_statistics = statsList;
|
2019-02-08 20:53:13 -08:00
|
|
|
|
}
|
2017-11-07 13:56:15 -08:00
|
|
|
|
|
2020-07-15 09:41:59 -07:00
|
|
|
|
/// <summary>
|
2021-02-18 11:13:11 -08:00
|
|
|
|
/// Create and open an output file for writing direct from a set of statistics
|
2019-02-08 20:53:13 -08:00
|
|
|
|
/// </summary>
|
2021-02-18 11:13:11 -08:00
|
|
|
|
/// <param name="outfile">Name of the file to write to</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="throwOnError">True if the error that is thrown should be thrown back to the caller, false otherwise</param>
|
|
|
|
|
|
/// <returns>True if the report was written correctly, false otherwise</returns>
|
2024-02-28 19:19:50 -05:00
|
|
|
|
public abstract bool WriteToFile(string? outfile, bool baddumpCol, bool nodumpCol, bool throwOnError = false);
|
2019-02-08 20:53:13 -08:00
|
|
|
|
}
|
2017-11-07 13:56:15 -08:00
|
|
|
|
}
|