private void ReadNode(System.IO.BinaryReader file) { // Read node info mType = (ENodeType)file.ReadInt32(); mName = file.ReadString(); mOffset = file.ReadInt64(); int count = file.ReadInt32(); // Recursively read child nodes for (int i = 0; i < count; i++) { CCatalogNode node = new CCatalogNode(); mNodes.Add(node); node.ReadNode(file); } }
/// <summary> /// Reads the catalog from the disk. /// </summary> public static CCatalogNode ReadCatalog(string filename) { // Create the root node var node = new CCatalogNode(); // Open the file System.IO.BinaryReader file = new System.IO.BinaryReader(new System.IO.FileStream(filename, System.IO.FileMode.Open, System.IO.FileAccess.Read)); // Read backup file name file.ReadString(); // Read nodes node.ReadNode(file); // Close the file file.Close(); return(node); }