/// <summary> /// Saves the node and the children. /// </summary> /// <param name="node">The node.</param> /// <param name="writer">The writer.</param> private void SaveNode(HelpNode node, BinaryWriter writer) { writer.Write(node.Name); writer.Write(node.Children.Count); node.Children.ForEach(child => { SaveNode(child, writer); }); }
/// <summary> /// Loads the node and subsequent child nodes from the reader. /// </summary> /// <param name="node">The node.</param> /// <param name="reader">The reader.</param> private void LoadNode(HelpNode node, BinaryReader reader) { node.Name = reader.ReadString(); int nodeCount = reader.ReadInt32(); for (int i = 0; i < nodeCount; i++) { HelpNode child = new HelpNode(); LoadNode(child, reader); node.Children.Add(child); } }
/// <summary> /// Removes all nodes and pages. /// </summary> public void Clear() { RootNode = new HelpNode(); Pages.Clear(); }