Пример #1
0
        private IEnumerable <string> _GetSentence(string message)
        {
            var    splitSymbol = new string[] { Environment.NewLine };
            var    tempText    = Hyphenation.GetAdjustmentTextList(message, _UI.Sentence);
            var    textList    = tempText.Split(splitSymbol, StringSplitOptions.None);
            var    dirty       = true;
            string newText;
            int    count = 0;

            while (dirty && count < 30)
            {
                count++;
                newText = string.Empty;
                for (int i = 0; i < textList.Length; i++)
                {
                    dirty = false;
                    if (i % 2 == 0 && textList[i].FirstOrDefault() != '「')
                    {
                        textList[i] = "「" + textList[i];
                        dirty       = true;
                    }

                    if (i != 0 && (i + 1) % 2 == 0 && textList[i].LastOrDefault() != '」')
                    {
                        textList[i] += "」";
                        dirty        = true;
                    }
                }
                for (int i = 0; i < textList.Length; i++)
                {
                    newText += textList[i];
                }
                tempText = Hyphenation.GetAdjustmentTextList(newText, _UI.Sentence);
                textList = tempText.Split(splitSymbol, StringSplitOptions.None);
            }
            return(textList);
        }