public static CriteriaMatchModel GetCriteriaMatches(int networkMapId, LineArgs source, LineArgs target, bool noNetworkMessages) { var matches = new List <CriteriaMatch>(); var map = XmlDal.DataModel.GetNetworkMap(networkMapId); var sourceMessage = XmlDal.CacheModel.GetFile(source.Path).GetNetworkMessage(source.iLine); if (sourceMessage == null) { Log.WriteError("sourceMessage should never be null!!!!", typeof(NetworkMapService).FullName, MethodBase.GetCurrentMethod().Name); return(new CriteriaMatchModel()); } var targetMessage = XmlDal.CacheModel.GetFile(target.Path).GetNetworkMessage(target.iLine); foreach (var criteria in map.Criteria) { var match = IsMatch(criteria, sourceMessage, targetMessage, target.Path); if (criteria.UseSourceValue) { match.SourceValue = $"=={match.CriteriaSourceValue} [{match.SourceValue}]"; } if (criteria.UseTargetValue) { match.TargetValue = $"=={match.CriteriaTargetValue} [{match.TargetValue}]"; } if (criteria.TimeConditionMs != null) { match.TargetValue = $"{match.TargetValue} tc:{criteria.TimeConditionMs}"; } matches.Add(new CriteriaMatch { Enabled = criteria.Enabled, IsMatch = match.IsMatch, Operator = criteria.Operator, SourceName = criteria.SourceName, SourceType = criteria.SourceType.ToString(), SourceValue = match.SourceValue, TargetName = criteria.TargetName, TargetType = criteria.TargetType.ToString(), TargetValue = match.TargetValue }); } LogPropertyBaseModel targetProperty = null; if (!noNetworkMessages) { targetProperty = PropertyService.GetProperty(target); } var sourceProperty = PropertyService.GetProperty(source); var dateTimeDifference = CalculateDateTimeDifference(targetProperty, sourceProperty); return(new CriteriaMatchModel { DateTimeDifference = dateTimeDifference, Matches = matches }); }