public void ApplyRule(MetadataRuleSet ruleSetSet, HashSet <MsDataFileUri> dataFileUris) { var skylineDataSchema = (SkylineDataSchema)_rootColumn.DataSchema; List <Step> resolvedRules = null; foreach (var resultFile in skylineDataSchema.ResultFileList.Values) { if (dataFileUris != null && !dataFileUris.Contains(resultFile.ChromFileInfo.FilePath)) { continue; } if (resolvedRules == null) { var ruleErrors = new List <CommonException <StepError> >(); resolvedRules = new List <Step>(); foreach (var rule in ruleSetSet.Rules) { var resolvedRule = ResolveStep(rule, ruleErrors); if (ruleErrors.Count > 0) { var ruleError = ruleErrors[0]; throw CommonException.Create( new RuleError(ruleSetSet.Name, resultFile.ChromFileInfo.FilePath, ruleError.Message), ruleError); } resolvedRules.Add(resolvedRule); } } var properties = new HashSet <PropertyPath>(); foreach (var rule in resolvedRules) { if (properties.Contains(rule.Def.Target)) { continue; } var result = ApplyStep(resultFile, rule); if (result.ErrorText != null) { throw CommonException.Create(new RuleError(ruleSetSet.Name, resultFile.ChromFileInfo.FilePath, result.ErrorText)); } if (!result.Match) { continue; } properties.Add(rule.Def.Target); rule.Target.SetTextValue(CultureInfo.InvariantCulture, resultFile, result.ReplacedValue); } } }
protected bool Equals(MetadataRuleSet other) { return(Name == other.Name && RowSource == other.RowSource && Equals(Rules, other.Rules)); }