namespace QFSW.QC.Actions { /// /// Serializes and logs a value to the console. /// public class Value : ICommandAction { private readonly object _value; private readonly bool _newline; public bool IsFinished => true; public bool StartsIdle => false; /// The value to log to the console. /// If the value should be logged on a new line. public Value(object value, bool newline = true) { _value = value; _newline = newline; } public void Start(ActionContext context) { } public void Finalize(ActionContext context) { QuantumConsole console = context.Console; string serialized = _value as string ?? console.Serialize(_value); console.LogToConsole(serialized, _newline); } } }