Add statistics recalculation to IDDB

This commit is contained in:
Matt Nadareski
2024-03-13 11:05:34 -04:00
parent 4bf536b072
commit 96f84e9c90

View File

@@ -468,5 +468,31 @@ namespace SabreTools.DatFiles
// TODO: Write a method that deduplicates items based on any of the fields selected
#endregion
#region Statistics
/// <summary>
/// Recalculate the statistics for the Dat
/// </summary>
public void RecalculateStats()
{
// Wipe out any stats already there
DatStatistics.ResetStatistics();
// If there are no items
if (_items == null || !_items.Any())
return;
// Loop through and add
foreach (var item in _items.Values)
{
if (item == null)
continue;
DatStatistics.AddItemStatistics(item);
}
}
#endregion
}
}