Patrik Svensson 98cf63f485 Rename Style and Appearance
* Renames Style -> Decoration
* Renames Appearance -> Style
* Adds Style.Parse and Style.TryParse
2020-08-03 23:30:47 +02:00

43 lines
1.1 KiB
C#

using System;
using System.Collections.Generic;
using System.IO;
using System.Text;
namespace Spectre.Console.Tests
{
public sealed class PlainConsole : IAnsiConsole, IDisposable
{
public Capabilities Capabilities => throw new NotSupportedException();
public Encoding Encoding { get; }
public int Width { get; }
public int Height { get; }
public Decoration Decoration { get; set; }
public Color Foreground { get; set; }
public Color Background { get; set; }
public StringWriter Writer { get; }
public string Output => Writer.ToString().TrimEnd('\n');
public IReadOnlyList<string> Lines => Output.Split(new char[] { '\n' });
public PlainConsole(int width = 80, int height = 9000, Encoding encoding = null)
{
Width = width;
Height = height;
Encoding = encoding ?? Encoding.UTF8;
Writer = new StringWriter();
}
public void Dispose()
{
Writer.Dispose();
}
public void Write(string text)
{
Writer.Write(text);
}
}
}