// 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);
        }
Esempio n. 2
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);
 }
        // 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);
        }