public LanguageConfig(JObject config) { Languages = (config["languages"] as JArray).Select(s => s.ToString()).ToArray(); //加载错误码信息 string error_code_path = Path.GetFullPath(config["error_code"]["path"].ToString()).TrimEnd('\\', '/'); string error_code_prefix = config["error_code"]["prefix"].ToString(); foreach (var item in Languages) { using StreamReader file = File.OpenText($@"{error_code_path}/{error_code_prefix}{item}.json"); using JsonTextReader reader = new JsonTextReader(file); JObject o = (JObject)JToken.ReadFrom(reader); Dictionary <string, string> error_dic = new Dictionary <string, string>(); var pairs = o.GetEnumerator(); while (pairs.MoveNext()) { error_dic.Add(pairs.Current.Key, pairs.Current.Value.ToString()); } ErrorCodeConfig.Add(item, error_dic); } }