示例#1
0
 // Token: 0x06003DA8 RID: 15784 RVA: 0x0011C590 File Offset: 0x0011A790
 internal static char[] CutText(TextTreeRootTextBlock rootTextBlock, int offset, int count)
 {
     char[] array = new char[count];
     TextTreeText.ReadText(rootTextBlock, offset, count, array, 0);
     TextTreeText.RemoveText(rootTextBlock, offset, count);
     return(array);
 }
        // Copies a run of text into a ContentContainer.
        // Returns the next node to examine.
        private TextTreeNode CopyTextNode(TextTreeTextNode textNode, TextTreeNode haltNode, out ContentContainer container)
        {
            SplayTreeNode node;

            char[] text;
            int    count;
            int    symbolOffset;

            Invariant.Assert(textNode != haltNode, "Expect at least one node to copy!");

            symbolOffset = textNode.GetSymbolOffset(this.TextContainer.Generation);

            // Get a count of all the characters we're about to copy.
            count = 0;
            node  = textNode;

            do
            {
                count += textNode.SymbolCount;

                node     = textNode.GetNextNode();
                textNode = node as TextTreeTextNode;
            }while (textNode != null && textNode != haltNode);

            // Allocate storage.
            text = new char[count];

            // Copy the text.
            TextTreeText.ReadText(this.TextContainer.RootTextBlock, symbolOffset, count, text, 0 /*startIndex*/);

            container = new TextContentContainer(text);

            return((TextTreeNode)node);
        }
示例#3
0
 // Token: 0x06003DAB RID: 15787 RVA: 0x0011C61F File Offset: 0x0011A81F
 internal static void InsertElementEdges(TextTreeRootTextBlock rootTextBlock, int offset, int childSymbolCount)
 {
     if (childSymbolCount == 0)
     {
         TextTreeText.InsertText(rootTextBlock, offset, new string('뻯', 2));
         return;
     }
     TextTreeText.InsertText(rootTextBlock, offset, new string('뻯', 1));
     TextTreeText.InsertText(rootTextBlock, offset + childSymbolCount + 1, new string('\0', 1));
 }
示例#4
0
 // Token: 0x06003DAC RID: 15788 RVA: 0x0011C65B File Offset: 0x0011A85B
 internal static void RemoveElementEdges(TextTreeRootTextBlock rootTextBlock, int offset, int symbolCount)
 {
     Invariant.Assert(symbolCount >= 2, "Element must span at least two symbols!");
     if (symbolCount == 2)
     {
         TextTreeText.RemoveText(rootTextBlock, offset, 2);
         return;
     }
     TextTreeText.RemoveText(rootTextBlock, offset + symbolCount - 1, 1);
     TextTreeText.RemoveText(rootTextBlock, offset, 1);
 }
