Example #1
0
        /// <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);
            });
        }
Example #2
0
        /// <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);
            }
        }
Example #3
0
 /// <summary>
 /// Removes all nodes and pages.
 /// </summary>
 public void Clear()
 {
     RootNode = new HelpNode();
     Pages.Clear();
 }