Esempio n. 1
0
 // Token: 0x06004213 RID: 16915 RVA: 0x0012E47C File Offset: 0x0012C67C
 internal static string RemoveAccessKeyMarker(string text)
 {
     if (!string.IsNullOrEmpty(text))
     {
         string text2    = AccessText.AccessKeyMarker.ToString();
         string oldValue = text2 + text2;
         int    num      = AccessText.FindAccessKeyMarker(text);
         if (num >= 0 && num < text.Length - 1)
         {
             text = text.Remove(num, 1);
         }
         text = text.Replace(oldValue, text2);
     }
     return(text);
 }
Esempio n. 2
0
        // Token: 0x06004211 RID: 16913 RVA: 0x0012E228 File Offset: 0x0012C428
        private void UpdateAccessKey()
        {
            TextPointer textPointer = new TextPointer(this.TextContainer.Start);

            while (!this._accessKeyLocated && textPointer.CompareTo(this.TextContainer.End) < 0)
            {
                TextPointerContext pointerContext = textPointer.GetPointerContext(LogicalDirection.Forward);
                if (pointerContext == TextPointerContext.Text)
                {
                    string textInRun = textPointer.GetTextInRun(LogicalDirection.Forward);
                    int    num       = AccessText.FindAccessKeyMarker(textInRun);
                    if (num != -1 && num < textInRun.Length - 1)
                    {
                        string      nextTextElement  = StringInfo.GetNextTextElement(textInRun, num + 1);
                        TextPointer positionAtOffset = textPointer.GetPositionAtOffset(num + 1 + nextTextElement.Length);
                        this._accessKey       = new Run(nextTextElement);
                        this._accessKey.Style = AccessText.AccessKeyStyle;
                        this.RegisterAccessKey();
                        AccessText.HasCustomSerializationStorage.SetValue(this._accessKey, true);
                        this._accessKeyLocated = true;
                        this.UninitializeTextContainerListener();
                        this.TextContainer.BeginChange();
                        try
                        {
                            TextPointer textPointer2 = new TextPointer(textPointer, num);
                            TextRangeEdit.DeleteInlineContent(textPointer2, positionAtOffset);
                            this._accessKey.RepositionWithContent(textPointer2);
                        }
                        finally
                        {
                            this.TextContainer.EndChange();
                            this.InitializeTextContainerListener();
                        }
                    }
                }
                textPointer.MoveToNextContextPosition(LogicalDirection.Forward);
            }
            textPointer = new TextPointer(this.TextContainer.Start);
            string text     = AccessText.AccessKeyMarker.ToString();
            string oldValue = text + text;

            while (textPointer.CompareTo(this.TextContainer.End) < 0)
            {
                TextPointerContext pointerContext2 = textPointer.GetPointerContext(LogicalDirection.Forward);
                if (pointerContext2 == TextPointerContext.Text)
                {
                    string textInRun2 = textPointer.GetTextInRun(LogicalDirection.Forward);
                    string text2      = textInRun2.Replace(oldValue, text);
                    if (textInRun2 != text2)
                    {
                        TextPointer start        = new TextPointer(textPointer, 0);
                        TextPointer textPointer3 = new TextPointer(textPointer, textInRun2.Length);
                        this.UninitializeTextContainerListener();
                        this.TextContainer.BeginChange();
                        try
                        {
                            textPointer3.InsertTextInRun(text2);
                            TextRangeEdit.DeleteInlineContent(start, textPointer3);
                        }
                        finally
                        {
                            this.TextContainer.EndChange();
                            this.InitializeTextContainerListener();
                        }
                    }
                }
                textPointer.MoveToNextContextPosition(LogicalDirection.Forward);
            }
        }