private GlobalConfigData Initialize() { GlobalConfigData globalConfigData; using (ConfigDataLoader dataLoader = new ConfigDataLoader()) { globalConfigData = dataLoader.Load(ConfigData.GetProperty <string>(Constants.ConfigFile)); InitializeExpressionInfos(globalConfigData, dataLoader); } return(globalConfigData); }
private void InitializeExpressionInfos(GlobalConfigData globalConfigData, ConfigDataLoader dataLoader) { // 获取表达式符号信息并添加到SequenceManager和EngineCore的配置信息中 ExpressionOperatorConfiguration expressionTokens = GetExpressionTokens(globalConfigData, dataLoader); // 添加操作符到操作符信息的映射 Dictionary <string, ExpressionOperatorInfo> operatorInfos = new Dictionary <string, ExpressionOperatorInfo>(expressionTokens.Operators.Count); foreach (ExpressionOperatorInfo operatorInfo in expressionTokens.Operators) { operatorInfos.Add(operatorInfo.Symbol, operatorInfo); } globalConfigData.AddConfigItem(Constants.SequenceManage, "ExpressionOperators", operatorInfos); globalConfigData.AddConfigItem(Constants.EngineConfig, "ExpressionOperators", operatorInfos); globalConfigData.AddConfigItem(Constants.ParamCheck, "ExpressionOperators", operatorInfos); // 添加计算类的信息 globalConfigData.AddConfigItem(Constants.SequenceManage, "ExpressionCalculators", expressionTokens.Calculators); globalConfigData.AddConfigItem(Constants.EngineConfig, "ExpressionCalculators", expressionTokens.Calculators); globalConfigData.AddConfigItem(Constants.ParamCheck, "ExpressionCalculators", expressionTokens.Calculators); }
private ExpressionOperatorConfiguration GetExpressionTokens(GlobalConfigData globalConfigData, ConfigDataLoader dataLoader) { string testflowHome = globalConfigData.GetConfigValue <string>(Constants.GlobalConfig, "TestflowHome"); string expressionConfigFile = $"{testflowHome}{CommonConst.DeployDir}{Path.DirectorySeparatorChar}expressionconfig.xml"; ExpressionOperatorConfiguration expressionTokens = dataLoader.LoadExpressionTokens(expressionConfigFile); // 有效化ExpressTokens ValidateExpressionTokens(globalConfigData, expressionTokens); return(expressionTokens); }