/// <summary> /// Creates a DataAsset with the given filepath. /// </summary> /// <param name="fileName">The path to the file.</param> /// <param name="load">Whether to load the file immediately.</param> public DataAsset(string fileName, bool load) { FilePath = fileName; HeadNode = new DataNode(""); if (load) Load(); }
/// <summary> /// Sets a child at the given key to the given node. /// </summary> public DataNode SetChild(string key, DataNode node) { RemoveKey(key); children[key] = node; node.Parent = this; node.Key = key; return node; }
/// <summary> /// Removes the given node from the current node. /// </summary> /// <param name="node"></param> public void RemoveChild(DataNode node) { children.Remove(node.Key); node.Parent = null; }
/// <summary> /// Sets a child at the given node's key to the given node. /// </summary> public DataNode SetChild(DataNode node) { return SetChild(node.Key, node); }
/// <summary> /// Adds a child node at the given key. /// </summary> public DataNode AddChild(string key) { var newChild = new DataNode(key); RemoveKey(key); children[key] = newChild; newChild.Parent = this; return newChild; }