mirror of
https://github.com/claunia/SabreTools.git
synced 2025-12-16 19:14:27 +00:00
Make statistics a bit less strange
This commit is contained in:
@@ -66,12 +66,36 @@ namespace SabreTools.DatFiles
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Total machine count to use on output
|
/// Total machine count to use on output
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public long MachineCount { get; set; } = 0;
|
public long MachineCount { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines if statistics are for a directory or not
|
/// Determines if statistics are for a directory or not
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool IsDirectory { get; set; } = false;
|
public readonly bool IsDirectory;
|
||||||
|
|
||||||
|
#endregion
|
||||||
|
|
||||||
|
#region Constructors
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Default constructor
|
||||||
|
/// </summary>
|
||||||
|
public DatStatistics()
|
||||||
|
{
|
||||||
|
DisplayName = null;
|
||||||
|
MachineCount = 0;
|
||||||
|
IsDirectory = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Constructor for aggregate data
|
||||||
|
/// </summary>
|
||||||
|
public DatStatistics(string? displayName, bool isDirectory)
|
||||||
|
{
|
||||||
|
DisplayName = displayName;
|
||||||
|
MachineCount = 0;
|
||||||
|
IsDirectory = isDirectory;
|
||||||
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
|||||||
@@ -48,20 +48,11 @@ namespace SabreTools.DatTools
|
|||||||
.ToList();
|
.ToList();
|
||||||
|
|
||||||
// Init total
|
// Init total
|
||||||
DatStatistics totalStats = new()
|
DatStatistics totalStats = new("DIR: All DATs", isDirectory: true);
|
||||||
{
|
|
||||||
DisplayName = "DIR: All DATs",
|
|
||||||
MachineCount = 0,
|
|
||||||
IsDirectory = true,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Init directory-level variables
|
// Init directory-level variables
|
||||||
string? lastdir = null;
|
string? lastdir = null;
|
||||||
DatStatistics dirStats = new()
|
DatStatistics dirStats = new(displayName: null, isDirectory: true);
|
||||||
{
|
|
||||||
MachineCount = 0,
|
|
||||||
IsDirectory = true,
|
|
||||||
};
|
|
||||||
|
|
||||||
// Now process each of the input files
|
// Now process each of the input files
|
||||||
foreach (ParentablePath file in files)
|
foreach (ParentablePath file in files)
|
||||||
@@ -79,11 +70,7 @@ namespace SabreTools.DatTools
|
|||||||
#endif
|
#endif
|
||||||
dirStats.MachineCount = dirStats.GameCount;
|
dirStats.MachineCount = dirStats.GameCount;
|
||||||
stats.Add(dirStats);
|
stats.Add(dirStats);
|
||||||
dirStats = new DatStatistics
|
dirStats = new DatStatistics(displayName: null, isDirectory: true);
|
||||||
{
|
|
||||||
MachineCount = 0,
|
|
||||||
IsDirectory = true,
|
|
||||||
};
|
|
||||||
}
|
}
|
||||||
|
|
||||||
InternalStopwatch watch = new($"Collecting statistics for '{file.CurrentPath}'");
|
InternalStopwatch watch = new($"Collecting statistics for '{file.CurrentPath}'");
|
||||||
@@ -98,7 +85,6 @@ namespace SabreTools.DatTools
|
|||||||
//DatStatistics individualStats = datdata.ItemsDB.DatStatistics;
|
//DatStatistics individualStats = datdata.ItemsDB.DatStatistics;
|
||||||
individualStats.DisplayName = datdata.Header.GetStringFieldValue(DatHeader.FileNameKey);
|
individualStats.DisplayName = datdata.Header.GetStringFieldValue(DatHeader.FileNameKey);
|
||||||
individualStats.MachineCount = datdata.Items.Keys.Count;
|
individualStats.MachineCount = datdata.Items.Keys.Count;
|
||||||
individualStats.IsDirectory = false;
|
|
||||||
stats.Add(individualStats);
|
stats.Add(individualStats);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user