Ejemplo n.º 1
0
        private void ParseText(ResxValue.Creator creator, int startIdx, ref string txt)
        {
            int           idx    = startIdx;
            StringBuilder buffer = new StringBuilder();

            while (txt.Length > idx)
            {
                if (txt[idx] == '{')
                {
                    if (txt.Length > idx + 1)
                    {
                        // cruly brace escape char
                        if (txt[idx + 1] == '{')
                        {
                            // skip one of the braces to add only one to the text value
                            idx++;
                        }
                        else
                        {
                            ParseParameter(creator, idx, ref txt);

                            // revert one step as it belongs to the parameter
                            idx--;
                            break;
                        }
                    }
                }

                buffer.Append(txt[idx]);
                idx++;
            }

            if (buffer.Length > 0)
            {
                creator.AddSegment(StringSegment.Create(startIdx, idx, buffer.ToString()));
            }
        }