Table of Contents

Class Extensions

Namespace
NominalSystems.Universe
Assembly
NominalSystems.Universe.dll

Represents a collection of supported extension functions by the "Universe" library.


public static class Extensions
Inheritance
Extensions

Methods

AddObject(Simulation, Type, Object?)

Adds a new simulation object with the specified type.

public static Simulation.Object AddObject(this Simulation src, Type type, Simulation.Object? parent = null)

Parameters

src Simulation
type Type

A supported object type.

parent Simulation.Object

Returns

Simulation.Object

AddObject(Simulation, Type, in Guid, Object?)

Adds a new simulation object with the specified type and identifier.

public static Simulation.Object AddObject(this Simulation src, Type type, in Guid guid, Simulation.Object? parent = null)

Parameters

src Simulation
type Type

A supported object type.

guid Guid

The object's unique identifier.

parent Simulation.Object

Returns

Simulation.Object

AddObject<T>(Simulation, Object?)

Adds a new simulation object with the specified type.

public static T AddObject<T>(this Simulation src, Simulation.Object? parent = null) where T : Simulation.Object

Parameters

src Simulation
parent Simulation.Object

Returns

T

Type Parameters

T

AddObject<T>(Simulation, in Guid, Object?)

Adds a new simulation object with the specified type and identifier.

public static T AddObject<T>(this Simulation src, in Guid guid, Simulation.Object? parent = null) where T : Simulation.Object

Parameters

src Simulation
guid Guid

The object's unique identifier.

parent Simulation.Object

Returns

T

Type Parameters

T

Deserialize(Message, JObject?)

Deserializes a JSON object into the message, which will set the properties of the message to the values of the JSON object.

public static void Deserialize(this Message message, JObject? obj)

Parameters

message Message

The message to update the values of

obj JObject

The JSON object containing the message data

GetFieldNames(Message, bool)

Gets all the fields from the string along with their units, formatted like 'Property [unit]'.

public static List<string> GetFieldNames(this Message message, bool units = true)

Parameters

message Message
units bool

Returns

List<string>

An array of all properties with the format

GetFieldValues(Message)

Gets all the fields values from the message as a string.

public static List<string> GetFieldValues(this Message message)

Parameters

message Message

Returns

List<string>

An array of all fields with the format

GetMetadata(Object)

Returns the simulation object's metadata.

public static JObject GetMetadata(this Simulation.Object src)

Parameters

src Simulation.Object

Returns

JObject

Exceptions

Exception

GetMetadata(Object, string)

Returns the simulation object's metadata at the specified key.

public static JToken? GetMetadata(this Simulation.Object src, string key)

Parameters

src Simulation.Object
key string

Returns

JToken

Exceptions

Exception

GetMetadata(System)

Returns the simulation system's metadata.

public static JObject GetMetadata(this Simulation.System src)

Parameters

src Simulation.System

Returns

JObject

Exceptions

Exception

GetMetadata(System, string)

Returns the simulation system's metadata at the specified key.

public static JToken? GetMetadata(this Simulation.System src, string key)

Parameters

src Simulation.System
key string

Returns

JToken

Exceptions

Exception

GetObject(Message)

This will return the object from the message, which is in the raw form of the JSON object.

public static object? GetObject(this Message message)

Parameters

message Message

The message to get the object from

Returns

object

The object reference

Serialize(Message?)

Serializes this message to a JSON object and returns the JObject from the message, if possible. This will not serialize the ID of the message.

public static JObject? Serialize(this Message? message)

Parameters

message Message

The message to serialize

Returns

JObject

The JSON object from the message

SetMetadata(Object, JObject)

Sets the simulation object's metadata.

public static void SetMetadata(this Simulation.Object src, JObject value)

Parameters

src Simulation.Object
value JObject

Exceptions

Exception

SetMetadata(Object, string, JToken?)

Sets the simulation object's metadata at the specified key.

public static void SetMetadata(this Simulation.Object src, string key, JToken? value)

Parameters

src Simulation.Object
key string
value JToken

Exceptions

Exception

SetMetadata(System, JObject)

Sets the simulation system's metadata.

public static void SetMetadata(this Simulation.System src, JObject value)

Parameters

src Simulation.System
value JObject

Exceptions

Exception

SetMetadata(System, string, JToken?)

Sets the simulation system's metadata at the specified key.

public static void SetMetadata(this Simulation.System src, string key, JToken? value)

Parameters

src Simulation.System
key string
value JToken

Exceptions

Exception

SetObject(Message, object?)

This will set the object of the message to the object that is passed in. This will attempt to deserialize the object if it is a JObject.

public static void SetObject(this Message message, object? obj)

Parameters

message Message

The message reference to update the data of

obj object

The object that contains the data that should be copied

ToJson(Message)

Converts the current message to a JSON string complete with the data.

public static string ToJson(this Message message)

Parameters

message Message

Returns

string

The JSON string