Class RecordingService
Holds the one folder every recording block writes into, so a path is chosen once per machine instead of once per block.
Implements
Inherited Members
Namespace: MOSAIC.Services
Assembly: MOSAIC.dll
Syntax
public sealed class RecordingService : IRecordingDestination
Remarks
A block that records does not own a path — it owns a boolean. The path comes from here, and the
file it gets is <RootFolder>/<session>/<BlockName>.csv. That is what makes the
per-block toggle usable from the pipeline builder: dropping a block on the canvas and ticking
"Record" is enough, because the folder was already answered.
Sessions. SessionFolder is a timestamped subfolder created on first use and kept for the rest of the run. Without it every run would append into the same per-block file and two experiments would be indistinguishable inside one CSV. StartNewSession() begins a fresh one; blocks that are already recording pick it up the next time they are toggled.
RootFolder persists to %AppData%/MOSAIC/recording.json and deliberately does
not live in the pipeline JSON — it is machine-specific, and a config shared with a
colleague should not carry someone else's drive layout.
What the pipeline JSON does carry is Path, and
nothing else. A block with a Path loads already recording into that folder; a block
without one loads not recording. There is deliberately no separate record flag — the folder being
set is the flag. Switching recording on from the card is therefore a session-only
convenience that writes to SessionFolder and does not survive a save.
Constructors
RecordingService()
Declaration
public RecordingService()
Fields
SettingsFileName
Declaration
private const string SettingsFileName = "recording.json"
Field Value
| Type | Description |
|---|---|
| string |
_rootFolder
Declaration
private string? _rootFolder
Field Value
| Type | Description |
|---|---|
| string |
_sessionFolder
Declaration
private string? _sessionFolder
Field Value
| Type | Description |
|---|---|
| string |
_settingsPath
Declaration
private readonly string _settingsPath
Field Value
| Type | Description |
|---|---|
| string |
Properties
IsConfigured
True once a root folder is set and blocks can actually be recorded.
Declaration
public bool IsConfigured { get; }
Property Value
| Type | Description |
|---|---|
| bool |
RootFolder
Destination folder for all recordings, or null when the user has not picked one. Setting it persists immediately and starts a new session.
Declaration
public string? RootFolder { get; set; }
Property Value
| Type | Description |
|---|---|
| string |
SessionFolder
Timestamped subfolder for this run, created on first access, or null when no root folder is set.
Declaration
public string? SessionFolder { get; }
Property Value
| Type | Description |
|---|---|
| string |
Remarks
Creation is deferred so that merely launching MOSAIC does not litter the root with empty folders — the directory appears the first time a block actually starts recording.
Methods
Load()
Declaration
private void Load()
Save()
Declaration
private void Save()
StartNewSession()
Drops the current session so the next recording lands in a fresh timestamped folder.
Declaration
public void StartNewSession()
Remarks
Blocks already recording keep writing to the old session until they are toggled off and on — stopping their dumper mid-file from here would truncate a capture in progress.
Events
RootFolderChanged
Raised whenever RootFolder changes, so the header and any open menus refresh.
Declaration
public event EventHandler? RootFolderChanged
Event Type
| Type | Description |
|---|---|
| EventHandler |