Ejemplo n.º 1
0
        public override void ProcessParagraphUnit(IParagraphUnit paragraphUnit)
        {
            if (paragraphUnit.IsStructure || !paragraphUnit.SegmentPairs.Any())
            {
                base.ProcessParagraphUnit(paragraphUnit);
                return;
            }

            var updatedSegmentPairs = _updatedSegmentPairs.Where(a =>
                                                                 a.ParagraphUnitId == paragraphUnit.Properties.ParagraphUnitId.Id).ToList();

            TotalSegments = paragraphUnit.SegmentPairs.Count();

            if (updatedSegmentPairs.Any())
            {
                foreach (var segmentPair in paragraphUnit.SegmentPairs)
                {
                    var updatedSegmentPair = updatedSegmentPairs.FirstOrDefault(a =>
                                                                                a.SegmentId == segmentPair.Properties.Id.Id);

                    if (updatedSegmentPair?.SegmentPair?.Target == null ||
                        IsSame(segmentPair.Target, updatedSegmentPair.SegmentPair.Target) ||
                        IsEmpty(updatedSegmentPair.SegmentPair.Target))
                    {
                        continue;
                    }


                    if (_excludeFilterIds.Count > 0)
                    {
                        var status = segmentPair.Properties.ConfirmationLevel.ToString();
                        var match  = _filterItemService.GetTranslationOriginType(segmentPair.Target.Properties.TranslationOrigin,
                                                                                 _analysisBands);

                        if ((segmentPair.Properties.IsLocked && _excludeFilterIds.Exists(a => a == "Locked")) ||
                            _excludeFilterIds.Exists(a => a == status) ||
                            _excludeFilterIds.Exists(a => a == match))
                        {
                            ExcludedSegments++;
                            continue;
                        }
                    }

                    segmentPair.Target.Clear();
                    foreach (var item in updatedSegmentPair.SegmentPair.Target)
                    {
                        segmentPair.Target.Add(item.Clone() as IAbstractMarkupData);
                    }

                    segmentPair.Properties = updatedSegmentPair.SegmentPair.Properties;

                    UpdatedSegments++;
                }
            }

            base.ProcessParagraphUnit(paragraphUnit);
        }
Ejemplo n.º 2
0
        private bool SegmentIsExcluded(List <string> excludeFilterIds, ISegmentPair segmentPair)
        {
            var segmentIsExcluded = false;

            if (segmentPair != null && excludeFilterIds?.Count > 0)
            {
                var status = segmentPair.Properties.ConfirmationLevel.ToString();
                var match  = _filterItemService.GetTranslationOriginType(
                    segmentPair.Target.Properties.TranslationOrigin);

                if ((segmentPair.Properties.IsLocked && excludeFilterIds.Exists(a => a == "Locked")) ||
                    excludeFilterIds.Exists(a => a == status) ||
                    excludeFilterIds.Exists(a => a == match))
                {
                    segmentIsExcluded = true;
                }
            }

            return(segmentIsExcluded);
        }