mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 00:42:51 +08:00

* Renames Style -> Decoration * Renames Appearance -> Style * Adds Style.Parse and Style.TryParse
43 lines
1.1 KiB
C#
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);
|
|
}
|
|
}
|
|
}
|