mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Move stats display out of DatFile
This commit is contained in:
@@ -6,7 +6,6 @@ using System.Xml.Serialization;
|
||||
|
||||
using SabreTools.Core;
|
||||
using SabreTools.DatFiles.Formats;
|
||||
using SabreTools.DatFiles.Reports;
|
||||
using SabreTools.DatItems;
|
||||
using SabreTools.IO;
|
||||
using SabreTools.Logging;
|
||||
@@ -301,8 +300,6 @@ namespace SabreTools.DatFiles
|
||||
return key;
|
||||
}
|
||||
|
||||
#region Input Sanitization
|
||||
|
||||
/// <summary>
|
||||
/// Get a sanitized Date from an input string
|
||||
/// </summary>
|
||||
@@ -344,24 +341,8 @@ namespace SabreTools.DatFiles
|
||||
|
||||
#endregion
|
||||
|
||||
#endregion
|
||||
|
||||
#region Writing
|
||||
|
||||
/// <summary>
|
||||
/// Write the stats out to console for the current DatFile
|
||||
/// </summary>
|
||||
public void WriteStatsToConsole()
|
||||
{
|
||||
if (Items.RomCount + Items.DiskCount == 0)
|
||||
Items.RecalculateStats();
|
||||
|
||||
Items.BucketBy(Field.Machine_Name, DedupeType.None, norename: true);
|
||||
|
||||
var consoleOutput = BaseReport.Create(StatReportFormat.None, null, true, true);
|
||||
consoleOutput.ReplaceStatistics(Header.FileName, Items.Keys.Count(), Items);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Create and open an output file for writing direct from a dictionary
|
||||
/// </summary>
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using SabreTools.Core;
|
||||
using SabreTools.DatFiles.Reports;
|
||||
using SabreTools.IO;
|
||||
using SabreTools.Logging;
|
||||
|
||||
@@ -95,6 +97,21 @@ namespace SabreTools.DatFiles
|
||||
return true;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Write the stats out to console for the current DatFile
|
||||
/// </summary>
|
||||
/// <param name="datFile">Current DatFile object to write from</param>
|
||||
public static void WriteStatsToConsole(DatFile datFile)
|
||||
{
|
||||
if (datFile.Items.RomCount + datFile.Items.DiskCount == 0)
|
||||
datFile.Items.RecalculateStats();
|
||||
|
||||
datFile.Items.BucketBy(Field.Machine_Name, DedupeType.None, norename: true);
|
||||
|
||||
var consoleOutput = BaseReport.Create(StatReportFormat.None, null, true, true);
|
||||
consoleOutput.ReplaceStatistics(datFile.Header.FileName, datFile.Items.Keys.Count(), datFile.Items);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensure that FileName, Name, and Description are filled with some value
|
||||
/// </summary>
|
||||
|
||||
@@ -91,7 +91,7 @@ namespace SabreTools.Features
|
||||
}
|
||||
|
||||
// Now write out if there are any items left
|
||||
datdata.WriteStatsToConsole();
|
||||
Writer.WriteStatsToConsole(datdata);
|
||||
Writer.Write(datdata, OutputDir);
|
||||
}
|
||||
}
|
||||
@@ -140,7 +140,7 @@ namespace SabreTools.Features
|
||||
}
|
||||
|
||||
// Now write out if there are any items left
|
||||
datdata.WriteStatsToConsole();
|
||||
Writer.WriteStatsToConsole(datdata);
|
||||
Writer.Write(datdata, OutputDir);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user