// Called whenever _password changes value.
        // Offset/delta identify the character offset at which chars have been
        // added (delta > 0) or removed (delta < 0).
        private void OnPasswordChange(int offset, int delta)
        {
            PasswordTextPointer textPosition;
            int symbolCount;
            PrecursorTextChangeType operation;

            if (delta != 0)
            {
                UpdatePositionList(offset, delta);

                textPosition = new PasswordTextPointer(this, LogicalDirection.Forward, offset);

                if (delta > 0)
                {
                    symbolCount = delta;
                    operation   = PrecursorTextChangeType.ContentAdded;
                }
                else
                {
                    symbolCount = -delta;
                    operation   = PrecursorTextChangeType.ContentRemoved;
                }

                AddChange(textPosition, symbolCount, operation);
            }
        }
Пример #2
0
        // Token: 0x0600537C RID: 21372 RVA: 0x00172F30 File Offset: 0x00171130
        internal void AddPosition(PasswordTextPointer position)
        {
            this.RemoveUnreferencedPositions();
            if (this._positionList == null)
            {
                this._positionList = new ArrayList();
            }
            int index = this.FindIndex(position.Offset, position.LogicalDirection);

            this._positionList.Insert(index, new WeakReference(position));
            this.DebugAssertPositionList();
        }
Пример #3
0
        // Token: 0x0600539C RID: 21404 RVA: 0x00173274 File Offset: 0x00171474
        private void UpdatePositionList(int offset, int delta)
        {
            if (this._positionList == null)
            {
                return;
            }
            this.RemoveUnreferencedPositions();
            int i = this.FindIndex(offset, LogicalDirection.Forward);

            if (delta < 0)
            {
                int num = -1;
                while (i < this._positionList.Count)
                {
                    PasswordTextPointer pointerAtIndex = this.GetPointerAtIndex(i);
                    if (pointerAtIndex != null)
                    {
                        if (pointerAtIndex.Offset > offset + -delta)
                        {
                            break;
                        }
                        pointerAtIndex.Offset = offset;
                        if (pointerAtIndex.LogicalDirection == LogicalDirection.Backward)
                        {
                            if (num >= 0)
                            {
                                WeakReference value = (WeakReference)this._positionList[num];
                                this._positionList[num] = this._positionList[i];
                                this._positionList[i]   = value;
                                num++;
                            }
                        }
                        else if (num == -1)
                        {
                            num = i;
                        }
                    }
                    i++;
                }
            }
            while (i < this._positionList.Count)
            {
                PasswordTextPointer pointerAtIndex = this.GetPointerAtIndex(i);
                if (pointerAtIndex != null)
                {
                    pointerAtIndex.Offset += delta;
                }
                i++;
            }
            this.DebugAssertPositionList();
        }
Пример #4
0
        // Token: 0x0600539E RID: 21406 RVA: 0x001733A4 File Offset: 0x001715A4
        private int FindIndex(int offset, LogicalDirection gravity)
        {
            Invariant.Assert(this._positionList != null);
            int i;

            for (i = 0; i < this._positionList.Count; i++)
            {
                PasswordTextPointer pointerAtIndex = this.GetPointerAtIndex(i);
                if (pointerAtIndex != null && ((pointerAtIndex.Offset == offset && (pointerAtIndex.LogicalDirection == gravity || gravity == LogicalDirection.Backward)) || pointerAtIndex.Offset > offset))
                {
                    break;
                }
            }
            return(i);
        }
Пример #5
0
        // Token: 0x0600537D RID: 21373 RVA: 0x00172F84 File Offset: 0x00171184
        internal void RemovePosition(PasswordTextPointer searchPosition)
        {
            Invariant.Assert(this._positionList != null);
            int i;

            for (i = 0; i < this._positionList.Count; i++)
            {
                PasswordTextPointer pointerAtIndex = this.GetPointerAtIndex(i);
                if (pointerAtIndex == searchPosition)
                {
                    this._positionList.RemoveAt(i);
                    i = -1;
                    break;
                }
            }
            Invariant.Assert(i == -1, "Couldn't find position to remove!");
        }
