Connections

References
[IoId("00000000-79ac-4cfd-be35-e0ac16d15c1e")] public sealed class Connections : IStorable
Provides access to a list of parameters as well as static methods for connecting and disconnecting parameters. The only way for external code to create or remove connections is via the static methods on this class.

Constructors

Connections

#
public Connections()
Create a new parameter collection.

Connections

#
public Connections(IReader reader)
reader (IReader)

Properties

Backwards

#
public IEnumerable<Guid> Backwards { get; }
Enumerate all guids in a backward fashion.

Count

#
public int Count { get; }
Gets the number of parameters in this list.

Forwards

#
public IEnumerable<Guid> Forwards { get; }
Enumerate all guids in a forward fashion.

Indexers

this[]

#
public Guid this[int index] { get; }
Gets the parameter at the specific index.
index (int)Index of parameter to retrieve.
Parameter at index.

Methods

Connect

#
public static bool Connect(IParameter source, IParameter target, ActionList undo = null)
Create a connection between a source and a target parameter.
source (IParameter)
target (IParameter)
undo (ActionList = null)
True if connection was created.

Connect

#
public static bool Connect(IParameter source, IParameter target, int indexAtSource, int indexAtTarget, ActionList undo = null)
Create a connection between a source and a target parameter.
source (IParameter)
target (IParameter)
indexAtSource (int)
indexAtTarget (int)
undo (ActionList = null)
True if connection was created.

CopyAllInputs

#
public static int CopyAllInputs(IParameter oldTarget, IParameter newTarget, ActionList undo = null)
Copy all incoming wires from one parameter to another.
oldTarget (IParameter)
newTarget (IParameter)
undo (ActionList = null)
Number of wires successfully copied.

CopyAllOutputs

#
public static int CopyAllOutputs(IParameter oldSource, IParameter newSource, ActionList undo = null)
Copy all outgoing wires from one parameter to another.
oldSource (IParameter)
newSource (IParameter)
undo (ActionList = null)
Number of wires successfully copied.

CutOutMiddleMan

#
public static bool CutOutMiddleMan(IParameter left, IParameter middle, IParameter right, ActionList undo = null)
Attempt to cut out the middle man from a triplet of connected parameters.
left (IParameter)Source parameter.
middle (IParameter)Middleman.
right (IParameter)Target parameter.
undo (ActionList = null)Undo actions.

Disconnect

#
public static bool Disconnect(IParameter source, IParameter target, ActionList undo = null)
Remove the connection between a source and a target parameter.
source (IParameter)
target (IParameter)
undo (ActionList = null)
True if connection was removed.

DisconnectAllInputs

#
public static int DisconnectAllInputs(IParameter target, ActionList undo = null)
Remove all sources from a specific parameter.
target (IParameter)
undo (ActionList = null)
True if a change was made.

DisconnectAllInputsExcept

#
public static int DisconnectAllInputsExcept(IParameter target, Guid omit, ActionList undo = null)
Remove all sources but one from a specific parameter.
target (IParameter)
omit (Guid)
undo (ActionList = null)
True if a change was made.

DisconnectAllInputsExcept

#
public static int DisconnectAllInputsExcept(IParameter target, HashSet<Guid> omissions, ActionList undo = null)
Remove all unmarked sources from a specific parameter.
target (IParameter)
omissions (HashSet<Guid>)
undo (ActionList = null)
True if a change was made.

DisconnectAllOutputs

#
public static int DisconnectAllOutputs(IParameter source, ActionList undo = null)
Remove all targets from a specific parameter.
source (IParameter)
undo (ActionList = null)
True if a change was made.

DisconnectAllOutputsExcept

#
public static int DisconnectAllOutputsExcept(IParameter source, Guid omit, ActionList undo = null)
Remove all targets but one from a specific parameter.
source (IParameter)
omit (Guid)
undo (ActionList = null)
True if a change was made.

DisconnectAllOutputsExcept

#
public static int DisconnectAllOutputsExcept(IParameter source, HashSet<Guid> omissions, ActionList undo = null)
Remove all unmarked targets from a specific parameter.
source (IParameter)
omissions (HashSet<Guid>)
undo (ActionList = null)
True if a change was made.
Explicit

IStorable.Store

#
void IStorable.Store(IWriter writer)
writer (IWriter)
Store

IndexOf

#
public int IndexOf(Guid parameter)
Find the index of a specific parameter within this list.
parameter (Guid)Parameter to search for.
Index of parameter or -1 if the parameter was not found.

MigrateAllInputs

#
public static int MigrateAllInputs(IParameter oldTarget, IParameter newTarget, ActionList undo = null)
Migrate all incoming wires from one parameter to another.
oldTarget (IParameter)
newTarget (IParameter)
undo (ActionList = null)
Number of wires successfully migrated.

MigrateAllOutputs

#
public static int MigrateAllOutputs(IParameter oldSource, IParameter newSource, ActionList undo = null)
Migrate all outgoing wires from one parameter to another.
oldSource (IParameter)
newSource (IParameter)
undo (ActionList = null)
Number of wires successfully migrated.

Mimic

#
public int Mimic(Connections other)
Duplicate another set of connections. This is a low level method which should only be used with utmost care. If at all possible consider the static methods on this class for creating, removing, and copying connections.
other (Connections)

Mimic

#
public int Mimic(Guid[] other)
Duplicate another set of connections. This is a low level method which should only be used with utmost care. If at all possible consider the static methods on this class for creating, removing, and copying connections.
other (Guid[])

Reorder

#
public void Reorder(Guid[] order)
Sort the connections so that the ID order matches the given list.
order (Guid[])

ReplaceSource

#
public static bool ReplaceSource(IParameter oldSource, IParameter newSource, IParameter target, ActionList undo = null)
Replace one source with another.
oldSource (IParameter)Source to disconnect from.
newSource (IParameter)Source to connect to.
target (IParameter)Target to affect.
undo (ActionList = null)Optional undo list.

ReplaceTarget

#
public static bool ReplaceTarget(IParameter source, IParameter oldTarget, IParameter newTarget, ActionList undo = null)
Replace one target with another.
source (IParameter)Source to affect.
oldTarget (IParameter)Target to disconnect.
newTarget (IParameter)Target to connect.
undo (ActionList = null)Optional undo list.

SwapSources

#
public static bool SwapSources(IParameter sourceA, IParameter sourceB, IParameter targetA, IParameter targetB, ActionList undo = null)
Swap the sources of two parameters. I.e. cross the wires.
sourceA (IParameter)
sourceB (IParameter)
targetA (IParameter)
targetB (IParameter)
undo (ActionList = null)
True if a swap was made.

ToArray

#
public Guid[] ToArray()
Create a duplicate of the Guid array.

Events

ParameterAdded

#
public event EventHandler<ConnectionEventArgs> ParameterAdded
Raised whenever a parameter is added or inserted into this list.

ParameterRemoved

#
public event EventHandler<ConnectionEventArgs> ParameterRemoved
Raised whenever a parameter is removed from this list.