Table of Contents

Class MediaBlockCatalog

Namespace
VisioForge.Core.MediaBlocks.Catalog
Assembly
VisioForge.Core.dll

A read-only catalog of every built-in Media Block known to the loaded SDK assemblies. Descriptors are generated once, by reflection: block identity from the Type property override (read from its IL - the getters are constant expressions and blocks are never instantiated for this), category from the diagram categorizer, factories from the settings CreateBlock() convention or a parameterless constructor, availability from the block's static IsAvailable(), and property metadata from the settings CLR type. Custom third-party block assemblies are not supported.

public static class MediaBlockCatalog

Inheritance

Inherited Members

Fields

SatelliteAssemblyNames

The satellite SDK assemblies whose blocks participate in the catalog. Loaded on demand at first catalog access; a satellite missing from the deployment simply contributes no blocks.

public static readonly IReadOnlyList<string> SatelliteAssemblyNames

Field Value

IReadOnlyList<string>

Properties

All

Gets every registered descriptor, ordered by type name. The scan runs once per process.

public static IReadOnlyList<MediaBlockDescriptor> All { get; }

Property Value

IReadOnlyList<MediaBlockDescriptor>

Methods

ByCategory(DiagramBlockCategory)

Filters descriptors by visual category.

public static IEnumerable<MediaBlockDescriptor> ByCategory(DiagramBlockCategory category)

Parameters

category DiagramBlockCategory

The category to keep.

Returns

IEnumerable<MediaBlockDescriptor>

CanCreateDefaultSettings(Type)

Reports whether VisioForge.Core.MediaBlocks.Catalog.MediaBlockCatalog.TryCreateDefaultSettings(System.Type,System.Object@) has a constructor to work with, without building an instance.

public static bool CanCreateDefaultSettings(Type settingsType)

Parameters

settingsType Type

The settings CLR type.

Returns

bool

true when a default instance can be created.

DeserializeSettings(MediaBlockDescriptor, JsonElement?)

Deserializes document JSON back into a settings object of this descriptor's settings type.

public static object DeserializeSettings(MediaBlockDescriptor descriptor, JsonElement? json)

Parameters

descriptor MediaBlockDescriptor

The descriptor whose settings type is materialized.

json JsonElement?

The raw settings JSON stored in a document.

Returns

object

The settings instance, or null when the block has no settings and the payload is empty.

Get(MediaBlockType)

Gets the descriptor for one block type, or null when no concrete block reports it.

public static MediaBlockDescriptor Get(MediaBlockType type)

Parameters

type MediaBlockType

The stable block type.

Returns

MediaBlockDescriptor

Search(string)

Searches descriptors across display name, type name and keywords, case-insensitively.

public static IEnumerable<MediaBlockDescriptor> Search(string text)

Parameters

text string

The search text; null or whitespace returns everything.

Returns

IEnumerable<MediaBlockDescriptor>

SerializeSettings(MediaBlockDescriptor, object)

Serializes a settings object of this descriptor's settings type into the JSON shape used in documents.

public static JsonElement? SerializeSettings(MediaBlockDescriptor descriptor, object settings)

Parameters

descriptor MediaBlockDescriptor

The descriptor whose settings type is serialized.

settings object

The settings instance.

Returns

JsonElement?

A raw JSON element, or null when the block has no settings.

TryCreateDefaultSettings(Type, out object)

Creates a settings instance carrying nothing but its own defaults. A parameterless constructor is used when there is one; otherwise a constructor whose parameters are all optional is invoked with every argument omitted - the same allowance the block constructors already get, and the only way settings such as VirtualAudioSourceSettings(wave = Ticks, sampleRate = 48000, ...) can be built by the catalog or restored from a document that carries no payload for them.

public static bool TryCreateDefaultSettings(Type settingsType, out object settings)

Parameters

settingsType Type

The settings CLR type.

settings object

The created instance, or null when no usable constructor exists.

Returns

bool

true when an instance was created.

Remarks

False means "no usable constructor". A constructor that exists and throws is not swallowed: its own exception is rethrown, because a settings type that cannot initialize is a different failure from one that cannot be constructed, and both call sites report it as a diagnostic rather than letting it escape.