Exemplo n.º 1
0
        public LocalPropertyId(string id)
        {
            string[] components = id.Split('.');

            Target   = new LocalId(components[0]);
            Property = components[1];
        }
Exemplo n.º 2
0
        public LocalPropertyId(string expression)
        {
            string[] elements = expression.Split('.');

            TargetIdentifier = new LocalId(elements[0]);
            PropertyPath     = new string[elements.Length - 1];
            for (int i = 0; i < elements.Length - 1; i++)
            {
                PropertyPath[i] = elements[i + 1];
            }
        }
Exemplo n.º 3
0
		public Node this[LocalId id]
		{
			get
			{
				foreach (var node in Nodes)
				{
					if (node.Id == id)
					{
						return node;
					}
				}
				return null;
			}
		}
Exemplo n.º 4
0
 public INodeInstance this[LocalId id]
 {
     get {
         for (int i = 0; i < graph.Nodes.Length; i++)
         {
             Node node = graph.Nodes[i];
             if (node.Id == id)
             {
                 return(nodeInstances[i]);
             }
         }
         return(null);
     }
 }
Exemplo n.º 5
0
 public NodeTemplate this[LocalId id]
 {
     get
     {
         foreach (var node in Nodes)
         {
             if (node.Id == id)
             {
                 return(node);
             }
         }
         return(null);
     }
 }
Exemplo n.º 6
0
 public INodeInstance this[LocalId id]
 {
     get
     {
         for (int i = 0; i < Template.Nodes.Length; i++)
         {
             var node = Template.Nodes[i];
             if (node.Id == id)
             {
                 return(nodeInstances[i]);
             }
         }
         return(null);
     }
 }
Exemplo n.º 7
0
        public Node UnpackInputs(LocalId id, List <LocalPropertyId> connectionIds, ref int outputCounter)
        {
            var nodeType = System.Type.GetType(Type);

            var jsonSerializer = new JsonSerializer();

            jsonSerializer.Converters.Add(new InputSocketConverter(connectionIds));
            jsonSerializer.Converters.Add(new LocalIdJsonConverter());
            object nodeObject = Data.ToObject(nodeType, jsonSerializer);

            var node = (Node)nodeObject;

            node.Id = id;

            return(node);
        }
Exemplo n.º 8
0
        public LocalPropertyId(string expression)
        {
            if (string.IsNullOrEmpty(expression))
            {
                TargetIdentifier = LocalId.None;
                PropertyPath     = null;
                return;
            }

            string[] elements = expression.Split('.');

            TargetIdentifier = new LocalId(elements[0]);
            PropertyPath     = new string[elements.Length - 1];
            for (int i = 0; i < elements.Length - 1; i++)
            {
                PropertyPath[i] = elements[i + 1];
            }
        }
Exemplo n.º 9
0
        public Node UnpackNodeAndInputs(Type nodeType, LocalId id, HashSet <LocalPropertyId> validOutputs, List <LocalPropertyId> connectionIds)
        {
            if (nodeType is null)
            {
                throw new ArgumentNullException(nameof(nodeType));
            }

            var jsonSerializer = new JsonSerializer();

            jsonSerializer.Converters.Add(new InputSocketConverter(validOutputs, connectionIds));
            jsonSerializer.Converters.Add(new LocalIdJsonConverter());

            object nodeObject = Data.ToObject(nodeType, jsonSerializer);

            var node = (Node)nodeObject;

            node.Id = id;

            return(node);
        }
Exemplo n.º 10
0
 public LocalPropertyId(LocalId targetIdentifier, string[] propertyPath)
 {
     TargetIdentifier = targetIdentifier;
     PropertyPath     = propertyPath;
 }
Exemplo n.º 11
0
 public LocalPropertyId(LocalId targetIdentifier, string property)
 {
     TargetIdentifier = targetIdentifier;
     PropertyPath     = property.Split('.');
 }