34 lines
964 B
C#
34 lines
964 B
C#
using System.Collections.Generic;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
namespace NBC
|
|
{
|
|
public struct LanguageFontConfig
|
|
{
|
|
public string Type;
|
|
public string Name;
|
|
public string RelativePath;
|
|
}
|
|
|
|
public class LanguageConfig
|
|
{
|
|
public string Key;
|
|
private readonly Dictionary<string, string> _languages = new Dictionary<string, string>();
|
|
|
|
public string this[string key] => _languages.GetValueOrDefault(key, key);
|
|
|
|
public Dictionary<string, string>.KeyCollection Keys => _languages.Keys;
|
|
|
|
public void Parse(JToken row)
|
|
{
|
|
Key = row["key"].ToString();
|
|
var children = row.Children();
|
|
foreach (var child in children)
|
|
{
|
|
if (child is not JProperty property) continue;
|
|
if (property.Name == "key") continue;
|
|
_languages[property.Name] = property.Value.ToString();
|
|
}
|
|
}
|
|
}
|
|
} |