public static bool IsSegmentWithComments(this DisplayFilterRowInfo rowInfo, DisplayFilterSettings settings) { if (!rowInfo.IsSegment) { return(false); } var success = settings.SegmentReviewTypes.ToList() .Any(status => string.Compare(status, DisplayFilterSettings.SegmentReviewType.WithComments.ToString() , StringComparison.OrdinalIgnoreCase) == 0); var visitor = new CommentDataVisitor(); // check if comments exist in the target segment if (success && !visitor.GetComments(rowInfo.SegmentPair.Target).Any()) { // check if comments exit in the source segment if (!visitor.GetComments(rowInfo.SegmentPair.Source).Any()) { success = false; } } return(success); }
public static bool IsSeverityFoundInComment(this DisplayFilterRowInfo rowInfo, DisplayFilterSettings settings) { var visitor = new CommentDataVisitor(); var success = visitor.GetComments(rowInfo.SegmentPair.Target) .Any(comment => settings.CommentSeverity == (int)comment.Severity); if (!success) { success = visitor.GetComments(rowInfo.SegmentPair.Source) .Any(comment => settings.CommentSeverity == (int)comment.Severity); } return(success); }
public static bool IsAuthorFoundInComment(this DisplayFilterRowInfo rowInfo, DisplayFilterSettings settings) { var visitor = new CommentDataVisitor(); var success = visitor.GetComments(rowInfo.SegmentPair.Target) .Any(comment => StringMatch(settings.CommentAuthor, comment.Author, false)); if (!success) { success = visitor.GetComments(rowInfo.SegmentPair.Source) .Any(comment => StringMatch(settings.CommentAuthor, comment.Author, false)); } return(success); }
public bool Filter(DisplayFilterRowInfo rowInfo, bool success) { if (!rowInfo.IsSegment) { return(!HasCustomSettings()); } var rowId = rowInfo.SegmentPair.Properties.Id.Id; if (success && _customSettings.EvenNo) { success = SegmentNumbersHelper.IsEven(rowId); } if (success && _customSettings.OddsNo) { success = SegmentNumbersHelper.IsOdd(rowId); } if (success && _customSettings.SplitSegments) { success = SegmentNumbersHelper.IsSplitSegment(rowId, _document); } if (success && (_customSettings.MergedSegments || _customSettings.MergedAcross)) { success = SegmentNumbersHelper.IsMergedSegment(rowId, _document, _customSettings.MergedAcross); } if (success && _customSettings.SourceEqualsTarget) { success = SegmentNumbersHelper.IsSourceEqualsToTarget(rowInfo.SegmentPair, _customSettings.IsEqualsCaseSensitive); } if (success && _customSettings.Grouped && !string.IsNullOrWhiteSpace(_customSettings.GroupedList)) { success = SegmentNumbersHelper.IdInRange(rowId, _customSettings.GroupedList); } if (success && _customSettings.UseRegexCommentSearch && !string.IsNullOrWhiteSpace(_customSettings.CommentRegex)) { var visitor = new CommentDataVisitor(); var commentsList = visitor.GetComments(rowInfo.SegmentPair.Source); commentsList.AddRange(visitor.GetComments(rowInfo.SegmentPair.Target)); success = CommentsHelper.IsCommentTextFoundWithRegex(commentsList, _customSettings.CommentRegex); } if (success && _customSettings.Colors?.Count > 0) { success = ColorPickerHelper.ContainsColor(rowInfo, _customSettings.Colors, _customSettings.ColorsFoundIn); } if (success && !string.IsNullOrWhiteSpace(_customSettings.FuzzyMin) && !string.IsNullOrWhiteSpace(_customSettings.FuzzyMax)) { success = FuzzyHelper.IsInFuzzyRange(rowInfo, _customSettings.FuzzyMin, _customSettings.FuzzyMax); } if (success && _customSettings.ContainsTags) { var containsTagVisitor = new TagVisitor(); success = containsTagVisitor.ContainsTag(rowInfo.SegmentPair.Source); } if (success && _customSettings.CreatedByChecked && !string.IsNullOrWhiteSpace(_customSettings.CreatedBy)) { var userVisitor = new TranslationOriginMetaDataVisitor(); success = userVisitor.CreatedBy(rowInfo.SegmentPair.Source, _customSettings.CreatedBy); } if (success && _customSettings.ModifiedByChecked && !string.IsNullOrWhiteSpace(_customSettings.ModifiedBy)) { var userVisitor = new TranslationOriginMetaDataVisitor(); success = userVisitor.ModifiedBy(rowInfo.SegmentPair.Source, _customSettings.ModifiedBy); } if (success && !string.IsNullOrEmpty(_customSettings.DocumentStructureInformation)) { success = _settings.IsRegularExpression ? DocumentStructureInfoRegexSearch(rowInfo, _customSettings.DocumentStructureInformation, _settings.IsCaseSensitive ? RegexOptions.None : RegexOptions.IgnoreCase) : DocumentStructureInfoSearch(rowInfo, _customSettings); } return(success); }
public static List <IComment> GetComments(this ISegment segment) { var commentVisitor = new CommentDataVisitor(); return(commentVisitor.GetComments(segment)); }