Exemple #1
0
 public Bookmark(IDjvuReader reader, IDjvuDocument document, INavmChunk navm, Bookmark parent)
 {
     InitializeReferences(document, navm, parent);
     DecodeBookmarkData(reader);
     LoadReferencedPage();
 }
Exemple #2
0
 public BGjpChunk(IDjvuReader reader, IDjvuElement parent, IDjvuDocument document,
                  string chunkID = "", long length = 0)
     : base(reader, parent, document, chunkID, length)
 {
 }
Exemple #3
0
 /// <summary>
 /// Initialize allows to delay reading of IFFChunk content to the moment it is needed.
 /// </summary>
 /// <param name="reader"></param>
 public virtual void Initialize(IDjvuReader reader)
 {
     reader.Position = DataOffset;
     ReadData(reader);
     IsInitialized = true;
 }
Exemple #4
0
 /// <summary>
 /// Reads the data for the chunk
 /// </summary>
 /// <param name="reader"></param>
 public virtual void ReadData(IDjvuReader reader)
 {
     DataOffset       = reader.Position;
     reader.Position += Length;
 }
Exemple #5
0
        /// <summary>
        /// Decodes the children of this chunk
        /// </summary>
        /// <param name="reader"></param>
        internal virtual void ReadChildren(IDjvuReader reader)
        {
            _TempChildren = new List <IDjvuNode>();

            long maxPosition = this.Length + DataOffset;

            // Jump to next FORM data "space" - it is skipped for root FORM
            if (this != Document.RootForm)
            {
                reader.Position = DataOffset;
                if (DjvuParser.IsFormChunk(ChunkType))
                {
                    maxPosition -= 4;
                }
            }

            // Read in all the chunks
            while (true)
            {
                if (reader.Position % 2 == 1)
                {
                    reader.Position++;
                }

                if (reader.Position >= maxPosition)
                {
                    break;
                }

                // Read the chunk ID
                string    id     = reader.ReadUTF8String(4);
                ChunkType type   = DjvuParser.GetChunkType(id);
                long      length = reader.ReadUInt32BigEndian();

                bool isFormChunk = DjvuParser.IsFormChunk(type);

                if (isFormChunk)
                {
                    id   = reader.ReadUTF8String(4);
                    type = DjvuParser.GetChunkType(id);
                }

                // Reset the stream position
                // reader.Position -= 4;

                var chunk = DjvuParser.CreateDecodedDjvuNode(reader, Document, this, type, id, length);

                if (chunk != null)
                {
                    if (!DjvuParser.IsRootFormChild(type))
                    {
                        _TempChildren.Add(chunk);
                        _TempChildren[_TempChildren.Count - 1].Initialize(reader);
                        reader.Position = chunk.Length + chunk.DataOffset;
                    }
                    else
                    {
                        Document.RootForm._TempChildren.Add(chunk);
                        reader.Position = chunk.Length + chunk.DataOffset;
                        if (isFormChunk)
                        {
                            reader.Position -= 4;
                        }
                    }
                }
            }

            Children      = _TempChildren;
            _TempChildren = null;
        }
Exemple #6
0
 public override void Initialize(IDjvuReader reader)
 {
     reader.Position = DataOffset + 4;
     ReadData(reader);
 }
Exemple #7
0
 public DjvuFormElement(IDjvuReader reader, IDjvuElement parent, IDjvuDocument document,
                        string chunkID = "", long length = 0)
     : base(reader, parent, document, chunkID, length)
 {
     InitializeInternal();
 }
Exemple #8
0
 public override void ReadData(IDjvuReader reader)
 {
     base.ReadData(reader);
     // TODO use ETW logging here
 }
Exemple #9
0
 public UnknownChunk(IDjvuReader reader, IDjvuElement parent, IDjvuDocument document,
                     string chunkID = "", long length = 0)
     : base(reader, parent, document, chunkID, length)
 {
     // Nothing
 }