API ReferenceFacepunch.ActionGraphs

ActionGraphclass

Represents an async method as a directed graph. Control will enter through an "event" node, which can route signals through a network of other nodes that perform actions. Use `Facepunch.ActionGraphs.ActionGraph.CreateEmpty(Facepunch.ActionGraphs.NodeLibrary)` to create a completely blank graph, or `Facepunch.ActionGraphs.ActionGraph.CreateDelegate`(Facepunch.ActionGraphs.NodeLibrary)` to create a graph that handles an event matching the signature of a particular delegate.

objectActionGraph
Namespace
Facepunch.ActionGraphs
Assembly
Facepunch.ActionGraphs
Declaration
public class Facepunch.ActionGraphs.ActionGraph

Methods39

Showing 39 methods

public void AddRequiredNodes()PUBLIC

Returns:void

public Facepunch.ActionGraphs.Variable AddVariable(string name, System.Type type, object defaultValue = null)PUBLIC

ParameterTypeDescription
namestring
typeType
defaultValue = nullobject
Returns:Variable

public System.Linq.Expressions.LambdaExpression BuildExpression()PUBLIC

Builds a `System.Linq.Expressions.LambdaExpression` that implements this graph.

Returns:LambdaExpression

public bool CanCreateSubGraph(System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.Node> nodes)PUBLIC

ParameterTypeDescription
nodesIEnumerable<Node>
Returns:bool

public void ClearChanges()PUBLIC

Don't increment `Facepunch.ActionGraphs.ActionGraph.ChangeId` during next validation.

Returns:void

public static Facepunch.ActionGraphs.ActionGraph CreateEmpty(Facepunch.ActionGraphs.NodeLibrary nodeLibrary)PUBLICSTATIC

Creates a completely blank action graph. This won't be invokable until an event node is added.

ParameterTypeDescription
nodeLibraryNodeLibrarySource of node definitions for the new action graph.
Returns:ActionGraph

public System.Threading.Tasks.Task`1<System.Nullable`1<Facepunch.ActionGraphs.CreateSubGraphResult>> CreateSubGraphAsync(System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.Node> nodes, System.Text.Json.JsonSerializerOptions jsonOptions, Facepunch.ActionGraphs.CreateSubGraphNodeDelegate createSubGraphNode)PUBLIC

ParameterTypeDescription
nodesIEnumerable<Node>
jsonOptionsJsonSerializerOptions
createSubGraphNodeCreateSubGraphNodeDelegate
Returns:Task<Nullable<CreateSubGraphResult>>

public void Deserialize(string json, System.Type delegateType, System.Text.Json.JsonSerializerOptions options = null)PUBLIC

Restore a previously serialized graph from JSON in this instance.

ParameterTypeDescription
jsonstringSerialized action graph.
delegateTypeTypeOptional delegate type, must match the one used when serializing.
options = nullJsonSerializerOptionsOptional serializer options.
Returns:void

public System.Collections.Generic.IReadOnlyDictionary`2<string,object> Evaluate(System.Collections.Generic.IReadOnlyDictionary`2<string,object> inputs = null)PUBLIC

ParameterTypeDescription
inputs = nullIReadOnlyDictionary<string,object>
Returns:IReadOnlyDictionary<string,object>

public System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.IActionGraphDelegate> GetDelegates()PUBLIC

Gets all known `Facepunch.ActionGraphs.IActionGraphDelegate`s created from this graph.

Returns:IEnumerable<IActionGraphDelegate>

public System.Threading.Tasks.Task`1<System.Collections.Generic.IReadOnlyDictionary`2<string,object>> InvokeAsync(System.Collections.Generic.IReadOnlyDictionary`2<string,object> inputs = null, System.Collections.Generic.IReadOnlyDictionary`2<string,Facepunch.ActionGraphs.Compilation.OutputDelegate> outputs = null)PUBLIC

ParameterTypeDescription
inputs = nullIReadOnlyDictionary<string,object>
outputs = nullIReadOnlyDictionary<string,OutputDelegate>
Returns:Task<IReadOnlyDictionary<string,object>>

public void RemoveNode(Facepunch.ActionGraphs.Node node)PUBLIC

Remove a node from this action graph. Any links into or out of the node will also be removed.

ParameterTypeDescription
nodeNodeNode to remove.
Returns:void

public void RemoveUnusedChildNodes()PUBLIC

Returns:void

public void RemoveVariable(Facepunch.ActionGraphs.Variable variable)PUBLIC

ParameterTypeDescription
variableVariable
Returns:void

public string Serialize(System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.Node> nodes, System.Text.Json.JsonSerializerOptions options)PUBLIC

ParameterTypeDescription
nodesIEnumerable<Node>
optionsJsonSerializerOptions
Returns:string

public System.Text.Json.Nodes.JsonNode SerializeToNode(System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.Node> nodes, System.Text.Json.JsonSerializerOptions options)PUBLIC

ParameterTypeDescription
nodesIEnumerable<Node>
optionsJsonSerializerOptions
Returns:JsonNode

public void Validate(bool force = False)PUBLIC

ParameterTypeDescription
force = Falsebool
Returns:void

Properties25

Showing 25 properties

public string Facepunch.ActionGraphs.ActionGraph.Category { get; set; }PUBLICGETSET

Returns:string

public int Facepunch.ActionGraphs.ActionGraph.ChangeId { get; set; }PUBLICGETSET

Increments each time this graph re-validates after a change.

Returns:int

public string Facepunch.ActionGraphs.ActionGraph.Description { get; set; }PUBLICGETSET

Returns:string

public System.Guid Facepunch.ActionGraphs.ActionGraph.Guid { get; set; }PUBLICGETSET

Returns:Guid

public string Facepunch.ActionGraphs.ActionGraph.Icon { get; set; }PUBLICGETSET

Returns:string

public Facepunch.ActionGraphs.Node Facepunch.ActionGraphs.ActionGraph.InputNode { get; set; }PUBLICGETSETINGEST

Entry point of the graph.

Returns:Node

public System.Collections.Generic.IReadOnlyCollection`1<Facepunch.ActionGraphs.ValidationMessage> Facepunch.ActionGraphs.ActionGraph.Messages { get; set; }PUBLICGETSET

Returns:IReadOnlyCollection<ValidationMessage>

public virtual sealed Facepunch.ActionGraphs.NodeLibrary Facepunch.ActionGraphs.ActionGraph.NodeLibrary { get; set; }PUBLICVIRTUALGETSET

Library of node definitions available for use by this action graph.

Returns:NodeLibrary

public System.Collections.Generic.IReadOnlyDictionary`2<int,Facepunch.ActionGraphs.Node> Facepunch.ActionGraphs.ActionGraph.Nodes { get; set; }PUBLICGETSET

Set of nodes added to this action graph.

Returns:IReadOnlyDictionary<int,Node>

public System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.Node> Facepunch.ActionGraphs.ActionGraph.OutputNodes { get; set; }PUBLICGETSET

Nodes that emit return values or output signals from this graph to the caller.

Returns:IEnumerable<Node>

public System.Collections.Generic.IReadOnlyDictionary`2<string,Facepunch.ActionGraphs.OutputDefinition> Facepunch.ActionGraphs.ActionGraph.Outputs { get; set; }PUBLICGETSET

Returns:IReadOnlyDictionary<string,OutputDefinition>

public Facepunch.ActionGraphs.Node Facepunch.ActionGraphs.ActionGraph.PrimaryOutputNode { get; set; }PUBLICGETSET

Primary output of the graph.

Returns:Node

public virtual sealed string Facepunch.ActionGraphs.ActionGraph.StackTraceIdentifier { get; set; }PUBLICVIRTUALGETSET

Returns:string

public string[] Facepunch.ActionGraphs.ActionGraph.Tags { get; set; }PUBLICGETSET

Returns:string[]

public Facepunch.ActionGraphs.InputDefinition Facepunch.ActionGraphs.ActionGraph.TargetDefinition { get; set; }PUBLICGETSET

The definition of the graph input that represents the target of the graph.

Returns:InputDefinition

public Facepunch.ActionGraphs.Node.Output Facepunch.ActionGraphs.ActionGraph.TargetOutput { get; set; }PUBLICGETSET

The output of the graph's entry node that represents the target of the graph.

Returns:Output

public string Facepunch.ActionGraphs.ActionGraph.Title { get; set; }PUBLICGETSET

Returns:string

public System.Text.Json.Nodes.JsonObject Facepunch.ActionGraphs.ActionGraph.UserData { get; set; }PUBLICGETSET

Arbitrary named values stored in this action graph, which will be included during serialization. Values must be serializable to JSON.

Returns:JsonObject

public System.Collections.Generic.IReadOnlyDictionary`2<string,Facepunch.ActionGraphs.Variable> Facepunch.ActionGraphs.ActionGraph.Variables { get; set; }PUBLICGETSET

Set of variables added to this action graph.

Returns:IReadOnlyDictionary<string,Variable>

On this page

Methodspublic Facepunch.ActionGraphs.Node AddNode(Facepunch.ActionGraphs.NodeDefinition definition, Facepunch.ActionGraphs.Node parent)public virtual sealed Facepunch.ActionGraphs.Node AddNode(Facepunch.ActionGraphs.NodeDefinition definition)public System.Void AddRequiredNodes()public Facepunch.ActionGraphs.Variable AddVariable(System.String name, System.Type type, System.Object defaultValue = null)public System.Linq.Expressions.LambdaExpression BuildExpression()public System.Boolean CanCreateSubGraph(System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.Node> nodes)public System.Void ClearChanges()public static Facepunch.ActionGraphs.IActionGraphDelegate CreateDelegate(Facepunch.ActionGraphs.NodeLibrary nodeLibrary, System.Type delegateType)public Facepunch.ActionGraphs.IActionGraphDelegate CreateDelegate(System.Type delegateType, System.Collections.Generic.IReadOnlyDictionary`2<System.String,System.Object> defaults = null)public static Facepunch.ActionGraphs.ActionGraphDelegate`1<T> CreateDelegate(Facepunch.ActionGraphs.NodeLibrary nodeLibrary)public Facepunch.ActionGraphs.ActionGraphDelegate`1<T> CreateDelegate(System.Collections.Generic.IReadOnlyDictionary`2<System.String,System.Object> defaults = null)public static Facepunch.ActionGraphs.ActionGraph CreateEmpty(Facepunch.ActionGraphs.NodeLibrary nodeLibrary)public System.Threading.Tasks.Task`1<System.Nullable`1<Facepunch.ActionGraphs.CreateSubGraphResult>> CreateSubGraphAsync(System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.Node> nodes, System.Text.Json.JsonSerializerOptions jsonOptions, Facepunch.ActionGraphs.CreateSubGraphNodeDelegate createSubGraphNode)public System.Void Deserialize(System.String json, System.Type delegateType, System.Text.Json.JsonSerializerOptions options = null)public Facepunch.ActionGraphs.InsertResult DeserializeInsert(System.String json, System.Text.Json.JsonSerializerOptions options)public Facepunch.ActionGraphs.InsertResult DeserializeInsert(System.Text.Json.Nodes.JsonNode json, System.Text.Json.JsonSerializerOptions options)public System.Collections.Generic.IReadOnlyDictionary`2<System.String,System.Object> Evaluate(System.Collections.Generic.IReadOnlyDictionary`2<System.String,System.Object> inputs = null)public System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.IActionGraphDelegate> GetDelegates()public Facepunch.ActionGraphs.Link InsertLink(Facepunch.ActionGraphs.Node.Input target, Facepunch.ActionGraphs.ILinkSource source, System.Int32 index)public System.Threading.Tasks.Task`1<System.Collections.Generic.IReadOnlyDictionary`2<System.String,System.Object>> InvokeAsync(System.Collections.Generic.IReadOnlyDictionary`2<System.String,System.Object> inputs = null, System.Collections.Generic.IReadOnlyDictionary`2<System.String,Facepunch.ActionGraphs.Compilation.OutputDelegate> outputs = null)public static Facepunch.ActionGraphs.ActionGraph.SerializationOptionsScope PushCache(Facepunch.ActionGraphs.IActionGraphCache value, System.Boolean writeReferences)public static Facepunch.ActionGraphs.ActionGraph.SerializationOptionsScope PushGuidMap(System.Collections.Generic.IReadOnlyDictionary`2<System.Guid,System.Guid> value)public static Facepunch.ActionGraphs.ActionGraph.SerializationOptionsScope PushMakeGuidsUnique(System.Boolean value)public static Facepunch.ActionGraphs.ActionGraph.SerializationOptionsScope PushSerializationOptions(Facepunch.ActionGraphs.SerializationOptions options)public static Facepunch.ActionGraphs.ActionGraph.SerializationOptionsScope PushSourceLocation(Facepunch.ActionGraphs.ISourceLocation value)public static Facepunch.ActionGraphs.ActionGraph.SerializationOptionsScope PushTarget(Facepunch.ActionGraphs.InputDefinition value)public static Facepunch.ActionGraphs.ActionGraph.SerializationOptionsScope PushWriteCacheReferences(System.Boolean value)public System.Void RemoveLink(Facepunch.ActionGraphs.Link link)public System.Void RemoveNode(Facepunch.ActionGraphs.Node node)public System.Void RemoveUnusedChildNodes()public System.Void RemoveVariable(Facepunch.ActionGraphs.Variable variable)public System.String Serialize(System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.Node> nodes, System.Text.Json.JsonSerializerOptions options)public System.Text.Json.Nodes.JsonNode SerializeToNode(System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.Node> nodes, System.Text.Json.JsonSerializerOptions options)public Facepunch.ActionGraphs.Link SetLink(Facepunch.ActionGraphs.Node.Input target, Facepunch.ActionGraphs.ILinkSource source, System.Int32 index)public Facepunch.ActionGraphs.Link SetLink(Facepunch.ActionGraphs.Node.Input target, Facepunch.ActionGraphs.ILinkSource source)public System.Collections.Generic.IReadOnlyList`1<Facepunch.ActionGraphs.Link> SetLinks(Facepunch.ActionGraphs.Node.Input target, System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.ILinkSource> sources)public System.Void SetParameters(Facepunch.ActionGraphs.NodeBinding binding)public System.Void SetParameters(System.Collections.Generic.IReadOnlyCollection`1<Facepunch.ActionGraphs.InputDefinition> inputs, System.Collections.Generic.IReadOnlyCollection`1<Facepunch.ActionGraphs.OutputDefinition> outputs)public System.Void Validate(System.Boolean force = False)Propertiespublic System.String Facepunch.ActionGraphs.ActionGraph.Category { get; set; }public System.Int32 Facepunch.ActionGraphs.ActionGraph.ChangeId { get; set; }public System.String Facepunch.ActionGraphs.ActionGraph.Description { get; set; }public Facepunch.ActionGraphs.DisplayInfo Facepunch.ActionGraphs.ActionGraph.DisplayInfo { get; set; }public System.Guid Facepunch.ActionGraphs.ActionGraph.Guid { get; set; }public System.String Facepunch.ActionGraphs.ActionGraph.Icon { get; set; }public Facepunch.ActionGraphs.Node Facepunch.ActionGraphs.ActionGraph.InputNode { get; set; }public System.Collections.Generic.IReadOnlyDictionary`2<System.String,Facepunch.ActionGraphs.InputDefinition> Facepunch.ActionGraphs.ActionGraph.Inputs { get; set; }public Facepunch.ActionGraphs.NodeKind Facepunch.ActionGraphs.ActionGraph.Kind { get; set; }public System.Collections.Generic.IReadOnlySet`1<Facepunch.ActionGraphs.Link> Facepunch.ActionGraphs.ActionGraph.Links { get; set; }public System.Collections.Generic.IReadOnlyCollection`1<Facepunch.ActionGraphs.ValidationMessage> Facepunch.ActionGraphs.ActionGraph.Messages { get; set; }public virtual sealed Facepunch.ActionGraphs.NodeLibrary Facepunch.ActionGraphs.ActionGraph.NodeLibrary { get; set; }public System.Collections.Generic.IReadOnlyDictionary`2<System.Int32,Facepunch.ActionGraphs.Node> Facepunch.ActionGraphs.ActionGraph.Nodes { get; set; }public System.Collections.Generic.IEnumerable`1<Facepunch.ActionGraphs.Node> Facepunch.ActionGraphs.ActionGraph.OutputNodes { get; set; }public System.Collections.Generic.IReadOnlyDictionary`2<System.String,Facepunch.ActionGraphs.OutputDefinition> Facepunch.ActionGraphs.ActionGraph.Outputs { get; set; }public Facepunch.ActionGraphs.Node Facepunch.ActionGraphs.ActionGraph.PrimaryOutputNode { get; set; }public static Facepunch.ActionGraphs.SerializationOptions Facepunch.ActionGraphs.ActionGraph.SerializationOptions { get; set; }public Facepunch.ActionGraphs.ISourceLocation Facepunch.ActionGraphs.ActionGraph.SourceLocation { get; set; }public virtual sealed System.String Facepunch.ActionGraphs.ActionGraph.StackTraceIdentifier { get; set; }public System.String[] Facepunch.ActionGraphs.ActionGraph.Tags { get; set; }public Facepunch.ActionGraphs.InputDefinition Facepunch.ActionGraphs.ActionGraph.TargetDefinition { get; set; }public Facepunch.ActionGraphs.Node.Output Facepunch.ActionGraphs.ActionGraph.TargetOutput { get; set; }public System.String Facepunch.ActionGraphs.ActionGraph.Title { get; set; }public System.Text.Json.Nodes.JsonObject Facepunch.ActionGraphs.ActionGraph.UserData { get; set; }public System.Collections.Generic.IReadOnlyDictionary`2<System.String,Facepunch.ActionGraphs.Variable> Facepunch.ActionGraphs.ActionGraph.Variables { get; set; }Metadata