示例#1
0
        public static (T, string) Load <T>(LogBase log, string filename, Type?type = null) where T : IConfig
        {
            var configName   = GetConfigName(log);
            var fullFilename = GetConfigFilename(filename, type);
            var configText   = File.ReadAllText(fullFilename);
            var allConfigs   = JsonConvert.DeserializeObject <T[]>(configText);

            var finalConfig   = GetConfig(allConfigs, "Base");
            var currentConfig = GetConfig(allConfigs, configName);

            finalConfig.Merge(currentConfig, jsonMergeSettings);

            var finalConfigClass = JsonConvert.DeserializeObject <T>(finalConfig.ToString());

            log?.Config(finalConfigClass, filename);

            return(finalConfigClass, configName);
        }