Ejemplo n.º 1
0
        private NodeConnection DeserializeConnection(string s,
                                                     ref List <NodeConnection> connections,
                                                     ref Dictionary <int, Node> nodeIdReverseDict)
        {
            string[] splitData = s.Split('|');
            if (splitData.Length != 4)
            {
                return(null);
            }
            int      fromID = int.Parse(splitData[0]);
            int      toID = int.Parse(splitData[2]);
            Node     fromNode = nodeIdReverseDict[fromID];
            Node     toNode = nodeIdReverseDict[toID];
            NodeItem fromItem = null, toItem = null;

            foreach (NodeItem item in fromNode.Items)
            {
                if (item.Tag != null && item.Tag.ToString().Equals(splitData[1]))
                {
                    fromItem = item;
                }
            }
            foreach (NodeItem item in toNode.Items)
            {
                if (item.Tag.ToString().Equals(splitData[3]))
                {
                    toItem = item;
                }
            }

            NodeConnector fromConnector = new NodeOutputConnector(fromItem, true);
            NodeConnector toConnector   = new NodeInputConnector(toItem, true);

            NodeConnection NC = new NodeConnection()
            {
                From = fromConnector,
                To   = toConnector
            };

            connections.Add(NC);

            return(NC);
        }
Ejemplo n.º 2
0
 public void InvalidateConnectors()
 {
     NodeInputConnector.Invalidate();
     NodeOutputConnector.Invalidate();
 }