| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203 |
- #nullable enable
- using System.Text;
- internal class MockConsoleDriver : IConsoleDriver
- {
- public event EventHandler<Attribute>? AttributeSet;
- private IClipboard? _clipboard;
- private Rectangle _screen;
- private Region? _clip;
- private int _col;
- private int _cols;
- private Cell [,]? _contents;
- private int _left;
- private int _row;
- private int _rows;
- private int _top;
- private bool _supportsTrueColor;
- private bool _force16Colors;
- private Attribute _currentAttribute;
- /// <inheritdoc />
- public IClipboard? Clipboard => _clipboard;
- /// <inheritdoc />
- public Rectangle Screen => _screen;
- /// <inheritdoc />
- public Region? Clip
- {
- get => _clip;
- set => _clip = value;
- }
- /// <inheritdoc />
- public int Col => _col;
- /// <inheritdoc />
- public int Cols
- {
- get => _cols;
- set => _cols = value;
- }
- /// <inheritdoc />
- public Cell [,]? Contents
- {
- get => _contents;
- set => _contents = value;
- }
- /// <inheritdoc />
- public int Left
- {
- get => _left;
- set => _left = value;
- }
- /// <inheritdoc />
- public int Row => _row;
- /// <inheritdoc />
- public int Rows
- {
- get => _rows;
- set => _rows = value;
- }
- /// <inheritdoc />
- public int Top
- {
- get => _top;
- set => _top = value;
- }
- /// <inheritdoc />
- public bool SupportsTrueColor => _supportsTrueColor;
- /// <inheritdoc />
- public bool Force16Colors
- {
- get => _force16Colors;
- set => _force16Colors = value;
- }
- /// <inheritdoc />
- public Attribute CurrentAttribute
- {
- get => _currentAttribute;
- set => _currentAttribute = value;
- }
- /// <inheritdoc />
- public string GetVersionInfo () { return string.Empty; }
- /// <inheritdoc />
- public void WriteRaw (string ansi) { }
- /// <inheritdoc />
- public bool IsRuneSupported (Rune rune) { return true; }
- /// <inheritdoc />
- public bool IsValidLocation (Rune rune, int col, int row) { return true; }
- /// <inheritdoc />
- public void Move (int col, int row)
- {
- _col = col;
- _row = row;
- }
- /// <inheritdoc />
- public void AddRune (Rune rune) { }
- /// <inheritdoc />
- public void AddRune (char c) { }
- /// <inheritdoc />
- public void AddStr (string str) { }
- /// <inheritdoc />
- public void ClearContents () { }
- /// <inheritdoc />
- public event EventHandler<EventArgs>? ClearedContents;
- /// <inheritdoc />
- public void FillRect (Rectangle rect, Rune rune = default) { }
- /// <inheritdoc />
- public void FillRect (Rectangle rect, char c) { }
- /// <inheritdoc />
- public bool GetCursorVisibility (out CursorVisibility visibility)
- {
- visibility = CursorVisibility.Invisible;
- return false;
- }
- /// <inheritdoc />
- public void Refresh () { }
- /// <inheritdoc />
- public bool SetCursorVisibility (CursorVisibility visibility) { throw new NotImplementedException (); }
- /// <inheritdoc />
- public event EventHandler<SizeChangedEventArgs>? SizeChanged;
- /// <inheritdoc />
- public void Suspend () { }
- /// <inheritdoc />
- public void UpdateCursor () {}
- /// <inheritdoc />
- public void Init () { }
- /// <inheritdoc />
- public void End () { }
- /// <inheritdoc />
- /// <inheritdoc />
- public Attribute SetAttribute (Attribute c)
- {
- Attribute oldAttribute = _currentAttribute;
- _currentAttribute = c;
- AttributeSet?.Invoke (this, c);
- return oldAttribute;
- }
- /// <inheritdoc />
- public Attribute GetAttribute ()
- {
- return _currentAttribute;
- }
- /// <inheritdoc />
- public Attribute MakeColor (in Color foreground, in Color background) { throw new NotImplementedException (); }
- /// <inheritdoc />
- public event EventHandler<MouseEventArgs>? MouseEvent;
- /// <inheritdoc />
- public event EventHandler<Key>? KeyDown;
- /// <inheritdoc />
- public event EventHandler<Key>? KeyUp;
- /// <inheritdoc />
- public void SendKeys (char keyChar, ConsoleKey key, bool shift, bool alt, bool ctrl) { throw new NotImplementedException (); }
- /// <inheritdoc />
- public void QueueAnsiRequest (AnsiEscapeSequenceRequest request) { throw new NotImplementedException (); }
- /// <inheritdoc />
- public AnsiRequestScheduler GetRequestScheduler () { throw new NotImplementedException (); }
- }
|