示例#5
0
        // Token: 0x06003DA7 RID: 15783 RVA: 0x0011C4CC File Offset: 0x0011A6CC
        internal static void RemoveText(TextTreeRootTextBlock rootTextBlock, int offset, int count)
        {
            if (count == 0)
            {
                return;
            }
            int num;
            TextTreeTextBlock textTreeTextBlock = TextTreeText.FindBlock(rootTextBlock, offset, out num);

            if (textTreeTextBlock.Count == num)
            {
                textTreeTextBlock = (TextTreeTextBlock)textTreeTextBlock.GetNextNode();
                Invariant.Assert(textTreeTextBlock != null);
                num = 0;
            }
            int num2;
            TextTreeTextBlock textTreeTextBlock2 = TextTreeText.FindBlock(rootTextBlock, offset + count, out num2);
            int           num3;
            SplayTreeNode splayTreeNode;

            if (num > 0 || count < textTreeTextBlock.Count)
            {
                num3 = Math.Min(count, textTreeTextBlock.Count - num);
                textTreeTextBlock.RemoveText(num, num3);
                splayTreeNode = textTreeTextBlock.GetNextNode();
            }
            else
            {
                num3          = 0;
                splayTreeNode = textTreeTextBlock;
            }
            if (count > num3)
            {
                int           num4;
                SplayTreeNode splayTreeNode2;
                if (num2 < textTreeTextBlock2.Count)
                {
                    num4 = num2;
                    textTreeTextBlock2.RemoveText(0, num2);
                    splayTreeNode2 = textTreeTextBlock2.GetPreviousNode();
                }
                else
                {
                    num4           = 0;
                    splayTreeNode2 = textTreeTextBlock2;
                }
                if (num3 + num4 < count)
                {
                    TextTreeText.Remove((TextTreeTextBlock)splayTreeNode, (TextTreeTextBlock)splayTreeNode2);
                }
            }
        }
        // Token: 0x06003D13 RID: 15635 RVA: 0x0011BAC8 File Offset: 0x00119CC8
        private TextTreeNode CopyTextNode(TextTreeTextNode textNode, TextTreeNode haltNode, out TextTreeDeleteContentUndoUnit.ContentContainer container)
        {
            Invariant.Assert(textNode != haltNode, "Expect at least one node to copy!");
            int           symbolOffset = textNode.GetSymbolOffset(base.TextContainer.Generation);
            int           num          = 0;
            SplayTreeNode nextNode;

            do
            {
                num     += textNode.SymbolCount;
                nextNode = textNode.GetNextNode();
                textNode = (nextNode as TextTreeTextNode);
            }while (textNode != null && textNode != haltNode);
            char[] array = new char[num];
            TextTreeText.ReadText(base.TextContainer.RootTextBlock, symbolOffset, num, array, 0);
            container = new TextTreeDeleteContentUndoUnit.TextContentContainer(array);
            return((TextTreeNode)nextNode);
        }
示例#7
0
        // Token: 0x06003DA6 RID: 15782 RVA: 0x0011C460 File Offset: 0x0011A660
        internal static void InsertText(TextTreeRootTextBlock rootTextBlock, int offset, object text)
        {
            Invariant.Assert(text is string || text is char[], "Bad text parameter!");
            int logicalOffset;
            TextTreeTextBlock textTreeTextBlock = TextTreeText.FindBlock(rootTextBlock, offset, out logicalOffset);
            int textLength = TextContainer.GetTextLength(text);
            int num        = textTreeTextBlock.InsertText(logicalOffset, text, 0, textLength);

            if (num < textLength)
            {
                if (textTreeTextBlock.GapOffset < 2048)
                {
                    TextTreeText.InsertTextLeft(textTreeTextBlock, text, num);
                    return;
                }
                TextTreeText.InsertTextRight(textTreeTextBlock, text, num);
            }
        }
示例#8
0
 // Token: 0x06003DA9 RID: 15785 RVA: 0x0011C5B8 File Offset: 0x0011A7B8
 internal static void ReadText(TextTreeRootTextBlock rootTextBlock, int offset, int count, char[] chars, int startIndex)
 {
     if (count > 0)
     {
         int logicalOffset;
         TextTreeTextBlock textTreeTextBlock = TextTreeText.FindBlock(rootTextBlock, offset, out logicalOffset);
         for (;;)
         {
             Invariant.Assert(textTreeTextBlock != null, "Caller asked for too much text!");
             int num = textTreeTextBlock.ReadText(logicalOffset, count, chars, startIndex);
             logicalOffset = 0;
             count        -= num;
             if (count == 0)
             {
                 break;
             }
             startIndex       += num;
             textTreeTextBlock = (TextTreeTextBlock)textTreeTextBlock.GetNextNode();
         }
     }
 }
示例#9
0
 // Token: 0x06003DAA RID: 15786 RVA: 0x0011C60B File Offset: 0x0011A80B
 internal static void InsertObject(TextTreeRootTextBlock rootTextBlock, int offset)
 {
     TextTreeText.InsertText(rootTextBlock, offset, new string(char.MaxValue, 1));
 }