Alsing.SourceCode.SyntaxDocumentParsers.ParseTools.AddString C# (CSharp) Method

AddString() public static method

public static AddString ( string Text, Row Row, TextStyle Style, Span span ) : void
Text string
Row Row
Style TextStyle
span Span
return void
        public static unsafe void AddString(string Text, Row Row, TextStyle Style,
                                            Span span)
        {
            if (Text == "")
                return;

            var CurrentWord = new StringBuilder();
            char[] Buff = Text.ToCharArray();
            fixed (char* c = &Buff[0])
            {
                for (int i = 0; i < Text.Length; i++)
                {
                    if (c[i] == ' ' || c[i] == '\t')
                    {
                        if (CurrentWord.Length != 0)
                        {
                            Word word = Row.Add(CurrentWord.ToString());
                            word.Style = Style;
                            word.Span = span;
                            CurrentWord = new StringBuilder();
                        }

                        Word ws = Row.Add(c[i].ToString());
                        if (c[i] == ' ')
                            ws.Type = WordType.Space;
                        else
                            ws.Type = WordType.Tab;
                        ws.Style = Style;
                        ws.Span = span;
                    }
                    else
                        CurrentWord.Append(c[i].ToString());
                }
                if (CurrentWord.Length != 0)
                {
                    Word word = Row.Add(CurrentWord.ToString());
                    word.Style = Style;
                    word.Span = span;
                }
            }
        }