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
Simulationtype
TypeA supported object type.
parent
Simulation.Object
Returns
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
Simulationtype
TypeA supported object type.
guid
GuidThe object's unique identifier.
parent
Simulation.Object
Returns
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
Simulationparent
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
Simulationguid
GuidThe 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
MessageThe message to update the values of
obj
JObjectThe 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
Returns
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
GetMetadata(Object)
Returns the simulation object's metadata.
public static JObject GetMetadata(this Simulation.Object src)
Parameters
src
Simulation.Object
Returns
- JObject
Exceptions
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.Objectkey
string
Returns
- JToken
Exceptions
GetMetadata(System)
Returns the simulation system's metadata.
public static JObject GetMetadata(this Simulation.System src)
Parameters
src
Simulation.System
Returns
- JObject
Exceptions
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.Systemkey
string
Returns
- JToken
Exceptions
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
MessageThe 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
MessageThe 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.Objectvalue
JObject
Exceptions
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.Objectkey
stringvalue
JToken
Exceptions
SetMetadata(System, JObject)
Sets the simulation system's metadata.
public static void SetMetadata(this Simulation.System src, JObject value)
Parameters
src
Simulation.Systemvalue
JObject
Exceptions
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.Systemkey
stringvalue
JToken
Exceptions
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
MessageThe message reference to update the data of
obj
objectThe 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