/// <summary> /// Constructor for when created a linked version of the node /// </summary> /// <param name="linkedNode">The linked master node</param> /// <param name="logger">The associated logger</param> public NetGraphContainerNode(NetGraphContainerNode linkedNode, Logger logger) { _graph = linkedNode._graph; // Reverse the nodes _inputNode = linkedNode._outputNode; _outputNode = linkedNode._inputNode; _graph.BindEndpoint(_outputNode.Uuid, new EventDataAdapter(this)); LinkedNode = true; // We don't bind logging and editing from the same graph, we assume the master did that }
/// <summary> /// Constructor /// </summary> /// <param name="name">Name of the factory</param> /// <param name="factory">Factory</param> /// <param name="direction">Direction of graph</param> /// <param name="containerGraph">The parent graph</param> /// <param name="logger">The logger to use</param> /// <param name="stateDictionary">Forwarded state dictionary</param> /// <param name="linked">If true then we are creating a linked master node</param> public NetGraphContainerNode(string name, NetGraphFactory factory, GraphDirection direction, NetGraph containerGraph, Logger logger, Dictionary <string, object> stateDictionary, bool linked) { var clients = factory.GetNodes <ClientEndpointFactory>(); var servers = factory.GetNodes <ServerEndpointFactory>(); if ((clients.Length > 0) && (servers.Length > 0)) { Guid outputNode = direction == GraphDirection.ClientToServer ? servers[0].Id : clients[0].Id; Guid inputNode = direction == GraphDirection.ClientToServer ? clients[0].Id : servers[0].Id; if (linked) { _graph = factory.Create(name, logger, containerGraph, containerGraph.GlobalMeta, containerGraph.Meta, containerGraph.ConnectionProperties); } else { _graph = factory.CreateFiltered(name, logger, containerGraph, containerGraph.GlobalMeta, containerGraph.Meta, inputNode, containerGraph.ConnectionProperties, stateDictionary); } _graph.BindEndpoint(outputNode, new EventDataAdapter(this)); _inputNode = (PipelineEndpoint)_graph.Nodes[inputNode]; _inputNode.Hidden = true; _outputNode = (PipelineEndpoint)_graph.Nodes[outputNode]; _outputNode.Hidden = true; } else { throw new ArgumentException(CANAPE.Properties.Resources.NetGraphContainerNode_InvalidGraph); } }
/// <summary> /// Constructor /// </summary> /// <param name="name">Name of the factory</param> /// <param name="factory">Factory</param> /// <param name="direction">Direction of graph</param> /// <param name="containerGraph">The parent graph</param> /// <param name="logger">The logger to use</param> /// <param name="stateDictionary">Forwarded state dictionary</param> /// <param name="linked">If true then we are creating a linked master node</param> public NetGraphContainerNode(string name, NetGraphFactory factory, GraphDirection direction, NetGraph containerGraph, Logger logger, Dictionary<string, object> stateDictionary, bool linked) { var clients = factory.GetNodes<ClientEndpointFactory>(); var servers = factory.GetNodes<ServerEndpointFactory>(); if ((clients.Length > 0) && (servers.Length > 0)) { Guid outputNode = direction == GraphDirection.ClientToServer ? servers[0].Id : clients[0].Id; Guid inputNode = direction == GraphDirection.ClientToServer ? clients[0].Id : servers[0].Id; if (linked) { _graph = factory.Create(name, logger, containerGraph, containerGraph.GlobalMeta, containerGraph.Meta, containerGraph.ConnectionProperties); } else { _graph = factory.CreateFiltered(name, logger, containerGraph, containerGraph.GlobalMeta, containerGraph.Meta, inputNode, containerGraph.ConnectionProperties, stateDictionary); } _graph.BindEndpoint(outputNode, new EventDataAdapter(this)); _inputNode = (PipelineEndpoint)_graph.Nodes[inputNode]; _inputNode.Hidden = true; _outputNode = (PipelineEndpoint)_graph.Nodes[outputNode]; _outputNode.Hidden = true; } else { throw new ArgumentException(CANAPE.Properties.Resources.NetGraphContainerNode_InvalidGraph); } }