UserInterface.ProgWin.syntax C# (CSharp) Méthode

syntax() private méthode

private syntax ( ) : void
Résultat void
        private void syntax()
        {
            TextPointer start = rtbInput.Document.ContentStart;
            TextPointer end = rtbInput.Document.ContentEnd;
            TextRange tr = new TextRange(start, end);
            tr.ApplyPropertyValue(TextElement.ForegroundProperty, new SolidColorBrush(Colors.Black)); 
            m_tags.Clear();
            for (int s = 0; s < keywords.Count && tr.Text.Length > 2; s++)
            {
                int index = -1;
                string text = tr.Text.ToString();
                string[] txt;
                index = text.LastIndexOf(keywords[s]);
                while (index != -1 && text.Length > 0)
                {
                    tags t = new tags();
                    text = text.Substring(0, index + keywords[s].Length);
                    txt = text.Split('\n');
                    int num = 0;
                    for (int i = 0; i <txt.Length; i++)
                        if (txt[i].Length > 1)
                            num = num + 1;
                    if ((index == 0 || (index > 0 && (text[index - 1] == ' ' || text[index - 1] == '\n'))) && index + keywords[s].Length <= tr.Text.Length && (tr.Text[index + keywords[s].Length] == ' ' || tr.Text[index + keywords[s].Length] == '\r'))
                    {
                        t.start = index+2*num;
                        t.size = keywords[s].Length;
                        m_tags.Add(t);
                    }
                    text = text.Substring(0, index);
                    index = text.LastIndexOf(keywords[s]);
                }
            }
            format();
        }