Table of Contents

Class BuildingExtensions

Namespace
Icy.Configuration
Assembly
IcyUI.dll

Provides extension methods for configuring asset settings in the library.

public static class BuildingExtensions
Inheritance
BuildingExtensions
Inherited Members

Methods

AddBasicFontSupport(IAssetConfigurationBuilder)

Adds support for basic font types to the asset configuration.

public static IAssetConfigurationBuilder AddBasicFontSupport(this IAssetConfigurationBuilder builder)

Parameters

builder IAssetConfigurationBuilder

The asset configuration builder instance.

Returns

IAssetConfigurationBuilder

The current asset configuration builder instance for fluent configuration.

Remarks

This method adds support for both bitmap fonts and TrueType fonts.

AddBitmapFontSupport(IAssetConfigurationBuilder)

Adds support for bitmap fonts to the asset configuration.

public static IAssetConfigurationBuilder AddBitmapFontSupport(this IAssetConfigurationBuilder builder)

Parameters

builder IAssetConfigurationBuilder

The asset configuration builder instance.

Returns

IAssetConfigurationBuilder

The current asset configuration builder instance for fluent configuration.

AddDynamicFontSupport(IAssetConfigurationBuilder)

Adds support for dynamic TrueType fonts to the asset configuration.

public static IAssetConfigurationBuilder AddDynamicFontSupport(this IAssetConfigurationBuilder builder)

Parameters

builder IAssetConfigurationBuilder

The asset configuration builder instance.

Returns

IAssetConfigurationBuilder

The current asset configuration builder instance for fluent configuration.

AddImporter<T>(IAssetConfigurationBuilder, IAssetImporter<T>)

Adds an asset importer to the asset configuration.

public static IAssetConfigurationBuilder AddImporter<T>(this IAssetConfigurationBuilder builder, IAssetImporter<T> importer)

Parameters

builder IAssetConfigurationBuilder

The asset configuration builder instance.

importer IAssetImporter<T>

The asset importer instance to be added.

Returns

IAssetConfigurationBuilder

The current asset configuration builder instance for fluent configuration.

Type Parameters

T

The type of the asset to be imported.

AddImporter<TAsset, TImporter>(IAssetConfigurationBuilder)

Adds an asset importer of the specified type to the asset configuration.

public static IAssetConfigurationBuilder AddImporter<TAsset, TImporter>(this IAssetConfigurationBuilder builder) where TImporter : IAssetImporter<TAsset>, new()

Parameters

builder IAssetConfigurationBuilder

The asset configuration builder instance.

Returns

IAssetConfigurationBuilder

The current asset configuration builder instance for fluent configuration.

Type Parameters

TAsset

The type of the asset to be imported.

TImporter

The type of the asset importer to be created.

AddLoggerProvider(ILoggingConfigurationBuilder, ILoggerProvider)

Adds a provider to IcyUI's own logger factory.

public static ILoggingConfigurationBuilder AddLoggerProvider(this ILoggingConfigurationBuilder builder, ILoggerProvider provider)

Parameters

builder ILoggingConfigurationBuilder

The logging section.

provider ILoggerProvider

The provider to write to.

Returns

ILoggingConfigurationBuilder

The logging section of the builder.

AddMarkupSupport(IConfigurationBuilder)

Adds support for loading markup documents through the asset pipeline - both a UIElement document (a Page, say) and a standalone ResourceDictionary document (a theme file referenced via Source=), so either can be requested by path like any other asset.

public static IAssetConfigurationBuilder AddMarkupSupport(this IConfigurationBuilder builder)

Parameters

builder IConfigurationBuilder

The configuration builder instance.

Returns

IAssetConfigurationBuilder

The asset section of the builder.

Remarks

The importers need the whole built configuration (assets, types and fonts), so they're registered by an AfterBuild(Action<IcyConfiguration>) step. Both engine integrations call this by default, which is what lets Load<T>(string) and LoadMarkup(string, object?) load markup files.

AddParser(IAssetConfigurationBuilder, IAssetParser)

Adds an asset parser to the asset configuration.

public static IAssetConfigurationBuilder AddParser(this IAssetConfigurationBuilder builder, IAssetParser parser)

