Exemplo n.º 1
0
 /// <summary>
 /// Map old Guids to new Models in the IdReferenceResolver.
 /// This method also sets portData from the deserialized ports onto the
 /// newly created ports.
 /// </summary>
 /// <param name="node">The newly created node.</param>
 /// <param name="inPorts">The deserialized input ports.</param>
 /// <param name="outPorts">The deserialized output ports.</param>
 /// <param name="resolver">The IdReferenceResolver used during deserialization.</param>
 private static void RemapPorts(NodeModel node, PortModel[] inPorts, PortModel[] outPorts, IdReferenceResolver resolver)
 {
     foreach (var p in node.InPorts)
     {
         var deserializedPort = inPorts[p.Index];
         resolver.AddToReferenceMap(deserializedPort.GUID, p);
         setPortDataOnNewPort(p, deserializedPort);
     }
     foreach (var p in node.OutPorts)
     {
         var deserializedPort = outPorts[p.Index];
         resolver.AddToReferenceMap(deserializedPort.GUID, p);
         setPortDataOnNewPort(p, deserializedPort);
     }
 }
Exemplo n.º 2
0
 /// <summary>
 /// Map old Guids to new Models in the IdReferenceResolver.
 /// This method also sets portData from the deserialized ports onto the
 /// newly created ports.
 /// </summary>
 /// <param name="node">The newly created node.</param>
 /// <param name="inPorts">The deserialized input ports.</param>
 /// <param name="outPorts">The deserialized output ports.</param>
 /// <param name="resolver">The IdReferenceResolver used during deserialization.</param>
 private static void RemapPorts(NodeModel node, PortModel[] inPorts, PortModel[] outPorts, IdReferenceResolver resolver, ILogger logger)
 {
     foreach (var p in node.InPorts)
     {
         // Check that the port index is not out of range of the loaded ports
         if (p.Index < inPorts.Length)
         {
             var deserializedPort = inPorts[p.Index];
             resolver.AddToReferenceMap(deserializedPort.GUID, p);
             setPortDataOnNewPort(p, deserializedPort);
         }
         else
         {
             if (logger != null)
             {
                 logger.Log(
                     string.Format("while loading node {0} we could not find a port for the parameter {1} at index {2}", node.Name, p.Name, p.Index)
                     );
             }
         }
     }
     foreach (var p in node.OutPorts)
     {
         // Check that the port index is not out of range of the loaded ports
         if (p.Index < outPorts.Length)
         {
             var deserializedPort = outPorts[p.Index];
             resolver.AddToReferenceMap(deserializedPort.GUID, p);
             setPortDataOnNewPort(p, deserializedPort);
         }
         else
         {
             if (logger != null)
             {
                 logger.Log(
                     string.Format("while loading node {0} we could not find a port for the retrunkey {1} at index {2}", node.Name, p.Name, p.Index)
                     );
             }
         }
     }
 }
Exemplo n.º 3
0
 /// <summary>
 /// Map old Guids to new Models in the IdReferenceResolver.
 /// </summary>
 /// <param name="node">The newly created node.</param>
 /// <param name="inPorts">The deserialized input ports.</param>
 /// <param name="outPorts">The deserialized output ports.</param>
 /// <param name="resolver">The IdReferenceResolver used during deserialization.</param>
 private static void RemapPorts(NodeModel node, PortModel[] inPorts, PortModel[] outPorts, IdReferenceResolver resolver)
 {
     foreach (var p in node.InPorts)
     {
         resolver.AddToReferenceMap(inPorts[p.Index].GUID, p);
     }
     foreach (var p in node.OutPorts)
     {
         resolver.AddToReferenceMap(outPorts[p.Index].GUID, p);
     }
 }