// Token: 0x06007C92 RID: 31890 RVA: 0x00230870 File Offset: 0x0022EA70
        internal void RemoveRange(IHighlightRange highlightRange)
        {
            if (highlightRange.Range.Start.CompareTo(highlightRange.Range.End) == 0)
            {
                return;
            }
            int num;
            int num2;

            this.GetSpannedSegments(highlightRange.Range.Start, highlightRange.Range.End, out num, out num2);
            ITextPointer start = this._segments[num].Segment.Start;
            ITextPointer end   = this._segments[num2].Segment.End;
            int          i     = num;

            while (i <= num2)
            {
                AnnotationHighlightLayer.HighlightSegment highlightSegment = this._segments[i];
                if (highlightSegment.RemoveOwner(highlightRange) == 0)
                {
                    this._segments.Remove(highlightSegment);
                    num2--;
                }
                else
                {
                    i++;
                }
            }
            if (this.Changed != null && this.IsFixedContainer)
            {
                this.Changed(this, new AnnotationHighlightLayer.AnnotationHighlightChangedEventArgs(start, end));
            }
        }
 // Token: 0x06007C9D RID: 31901 RVA: 0x00230FE4 File Offset: 0x0022F1E4
 private ITextPointer GetNextBackwardPosition(StaticTextPointer pos)
 {
     for (int i = this._segments.Count - 1; i >= 0; i--)
     {
         AnnotationHighlightLayer.HighlightSegment highlightSegment = this._segments[i];
         if (pos.CompareTo(highlightSegment.Segment.End) > 0)
         {
             return(highlightSegment.Segment.End);
         }
         if (pos.CompareTo(highlightSegment.Segment.Start) > 0)
         {
             return(highlightSegment.Segment.Start);
         }
     }
     return(null);
 }
 // Token: 0x06007C9C RID: 31900 RVA: 0x00230F64 File Offset: 0x0022F164
 private ITextPointer GetNextForwardPosition(StaticTextPointer pos)
 {
     for (int i = 0; i < this._segments.Count; i++)
     {
         AnnotationHighlightLayer.HighlightSegment highlightSegment = this._segments[i];
         if (pos.CompareTo(highlightSegment.Segment.Start) < 0)
         {
             return(highlightSegment.Segment.Start);
         }
         if (pos.CompareTo(highlightSegment.Segment.End) < 0)
         {
             return(highlightSegment.Segment.End);
         }
     }
     return(null);
 }
        // Token: 0x06007C95 RID: 31893 RVA: 0x00230B1C File Offset: 0x0022ED1C
        internal override object GetHighlightValue(StaticTextPointer textPosition, LogicalDirection direction)
        {
            object result = DependencyProperty.UnsetValue;

            for (int i = 0; i < this._segments.Count; i++)
            {
                AnnotationHighlightLayer.HighlightSegment highlightSegment = this._segments[i];
                if (highlightSegment.Segment.Start.CompareTo(textPosition) > 0 || (highlightSegment.Segment.Start.CompareTo(textPosition) == 0 && direction == LogicalDirection.Backward))
                {
                    break;
                }
                if (highlightSegment.Segment.End.CompareTo(textPosition) > 0 || (highlightSegment.Segment.End.CompareTo(textPosition) == 0 && direction == LogicalDirection.Backward))
                {
                    result = highlightSegment;
                    break;
                }
            }
            return(result);
        }
 // Token: 0x06007C9E RID: 31902 RVA: 0x00231068 File Offset: 0x0022F268
 private void GetSpannedSegments(ITextPointer start, ITextPointer end, out int startSeg, out int endSeg)
 {
     startSeg = -1;
     endSeg   = -1;
     for (int i = 0; i < this._segments.Count; i++)
     {
         AnnotationHighlightLayer.HighlightSegment highlightSegment = this._segments[i];
         if (highlightSegment.Segment.Start.CompareTo(start) == 0)
         {
             startSeg = i;
         }
         if (highlightSegment.Segment.End.CompareTo(end) == 0)
         {
             endSeg = i;
             break;
         }
     }
     if (startSeg >= 0 && endSeg >= 0)
     {
         int num  = startSeg;
         int num2 = endSeg;
     }
 }
            // Token: 0x06008E56 RID: 36438 RVA: 0x0025BACC File Offset: 0x00259CCC
            internal IList <AnnotationHighlightLayer.HighlightSegment> Split(ITextPointer ps1, ITextPointer ps2, IHighlightRange newOwner)
            {
                IList <AnnotationHighlightLayer.HighlightSegment> list = new List <AnnotationHighlightLayer.HighlightSegment>();

                if (ps1.CompareTo(ps2) == 0)
                {
                    if (this._segment.Start.CompareTo(ps1) > 0 || this._segment.End.CompareTo(ps1) < 0)
                    {
                        return(list);
                    }
                    if (this._segment.Start.CompareTo(ps1) < 0)
                    {
                        list.Add(new AnnotationHighlightLayer.HighlightSegment(this._segment.Start, ps1, this._owners));
                    }
                    list.Add(new AnnotationHighlightLayer.HighlightSegment(ps1, ps1, this._owners));
                    if (this._segment.End.CompareTo(ps1) > 0)
                    {
                        list.Add(new AnnotationHighlightLayer.HighlightSegment(ps1, this._segment.End, this._owners));
                    }
                    using (IEnumerator <AnnotationHighlightLayer.HighlightSegment> enumerator = list.GetEnumerator())
                    {
                        while (enumerator.MoveNext())
                        {
                            AnnotationHighlightLayer.HighlightSegment highlightSegment = enumerator.Current;
                            highlightSegment.AddActiveOwners(this._activeOwners);
                        }
                        goto IL_1A1;
                    }
                }
                if (this._segment.Contains(ps1))
                {
                    IList <AnnotationHighlightLayer.HighlightSegment> list2 = this.Split(ps1, LogicalDirection.Forward);
                    for (int i = 0; i < list2.Count; i++)
                    {
                        if (list2[i].Segment.Contains(ps2))
                        {
                            IList <AnnotationHighlightLayer.HighlightSegment> list3 = list2[i].Split(ps2, LogicalDirection.Backward);
                            for (int j = 0; j < list3.Count; j++)
                            {
                                list.Add(list3[j]);
                            }
                            if (!list3.Contains(list2[i]))
                            {
                                list2[i].Discard();
                            }
                        }
                        else
                        {
                            list.Add(list2[i]);
                        }
                    }
                }
                else
                {
                    list = this.Split(ps2, LogicalDirection.Backward);
                }
IL_1A1:
                if (list != null && list.Count > 0 && newOwner != null)
                {
                    if (list.Count == 3)
                    {
                        list[1].AddOwner(newOwner);
                    }
                    else if (list[0].Segment.Start.CompareTo(ps1) == 0 || list[0].Segment.End.CompareTo(ps2) == 0)
                    {
                        list[0].AddOwner(newOwner);
                    }
                    else
                    {
                        list[1].AddOwner(newOwner);
                    }
                }
                return(list);
            }
        // Token: 0x06007C9B RID: 31899 RVA: 0x00230C80 File Offset: 0x0022EE80
        private void ProcessOverlapingSegments(IHighlightRange highlightRange, out ITextPointer invalidateStart, out ITextPointer invalidateEnd)
        {
            ReadOnlyCollection <TextSegment> textSegments = highlightRange.Range.TextSegments;

            invalidateStart = null;
            invalidateEnd   = null;
            int num = 0;
            IEnumerator <TextSegment> enumerator = textSegments.GetEnumerator();
            TextSegment textSegment = enumerator.MoveNext() ? enumerator.Current : TextSegment.Null;

            while (num < this._segments.Count && !textSegment.IsNull)
            {
                AnnotationHighlightLayer.HighlightSegment highlightSegment = this._segments[num];
                if (highlightSegment.Segment.Start.CompareTo(textSegment.Start) <= 0)
                {
                    if (highlightSegment.Segment.End.CompareTo(textSegment.Start) > 0)
                    {
                        IList <AnnotationHighlightLayer.HighlightSegment> list = highlightSegment.Split(textSegment.Start, textSegment.End, highlightRange);
                        if (!list.Contains(highlightSegment))
                        {
                            highlightSegment.ClearOwners();
                        }
                        this._segments.Remove(highlightSegment);
                        this._segments.InsertRange(num, list);
                        num = num + list.Count - 1;
                        if (textSegment.End.CompareTo(highlightSegment.Segment.End) <= 0)
                        {
                            textSegment = (enumerator.MoveNext() ? enumerator.Current : TextSegment.Null);
                        }
                        else
                        {
                            textSegment = new TextSegment(highlightSegment.Segment.End, textSegment.End);
                        }
                        if (invalidateStart == null)
                        {
                            invalidateStart = highlightSegment.Segment.Start;
                        }
                    }
                    else
                    {
                        num++;
                    }
                }
                else
                {
                    if (invalidateStart == null)
                    {
                        invalidateStart = textSegment.Start;
                    }
                    if (textSegment.End.CompareTo(highlightSegment.Segment.Start) > 0)
                    {
                        AnnotationHighlightLayer.HighlightSegment item = new AnnotationHighlightLayer.HighlightSegment(textSegment.Start, highlightSegment.Segment.Start, highlightRange);
                        this._segments.Insert(num++, item);
                        textSegment = new TextSegment(highlightSegment.Segment.Start, textSegment.End);
                    }
                    else
                    {
                        this._segments.Insert(num++, new AnnotationHighlightLayer.HighlightSegment(textSegment.Start, textSegment.End, highlightRange));
                        textSegment = (enumerator.MoveNext() ? enumerator.Current : TextSegment.Null);
                    }
                }
            }
            if (!textSegment.IsNull)
            {
                if (invalidateStart == null)
                {
                    invalidateStart = textSegment.Start;
                }
                this._segments.Insert(num++, new AnnotationHighlightLayer.HighlightSegment(textSegment.Start, textSegment.End, highlightRange));
            }
            while (enumerator.MoveNext())
            {
                List <AnnotationHighlightLayer.HighlightSegment> segments = this._segments;
                int          index        = num++;
                TextSegment  textSegment2 = enumerator.Current;
                ITextPointer start        = textSegment2.Start;
                textSegment2 = enumerator.Current;
                segments.Insert(index, new AnnotationHighlightLayer.HighlightSegment(start, textSegment2.End, highlightRange));
            }
            if (invalidateStart != null)
            {
                if (num == this._segments.Count)
                {
                    num--;
                }
                invalidateEnd = this._segments[num].Segment.End;
            }
        }