public Node <INode> GetNode(NodeData _nodeData, IConstellationFileParser constellationFileParser) { Node <INode> node = null; foreach (var nodesGetter in NodeGetters) { if (nodesGetter.GetNameSpace() == _nodeData.Namespace) { var selectedNode = nodesGetter.GetNode(_nodeData.Name, constellationFileParser); if (selectedNode != null) { node = selectedNode; break; } } } var i = 0; foreach (Input input in node.GetInputs()) { input.Guid = _nodeData.GetInputs()[i].Guid; i++; } var j = 0; foreach (Output output in node.GetOutputs()) { output.Guid = _nodeData.GetOutputs()[j].Guid; j++; } var a = 0; foreach (Parameter parameter in node.GetParameters()) { if (_nodeData.GetParameters()[a].Value.IsFloat()) { parameter.Value.Set(_nodeData.GetParameters()[a].Value.GetFloat()); } else { parameter.Value.Set(_nodeData.GetParameters()[a].Value.GetString()); } a++; } return(node); }
public Node <INode> GetNodeSafeMode(NodeData _nodeData) { try { Node <INode> node = null; foreach (var nodesGetter in NodeGetters) { if (nodesGetter.GetNameSpace() == _nodeData.Namespace) { var selectedNode = nodesGetter.GetNode(_nodeData.Name); if (selectedNode != null) { node = selectedNode; break; } } } var i = 0; foreach (Input input in node.GetInputs()) { input.Guid = _nodeData.GetInputs()[i].Guid; i++; } var j = 0; foreach (Output output in node.GetOutputs()) { output.Guid = _nodeData.GetOutputs()[j].Guid; j++; } var a = 0; foreach (Attribute attribute in node.GetAttributes()) { if (_nodeData.GetAttributes()[a].Value.IsFloat()) { attribute.Value.Set(_nodeData.GetAttributes()[a].Value.GetFloat()); } else { attribute.Value.Set(_nodeData.GetAttributes()[a].Value.GetString()); } a++; } return(node); } catch { return(null); } }