Parameters

builder IAssetConfigurationBuilder

The asset configuration builder instance.

parser IAssetParser

The asset parser instance to be added.

Returns

IAssetConfigurationBuilder

The current asset configuration builder instance for fluent configuration.

AddParser<T>(IAssetConfigurationBuilder)

Adds an asset parser of the specified type to the asset configuration.

public static IAssetConfigurationBuilder AddParser<T>(this IAssetConfigurationBuilder builder) where T : IAssetParser, new()

Parameters

builder IAssetConfigurationBuilder

The asset configuration builder instance.

Returns

IAssetConfigurationBuilder

The current asset configuration builder instance for fluent configuration.

Type Parameters

T

The type of the asset parser to be created.

AddTypeConverter(IReflectionConfigurationBuilder, Type, Type, IValueConverter)

Registers a type converter for converting values from one type to another.

public static IReflectionConfigurationBuilder AddTypeConverter(this IReflectionConfigurationBuilder builder, Type from, Type to, IValueConverter converter)

Parameters

builder IReflectionConfigurationBuilder

The reflection configuration builder instance.

from Type

The source type for the conversion.

to Type

The target type for the conversion.

converter IValueConverter

The value converter instance to be registered.

Returns

IReflectionConfigurationBuilder

The current reflection configuration builder instance for fluent configuration.

AddTypeConverter<TSource, TTarget>(IReflectionConfigurationBuilder, IValueConverter<TSource, TTarget>)

Registers a type converter for converting values from a specified source type to a target type.

public static IReflectionConfigurationBuilder AddTypeConverter<TSource, TTarget>(this IReflectionConfigurationBuilder builder, IValueConverter<TSource, TTarget> converter)

Parameters

builder IReflectionConfigurationBuilder

The reflection configuration builder instance.

converter IValueConverter<TSource, TTarget>

The value converter instance to be registered.

Returns

IReflectionConfigurationBuilder

The current reflection configuration builder instance for fluent configuration.

Type Parameters

TSource

The source type for the conversion.

TTarget

The target type for the conversion.

ConfigureAssets(IConfigurationBuilder, Action<AssetConfiguration>)

Configures the asset options with a callback.

public static IAssetConfigurationBuilder ConfigureAssets(this IConfigurationBuilder builder, Action<AssetConfiguration> configure)

Parameters

builder IConfigurationBuilder

The configuration builder instance.

configure Action<AssetConfiguration>

Receives the AssetConfiguration.

Returns

IAssetConfigurationBuilder

The asset section of the builder.

ConfigureDiagnostics(IConfigurationBuilder, Action<DebugToolRegistry>)

Configures the catalog of registered debug overlays and HUD panels.

public static IReflectionConfigurationBuilder ConfigureDiagnostics(this IConfigurationBuilder builder, Action<DebugToolRegistry> configure)

Parameters

builder IConfigurationBuilder

The configuration builder instance; ConfigureTypes() isn't needed first.

configure Action<DebugToolRegistry>

The configuration action applied to Diagnostics.

Returns

IReflectionConfigurationBuilder

The reflection section of the builder.

Examples

builder.ConfigureDiagnostics(d => d.RegisterOverlay<MyCustomOverlay>());

ConfigureGestures(IConfigurationBuilder, Action<GestureSettings>)

Configures gesture recognition: hold delay, multi-tap interval and movement tolerance.

public static IInputConfigurationBuilder ConfigureGestures(this IConfigurationBuilder builder, Action<GestureSettings> configure)

Parameters

builder IConfigurationBuilder

The configuration builder instance; its input system must already be set.

configure Action<GestureSettings>

Receives the input system's GestureSettings.

Returns

IInputConfigurationBuilder

The input section of the builder.

ConfigureInput(IConfigurationBuilder, Action<IInputSystem>)

Configures the input system with a callback.

public static IInputConfigurationBuilder ConfigureInput(this IConfigurationBuilder builder, Action<IInputSystem> configure)

Parameters

builder IConfigurationBuilder

The configuration builder instance; its input system must already be set.

configure Action<IInputSystem>

Receives the IInputSystem.

