Table of Contents

Class RuntimeOutputBuffer

Namespace
RDCore.SDK.Runtime.Abstract.Execution
Assembly
RDCore.SDK.dll

Collects a session's output in memory, as lines.

public sealed class RuntimeOutputBuffer : IRuntimeOutput
Inheritance
RuntimeOutputBuffer
Implements
Inherited Members

Remarks

What a host that answers a "run this" request uses: the caller wants the output back with the result, not streamed somewhere. A line the program left open with a trailing ; is part of Lines as soon as it has anything on it, so output that never reached a line break is still reported.

A buffer that is given somewhere to say its lines (completed) does not keep them: each is handed over as soon as it is complete, and Lines is what has not been - the line in progress. That is for a caller that wants the output while the program runs, and not with the result.

Constructors

RuntimeOutputBuffer(Action<string>?)

Collects a session's output in memory, as lines.

public RuntimeOutputBuffer(Action<string>? completed = null)

Parameters

completed Action<string>

Receives each line as it is completed, or null to keep them.

Remarks

What a host that answers a "run this" request uses: the caller wants the output back with the result, not streamed somewhere. A line the program left open with a trailing ; is part of Lines as soon as it has anything on it, so output that never reached a line break is still reported.

A buffer that is given somewhere to say its lines (completed) does not keep them: each is handed over as soon as it is complete, and Lines is what has not been - the line in progress. That is for a caller that wants the output while the program runs, and not with the result.

Properties

CompletedLines

The lines that are complete and kept, without the line in progress.

public IReadOnlyList<string> CompletedLines { get; }

Property Value

IReadOnlyList<string>

Remarks

What has been printed in full so far, for a caller that shows it before the program goes on - a dialog the program opens is to come after what it printed before opening it - and then ForgetCompleted(int)s it, so that it is not said twice.

LinePosition

The current line position, one-based — 1 at the start of a line, exactly as MS-VBAL §5.4.5 counts it.

public int LinePosition { get; }

Property Value

int

Lines

Every completed line, plus the line in progress when there is one.

public IReadOnlyList<string> Lines { get; }

Property Value

IReadOnlyList<string>

Methods

ForgetCompleted(int)

Forgets the first count completed lines, which have been said some other way (CompletedLines).

public void ForgetCompleted(int count)

Parameters

count int

How many of the completed lines to forget, from the first.

Write(string)

Writes text at the current line position, which advances by its length.

public void Write(string text)

Parameters

text string

The text to write; it contains no line terminators.

WriteLine()

Ends the current line and returns the line position to 1.

public void WriteLine()