Пример #6
0
 // Token: 0x0600539B RID: 21403 RVA: 0x00173238 File Offset: 0x00171438
 private void OnPasswordChange(int offset, int delta)
 {
     if (delta != 0)
     {
         this.UpdatePositionList(offset, delta);
         PasswordTextPointer startPosition = new PasswordTextPointer(this, LogicalDirection.Forward, offset);
         int symbolCount;
         PrecursorTextChangeType precursorTextChange;
         if (delta > 0)
         {
             symbolCount         = delta;
             precursorTextChange = PrecursorTextChangeType.ContentAdded;
         }
         else
         {
             symbolCount         = -delta;
             precursorTextChange = PrecursorTextChangeType.ContentRemoved;
         }
         this.AddChange(startPosition, symbolCount, precursorTextChange);
     }
 }
        // Removes a PasswordTextPointer from the list of live positions.
        // Positions in the list are updated as the document content changes.
        internal void RemovePosition(PasswordTextPointer searchPosition)
        {
            int index;
            PasswordTextPointer position;

            Invariant.Assert(_positionList != null);

            for (index = 0; index < _positionList.Count; index++)
            {
                position = GetPointerAtIndex(index);

                if (position == searchPosition)
                {
                    _positionList.RemoveAt(index);
                    // Tag index with a sentinel so we can assert below that we
                    // did find our position...
                    index = -1;
                    break;
                }
            }
            Invariant.Assert(index == -1, "Couldn't find position to remove!");
        }
Пример #8
0
 // Token: 0x0600539F RID: 21407 RVA: 0x00173400 File Offset: 0x00171600
 private void DebugAssertPositionList()
 {
     if (Invariant.Strict)
     {
         int num = -1;
         LogicalDirection logicalDirection = LogicalDirection.Backward;
         for (int i = 0; i < this._positionList.Count; i++)
         {
             PasswordTextPointer pointerAtIndex = this.GetPointerAtIndex(i);
             if (pointerAtIndex != null)
             {
                 Invariant.Assert(pointerAtIndex.Offset >= 0 && pointerAtIndex.Offset <= this._password.Length);
                 Invariant.Assert(num <= pointerAtIndex.Offset);
                 if (i > 0 && pointerAtIndex.LogicalDirection == LogicalDirection.Backward && num == pointerAtIndex.Offset)
                 {
                     Invariant.Assert(logicalDirection != LogicalDirection.Forward);
                 }
                 num = pointerAtIndex.Offset;
                 logicalDirection = pointerAtIndex.LogicalDirection;
             }
         }
     }
 }
Пример #9
0
        // Called whenever _password changes value.
        // Offset/delta identify the character offset at which chars have been
        // added (delta > 0) or removed (delta < 0). 
        private void OnPasswordChange(int offset, int delta)
        { 
            PasswordTextPointer textPosition; 
            int symbolCount;
            PrecursorTextChangeType operation; 

            if (delta != 0)
            {
                UpdatePositionList(offset, delta); 

                textPosition = new PasswordTextPointer(this, LogicalDirection.Forward, offset); 
 
                if (delta > 0)
                { 
                    symbolCount = delta;
                    operation = PrecursorTextChangeType.ContentAdded;
                }
                else 
                {
                    symbolCount = -delta; 
                    operation = PrecursorTextChangeType.ContentRemoved; 
                }
 
                AddChange(textPosition, symbolCount, operation);
            }
        }
Пример #10
0
        // Removes a PasswordTextPointer from the list of live positions.
        // Positions in the list are updated as the document content changes. 
        internal void RemovePosition(PasswordTextPointer searchPosition) 
        {
            int index; 
            PasswordTextPointer position;

            Invariant.Assert(_positionList != null);
 
            for (index = 0; index < _positionList.Count; index++)
            { 
                position = GetPointerAtIndex(index); 

                if (position == searchPosition) 
                {
                    _positionList.RemoveAt(index);
                    // Tag index with a sentinel so we can assert below that we
                    // did find our position... 
                    index = -1;
                    break; 
                } 
            }
            Invariant.Assert(index == -1, "Couldn't find position to remove!"); 
        }
Пример #11
0
        // Adds a PasswordTextPointer to the list of live positions.
        // Positions in the list are updated as the document content changes. 
        internal void AddPosition(PasswordTextPointer position)
        { 
            int index; 

            RemoveUnreferencedPositions(); 

            if (_positionList == null)
            {
                _positionList = new ArrayList(); 
            }
 
            index = FindIndex(position.Offset, position.LogicalDirection); 

            _positionList.Insert(index, new WeakReference(position)); 

            DebugAssertPositionList();
        }