Class DataModel
Represents a data model that contains information on a game/application etc.
public abstract class DataModel
- Inheritance
-
DataModel
Constructors
DataModel()
Creates a new instance of the DataModel class
protected DataModel()
Properties
ActivePaths
Gets a read-only list of DataModelPaths targeting this data model
public ReadOnlyCollection<DataModelPath> ActivePaths { get; }
Property Value
DataModelDescription
Gets the DataModelPropertyAttribute describing this data model
[JsonIgnore]
public DataModelPropertyAttribute DataModelDescription { get; }
Property Value
DynamicChildren
Gets an read-only dictionary of all dynamic children
public ReadOnlyDictionary<string, DynamicChild> DynamicChildren { get; }
Property Value
IsExpansion
Gets the is expansion status indicating whether this data model expands the main data model
public bool IsExpansion { get; }
Property Value
Module
Gets the module this data model belongs to
[JsonIgnore]
public Module Module { get; }
Property Value
Methods
AddDynamicChild<T>(string, T)
Adds a dynamic child to this data model
public DynamicChild<T> AddDynamicChild<T>(string key, T initialValue)
Parameters
key
stringThe key of the child, must be unique to this data model
initialValue
TThe initial value of the dynamic child
Returns
- DynamicChild<T>
The resulting dynamic child which can be used to further update the value
Type Parameters
T
AddDynamicChild<T>(string, T, DataModelPropertyAttribute)
Adds a dynamic child to this data model
public DynamicChild<T> AddDynamicChild<T>(string key, T initialValue, DataModelPropertyAttribute attribute)
Parameters
key
stringThe key of the child, must be unique to this data model
initialValue
TThe initial value of the dynamic child
attribute
DataModelPropertyAttributeA data model property attribute describing the dynamic child
Returns
- DynamicChild<T>
The resulting dynamic child which can be used to further update the value
Type Parameters
T
AddDynamicChild<T>(string, T, string, string?)
Adds a dynamic child to this data model
public DynamicChild<T> AddDynamicChild<T>(string key, T initialValue, string name, string? description = null)
Parameters
key
stringThe key of the child, must be unique to this data model
initialValue
TThe initial value of the dynamic child
name
stringA human readable name for your dynamic child, shown in the UI
description
stringAn optional description, shown in the UI
Returns
- DynamicChild<T>
The resulting dynamic child which can be used to further update the value
Type Parameters
T
ClearDynamicChildren()
Removes all dynamic children from this data model
public void ClearDynamicChildren()
GetDynamicChild(string)
Gets a previously added dynamic child by its key
public DynamicChild GetDynamicChild(string key)
Parameters
key
stringThe key of the dynamic child
Returns
GetDynamicChild<T>(string)
Gets a previously added dynamic child by its key
public DynamicChild<T> GetDynamicChild<T>(string key)
Parameters
key
stringThe key of the dynamic child
Returns
- DynamicChild<T>
Type Parameters
T
The typer of dynamic child you are expecting
GetHiddenProperties()
Returns a read-only collection of all properties in this datamodel that are to be ignored
public ReadOnlyCollection<PropertyInfo> GetHiddenProperties()
Returns
GetPropertyDescription(PropertyInfo)
Gets the property description of the provided property info
public virtual DataModelPropertyAttribute? GetPropertyDescription(PropertyInfo propertyInfo)
Parameters
propertyInfo
PropertyInfo
Returns
- DataModelPropertyAttribute
If found, the property description attribute, otherwise null.
OnActivePathAdded(DataModelPathEventArgs)
Invokes the ActivePathAdded event
protected virtual void OnActivePathAdded(DataModelPathEventArgs e)
Parameters
OnActivePathRemoved(DataModelPathEventArgs)
Invokes the ActivePathRemoved event
protected virtual void OnActivePathRemoved(DataModelPathEventArgs e)
Parameters
OnDynamicDataModelAdded(DynamicDataModelChildEventArgs)
Invokes the DynamicChildAdded event
protected virtual void OnDynamicDataModelAdded(DynamicDataModelChildEventArgs e)
Parameters
OnDynamicDataModelRemoved(DynamicDataModelChildEventArgs)
Invokes the DynamicChildRemoved event
protected virtual void OnDynamicDataModelRemoved(DynamicDataModelChildEventArgs e)
Parameters
RemoveDynamicChild(DynamicChild)
Removes a dynamic child from this data model
public void RemoveDynamicChild(DynamicChild dynamicChild)
Parameters
dynamicChild
DynamicChildThe dynamic data child to remove
RemoveDynamicChildByKey(string)
Removes a dynamic child from the data model by its key
public void RemoveDynamicChildByKey(string key)
Parameters
key
stringThe key of the dynamic child to remove
TryGetDynamicChild(string, out DynamicChild)
Gets a previously added dynamic child by its key
public bool TryGetDynamicChild(string key, out DynamicChild dynamicChild)
Parameters
key
stringThe key of the dynamic child
dynamicChild
DynamicChildWhen this method returns, the DynamicChild associated with the specified key, if the key is found; otherwise, null. This parameter is passed uninitialized.
Returns
TryGetDynamicChild<T>(string, out DynamicChild<T>)
Gets a previously added dynamic child by its key
public bool TryGetDynamicChild<T>(string key, out DynamicChild<T> dynamicChild)
Parameters
key
stringThe key of the dynamic child
dynamicChild
DynamicChild<T>When this method returns, the DynamicChild<T> associated with the specified key, if the key is found and the type matches; otherwise, null. This parameter is passed uninitialized.
Returns
Type Parameters
T
The typer of dynamic child you are expecting
Events
ActivePathAdded
Occurs when a dynamic child has been added to this data model
public event EventHandler<DataModelPathEventArgs>? ActivePathAdded
Event Type
ActivePathRemoved
Occurs when a dynamic child has been removed from this data model
public event EventHandler<DataModelPathEventArgs>? ActivePathRemoved
Event Type
DynamicChildAdded
Occurs when a dynamic child has been added to this data model
public event EventHandler<DynamicDataModelChildEventArgs>? DynamicChildAdded
Event Type
DynamicChildRemoved
Occurs when a dynamic child has been removed from this data model
public event EventHandler<DynamicDataModelChildEventArgs>? DynamicChildRemoved