コード例 #1
0
        // Removes all tags, except rich text codes.
        protected string ProcessTags(string source)
        {
            string result     = "";
            int    index      = 0;
            var    tagMatches = Tools.GetTagMatches(source);

            foreach (Match match in tagMatches)
            {
                if (Tools.IsRichTextCode(match.Value))
                {
                    result += source.Substring(index, match.Index + match.Length - index);
                }
                else
                {
                    result += source.Substring(index, match.Index - index);
                }
                index = match.Index + match.Length;
            }
            result += source.Substring(index, source.Length - index);
            return(Tools.UnescapeTagBrackets(result));
        }
コード例 #2
0
        // Removes all non-text mesh pro tags.
        protected void ProcessTags()
        {
            string source     = textComponent.text;
            string result     = "";
            int    index      = 0;
            var    tagMatches = Tools.GetTagMatches(source);

            foreach (Match match in tagMatches)
            {
                if (Tools.IsTextMeshProTag(match.Value) || Tools.IsRichTextCode(match.Value))
                {
                    result += source.Substring(index, match.Index + match.Length - index);
                }
                else
                {
                    result += source.Substring(index, match.Index - index);
                }
                index = match.Index + match.Length;
            }
            result            += source.Substring(index, source.Length - index);
            textComponent.text = Tools.UnescapeTagBrackets(result);
        }
コード例 #3
0
        private bool doParse(string inText)
        {
            int textPos    = 0;
            var tagMatches = Tools.GetTagMatches(inText);

            foreach (Match match in tagMatches)
            {
                string textPart = Tools.UnescapeTagBrackets(inText.Substring(textPos, match.Index - textPos));
                _textWithoutTags += textPart;
                if (Tools.IsTextMeshProTag(match.Value) || Tools.IsRichTextCode(match.Value) || !tryParseEffectTag(match.Value, _textWithoutTags.Length))
                {
                    _textWithoutEffects += textPart + inText.Substring(match.Index, match.Length);
                }
                else
                {
                    _textWithoutEffects += textPart;
                }
                textPos = match.Index + match.Length;
            }
            _textWithoutTags    += inText.Substring(textPos, inText.Length - textPos);
            _textWithoutEffects += inText.Substring(textPos, inText.Length - textPos);
            return(_formingEffects.Count == 0 && !haveErrors);
        }