mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Make stats use the reduced parsing model
This commit is contained in:
@@ -233,9 +233,7 @@ namespace SabreTools.DatFiles
|
||||
// If only adding statistics, we add an empty key for games and then just item stats
|
||||
if (statsOnly)
|
||||
{
|
||||
if (Items.ContainsKey(key))
|
||||
Items.Add(key, new List<DatItem>());
|
||||
|
||||
Items.EnsureKey(key);
|
||||
Items.AddItemStatistics(item);
|
||||
}
|
||||
else
|
||||
|
||||
@@ -669,6 +669,17 @@ namespace SabreTools.DatFiles
|
||||
return false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensure the key exists in the items dictionary
|
||||
/// </summary>
|
||||
/// <param name="key">Key to ensure</param>
|
||||
public void EnsureKey(string key)
|
||||
{
|
||||
// If the key is missing from the dictionary, add it
|
||||
if (!items.ContainsKey(key))
|
||||
items.TryAdd(key, new List<DatItem>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a list of filtered items for a given key
|
||||
/// </summary>
|
||||
@@ -768,17 +779,6 @@ namespace SabreTools.DatFiles
|
||||
bucketedBy = newBucket;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Ensure the key exists in the items dictionary
|
||||
/// </summary>
|
||||
/// <param name="key">Key to ensure</param>
|
||||
private void EnsureKey(string key)
|
||||
{
|
||||
// If the key is missing from the dictionary, add it
|
||||
if (!items.ContainsKey(key))
|
||||
items.TryAdd(key, new List<DatItem>());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Remove from the statistics given a DatItem
|
||||
/// </summary>
|
||||
|
||||
@@ -110,7 +110,7 @@ namespace SabreTools.DatTools
|
||||
|
||||
logger.Verbose($"Beginning stat collection for '{file.CurrentPath}'");
|
||||
List<string> games = new List<string>();
|
||||
DatFile datdata = Parser.CreateAndParse(file.CurrentPath);
|
||||
DatFile datdata = Parser.CreateAndParse(file.CurrentPath, statsOnly: true);
|
||||
datdata.Items.BucketBy(ItemKey.Machine, DedupeType.None, norename: true);
|
||||
|
||||
// Output single DAT stats (if asked)
|
||||
|
||||
Reference in New Issue
Block a user