Table of Contents

Class CharacterBufferSnapshot

Namespace
SharpConsoleUI.Diagnostics.Snapshots
Assembly
SharpConsoleUI.dll

Captures the state of a CharacterBuffer at a specific point in time. Used for validation, debugging, and regression testing.

public class CharacterBufferSnapshot
Inheritance
CharacterBufferSnapshot
Inherited Members

Properties

Cells

Gets the deep copy of the cell array.

public Cell[,] Cells { get; init; }

Property Value

Cell[,]

DirtyCells

Gets the list of dirty cells at the time of capture.

public List<CellChange> DirtyCells { get; init; }

Property Value

List<CellChange>

DirtyRegion

Gets the dirty region bounds.

public LayoutRect DirtyRegion { get; init; }

Property Value

LayoutRect

FrameNumber

Gets the frame number this snapshot represents.

public int FrameNumber { get; init; }

Property Value

int

Height

Gets the height of the captured 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 captured buffer.

public int Width { get; init; }

Property Value

int

Methods

CountCellsMatching(Func<Cell, bool>)

Counts the number of cells matching the given predicate.

public int CountCellsMatching(Func<Cell, bool> predicate)

Parameters

predicate Func<Cell, bool>

Returns

int

GetCell(int, int)

Gets the cell at the specified position.

public Cell GetCell(int x, int y)

Parameters

x int
y int

Returns

Cell

GetDifferences(CharacterBufferSnapshot)

Compares this snapshot with another and returns the differences.

public List<CellChange> GetDifferences(CharacterBufferSnapshot other)

Parameters

other CharacterBufferSnapshot

Returns

List<CellChange>

ToAsciiArt()

Converts the buffer to ASCII art for visualization.

public string ToAsciiArt()

Returns

string

ToDebugString()

Returns a debug string representation of the buffer.

public string ToDebugString()

Returns

string

ValidateRegion(LayoutRect, Func<Cell, bool>)

Validates that all cells in the specified region match the given predicate.

public bool ValidateRegion(LayoutRect region, Func<Cell, bool> predicate)

Parameters

region LayoutRect
predicate Func<Cell, bool>

Returns

bool