Exemple #1
0
        /// <summary>
        /// Return the n-th index of a given data block type
        /// </summary>
        private int FindBlockIndexByType(enumBlockType type, int number)
        {
            if ((number < 0) || (number >= Head.BlockCount))
            {
                return(-1);
            }

            for (int i = 0; i < Head.BlockCount; i++)
            {
                tyBlock block = Head.Block[i];

                //- find all images
                if (block.BlockType == type)
                {
                    /// return image if
                    number--;
                    if (number < 0)
                    {
                        return(i);
                    }
                }
            }

            return(-1);
        }
Exemple #2
0
        //-------------------------------------//
        private void SetHeadBlockVars(ref tyBlock block)
        {
            block.BlockType = (enumBlockType)reader.ReadIntBE();

            block.DWord2     = reader.ReadIntBE();
            block.FrameIndex = reader.ReadIntBE();


            block.offset = reader.ReadIntBE();

            block.size = reader.ReadIntBE();

            block.headerSize = 0x6C0;
            if (block.headerSize > block.size)
            {
                block.headerSize = block.size;
            }


            block.headerOffset = 0;

            block.imageOffset = block.headerSize;
            block.imageSize   = block.size - block.imageOffset;



            block.DWord6 = reader.ReadIntBE();
            block.DWord7 = reader.ReadIntBE();
            block.DWord8 = reader.ReadIntBE();

            if (block.BlockType == enumBlockType.enumBlockTypeImage || block.BlockType == enumBlockType.enumBlockTypeVisible)
            {
                this.m_imageCount++;
            }
        }
Exemple #3
0
        /// <summary>
        /// return the data of an image
        /// </summary>
        public byte[] GetImageData(int imageIndex)
        {
            int blockIndex = GetImageBlockIndex(imageIndex);

            if (blockIndex < 0)
            {
                return(null);
            }

            tyBlock block = Head.Block[blockIndex];

            return(reader.ReadByte(block.size, block.offset));
        }
Exemple #4
0
        /// <summary>
        /// Return the info text of this file
        /// </summary>
        public string GetTextInfo(int index = 0)
        {
            var blockIndex = FindBlockIndexByType(enumBlockType.enumBlockTypeTextInfo, index);

            if (blockIndex < 0)
            {
                return(string.Empty);
            }

            tyBlock block = Head.Block[blockIndex];

            return(reader.ReadStr(block.size, block.offset));
        }
        /// <summary>
        /// return the data of an image
        /// </summary>
        public byte[] GetImageData(int imageIndex)
        {
            int blockIndex = GetImageBlockIndex(imageIndex);

            if (blockIndex < 0)
            {
                logging.addError("getImageData(imageIndex) fail - ImageIndex: " + imageIndex + " not found");
                return(null);
            }

            //- Header zurückgeben
            tyBlock block = Head.Block[blockIndex];

            return(reader.ReadByte(block.size, block.offset));
        }
        //-------------------------------------//
        private void SetHeadBlockVars(ref tyBlock block)
        {
            block.BlockType = (enumBlockType)reader.ReadIntBE();

            block.DWord2     = reader.ReadIntBE();
            block.FrameIndex = reader.ReadIntBE();


            block.offset = reader.ReadIntBE(); // starts at 0

            block.size = reader.ReadIntBE();

            //- head is wlways 0x6C0 Byte in lengtg
            block.headerSize = 0x6C0;
            if (block.headerSize > block.size)
            {
                block.headerSize = block.size;
            }


            block.headerOffset = 0;

            block.imageOffset = block.headerSize;
            block.imageSize   = block.size - block.imageOffset;



            block.DWord6 = reader.ReadIntBE();
            block.DWord7 = reader.ReadIntBE();
            block.DWord8 = reader.ReadIntBE();

            if (block.BlockType == enumBlockType.enumBlockTypeImage)
            {
                this.m_imageCount++;
            }
        }