Returns

IInputConfigurationBuilder

The input section of the builder.

ConfigureLogging(IConfigurationBuilder, ILoggerFactory)

Sends IcyUI's log messages to factory instead of IcyUI's own providers.

public static ILoggingConfigurationBuilder ConfigureLogging(this IConfigurationBuilder builder, ILoggerFactory factory)

Parameters

builder IConfigurationBuilder

The configuration builder.

factory ILoggerFactory

The factory to create IcyUI's loggers from. IcyUI doesn't dispose it.

Returns

ILoggingConfigurationBuilder

The logging section of the builder.

ConfigureLogging(IConfigurationBuilder, LogLevel)

Sets the lowest level IcyUI's own providers receive. Debug shows why something doesn't render.

public static ILoggingConfigurationBuilder ConfigureLogging(this IConfigurationBuilder builder, LogLevel minimumLevel)

Parameters

builder IConfigurationBuilder

The configuration builder.

minimumLevel LogLevel

The lowest level to log.

Returns

ILoggingConfigurationBuilder

The logging section of the builder.

ConfigureLogging(IConfigurationBuilder, Action<LoggingConfiguration>)

Configures the logging options with a callback.

public static ILoggingConfigurationBuilder ConfigureLogging(this IConfigurationBuilder builder, Action<LoggingConfiguration> configure)

Parameters

builder IConfigurationBuilder

The configuration builder.

configure Action<LoggingConfiguration>

Receives the LoggingConfiguration.

Returns

ILoggingConfigurationBuilder

The logging section of the builder.

ConfigureMarkup(IConfigurationBuilder, Action<MarkupConfiguration>)

Configures the markup facet - the types markup may name, how they're constructed, and how bare text becomes objects.

public static IReflectionConfigurationBuilder ConfigureMarkup(this IConfigurationBuilder builder, Action<MarkupConfiguration> configure)

Parameters

builder IConfigurationBuilder

The configuration builder instance; ConfigureTypes() isn't needed first.

configure Action<MarkupConfiguration>

The configuration action applied to Markup.

Returns

IReflectionConfigurationBuilder

The reflection section of the builder.

Examples

builder.ConfigureMarkup(m => m.RegisterShortName<HealthBar>());

ConfigureRendering(IConfigurationBuilder, Action<IRenderContext>)

Configures the render context with a callback.

public static IRenderingConfigurationBuilder ConfigureRendering(this IConfigurationBuilder builder, Action<IRenderContext> configure)

Parameters

builder IConfigurationBuilder

The configuration builder instance; its render context must already be set.

configure Action<IRenderContext>

Receives the IRenderContext.

Returns

IRenderingConfigurationBuilder

The rendering section of the builder.

ConfigureScaling(IConfigurationBuilder, Action<ScalingConfiguration>)

Configures the UI scaling facet - the defaults every Canvas uses to compute EffectiveScale.

public static IScalingConfigurationBuilder ConfigureScaling(this IConfigurationBuilder builder, Action<ScalingConfiguration> configure)

Parameters

builder IConfigurationBuilder

The configuration builder instance.

configure Action<ScalingConfiguration>

The configuration action applied to ScalingConfiguration.

Returns

IScalingConfigurationBuilder

The scaling section of the builder.

Examples

builder.ConfigureScaling().ConfigureScaling(s => s.Mode = UIScaleMode.ReferenceResolution);

ConfigureTheme(IConfigurationBuilder, Action<ThemeConfiguration>)

Configures the default-theme facet - the ResourceDictionary a Canvas exposes to every element attached to it (see Resources).

public static IThemeConfigurationBuilder ConfigureTheme(this IConfigurationBuilder builder, Action<ThemeConfiguration> configure)

Parameters

builder IConfigurationBuilder

The configuration builder instance.

configure Action<ThemeConfiguration>

The configuration action applied to the built configuration's ThemeConfiguration.

Returns

IThemeConfigurationBuilder

The theme section of the builder.

Examples

builder.ConfigureTheme(t => t.Theme = myCustomThemeDictionary);

Remarks

