Table of Contents

Class RenderingDiagnostics

Namespace
SharpConsoleUI.Diagnostics
Assembly
SharpConsoleUI.dll

Main coordinator for capturing rendering artifacts and metrics across all three layers. Provides snapshot capture, metrics collection, and quality analysis for testing and debugging.

public class RenderingDiagnostics
Inheritance
RenderingDiagnostics
Inherited Members

Constructors

RenderingDiagnostics(ConsoleWindowSystemOptions)

Creates a new RenderingDiagnostics instance.

public RenderingDiagnostics(ConsoleWindowSystemOptions options)

Parameters

options ConsoleWindowSystemOptions

Properties

CurrentFrameNumber

Gets the current frame number.

public int CurrentFrameNumber { get; }

Property Value

int

EnabledLayers

Gets the enabled diagnostics layers.

public DiagnosticsLayers EnabledLayers { get; }

Property Value

DiagnosticsLayers

IsEnabled

Gets whether diagnostics are enabled.

public bool IsEnabled { get; set; }

Property Value

bool

LastAnsiSnapshot

Gets the most recent ANSI lines snapshot.

public AnsiLinesSnapshot? LastAnsiSnapshot { get; }

Property Value

AnsiLinesSnapshot

LastBufferSnapshot

Gets the most recent CharacterBuffer snapshot.

public CharacterBufferSnapshot? LastBufferSnapshot { get; }

Property Value

CharacterBufferSnapshot

LastConsoleSnapshot

Gets the most recent ConsoleBuffer snapshot.

public ConsoleBufferSnapshot? LastConsoleSnapshot { get; }

Property Value

ConsoleBufferSnapshot

LastMetrics

Gets the most recent metrics.

public RenderingMetrics? LastMetrics { get; }

Property Value

RenderingMetrics

LastOutputSnapshot

Gets the most recent output snapshot.

public RenderOutputSnapshot? LastOutputSnapshot { get; }

Property Value

RenderOutputSnapshot

LastQualityReport

Gets the most recent quality report.

public QualityReport? LastQualityReport { get; }

Property Value

QualityReport

Methods

BeginFrame()

Begins a new frame, incrementing the frame counter.

public void BeginFrame()

CaptureAnsiLines(List<string>)

Captures ANSI lines snapshot (MIDDLE LAYER).

public void CaptureAnsiLines(List<string> lines)

Parameters

lines List<string>

CaptureCharacterBuffer(CharacterBuffer)

Captures a CharacterBuffer snapshot (TOP LAYER).

public void CaptureCharacterBuffer(CharacterBuffer buffer)

Parameters

buffer CharacterBuffer

CaptureConsoleBufferState(ConsoleCell[,], ConsoleCell[,], int, int)

Captures ConsoleBuffer internal state (BOTTOM LAYER).

public void CaptureConsoleBufferState(ConsoleCell[,] front, ConsoleCell[,] back, int width, int height)

Parameters

front ConsoleCell[,]
back ConsoleCell[,]
width int
height int

CaptureConsoleOutput(string)

Captures console output string.

public void CaptureConsoleOutput(string output)

Parameters

output string

Clear()

Clears all captured diagnostics data.

public void Clear()

GetAllMetrics()

Gets all recorded metrics.

public IReadOnlyList<RenderingMetrics> GetAllMetrics()

Returns

IReadOnlyList<RenderingMetrics>

GetMetrics(int)

Gets metrics for a specific frame.

public RenderingMetrics? GetMetrics(int frameNumber)

Parameters

frameNumber int

Returns

RenderingMetrics

GetQualityReport(int)

Gets quality report for a specific frame.

public QualityReport? GetQualityReport(int frameNumber)

Parameters

frameNumber int

Returns

QualityReport

GetSnapshot<T>(int)

Gets a snapshot of a specific type for a given frame.

public T? GetSnapshot<T>(int frameNumber) where T : class

Parameters

frameNumber int

Returns

T

Type Parameters

T

RecordMetrics(RenderingMetrics)

Records rendering metrics for a frame.

public void RecordMetrics(RenderingMetrics metrics)

Parameters

metrics RenderingMetrics