s&box docs
API ReferenceFacepunch.ActionGraphs

public class Facepunch.ActionGraphs.ActionGraph

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.

Broader workflow and conceptual references connected to this API.

Methods

Showing 39 methods

public void AddRequiredNodes()

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

Parameters

  • defaultValue: Default: null

public System.Linq.Expressions.LambdaExpression BuildExpression()

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

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

public void ClearChanges()

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

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

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

Parameters

  • nodeLibrary: Source of node definitions for the new action graph.

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 void Deserialize(string json, System.Type delegateType, System.Text.Json.JsonSerializerOptions options = null)

Restore a previously serialized graph from JSON in this instance.

Parameters

  • json: Serialized action graph.
  • delegateType: Optional delegate type, must match the one used when serializing.
  • options: Optional serializer options. Default: null

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

Parameters

  • inputs: Default: null

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

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

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)

Parameters

  • inputs: Default: null
  • outputs: Default: null

public void RemoveNode(Facepunch.ActionGraphs.Node node)

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

Parameters

  • node: Node to remove.

public void RemoveUnusedChildNodes()

public void RemoveVariable(Facepunch.ActionGraphs.Variable variable)

public 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 void Validate(bool force = False)

Parameters

  • force: Default: False

Properties

Showing 25 properties

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

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

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

public 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 string Facepunch.ActionGraphs.ActionGraph.Icon { get; set; }

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

Entry point of the graph.

Set of links added between nodes in this action graph.

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; }

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

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

Set of nodes added to this action graph.

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

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

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

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

Primary output of the graph.

public Facepunch.ActionGraphs.ISourceLocation Facepunch.ActionGraphs.ActionGraph.SourceLocation { get; set; }

Identifies where this instance was deserialized from.

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

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

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

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

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

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

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

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

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

Set of variables added to this action graph.

Metadata

FieldValue
NamespaceFacepunch.ActionGraphs
Typeclass
AssemblyFacepunch.ActionGraphs
Doc IDT:Facepunch.ActionGraphs.ActionGraph

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