The callback runs when the configuration is built, in order with other deferred steps such as UseDefaultTheme(IConfigurationBuilder), so a theme set here replaces a default theme an engine integration requested earlier.

ConfigureTypes(IConfigurationBuilder, Action<ReflectionConfiguration>)

Configures the reflection options (type resolution, conversion, markup, debug tools) with a callback.

public static IReflectionConfigurationBuilder ConfigureTypes(this IConfigurationBuilder builder, Action<ReflectionConfiguration> configure)

Parameters

builder IConfigurationBuilder

The configuration builder instance.

configure Action<ReflectionConfiguration>

Receives the ReflectionConfiguration.

Returns

IReflectionConfigurationBuilder

The reflection section of the builder.

UseDefaultTheme(IConfigurationBuilder)

Loads IcyUI's built-in theme once the configuration is built. Both engine integrations call it by default.

public static IThemeConfigurationBuilder UseDefaultTheme(this IConfigurationBuilder builder)

Parameters

builder IConfigurationBuilder

The configuration builder instance.

Returns

IThemeConfigurationBuilder

The theme section of the builder.

Remarks

Runs as an AfterBuild(Action<IcyConfiguration>) step, so a ConfigureTheme(IConfigurationBuilder, Action<ThemeConfiguration>) callback declared later replaces the default theme. A theme already assigned through the builder's theme section (builder.ConfigureTheme().Theme.Theme = myTheme) is kept, and the built-in one isn't loaded.

UseDefaultTheme(IcyConfiguration)

Loads IcyUI's own bundled default theme and assigns it to Theme's Theme property, so a Canvas built against configuration gives every Tier-1 control (Button, CheckBox, etc.) a real default look with no further setup.

public static IcyConfiguration UseDefaultTheme(this IcyConfiguration configuration)

Parameters

configuration IcyConfiguration

The built configuration to load the theme through and assign it to.

Returns

IcyConfiguration

configuration, for fluent chaining.

Remarks

Loading the theme markup needs a fully-built IcyConfiguration (a real MarkupLoader, type resolution, and property registration). On a builder, use UseDefaultTheme(IConfigurationBuilder), which runs this after Build(); call this one to switch back to the default theme at runtime.

Exceptions

InvalidOperationException

The bundled default-theme resource is missing.

UseLoggerFactory(ILoggingConfigurationBuilder, ILoggerFactory)

Sends IcyUI's log messages to factory instead of IcyUI's own providers.

public static ILoggingConfigurationBuilder UseLoggerFactory(this ILoggingConfigurationBuilder builder, ILoggerFactory factory)

Parameters

builder ILoggingConfigurationBuilder

The logging section.

factory ILoggerFactory

The factory to create IcyUI's loggers from. IcyUI doesn't dispose it.

Returns

ILoggingConfigurationBuilder

The logging section of the builder.

UsePoLocalization(IAssetConfigurationBuilder, string, CultureInfo)

Takes localized strings from gettext .po files, one per language, in folder (see PoLocalizer).

public static IAssetConfigurationBuilder UsePoLocalization(this IAssetConfigurationBuilder builder, string folder, CultureInfo defaultCulture)

Parameters

builder IAssetConfigurationBuilder

The asset configuration builder instance.

folder string

The folder of the files, relative to the game's assets, such as Localization.

defaultCulture CultureInfo

The language used when the current one has no string, usually the game's own.

Returns

IAssetConfigurationBuilder

The current asset configuration builder instance for fluent configuration.

WithAssemblyResolver(IReflectionConfigurationBuilder, IAssemblyResolver)

Sets the assembly resolver for the reflection configuration.

public static IReflectionConfigurationBuilder WithAssemblyResolver(this IReflectionConfigurationBuilder builder, IAssemblyResolver resolver)

Parameters

builder IReflectionConfigurationBuilder

The reflection configuration builder instance.

resolver IAssemblyResolver

The assembly resolver instance to be used.

Returns

IReflectionConfigurationBuilder

The current reflection configuration builder instance for fluent configuration.

WithAssetContextFactory(IAssetConfigurationBuilder, IAssetContextFactory)

Sets the asset context factory for the asset configuration.

