Table of Contents

Class ConsoleBufferSnapshot

Namespace
SharpConsoleUI.Diagnostics.Snapshots
Assembly
SharpConsoleUI.dll

Captures the state of the ConsoleBuffer's front and back buffers. Used to validate double-buffering and dirty cell detection.

public class ConsoleBufferSnapshot
Inheritance
ConsoleBufferSnapshot
Inherited Members

Properties

BackBuffer

Gets the back buffer (to be rendered).

public ConsoleCell[,] BackBuffer { get; init; }

Property Value

ConsoleCell[,]

DirtyCells

Gets the list of dirty cell positions.

public List<(int x, int y)> DirtyCells { get; init; }

Property Value

List<(int x, int y)>

FrameNumber

Gets the frame number this snapshot represents.

public int FrameNumber { get; init; }

Property Value

int

FrontBuffer

Gets the front buffer (currently displayed).

public ConsoleCell[,] FrontBuffer { get; init; }

Property Value

ConsoleCell[,]

Height

Gets the height of the buffer.

public int Height { get; init; }

Property Value

int

Timestamp

Gets the timestamp when this snapshot was taken.

public DateTime Timestamp { get; init; }

Property Value

DateTime

Width

Gets the width of the buffer.

public int Width { get; init; }

Property Value

int

Methods

GetBack(int, int)

Gets the back buffer cell at the specified position.

public ConsoleCell GetBack(int x, int y)

Parameters

x int
y int

Returns

ConsoleCell

GetDifferences()

Compares front and back buffers and returns cells that differ.

public List<(int x, int y, ConsoleCell front, ConsoleCell back)> GetDifferences()

Returns

List<(int x, int y, ConsoleCell front, ConsoleCell back)>

GetDirtyCount()

Gets the number of dirty cells.

public int GetDirtyCount()

Returns

int

GetFront(int, int)

Gets the front buffer cell at the specified position.

public ConsoleCell GetFront(int x, int y)

Parameters

x int
y int

Returns

ConsoleCell

IsCellDirty(int, int)

Checks if a cell at the specified position is dirty.

public bool IsCellDirty(int x, int y)

Parameters

x int
y int

Returns

bool