#region using System.Collections.Generic; using System.IO; using Newtonsoft.Json.Linq; #endregion namespace NewHorizons.External.Configs { public class TranslationConfig { public Dictionary dialogueDictionary; public Dictionary shipLogDictionary; public Dictionary uiDictionary; public TranslationConfig(string filename) { var dict = JObject.Parse(File.ReadAllText(filename)).ToObject>(); if (dict.ContainsKey(nameof(dialogueDictionary))) dialogueDictionary = (Dictionary) (dict[nameof(dialogueDictionary)] as JObject).ToObject( typeof(Dictionary)); if (dict.ContainsKey(nameof(shipLogDictionary))) shipLogDictionary = (Dictionary) (dict[nameof(shipLogDictionary)] as JObject).ToObject( typeof(Dictionary)); if (dict.ContainsKey(nameof(uiDictionary))) uiDictionary = (Dictionary) (dict[nameof(uiDictionary)] as JObject).ToObject( typeof(Dictionary)); } } }