From c6a5683fbc4df027e3fe226e433ffd061f538b89 Mon Sep 17 00:00:00 2001 From: Kyle873 Date: Sun, 26 May 2024 20:11:10 -0400 Subject: [PATCH] Keep counts on the tables loaded --- Elisa/Data/Table.cs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Elisa/Data/Table.cs b/Elisa/Data/Table.cs index 35513ae..65f4fbc 100644 --- a/Elisa/Data/Table.cs +++ b/Elisa/Data/Table.cs @@ -86,6 +86,10 @@ public static class Table public static void Load() { + int catchDataCount = 0; + int stcCount = 0; + int textCount = 0; + foreach (PropertyInfo? prop in typeof(Table).GetProperties().Where(x => x.GetCustomAttribute() is not null)) { LoadDataAttribute attr = prop.GetCustomAttribute()!; @@ -98,18 +102,21 @@ public static class Table object? value = JsonSerializer.Deserialize(entry.Value.GetRawText(), prop.PropertyType, new JsonSerializerOptions { PropertyNameCaseInsensitive = true }); prop.SetValue(null, value); Log.Information($"Loaded {(prop.GetValue(null) as IList)?.Count} entries from {prop.Name} catchdata table"); + catchDataCount++; break; case LoadDataType.STC: prop.SetValue(null, typeof(JSON).GetMethod(nameof(JSON.Load))!.MakeGenericMethod(prop.PropertyType).Invoke(null, [Path.Combine(GetPath(attr.DataType), attr.FileName), false])); Log.Information($"Loaded {(prop.GetValue(null) as IList)?.Count} entries from {prop.Name} stc table"); + stcCount++; break; case LoadDataType.Text: // TODO: textdata is just a flat list of key-value pairs that are looked up from stc + textCount++; break; } } - Log.Information("All data tables loaded"); + Log.Information($"Finished loading data tables ({catchDataCount} catchdata, {stcCount} stc, {textCount} text)"); } public static string GetPath(LoadDataType type)