/// <summary> /// Decodes the data for the zone /// </summary> /// <param name="reader"></param> private void DecodeZoneData(DjvuReader reader, TextZone sibling, TextChunk chunkParent) { _zoneType = (ZoneTypes)reader.ReadByte(); _x = reader.ReadUInt16MSB() - 0x8000; _y = reader.ReadUInt16MSB() - 0x8000; _width = reader.ReadUInt16MSB() - 0x8000; _height = reader.ReadUInt16MSB() - 0x8000; _textOffset = reader.ReadUInt16MSB() - 0x8000; _textLength = reader.ReadInt24MSB(); ResolveOffsets(_parent, sibling); _rectangle = new Rectangle(_x, _y, _width, _height); int childrenZones = reader.ReadInt24MSB(); List <TextZone> children = new List <TextZone>(); TextZone childrenSibling = null; for (int x = 0; x < childrenZones; x++) { TextZone newZone = new TextZone(reader, this, childrenSibling, chunkParent); childrenSibling = newZone; children.Add(newZone); } _children = children.ToArray(); }
/// <summary> /// Reads in the bookmark data /// </summary> /// <returns></returns> private Bookmark[] ReadBookmarkData() { using (DjvuReader reader = Reader.CloneReader(_dataLocation)) { DjvuReader decompressor = reader.GetBZZEncodedReader(Length); int totalBookmarks = decompressor.ReadUInt16MSB(); List <Bookmark> bookmarks = new List <Bookmark>(); // Read in all the bookmarks while (bookmarks.Count() + bookmarks.Sum(x => x.TotalBookmarks) != totalBookmarks) { bookmarks.Add(new Bookmark(decompressor, Document, null)); } return(bookmarks.ToArray()); } }
/// <summary> /// Decodes the data for the zone /// </summary> /// <param name="reader"></param> private void DecodeZoneData(DjvuReader reader, TextZone sibling, TextChunk chunkParent) { _zoneType = (ZoneTypes)reader.ReadByte(); _x = reader.ReadUInt16MSB() - 0x8000; _y = reader.ReadUInt16MSB() - 0x8000; _width = reader.ReadUInt16MSB() - 0x8000; _height = reader.ReadUInt16MSB() - 0x8000; _textOffset = reader.ReadUInt16MSB() - 0x8000; _textLength = reader.ReadInt24MSB(); ResolveOffsets(_parent, sibling); _rectangle = new Rectangle(_x, _y, _width, _height); int childrenZones = reader.ReadInt24MSB(); List<TextZone> children = new List<TextZone>(); TextZone childrenSibling = null; for (int x = 0; x < childrenZones; x++) { TextZone newZone = new TextZone(reader, this, childrenSibling, chunkParent); childrenSibling = newZone; children.Add(newZone); } _children = children.ToArray(); }