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;
|
2020-12-12 13:35:25 -08:00
|
|
|
|
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;
|
2024-03-06 01:04:51 -05:00
|
|
|
|
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.";
|
2024-03-05 20:26:38 -05:00
|
|
|
|
Features = [];
|
2021-02-03 11:10:19 -08:00
|
|
|
|
|
|
|
|
|
|
// Common Features
|
|
|
|
|
|
AddCommonFeatures();
|
2020-08-01 13:25:32 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-05 20:26:38 -05: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)
|
2024-03-06 01:04:51 -05:00
|
|
|
|
Inputs = new List<string> { Path.GetFullPath(_dats!) };
|
2020-08-01 13:25:32 -07:00
|
|
|
|
|
|
|
|
|
|
// Now output the stats for all inputs
|
2021-02-18 11:13:11 -08:00
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|