Пример #1
0
        public async Task WriteMessageAsync(string message, MessageColour messageColor)
        {
            Console.CursorLeft = 0;
            UpdateColours(messageColor);

            var outputStream = messageColor == MessageColour.Error ? Console.Error : Console.Out;
            await outputStream.WriteLineAsync(message);

            await WritePromptAsync();

            await outputStream.WriteAsync(_lineBuffer.ToString());
        }
Пример #2
0
        public static ANSIColour ToANSIColour(this MessageColour @this)
        {
            switch (@this)
            {
            case MessageColour.Background:
                return(ANSIColour.Black);

            case MessageColour.Text:
                return(ANSIColour.White);

            case MessageColour.Error:
                return(ANSIColour.Red);

            case MessageColour.Warning:
                return(ANSIColour.Yellow);

            case MessageColour.OK:
                return(ANSIColour.Green);

            default:
                throw new ArgumentException("No mapping for: " + @this, "this");
            }
        }
Пример #3
0
 private void UpdateColours(MessageColour messageColor, MessageColour backgroundColor = MessageColour.Background)
 {
     UpdateColours(new ColourPair(messageColor.ToANSIColour(), backgroundColor.ToANSIColour()));
 }