Exemplo n.º 1
0
        /// <summary>
        /// Concatenates the specified rich texts.
        /// </summary>
        public static RichText Concat(params RichText[] texts)
        {
            if (texts == null || texts.Length == 0)
            {
                return(Empty);
            }
            else if (texts.Length == 1)
            {
                return(texts[0]);
            }
            string        newText = string.Concat(texts.Select(txt => txt.text));
            RichTextModel model   = texts[0].ToRichTextModel();
            int           offset  = texts[0].Length;

            for (int i = 1; i < texts.Length; i++)
            {
                model.Append(offset, texts[i].stateChangeOffsets, texts[i].stateChanges);
                offset += texts[i].Length;
            }
            return(new RichText(newText, model));
        }