using BLHX.Server.Common.Utils; namespace BLHX.Server.Common.Data; public static class Data { static readonly Logger c = new(nameof(Data), ConsoleColor.Yellow); public static Dictionary ChapterTemplate = []; public static Dictionary ShipDataStatistics = []; public static Dictionary ShipDataTemplate = []; public static Dictionary TaskDataTemplate = []; public static void Load() { LoadData(ref ChapterTemplate, "chapter_template.json", nameof(ChapterTemplate)); LoadData(ref ShipDataStatistics, "ship_data_statistics.json", nameof(ShipDataStatistics)); LoadData(ref ShipDataTemplate, "ship_data_template.json", nameof(ShipDataTemplate)); LoadData(ref TaskDataTemplate, "task_data_template.json", nameof(TaskDataTemplate)); c.Log("All data tables loaded"); } static void LoadData(ref Dictionary data, string fileName, string dataName) { try { data = JSON.Load>(Path.Combine(JSON.ShareConfigPath, fileName)); c.Warn($"Loaded {data.Count} {dataName}"); } catch (Exception e) { c.Error(e.Message); } } }