コード例 #1
0
 /// <summary>
 /// 初始化系统配置信息
 /// </summary>
 private static void InitAppConfig()
 {
     if (IOSysJson.Inst.AppConfig == null)
     {
         string fullFileName = ComHelper.GetFullFileName("JSON/App.json");
         string jsonText     = File.ReadAllText(fullFileName);
         IOSysJson.Inst.AppConfig = JsonConvert.DeserializeObject <AppConfig>(jsonText);
     }
 }
コード例 #2
0
        /// <summary>
        /// 初始化提示信息(多语言)
        /// </summary>
        private static void InitMsgConfig()
        {
            if (IOSysJson.Inst.DicMsg == null)
            {
                IOSysJson.Inst.DicMsg = new Dictionary <string, ResourceConfig>();

                var path            = ComHelper.GetFullFileName("JSON");
                var arrFullFileName = Directory.GetFiles(path, "resource-*.json");
                foreach (var fullFileName in arrFullFileName)
                {
                    var jsonText  = File.ReadAllText(fullFileName);
                    var msgConfig = JsonConvert.DeserializeObject <ResourceConfig>(jsonText);

                    var fileName = Path.GetFileName(fullFileName);
                    //"resource-".Length=9   ".json".Length=5
                    var key = fileName.ToLower().Substring(9, fileName.Length - 14);

                    IOSysJson.Inst.DicMsg[key] = msgConfig;
                }
            }
        }