public static IAssetConfigurationBuilder WithAssetContextFactory(this IAssetConfigurationBuilder builder, IAssetContextFactory factory)

Parameters

builder IAssetConfigurationBuilder

The asset configuration builder instance.

factory IAssetContextFactory

The asset context factory to be set to the configuration.

Returns

IAssetConfigurationBuilder

THe current asset configuration builder to fluent configuration.

WithCulture(IConfigurationBuilder, CultureInfo?)

Sets the culture IcyUI formats and parses the values players read and type with (Culture).

public static IConfigurationBuilder WithCulture(this IConfigurationBuilder builder, CultureInfo? culture)

Parameters

builder IConfigurationBuilder

The configuration builder instance.

culture CultureInfo

The culture to use, or null to follow CurrentUICulture (the default).

Returns

IConfigurationBuilder

The configuration builder instance, for fluent chaining.

Examples

builder.WithCulture(CultureInfo.GetCultureInfo("ru-RU"));

WithDefaultAssetContext(IAssetConfigurationBuilder, IAssetContext)

Sets the default asset context for the asset configuration.

public static IAssetConfigurationBuilder WithDefaultAssetContext(this IAssetConfigurationBuilder builder, IAssetContext context)

Parameters

builder IAssetConfigurationBuilder

The asset configuration builder instance.

context IAssetContext

The asset context to be set as default.

Returns

IAssetConfigurationBuilder

The current asset configuration builder instance for fluent configuration.

WithLocalizer(IAssetConfigurationBuilder, ILocalizer)

Sets the localizer for the asset configuration.

public static IAssetConfigurationBuilder WithLocalizer(this IAssetConfigurationBuilder builder, ILocalizer localizer)

Parameters

builder IAssetConfigurationBuilder

The asset configuration builder instance.

localizer ILocalizer

The localizer instance to be used.

Returns

IAssetConfigurationBuilder

The current asset configuration builder instance for fluent configuration.

Remarks

WithLocalizer<T>(IAssetConfigurationBuilder)

Sets the localizer for the asset configuration using a default instance of the specified type.

public static IAssetConfigurationBuilder WithLocalizer<T>(this IAssetConfigurationBuilder builder) where T : ILocalizer, new()

Parameters

builder IAssetConfigurationBuilder

The asset configuration builder instance.

Returns

IAssetConfigurationBuilder

The current asset configuration builder instance for fluent configuration.

Type Parameters

T

The type of the localizer to create.

WithMinimumLevel(ILoggingConfigurationBuilder, LogLevel)

Sets the lowest level IcyUI's own providers receive.

public static ILoggingConfigurationBuilder WithMinimumLevel(this ILoggingConfigurationBuilder builder, LogLevel minimumLevel)

Parameters

builder ILoggingConfigurationBuilder

The logging section.

minimumLevel LogLevel

The lowest level to log.

Returns

ILoggingConfigurationBuilder

The logging section of the builder.

WithPropertyRegistry(IReflectionConfigurationBuilder, PropertyRegistry)

Sets the property registry for the reflection configuration.

public static IReflectionConfigurationBuilder WithPropertyRegistry(this IReflectionConfigurationBuilder builder, PropertyRegistry registry)

Parameters

builder IReflectionConfigurationBuilder

The reflection configuration builder instance.

registry PropertyRegistry

The property registry instance to be used.

Returns

IReflectionConfigurationBuilder

The current reflection configuration builder instance for fluent configuration.

Remarks

Only useful for isolating a configuration from the process-wide Default - tests being the usual reason. Elements must be constructed against the same registry, so build them inside a UseScope(PropertyRegistry) for registry; see the remarks on PropertyRegistry for why mixing registries breaks value precedence.

WithTypeConverter(IReflectionConfigurationBuilder, ITypeConverter)

Sets the type converter for the reflection configuration.

public static IReflectionConfigurationBuilder WithTypeConverter(this IReflectionConfigurationBuilder builder, ITypeConverter converter)

Parameters

builder IReflectionConfigurationBuilder

The reflection configuration builder instance.

converter ITypeConverter

The type converter instance to be used.

Returns

IReflectionConfigurationBuilder

The current reflection configuration builder instance for fluent configuration.