示例#1
0
        public bool EvaluateRow(DisplayFilterRowInfo rowInfo)
        {
            var success = Settings.ShowAllContent || rowInfo.IsSegment;

            if (rowInfo.IsSegment)
            {
                if (ReverseSearch)
                {
                    return(CustomFilterHelper.Reverse(Settings, success, rowInfo, CustomSettings, ActiveDocument));
                }

                if (success && Settings.SegmentReviewTypes != null && Settings.SegmentReviewTypes.Any())
                {
                    success = rowInfo.IsSegmentReviewTypes(Settings);
                }

                if (success && Settings.ConfirmationLevels != null && Settings.ConfirmationLevels.Any())
                {
                    success = rowInfo.IsConfirmationLevelFound(Settings);
                }

                if (success && Settings.OriginTypes != null && Settings.OriginTypes.Any())
                {
                    if (!Settings.OriginTypes.Contains("EditedF") && !Settings.OriginTypes.Contains("UneditedF"))
                    {
                        success = rowInfo.IsOriginTypeFound(Settings);
                    }
                }

                if (success && Settings.PreviousOriginTypes != null && Settings.PreviousOriginTypes.Any())
                {
                    success = rowInfo.IsPreviousOriginTypeFound(Settings);
                }

                if (success && Settings.RepetitionTypes != null && Settings.RepetitionTypes.Any())
                {
                    if (!Settings.RepetitionTypes.Contains("Unique"))
                    {
                        success = rowInfo.IsRepetitionTypes(Settings);
                    }
                }

                if (success && Settings.SegmentLockingTypes != null && Settings.SegmentLockingTypes.Any())
                {
                    success = rowInfo.IsSegmentLockingTypes(Settings);
                }


                if (success && Settings.SegmentContentTypes != null && Settings.SegmentContentTypes.Any())
                {
                    success = rowInfo.IsSegmentContentTypes(Settings);
                }


                if (success && !string.IsNullOrEmpty(Settings.SourceText))
                {
                    success = IsExpressionFound(Settings.SourceText, rowInfo.SegmentPair.Source);
                }
                if (success && !string.IsNullOrEmpty(Settings.TargetText))
                {
                    success = IsExpressionFound(Settings.TargetText, rowInfo.SegmentPair.Target);
                }

                if (success && !CustomSettings.UseRegexCommentSearch && !string.IsNullOrEmpty(Settings.CommentText))
                {
                    success = rowInfo.IsTextFoundInComment(Settings);
                }


                if (success && !string.IsNullOrEmpty(Settings.CommentAuthor))
                {
                    success = rowInfo.IsAuthorFoundInComment(Settings);
                }


                if (success && Settings.CommentSeverity > 0)
                {
                    success = rowInfo.IsSeverityFoundInComment(Settings);
                }


                if (success && Settings.ContextInfoTypes.Any())
                {
                    success = rowInfo.IsContextInfoTypes(Settings);
                }

                // check custom settings
                if (success)
                {
                    success = CustomFilterHelper.Filter(CustomSettings, Settings, rowInfo, true, ActiveDocument);
                }
            }
            return(success);
        }