Table of Contents

Class Project

Namespace
Ofs
Assembly
Ofs.Api.dll

Access to project-level state: unsaved status, metadata, chapters, bookmarks and processing regions (all read-only snapshots), plus this plugin's own per-project data store (Scoped<T>(string)), which is persisted inside the .ofp and round-trips with save/load. All members are main-thread only and read fresh each call — the returned lists are snapshots, not live views.

public sealed class Project
Inheritance
object
Project

Properties

Bookmarks

The bookmarks, in project order (by time).

public IReadOnlyList<ProjectBookmark> Bookmarks { get; }

Property Value

IReadOnlyList<ProjectBookmark>

Chapters

The chapters, in project order (by start time).

public IReadOnlyList<ProjectChapter> Chapters { get; }

Property Value

IReadOnlyList<ProjectChapter>

IsDirty

True if the project has unsaved changes.

public bool IsDirty { get; }

Property Value

bool

Metadata

Full project metadata as a JsonElement (same schema as the .funscript metadata block): title, creator, scriptUrl, videoUrl, description, notes, tags, performers, license, plus any custom fields. Returns an empty JsonElement when no project is loaded. Main-thread only.

public JsonElement Metadata { get; }

Property Value

JsonElement

Regions

The processing regions, in project order (always sorted by start time).

public IReadOnlyList<ProjectRegion> Regions { get; }

Property Value

IReadOnlyList<ProjectRegion>

Methods

FunscriptJson(FunscriptVersion, params StandardAxis[])

The funscript document for one or more axes, as a UTF-8 JSON string, in the given format version. V10 is single-axis only — pass exactly one role, or it throws. V11/V20 carry the primary axis's actions at the root and the rest under "axes"/"channels". Absent, empty, scratch (S0–S9), and duplicate roles are skipped; the document carries the project metadata block and action times are in milliseconds, matching the host's own export. Returns an empty string when no requested axis is exportable. Main-thread only.

public string FunscriptJson(FunscriptVersion version, params StandardAxis[] roles)

Parameters

version FunscriptVersion
roles StandardAxis[]

Returns

string

Exceptions

ArgumentException

version is 1.0 but more than one role was passed — the 1.0 format cannot carry multiple axes.

FunscriptJson(StandardAxis, FunscriptVersion)

The funscript document for a single axis, as a UTF-8 JSON string, in the given format version (default 1.0). A convenience over FunscriptJson(FunscriptVersion, params StandardAxis[]) for the common single-axis case. Returns an empty string when the axis is absent, empty, or a scratch axis. Main-thread only.

public string FunscriptJson(StandardAxis role, FunscriptVersion version = FunscriptVersion.V10)

Parameters

role StandardAxis
version FunscriptVersion

Returns

string

Scoped<T>(string)

A ProjectScoped<T> handle over this plugin's data at key: it loads the value now, reloads it whenever a different project is opened, and saves it back on change — so a plugin's per-project state is one field with no manual load/save/reset wiring. Create it once in OnLoad(); the host flushes edits once per frame, so there is nothing manual to call. Main-thread only.

public ProjectScoped<T> Scoped<T>(string key) where T : new()

Parameters

key string

Returns

ProjectScoped<T>

Type Parameters

T