/// <summary> /// 刷新文件配置 /// </summary> /// <param name="zkHosts"></param> /// <param name="files"></param> private void RefreshAndInitFiles(string zkHosts, IEnumerable <string> files) { if (files != null) { var fileBuilder = new ZkFileTreeBuilder(config.ClientInfo.AppName, config.ClientInfo.Version, config.ClientInfo.Environment); foreach (var configName in files) { fileBuilder.GetOrAddZnodeName(configName); FileRules.For(configName).MapTo(configName); FileWatcher_NodeChanged(configName); } if (!string.IsNullOrWhiteSpace(zkHosts)) { _fileWatcher = new NodeWatcher(zkHosts, 30000, fileBuilder, config.ClientInfo.ClientName); _fileWatcher.NodeChanged += FileWatcher_NodeChanged; } } }