Skip to content
ConsoleMonster
Class

ScreenCapture

ConsoleMonster.Interactive

Namespace
ConsoleMonster.Interactive
Assembly
ConsoleMonster
Modifiers
sealed

Draws prompts, menus and forms into memory instead of the terminal and keeps every frame: for scripted demos, documentation screenshots and exports (ConsoleExporter.ToHtml(capture.LastFrame)). Set it on InteractiveOptions.Capture together with a scripted InteractiveOptions.Input.

Inheritance

  • object
  • ScreenCapture

Usage

Explore 6 API references to this type

This type appears in these public API surfaces even when no hand-authored example is attached directly to the page.

Returned or exposed by 2

Accepted by parameters 4

Constructors

public ScreenCapture(int width, int height, bool inline = false) #

Creates a capture of a fixed size.

Parameters

width int required
Width in cells.
height int required
Height in cells.
inline bool = false optional
Whether prompts draw as they would in the scrollback (true) or on a full screen (false).

Methods

public CellBuffer? FindFrame(string text) #

The first frame whose text contains a phrase (for picking a screen to export), or null.

Parameters

text string required
The phrase.

Returns

CellBuffer? The frame, or null.
public void Hold(TimeSpan duration) #

Records an additional playback pause after the last captured frame.

Parameters

duration System.TimeSpan required
A nonnegative pause; zero does nothing.
public List<RecordedFrame> ToRecordedFrames(TimeSpan frameDuration, TimeSpan lastFrameHold = default) #

The captured screens as an animation timeline: each frame shows for frameDuration plus its ScreenCapture.FrameHolds, and the last one for lastFrameHold more. Export it with Recording.Render (HTML player, animated SVG, asciicast) or SaveGraphics in ConsoleMonster.Graphics (GIF, APNG).

Parameters

frameDuration System.TimeSpan required
How long each frame shows (at least one millisecond).
lastFrameHold System.TimeSpan = default optional
Extra time on the last frame before the animation loops or ends.

Returns

List<RecordedFrame> The timed frames, sharing this capture's cells.

Properties

public int Width { get; } #

Width in cells.

public int Height { get; } #

Height in cells.

public IReadOnlyList<CellBuffer> Frames { get; } #

Every frame drawn, in order.

public IReadOnlyDictionary<int, TimeSpan> FrameHolds { get; } #

Additional playback pauses after each zero-based frame index. Capturing a pause never sleeps.

public CellBuffer? LastFrame { get; } #

The last frame drawn, or null.