diff --git a/SabreTools.DatFiles/ItemDictionaryDB.cs b/SabreTools.DatFiles/ItemDictionaryDB.cs index 8d6e1721..3e20eb46 100644 --- a/SabreTools.DatFiles/ItemDictionaryDB.cs +++ b/SabreTools.DatFiles/ItemDictionaryDB.cs @@ -468,5 +468,31 @@ namespace SabreTools.DatFiles // TODO: Write a method that deduplicates items based on any of the fields selected #endregion + + #region Statistics + + /// + /// Recalculate the statistics for the Dat + /// + 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 } }