//save format: //write this element's position //for each sub-element //write their ID //write their element public static CharaIndexNode Load(BinaryReader reader) { CharaIndexNode node = new CharaIndexNode(); node.Position = reader.ReadInt64(); int count = reader.ReadInt32(); for (int ii = 0; ii < count; ii++) { int id = reader.ReadInt32(); CharaIndexNode subNode = CharaIndexNode.Load(reader); node.Nodes[id] = subNode; } return(node); }
private static CharaIndexNode LoadCharaIndices(string charaDir) { CharaIndexNode fullGuide = null; try { using (FileStream stream = File.OpenRead(charaDir + "index.idx")) { using (BinaryReader reader = new BinaryReader(stream)) fullGuide = CharaIndexNode.Load(reader); } } catch (Exception ex) { DiagManager.Instance.LogError(new Exception("Error reading header at " + charaDir + "\n", ex)); } return(fullGuide); }