diff --git a/SabreTools.DatFiles/DatStatistics.cs b/SabreTools.DatFiles/DatStatistics.cs
index 07491f5b..6a4c68db 100644
--- a/SabreTools.DatFiles/DatStatistics.cs
+++ b/SabreTools.DatFiles/DatStatistics.cs
@@ -66,12 +66,36 @@ namespace SabreTools.DatFiles
///
/// Total machine count to use on output
///
- public long MachineCount { get; set; } = 0;
+ public long MachineCount { get; set; }
///
/// Determines if statistics are for a directory or not
///
- public bool IsDirectory { get; set; } = false;
+ public readonly bool IsDirectory;
+
+ #endregion
+
+ #region Constructors
+
+ ///
+ /// Default constructor
+ ///
+ public DatStatistics()
+ {
+ DisplayName = null;
+ MachineCount = 0;
+ IsDirectory = false;
+ }
+
+ ///
+ /// Constructor for aggregate data
+ ///
+ public DatStatistics(string? displayName, bool isDirectory)
+ {
+ DisplayName = displayName;
+ MachineCount = 0;
+ IsDirectory = isDirectory;
+ }
#endregion
diff --git a/SabreTools.DatTools/Statistics.cs b/SabreTools.DatTools/Statistics.cs
index 51ffcc0e..15eb3287 100644
--- a/SabreTools.DatTools/Statistics.cs
+++ b/SabreTools.DatTools/Statistics.cs
@@ -48,20 +48,11 @@ namespace SabreTools.DatTools
.ToList();
// Init total
- DatStatistics totalStats = new()
- {
- DisplayName = "DIR: All DATs",
- MachineCount = 0,
- IsDirectory = true,
- };
+ DatStatistics totalStats = new("DIR: All DATs", isDirectory: true);
// Init directory-level variables
string? lastdir = null;
- DatStatistics dirStats = new()
- {
- MachineCount = 0,
- IsDirectory = true,
- };
+ DatStatistics dirStats = new(displayName: null, isDirectory: true);
// Now process each of the input files
foreach (ParentablePath file in files)
@@ -79,11 +70,7 @@ namespace SabreTools.DatTools
#endif
dirStats.MachineCount = dirStats.GameCount;
stats.Add(dirStats);
- dirStats = new DatStatistics
- {
- MachineCount = 0,
- IsDirectory = true,
- };
+ dirStats = new DatStatistics(displayName: null, isDirectory: true);
}
InternalStopwatch watch = new($"Collecting statistics for '{file.CurrentPath}'");
@@ -98,7 +85,6 @@ namespace SabreTools.DatTools
//DatStatistics individualStats = datdata.ItemsDB.DatStatistics;
individualStats.DisplayName = datdata.Header.GetStringFieldValue(DatHeader.FileNameKey);
individualStats.MachineCount = datdata.Items.Keys.Count;
- individualStats.IsDirectory = false;
stats.Add(individualStats);
}