Table of Contents

Class Behavior

Namespace
Csra.Services
Assembly
Csra.dll

BehaviorService - when logic gets a personality.

[Serializable]
public class Behavior : IBehaviorService, IServiceBase
Inheritance
Behavior
Implements
Inherited Members

Constructors

Behavior()

protected Behavior()

Properties

Features

Gets a collection containing all defined features.

public IEnumerable<string> Features { get; }

Property Value

IEnumerable<string>

FilePath

Gets/Sets the import / export file path.

public string FilePath { get; set; }

Property Value

string

Instance

public static IBehaviorService Instance { get; }

Property Value

IBehaviorService

Methods

Export(string)

Writes all features to the specified file, or a previously defined FilePath if empty. Updates the FilePath setting.

public void Export(string filePath = "")

Parameters

filePath string

Optional. The (relative or absolute) file path.

GetFeature<T>(string)

Reads a feature's value. Type must match the original definition, an exception is thrown otherwise.

public T GetFeature<T>(string feature)

Parameters

feature string

The feature name.

Returns

T

The feature's value.

Type Parameters

T

The feature value's type.

Import(string)

Reads the specified file, or a previously defined FilePath if empty. Incrementally updates features with new values. Call Services.Behavior.Reset() to clear all data first. Updates the FilePath setting.

public void Import(string filePath = "")

Parameters

filePath string

Optional. The (relative or absolute) file path.

Reset()

Initialize the service. This is called by the API when the service is first used.

public void Reset()

SetFeature<T>(string, T)

Defines a feature's value. Creates a new entry, or updates an existing one if it already exists.

public void SetFeature<T>(string feature, T value)

Parameters

feature string

The feature name.

value T

The feature's new value.

Type Parameters

T

The feature value's type.