mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
* Add DatStatistics class * Add isDirectory setting * Add CalculateStatistics method (nw) * Add separate stats writing * Use new methods * Rename Write -> WriteIndividual * Naive implementation of new writing (nw) * Remove unncessary calls * Make writing more DatFile-like * Add console flag to constructor * Remove unused stream constructors * Move to local writers * Remove inherent filename * Fix invocation * Use SeparatedValueWriter * Fix final directory stats output * Use XmlTextWriter for HTML * Don't output separator on last stat output * Remove now-completed TODOs * Remove unused using
47 lines
1.3 KiB
C#
47 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
using System.IO;
|
|
|
|
using SabreTools.DatTools;
|
|
using SabreTools.Help;
|
|
using SabreTools.Reports;
|
|
|
|
namespace RombaSharp.Features
|
|
{
|
|
internal class DatStats : BaseFeature
|
|
{
|
|
public const string Value = "DatStats";
|
|
|
|
public DatStats()
|
|
{
|
|
Name = Value;
|
|
Flags = new List<string>() { "datstats" };
|
|
Description = "Prints dat stats.";
|
|
_featureType = ParameterType.Flag;
|
|
LongDescription = "Print dat stats.";
|
|
Features = new Dictionary<string, Feature>();
|
|
|
|
// Common Features
|
|
AddCommonFeatures();
|
|
}
|
|
|
|
public override void ProcessFeatures(Dictionary<string, Feature> features)
|
|
{
|
|
base.ProcessFeatures(features);
|
|
|
|
// If we have no inputs listed, we want to use datroot
|
|
if (Inputs == null || Inputs.Count == 0)
|
|
Inputs = new List<string> { Path.GetFullPath(_dats) };
|
|
|
|
// 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);
|
|
}
|
|
}
|
|
}
|