Table of Contents

Class FileMemorySink

Namespace
PopcorningGuineaPig.Engine.Diagnostics
Assembly
PopcorningGuineaPig.Engine.dll

Writes each received MemorySnapshot as a JSON file in the configured directory. Opens and closes the file per write so a crash mid-run cannot leave a corrupted handle behind.

public sealed class FileMemorySink : IMemorySink
Inheritance
FileMemorySink
Implements
Inherited Members

Remarks

Naming convention: snapshot-{yyyyMMdd-HHmmss-fff}.json. Subsequent captures within the same millisecond append an integer suffix. Story 12.3 wires the editor's snapshot command to read the most recent file from this directory when sampling a launched game.

Constructors

FileMemorySink(string)

Creates the sink. The directory is created on first Receive(MemorySnapshot) if it does not exist.

public FileMemorySink(string directory)

Parameters

directory string

Absolute path to the snapshot output directory.

Methods

Receive(MemorySnapshot)

Hand a snapshot to the sink. Should not throw under normal conditions.

public void Receive(MemorySnapshot snapshot)

Parameters

snapshot MemorySnapshot