Table of Contents

Class DataModel

Namespace
Artemis.Core.Modules
Assembly
Artemis.Core.dll

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

ReadOnlyCollection<DataModelPath>

DataModelDescription

Gets the DataModelPropertyAttribute describing this data model

[JsonIgnore]
public DataModelPropertyAttribute DataModelDescription { get; }

Property Value

DataModelPropertyAttribute

DynamicChildren

Gets an read-only dictionary of all dynamic children

public ReadOnlyDictionary<string, DynamicChild> DynamicChildren { get; }

Property Value

ReadOnlyDictionary<string, DynamicChild>

IsExpansion

Gets the is expansion status indicating whether this data model expands the main data model

public bool IsExpansion { get; }

Property Value

bool

Module

Gets the module this data model belongs to

[JsonIgnore]
public Module Module { get; }

Property Value

Module

Methods

AddDynamicChild<T>(string, T)

Adds a dynamic child to this data model

public DynamicChild<T> AddDynamicChild<T>(string key, T initialValue)

Parameters

key string

The key of the child, must be unique to this data model

initialValue T

The 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 string

The key of the child, must be unique to this data model

initialValue T

The initial value of the dynamic child

attribute DataModelPropertyAttribute

A 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 string

The key of the child, must be unique to this data model

initialValue T

The initial value of the dynamic child

name string

A human readable name for your dynamic child, shown in the UI

description string

An 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 string

The key of the dynamic child

Returns

DynamicChild

GetDynamicChild<T>(string)

Gets a previously added dynamic child by its key

public DynamicChild<T> GetDynamicChild<T>(string key)

Parameters

key string

The 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

ReadOnlyCollection<PropertyInfo>

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

e DataModelPathEventArgs

OnActivePathRemoved(DataModelPathEventArgs)

Invokes the ActivePathRemoved event

protected virtual void OnActivePathRemoved(DataModelPathEventArgs e)

Parameters

e DataModelPathEventArgs

OnDynamicDataModelAdded(DynamicDataModelChildEventArgs)

Invokes the DynamicChildAdded event

protected virtual void OnDynamicDataModelAdded(DynamicDataModelChildEventArgs e)

Parameters

e DynamicDataModelChildEventArgs

OnDynamicDataModelRemoved(DynamicDataModelChildEventArgs)

Invokes the DynamicChildRemoved event

protected virtual void OnDynamicDataModelRemoved(DynamicDataModelChildEventArgs e)

Parameters

e DynamicDataModelChildEventArgs

RemoveDynamicChild(DynamicChild)

Removes a dynamic child from this data model

public void RemoveDynamicChild(DynamicChild dynamicChild)

Parameters

dynamicChild DynamicChild

The 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 string

The 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 string

The key of the dynamic child

dynamicChild DynamicChild

When this method returns, the DynamicChild associated with the specified key, if the key is found; otherwise, null. This parameter is passed uninitialized.

Returns

bool

true if the data model contains the dynamic child; otherwise false

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 string

The 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

bool

true if the data model contains the dynamic child; otherwise false

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

EventHandler<DataModelPathEventArgs>

ActivePathRemoved

Occurs when a dynamic child has been removed from this data model

public event EventHandler<DataModelPathEventArgs>? ActivePathRemoved

Event Type

EventHandler<DataModelPathEventArgs>

DynamicChildAdded

Occurs when a dynamic child has been added to this data model

public event EventHandler<DynamicDataModelChildEventArgs>? DynamicChildAdded

Event Type

EventHandler<DynamicDataModelChildEventArgs>

DynamicChildRemoved

Occurs when a dynamic child has been removed from this data model

public event EventHandler<DynamicDataModelChildEventArgs>? DynamicChildRemoved

Event Type

EventHandler<DynamicDataModelChildEventArgs>