private void ConnectPage(PageObject page, BBeB book) { Debug.WriteLineIf(s_bDebugMode, "Connecting page: " + page.ID); UInt32ArrayTag childIDs = (UInt32ArrayTag)page.FindFirstTag(TagId.PageObjectIds); if (childIDs != null) { foreach (uint id in childIDs.Value) { BBeBObject child = book.FindObject((ushort)id); if (child == null) { throw new InvalidBookException("Can't find object id " + id); } Debug.Assert(child.ID == id); Debug.WriteLineIf(s_bDebugMode, " Child: " + child.GetType().ToString() + " - id:" + child.ID); page.Children.Add(child); } } UInt32Tag objInfoTag = (UInt32Tag)page.FindFirstTag(TagId.ObjectInfoLink); if (objInfoTag != null) { page.InfoObj = book.FindObject((ushort)objInfoTag.Value); if (page.InfoObj == null) { throw new InvalidBookException("Can't find info object id " + objInfoTag.Value); } } StreamTagGroup stream = (StreamTagGroup)page.FindFirstTag(TagId.StreamGroup); if (stream != null) { BBeBObject tempObj = new BBeBObject(0x0); page.StreamTags = BBeBTagFactory.ParseAllTags(tempObj, stream.Data); } UInt32Tag linkTag = (UInt32Tag)page.FindFirstTag(TagId.Link); if (linkTag != null) { BBeBObject linkedObj = book.FindObject((ushort)linkTag.Value); if (linkedObj == null) { throw new InvalidBookException("Can't find object id " + linkTag.Value); } page.LinkObj = linkedObj; } }