/// <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.ReadUInt16BigEndian() - 0x8000; _y = reader.ReadUInt16BigEndian() - 0x8000; _width = reader.ReadUInt16BigEndian() - 0x8000; _height = reader.ReadUInt16BigEndian() - 0x8000; _textOffset = reader.ReadUInt16BigEndian() - 0x8000; _textLength = reader.ReadInt24BigEndian(); ResolveOffsets(_parent, sibling); _rectangle = new Rectangle(_x, _y, _width, _height); int childrenZones = reader.ReadInt24BigEndian(); 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(); }
protected override void ReadChunkData(DjvuReader reader) { Width = reader.ReadInt16MSB(); Height = reader.ReadInt16MSB(); MinorVersion = reader.ReadSByte(); MajorVersion = reader.ReadSByte(); DPI = reader.ReadInt16(); // LSB Gamma = (float)reader.ReadByte() / 10; sbyte flag = reader.ReadSByte(); // B[3..0] PageRotation = (PageRotations)(flag & 0x07); }
/// <summary> /// Loads the bookmark data /// </summary> /// <param name="reader"></param> private void DecodeBookmarkData(DjvuReader reader) { int childrenCount = reader.ReadByte(); int textSize = reader.ReadInt24MSB(); Name = reader.ReadUTF8String(textSize); int urlSize = reader.ReadInt24MSB(); URL = reader.ReadUTF8String(urlSize); // Read in all the children bookmarks List <Bookmark> children = new List <Bookmark>(); for (int x = 0; x < childrenCount; x++) { children.Add(new Bookmark(reader, Document, this)); } _children = children.ToArray(); }
/// <summary> /// Reads the compressed text data /// </summary> private void ReadCompressedTextData() { if (Length > 0) { using (DjvuReader reader = GetTextDataReader(_dataLocation)) { int length = (int)reader.ReadUInt24BigEndian(); byte[] textBytes = reader.ReadBytes(length); TextBytes = textBytes; Text = Encoding.UTF8.GetString(textBytes); TextLength = _text.Length; Version = reader.ReadByte(); Zone = new TextZone(reader, null, null, this); } } _isDecoded = true; /* if (Length == 0) return; * * using (DjvuReader reader = GetTextDataReader(_dataLocation)) * { * _textLength = (int)reader.ReadUInt24BigEndian(); * byte[] textBytes = reader.ReadBytes(_textLength); * _text = Encoding.UTF8.GetString(textBytes); * if (_text.Contains("предварительной")) * { * * } * * * * _version = reader.ReadByte(); * _textLength = _text.Length; * * _zone = new TextZone(reader, null, null, this); * } * * _isDecoded = true;*/ }
/// <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> /// Loads the bookmark data /// </summary> /// <param name="reader"></param> private void DecodeBookmarkData(DjvuReader reader) { int childrenCount = reader.ReadByte(); int textSize = reader.ReadInt24MSB(); Name = reader.ReadUTF8String(textSize); int urlSize = reader.ReadInt24MSB(); URL = reader.ReadUTF8String(urlSize); // Read in all the children bookmarks List<Bookmark> children = new List<Bookmark>(); for (int x = 0; x < childrenCount; x++) { children.Add(new Bookmark(reader, Document, this)); } _children = children.ToArray(); }