Table of Contents

Interface IOfsHost

Namespace
Ofs
Assembly
Ofs.Api.dll

The host surface available to a plugin, organized into cohesive sub-objects.

public interface IOfsHost

Properties

Axes

Per-axis read access and edits, plus axis/project change events.

Axes Axes { get; }

Property Value

Axes

Commands

Register invocable commands (palette and/or bindable shortcuts).

Commands Commands { get; }

Property Value

Commands

Culture

ofs-ng's active UI language as a CultureInfo — feed it to your own ResourceManager.GetString(key, Host.Culture) so the plugin follows the language the user picked in ofs-ng (not the OS culture). English/unknown maps to the invariant culture (i.e. your neutral .resx). Read it at OnLoad: the host reloads the plugin on a UI-language switch, so OnLoad re-runs in the new language. Main-thread only.

CultureInfo Culture { get; }

Property Value

CultureInfo

Dialogs

Native file/folder pickers and confirmation prompts.

Dialogs Dialogs { get; }

Property Value

Dialogs

Editing

Register alternate edit modes for the timeline.

Editing Editing { get; }

Property Value

Editing

IsMainThread

True when called on ofs-ng's main thread — the only thread that may touch most Host members. Use the RunOnMainThread helpers to marshal work in from another thread.

bool IsMainThread { get; }

Property Value

bool

Language

The BCP 47 culture tag of ofs-ng's active UI language ("en" for built-in English, else the tag the translation declares, e.g. "ja", "zh-Hant"). Main-thread only.

string Language { get; }

Property Value

string

Navigation

Register alternate navigators (how stepping moves the playhead).

Navigation Navigation { get; }

Property Value

Navigation

Nodes

Register processing-graph nodes (generators, modifiers, combiners).

Nodes Nodes { get; }

Property Value

Nodes

Player

Video playback: time, duration, transport, and playback events.

Player Player { get; }

Property Value

Player

Project

The open project: chapters, bookmarks, regions, and project metadata.

Project Project { get; }

Property Value

Project

Selection

Register alternate selection modes.

Selection Selection { get; }

Property Value

Selection

UnloadToken

Cancelled when this plugin is being unloaded (disabled or app shutdown). Use it to stop background threads, timers and Tasks. After cancellation, do not touch Host members. Note: OnUnload() runs BEFORE this is cancelled — OnUnload is the imperative cleanup hook; the token is for work that outlives OnUnload.

CancellationToken UnloadToken { get; }

Property Value

CancellationToken

Methods

AppScoped<T>(string)

An AppScoped<T>(string) handle over this plugin's global settings at key: it loads the value now and saves it back whenever it changes — persisted in this plugin's own file under the app's settings directory, shared across all projects (unlike Scoped<T>(string), which is per-project). Create it once in OnLoad(); the host flushes edits once per frame and again on app close, so there is nothing manual to call. Main-thread only.

AppScoped<T> AppScoped<T>(string key) where T : new()

Parameters

key string

Returns

AppScoped<T>

Type Parameters

T

Log(LogLevel, string)

Writes to the host log at the given level. Any thread.

void Log(LogLevel level, string message)

Parameters

level LogLevel
message string

Log(string)

Writes to the host log at Info. Any thread.

void Log(string message)

Parameters

message string

Notify(NotifyLevel, string)

Raises a user-facing toast at the given level, shown verbatim (the host prefixes this plugin's name). Any thread. Not throttled — do not call every frame.

void Notify(NotifyLevel level, string message)

Parameters

level NotifyLevel
message string

NotifyError(string)

void NotifyError(string message)

Parameters

message string

NotifyInfo(string)

void NotifyInfo(string message)

Parameters

message string

NotifySuccess(string)

void NotifySuccess(string message)

Parameters

message string

NotifyWarning(string)

void NotifyWarning(string message)

Parameters

message string

RunOnMainThread(Action)

Queues work to run on the main thread at the start of the next frame. Fire-and-forget; safe to call from any thread.

void RunOnMainThread(Action work)

Parameters

work Action

RunOnMainThreadAsync(Action)

Queues work on the main thread and returns a task that completes when it has run (or is cancelled if the plugin unloads first). Awaitable from any thread.

Task RunOnMainThreadAsync(Action work)

Parameters

work Action

Returns

Task

RunOnMainThreadAsync<T>(Func<T>)

Queues work on the main thread and returns a task carrying its result (or cancelled if the plugin unloads first). Awaitable from any thread.

Task<T> RunOnMainThreadAsync<T>(Func<T> work)

Parameters

work Func<T>

Returns

Task<T>

Type Parameters

T