/// <summary> /// Add a subnode to this node /// </summary> /// <param name="inName">Name of the new Node</param> /// <returns>The newly created node</returns> public stringNode AddNode(string inName) { stringNode newStrNode = new stringNode(inName); Nodes.Add(newStrNode); newStrNode.Parent = this; return(newStrNode); }
/// <summary> /// Add a subnode to this node /// </summary> /// <param name="inName">Name of the new Node</param> /// <param name="inDesc">Description of the new Node</param> /// <returns>The newly created node</returns> public stringNode AddNode(string inName, string inDesc) { stringNode newStrNode = new stringNode(inName); newStrNode.Description = inDesc; Nodes.Add(newStrNode); newStrNode.Parent = this; return(newStrNode); }
/// <summary> /// Add a subnode to this node /// </summary> /// <param name="inChild">the child to add</param> public void AddNode(stringNode inChild) { if (inChild.Parent != null) { inChild.Parent.Nodes.Remove(inChild); } Nodes.Add(inChild); inChild.Parent = this; }
public string GetFullName(bool useRoot) { string fullName = Name; stringNode parent = Parent; while (parent != null && (parent.Parent != null || useRoot)) { fullName = parent.Name + "\\" + fullName; parent = parent.Parent; } return(fullName); }
public bool IsChildOf(stringNode realDropped) { foreach (stringNode node in realDropped.Nodes) { if (this == node) { return(true); } else { if (IsChildOf(node)) { return(true); } } } return(false); }
// == METHODS ===================================================================== public stringNode AddPath(string value) { string[] splittedValues = value.Split('/'); stringNode parentNode = this; stringNode node = null; foreach (string splittedValue in splittedValues) { node = parentNode.Get(splittedValue); if (node == null) { node = parentNode.AddNode(splittedValue); } parentNode = node; } return(node); }
public bool RemovePath(string value) { string[] splittedValues = value.Split('/'); stringNode parentNode = this; stringNode node = null; foreach (string splittedValue in splittedValues) { node = parentNode.Get(splittedValue); if (node != null) { parentNode = node; } } if (node != null) { node.Parent.Nodes.Remove(node); return(true); } return(false); }