public override string Process(string[] arguments) { string output = ""; if (arguments.Length == 3) { TransformNode childNode = TransformNode.Find(arguments[1]) as TransformNode; TransformNode parentNode = TransformNode.Find(arguments[2]) as TransformNode; if (childNode != null && parentNode != null) { if (childNode.FindNode(parentNode.Name) == null) { childNode.SetParent(parentNode); } else { output = "Cannot parent a node to one of its children"; } } else { output = "Parenting failed - could not find parent or child node"; } } else { output = "You must specify two nodes"; } return(output); }
public override string Process(string[] arguments) { string output = ""; Console.WriteLine(); if (arguments.Length == 2) { TransformNode node = TransformNode.Find(arguments[1]) as TransformNode; if (node != null) { node.ShowTree(); } else { output = "Invalid node specified: " + arguments[1]; } } else { TransformNode.ShowAll(); } return(output); }
public override string Process(string[] arguments) { string output = ""; if (arguments.Length == 3) { Node node = TransformNode.Find(arguments[1]); if (node != null) { if (TransformNode.Find(arguments[2]) == null) { node.Name = arguments[2]; } else { output = "The target name already exists: " + arguments[2]; } } else { output = "Could not find the specified node: " + arguments[1]; } } else { output = "You must specify the old name and the new name"; } return(output); }
public TransformNode(string name) { string validatedName = name; int counter = 2; while (TransformNode.Find(validatedName) != null) { validatedName = name + counter.ToString(); counter++; } children = new List <TransformNode>(); this.name = validatedName; rootNodes.Add(this); }
public override string Process(string[] arguments) { string output = ""; if (arguments.Length == 3) { TransformNode node1 = TransformNode.Find(arguments[1]) as TransformNode; TransformNode node2 = TransformNode.Find(arguments[2]) as TransformNode; if (node1 != null && node2 != null) { TransformNode.Group(node1, node2); } else { output = "One or both nodes are invalid"; } } else if (arguments.Length == 2) { TransformNode node1 = TransformNode.Find(arguments[1]) as TransformNode; if (node1 != null) { TransformNode.Group(node1); } else { output = "Invalid node"; } } else { output = "You must specify one or two nodes in order to group"; } return(output); }
public override string Process(string[] arguments) { string output = ""; if (arguments.Length == 2) { TransformNode node = TransformNode.Find(arguments[1]) as TransformNode; if (node != null) { node.RemoveNode(); } else { output = "Node not found: " + arguments[1]; } } else { output = "You must enter the name of a single node to remove"; } return(output); }
public override string Process(string[] arguments) { string output = ""; if (arguments.Length == 2) { TransformNode node = TransformNode.Find(arguments[1]) as TransformNode; if (node != null) { node.SetParent(null); } else { output = "Could not find specified node"; } } else { output = "You must specify a single node"; } return(output); }