Dynamo.Graph.Workspaces.WorkspaceModel.ReConnectInputConnections C# (CSharp) Method

ReConnectInputConnections() private method

Forms new connections from the external nodes to the Node To Code Node, based on the connectors passed as inputs.
private ReConnectInputConnections ( string>.Dictionary externalInputConnections, CodeBlockNodeModel cbn ) : List
externalInputConnections string>.Dictionary List of connectors to remake, along with the port names of the new port
cbn Dynamo.Graph.Nodes.CodeBlockNodeModel The new Node To Code created Code Block Node
return List
        private List<ConnectorModel> ReConnectInputConnections(
            Dictionary<ConnectorModel, string> externalInputConnections, CodeBlockNodeModel cbn)
        {
            List<ConnectorModel> newConnectors = new List<ConnectorModel>();

            foreach (var kvp in externalInputConnections)
            {
                var connector = kvp.Key;
                var variableName = kvp.Value;

                var endPortIndex = CodeBlockNodeModel.GetInportIndex(cbn, variableName);
                if (endPortIndex < 0)
                    continue;

                if (Connectors.Any(c => c.End == cbn.InPorts[endPortIndex]))
                    continue;

                var newConnector = ConnectorModel.Make(
                    connector.Start.Owner,
                    cbn,
                    connector.Start.Index,
                    endPortIndex);

                newConnectors.Add(newConnector);
            }

            return newConnectors;
        }
WorkspaceModel