示例#1
0
        public string Adapt(ConsoleTokens expression)
        {
            var buffer = new StringBuilder();

            foreach (var item in expression)
            {
                buffer.Append(item.State);
            }
            return(buffer.ToString());
        }
示例#2
0
        public string Adapt(ConsoleTokens expression)
        {
            var buffer = new StringBuilder();

            foreach (var item in expression)
            {
                if (item.Action == "red")
                {
                    buffer.Append($"\x1b[31m{item.State}\x1b[39m");
                }
                else if (item.Action == "normal")
                {
                    buffer.Append($"\x1b[39m{item.State}");
                }
                else
                {
                    buffer.Append(item.State);
                }
            }
            return(buffer.ToString());
        }