Files
SabreTools/SabreTools.Reports/BaseReport.cs

46 lines
1.6 KiB
C#
Raw Normal View History

using System.Collections.Generic;
using SabreTools.DatFiles;
2024-10-24 00:36:44 -04:00
using SabreTools.IO.Logging;
2020-12-11 10:10:56 -08:00
namespace SabreTools.Reports
{
2019-02-08 20:53:13 -08:00
/// <summary>
/// Base class for a report output format
/// </summary>
public abstract class BaseReport
{
#region Logging
2019-02-08 20:53:13 -08:00
/// <summary>
/// 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
#endregion
/// <summary>
/// Set of DatStatistics objects to use for formatting
/// </summary>
protected List<DatStatistics> _statistics;
2019-02-08 20:53:13 -08:00
/// <summary>
/// Create a new report from the filename
2019-02-08 20:53:13 -08:00
/// </summary>
/// <param name="statsList">List of statistics objects to set</param>
public BaseReport(List<DatStatistics> statsList)
2019-02-08 20:53:13 -08:00
{
_statistics = statsList;
2019-02-08 20:53:13 -08:00
}
/// <summary>
/// Create and open an output file for writing direct from a set of statistics
2019-02-08 20:53:13 -08:00
/// </summary>
/// <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
}
}