using System.Collections.Generic;
using System.IO;
using Newtonsoft.Json.Linq;
namespace NewHorizons.External.Configs
{
public class TranslationConfig
{
///
/// Translation table for dialogue
///
public Dictionary DialogueDictionary;
///
/// Translation table for Ship Log (entries, facts, etc)
///
public Dictionary ShipLogDictionary;
///
/// Translation table for UI elements
///
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));
}
}
}