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 only adding statistics, we add an empty key for games and then just item stats
|
||||||
if (statsOnly)
|
if (statsOnly)
|
||||||
{
|
{
|
||||||
if (Items.ContainsKey(key))
|
Items.EnsureKey(key);
|
||||||
Items.Add(key, new List<DatItem>());
|
|
||||||
|
|
||||||
Items.AddItemStatistics(item);
|
Items.AddItemStatistics(item);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -669,6 +669,17 @@ namespace SabreTools.DatFiles
|
|||||||
return false;
|
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>
|
/// <summary>
|
||||||
/// Get a list of filtered items for a given key
|
/// Get a list of filtered items for a given key
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -768,17 +779,6 @@ namespace SabreTools.DatFiles
|
|||||||
bucketedBy = newBucket;
|
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>
|
/// <summary>
|
||||||
/// Remove from the statistics given a DatItem
|
/// Remove from the statistics given a DatItem
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ namespace SabreTools.DatTools
|
|||||||
|
|
||||||
logger.Verbose($"Beginning stat collection for '{file.CurrentPath}'");
|
logger.Verbose($"Beginning stat collection for '{file.CurrentPath}'");
|
||||||
List<string> games = new List<string>();
|
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);
|
datdata.Items.BucketBy(ItemKey.Machine, DedupeType.None, norename: true);
|
||||||
|
|
||||||
// Output single DAT stats (if asked)
|
// Output single DAT stats (if asked)
|
||||||
|
|||||||
Reference in New Issue
Block a user