Class ConfigToSettingsExtensions
- Namespace
- MonkeyLoader.Resonite.DataFeeds.Settings
- Assembly
- MonkeyLoader.Resonite.Integration.dll
Contains extension methods to generate data feed items that represent config keys in data feeds - in particular, for the FrooxEngine.SettingsDataFeed.
public static class ConfigToSettingsExtensions
- Inheritance
-
ConfigToSettingsExtensions
- Inherited Members
Methods
EnumerateDefaultItemsAsync(ConfigSection, IReadOnlyList<string>, IReadOnlyList<string>, string?, object?)
Enumerates the default data feed items - as opposed to the custom items - for this config section.
public static IAsyncEnumerable<DataFeedItem> EnumerateDefaultItemsAsync(this ConfigSection configSection, IReadOnlyList<string> path, IReadOnlyList<string> groupKeys, string? searchPhrase = null, object? viewData = null)
Parameters
configSectionConfigSectionThe config section to enumerate the default items for.
pathIReadOnlyList<string>The path of the items being enumerated.
groupKeysIReadOnlyList<string>The group keys for the outer container that the items should be placed in.
searchPhrasestringThe search phrase for the enumeration request.
viewDataobjectThe custom view data for the enumeration request.
Returns
- IAsyncEnumerable<DataFeedItem>
A sequence of the default data feed items for this config section.
Remarks
Config keys in subgroups are handled automatically using the SubgroupGenerator, and those with custom data feed items will use those.
EnumerateDefaultItemsAsync<T>(IDefiningConfigKey<T>, IReadOnlyList<string>, IReadOnlyList<string>)
Enumerates the default data feed items - as opposed to the custom items - for this config key.
public static IAsyncEnumerable<DataFeedItem> EnumerateDefaultItemsAsync<T>(this IDefiningConfigKey<T> configKey, IReadOnlyList<string> path, IReadOnlyList<string> groupKeys)
Parameters
configKeyIDefiningConfigKey<T>The config key to enumerate the default items for.
pathIReadOnlyList<string>The path of the items being enumerated.
groupKeysIReadOnlyList<string>The group keys for the outer container that the items should be placed in.
Returns
- IAsyncEnumerable<DataFeedItem>
A sequence of the default data feed items for this config key.
Type Parameters
T
Remarks
This will automatically pick the right data feed item(s) to represent the config key.
EnumerateItemsAsync(ConfigSection, IReadOnlyList<string>, IReadOnlyList<string>, string?, object?)
Gets the data feed items that represent this config key.
public static IAsyncEnumerable<DataFeedItem> EnumerateItemsAsync(this ConfigSection configSection, IReadOnlyList<string> path, IReadOnlyList<string> groupKeys, string? searchPhrase = null, object? viewData = null)
Parameters
configSectionConfigSectionThe config section to enumerate the default or custom items for.
pathIReadOnlyList<string>The path of the items being enumerated.
groupKeysIReadOnlyList<string>The group keys for the outer container that the items should be placed in.
searchPhrasestringThe search phrase for the enumeration request.
viewDataobjectThe custom view data for the enumeration request.
Returns
- IAsyncEnumerable<DataFeedItem>
The custom items for this config section if it has a custom items implementation; otherwise, the default items.
Remarks
Do not use this method on the config section that you are implementing a
custom items for.
Use instead
to avoid infinite recursion and a stack overflow.configSection.EnumerateDefaultItemsAsync(path, groupKeys,
searchPhrase, viewData)
EnumerateItemsAsync<T>(IDefiningConfigKey<T>, IReadOnlyList<string>, IReadOnlyList<string>, string?, object?)
Gets the data feed items that represent this config key.
public static IAsyncEnumerable<DataFeedItem> EnumerateItemsAsync<T>(this IDefiningConfigKey<T> configKey, IReadOnlyList<string> path, IReadOnlyList<string> groupKeys, string? searchPhrase = null, object? viewData = null)
Parameters
configKeyIDefiningConfigKey<T>The config key to enumerate the default or custom items for.
pathIReadOnlyList<string>The path of the items being enumerated.
groupKeysIReadOnlyList<string>The group keys for the outer container that the items should be placed in.
searchPhrasestringThe search phrase for the enumeration request.
viewDataobjectThe custom view data for the enumeration request.
Returns
- IAsyncEnumerable<DataFeedItem>
The custom items for this config key if it has a custom items component; otherwise, the default items.
Type Parameters
T
Remarks
Do not use this method on the config key that you are implementing a
custom items component for.
Use
instead to avoid infinite recursion and a stack overflow.configKey.EnumerateDefaultItemsAsync(path, groupKeys)
MakeEnum<E>(IDefiningConfigKey<E?>, IReadOnlyList<string>, IReadOnlyList<string>)
Creates an enum item for this config key.
public static DataFeedEnum<E> MakeEnum<E>(this IDefiningConfigKey<E?> configKey, IReadOnlyList<string> path, IReadOnlyList<string> groupKeys) where E : unmanaged, Enum
Parameters
configKeyIDefiningConfigKey<E?>The config key to create an enum item for.
pathIReadOnlyList<string>The path of the item being created.
groupKeysIReadOnlyList<string>The group keys for the outer container that the item should be placed in.
Returns
- DataFeedEnum<E>
The enum item for this config key.
Type Parameters
EThe type of the enum.
Remarks
This is not suitable for flags-enums.
Use instead.configKey.EnumerateDefaultItemsAsync(path,
groupKeys)
MakeEnum<E>(IDefiningConfigKey<E>, IReadOnlyList<string>, IReadOnlyList<string>)
Creates an enum item for this config key.
public static DataFeedEnum<E> MakeEnum<E>(this IDefiningConfigKey<E> configKey, IReadOnlyList<string> path, IReadOnlyList<string> groupKeys) where E : unmanaged, Enum
Parameters
configKeyIDefiningConfigKey<E>The config key to create an enum item for.
pathIReadOnlyList<string>The path of the item being created.
groupKeysIReadOnlyList<string>The group keys for the outer container that the item should be placed in.
Returns
- DataFeedEnum<E>
The enum item for this config key.
Type Parameters
EThe type of the enum.
Remarks
This is not suitable for flags-enums.
Use instead.configKey.EnumerateDefaultItemsAsync(path,
groupKeys)
MakeIndicator<T>(IDefiningConfigKey<T>, IReadOnlyList<string>, IReadOnlyList<string>)
Creates an indicator item for this config key.
public static DataFeedIndicator<T> MakeIndicator<T>(this IDefiningConfigKey<T> configKey, IReadOnlyList<string> path, IReadOnlyList<string> groupKeys)
Parameters
configKeyIDefiningConfigKey<T>The config key to create a indicator item for.
pathIReadOnlyList<string>The path of the item being created.
groupKeysIReadOnlyList<string>The group keys for the outer container that the item should be placed in.
Returns
- DataFeedIndicator<T>
The indicator item for this config key.
Type Parameters
TThe type of the config key and indicator.
Remarks
So far, these only work for strings.
MakeQuantityField<T, TQuantity>(IDefiningConfigKey<T>, IConfigKeyQuantity<T>, IReadOnlyList<string>, IReadOnlyList<string>)
Creates an quantity field item for this config key, using the given quantity component for the configuration.
public static DataFeedQuantityField<TQuantity, T> MakeQuantityField<T, TQuantity>(this IDefiningConfigKey<T> configKey, IConfigKeyQuantity<T> quantity, IReadOnlyList<string> path, IReadOnlyList<string> groupKeys) where TQuantity : unmanaged, IQuantity<TQuantity>
Parameters
configKeyIDefiningConfigKey<T>The config key to create a quantity field item for.
quantityIConfigKeyQuantity<T>The quantity component defining the configuration.
pathIReadOnlyList<string>The path of the item being created.
groupKeysIReadOnlyList<string>The group keys for the outer container that the item should be placed in.
Returns
- DataFeedQuantityField<TQuantity, T>
The quantity field item for this config key.
Type Parameters
TThe type of the config key and quantity field's input.
TQuantityThe kind of quantity.
Remarks
MakeQuantityField<T, TQuantity>(IDefiningConfigKey<T>, IReadOnlyList<string>, IReadOnlyList<string>, T, T, UnitConfiguration, UnitConfiguration?)
Creates an quantity field item for this config key, using the given parameters for the configuration.
public static DataFeedQuantityField<TQuantity, T> MakeQuantityField<T, TQuantity>(this IDefiningConfigKey<T> configKey, IReadOnlyList<string> path, IReadOnlyList<string> groupKeys, T min, T max, UnitConfiguration defaultConfiguration, UnitConfiguration? imperialConfiguration = null) where TQuantity : unmanaged, IQuantity<TQuantity>
Parameters
configKeyIDefiningConfigKey<T>The config key to create a quantity field item for.
pathIReadOnlyList<string>The path of the item being created.
groupKeysIReadOnlyList<string>The group keys for the outer container that the item should be placed in.
minTThe lower bound for the quantity field.
maxTThe upper bound for the quantity field.
defaultConfigurationUnitConfigurationThe default unit configuration for the quantity field.
imperialConfigurationUnitConfigurationThe optional imperial unit configuration for the quantity field.
Returns
- DataFeedQuantityField<TQuantity, T>
The quantity field item for this config key.
Type Parameters
TThe type of the config key and quantity field's input.
TQuantityThe kind of quantity.
Remarks
MakeSlider<T>(IDefiningConfigKey<T>, IConfigKeyRange<T>, IReadOnlyList<string>, IReadOnlyList<string>)
Creates a slider item for this config key, using the given range component for the configuration.
public static DataFeedSlider<T> MakeSlider<T>(this IDefiningConfigKey<T> configKey, IConfigKeyRange<T> range, IReadOnlyList<string> path, IReadOnlyList<string> groupKeys)
Parameters
configKeyIDefiningConfigKey<T>The config key to create a slider item for.
rangeIConfigKeyRange<T>The range component defining the configuration.
pathIReadOnlyList<string>The path of the item being created.
groupKeysIReadOnlyList<string>The group keys for the outer container that the item should be placed in.
Returns
- DataFeedSlider<T>
The slider item for this config key.
Type Parameters
TThe type of the config key and slider.
Remarks
MakeSlider<T>(IDefiningConfigKey<T>, IReadOnlyList<string>, IReadOnlyList<string>, T, T)
Creates a slider item for this config key, using the given parameters for the configuration.
public static DataFeedSlider<T> MakeSlider<T>(this IDefiningConfigKey<T> configKey, IReadOnlyList<string> path, IReadOnlyList<string> groupKeys, T min, T max)
Parameters
configKeyIDefiningConfigKey<T>The config key to create a slider item for.
pathIReadOnlyList<string>The path of the item being created.
groupKeysIReadOnlyList<string>The group keys for the outer container that the item should be placed in.
minTThe lower bound for the slider.
maxTThe upper bound for the slider.
Returns
- DataFeedSlider<T>
The slider item for this config key.
Type Parameters
TThe type of the config key and slider.
Remarks
MakeToggle(IDefiningConfigKey<bool>, IReadOnlyList<string>, IReadOnlyList<string>)
Creates a toggle item for this config key.
public static DataFeedToggle MakeToggle(this IDefiningConfigKey<bool> configKey, IReadOnlyList<string> path, IReadOnlyList<string> groupKeys)
Parameters
configKeyIDefiningConfigKey<bool>The config key to create a toggle item for.
pathIReadOnlyList<string>The path of the item being created.
groupKeysIReadOnlyList<string>The group keys for the outer container that the item should be placed in.
Returns
- DataFeedToggle
The toggle item for this config key.
MakeValueField<T>(IDefiningConfigKey<T>, IReadOnlyList<string>, IReadOnlyList<string>)
Creates a value field item for this config key.
public static DataFeedValueField<T> MakeValueField<T>(this IDefiningConfigKey<T> configKey, IReadOnlyList<string> path, IReadOnlyList<string> groupKeys)
Parameters
configKeyIDefiningConfigKey<T>The config key to create a value field item for.
pathIReadOnlyList<string>The path of the item being created.
groupKeysIReadOnlyList<string>The group keys for the outer container that the item should be placed in.
Returns
- DataFeedValueField<T>
The value field item for this config key.
Type Parameters
T
WithEnabledSource<TDataFeedItem>(TDataFeedItem, IDefiningConfigKey<bool>)
Initializes the enabled field of this data feed item by synchronizing it with the given boolean config key.
public static TDataFeedItem WithEnabledSource<TDataFeedItem>(this TDataFeedItem feedItem, IDefiningConfigKey<bool> enabledSource) where TDataFeedItem : DataFeedItem
Parameters
feedItemTDataFeedItemThe data feed item being initialized.
enabledSourceIDefiningConfigKey<bool>The boolean config key to synchronize this data feed item's enabled field with.
Returns
- TDataFeedItem
This data feed item.
Type Parameters
TDataFeedItemThe type of the data feed item being initialized.
WithEnabledState<TDataFeedItem>(TDataFeedItem, bool)
Initializes the enabled field
of this data feed item by setting it to the given enabled state.
public static TDataFeedItem WithEnabledState<TDataFeedItem>(this TDataFeedItem feedItem, bool enabled) where TDataFeedItem : DataFeedItem
Parameters
feedItemTDataFeedItemThe data feed item being initialized.
enabledboolThe enabled state to set this data feed item's enabled field to.
Returns
- TDataFeedItem
This data feed item.
Type Parameters
TDataFeedItemThe type of the data feed item being initialized.