Emby Developer Emby Developer
  • DEV Home
  • Documentation
  • Reference
  • Download
Search Results for

    Show / Hide Table of Contents

    Class OptionValueManager

    Extracts those property values of an options object which differ from a baseline into a flat PropertyOptionValues list, and applies such a list back onto an object.

    Inheritance
    System.Object
    OptionValueManager
    Namespace: Emby.Web.GenericEdit.OptionValues
    Assembly: Emby.Web.GenericEdit.dll
    Syntax
    public static class OptionValueManager
    Remarks

    Unlike PropertyChangeDetector, which produces a diff for display only, the result of this class is meant to be serialized and read back, so every value is held as an invariant-culture string that the target property's own System.ComponentModel.TypeConverter can restore. A value which cannot be converted in both directions is not recorded at all, rather than recorded and then lost on the way back.

    Two values are considered equal when their string forms are equal. That is intentional: the string form is what gets stored, so anything which stores identically restores identically, and a value can never start showing up as changed merely because it survived a round-trip.

    What is included follows the same rules the editor UI uses (see EditorBuilder), so what gets persisted is what the user can actually edit: [Browsable(false)] members such as select-option sources and visibility/enablement toggle objects are skipped, as are read-only members, ignored members, and the presentation elements (buttons, captions, spacers, status and progress items, grids).

    Methods

    ApplyOptionValues(Object, PropertyOptionValues)

    Assigns every value in optionValues to the property its PropertyPath points at.

    Declaration
    public static PropertyOptionValues ApplyOptionValues(object targetObject, PropertyOptionValues optionValues)
    Parameters
    Type Name Description
    System.Object targetObject

    The object to apply the values to.

    PropertyOptionValues optionValues

    The values to apply.

    Returns
    Type Description
    PropertyOptionValues

    The entries which could not be applied - because the property no longer exists, is not settable, sits behind a null child object or an absent collection item, or because the stored text is not convertible to the property's current type. Nothing is thrown for these: the caller decides whether to discard them or to retain them, so that a configuration written by a newer version is not silently truncated by an older one.

    GetOptionValues(Object, Object, EditorBuildOptions)

    Collects the values of currentObject which differ from baselineObject.

    Declaration
    public static PropertyOptionValues GetOptionValues(object baselineObject, object currentObject, EditorBuildOptions options = null)
    Parameters
    Type Name Description
    System.Object baselineObject

    The baseline to compare against - normally a default instance, constructed and initialized the same way currentObject was.

    System.Object currentObject

    The object whose deviating values are to be collected.

    EditorBuildOptions options

    The traversal options, or null for the defaults.

    Returns
    Type Description
    PropertyOptionValues
    SDK
    On this Page
    Back to Top Copyright 2022 © EMBY LLC. Please see our terms of use and privacy policy.