Keep counts on the tables loaded
This commit is contained in:
parent
ac57ecb939
commit
c6a5683fbc
|
@ -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<LoadDataAttribute>() is not null))
|
||||
{
|
||||
LoadDataAttribute attr = prop.GetCustomAttribute<LoadDataAttribute>()!;
|
||||
|
@ -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)
|
||||
|
|
Loading…
Reference in New Issue