Files
SabreTools/RombaSharp/Features/DatStats.cs

50 lines
1.4 KiB
C#
Raw Normal View History

2020-08-01 13:25:32 -07:00
using System.Collections.Generic;
using System.IO;
2020-12-10 23:24:09 -08:00
using SabreTools.DatTools;
2020-12-07 13:57:26 -08:00
using SabreTools.Help;
using SabreTools.Reports;
2020-08-01 13:25:32 -07:00
namespace RombaSharp.Features
{
internal class DatStats : BaseFeature
{
public const string Value = "DatStats";
public DatStats()
{
Name = Value;
Flags = ["datstats"];
2020-08-01 13:25:32 -07:00
Description = "Prints dat stats.";
2020-12-07 13:57:26 -08:00
_featureType = ParameterType.Flag;
2020-08-01 13:25:32 -07:00
LongDescription = "Print dat stats.";
Features = [];
2021-02-03 11:10:19 -08:00
// Common Features
AddCommonFeatures();
2020-08-01 13:25:32 -07:00
}
public override bool ProcessFeatures(Dictionary<string, Feature?> features)
2020-08-01 13:25:32 -07:00
{
2021-03-19 20:52:11 -07:00
// If the base fails, just fail out
if (!base.ProcessFeatures(features))
return false;
2020-08-01 13:25:32 -07:00
// If we have no inputs listed, we want to use datroot
if (Inputs == null || Inputs.Count == 0)
Inputs = new List<string> { Path.GetFullPath(_dats!) };
2020-08-01 13:25:32 -07:00
// Now output the stats for all inputs
var statistics = Statistics.CalculateStatistics(Inputs, single: true);
Statistics.Write(
statistics,
"rombasharp-datstats",
outDir: null,
baddumpCol: true,
nodumpCol: true,
StatReportFormat.Textfile);
2021-03-19 20:52:11 -07:00
return true;
2020-08-01 13:25:32 -07:00
}
}
}