/// <summary>
        /// ReadNamedBlockHeader reads a named block header.
        /// </summary>
        /// <param name="stream">The stream to read the data in.</param>
        /// <param name="count">The number of bytes to character to read in the buffer.</param>
        /// <returns>The data read, null if an error occurred.</returns>
        public static WangNamedBlockHeader ReadNamedBlockHeader(IWangStream stream, int count)
        {
            // The expected data size is fixed.
            if (count == 12)
            {
                /*
                 * 8 bytes  =  name of named block
                 * 4 bytes  =  size (n) of named block
                 * 4 bytes  =  reserved. Only present and necessary with  Intel 16-bit format. Skip on read and write as zeros.
                 */
                WangNamedBlockHeader header =
                    new WangNamedBlockHeader(WangAnnotationStructureReader.ReadCharString(stream, 8), stream.ReadInt32());

                // TODO - David Ometto - 2016-11-21 - Add support for non Intel, big endian and 16 bit fun to handle here
                // Only present and necessary with  Intel 16-bit format. Skip on read and write as zeros.

                return(header);
            }
            return(null);
        }
        /// <summary>
        /// ReadBlock reads the block and updates the properties accordingly.
        /// </summary>
        /// <param name="properties">The properties to update.</param>
        /// <param name="stream">The stream to read the data in.</param>
        /// <param name="dataSize">The size of the block.</param>
        /// <returns>true if the operation succeeded otherwise returns false.</returns>
        public static bool ReadBlock(WangAnnotationProperties properties, IWangStream stream, int dataSize)
        {
#if DEBUG
            Debug.Assert(stream.AvailableBytes() >= dataSize);
#endif // DEBUG
            WangNamedBlockHeader header = WangAnnotationStructureReader.ReadNamedBlockHeader(stream, dataSize);
            if (header == null || header.Size > stream.AvailableBytes())
            {
                return(false);
            }

            /*
             * Named Block          Associated Structure            Usage
             * OiAnoDat             For lines: AN_POINTS            List coordinates for lines and freehand marks.
             *                      For images:AN_NEW_ROTATE_STRUCT Hold scaling and resolution information for image marks.
             * OiFilNam             AN_NAME_STRUCT                  Hold file name for image marks.
             * OiDIB                AN_IMAGE_STRUCT                 Store DIB data.
             * OiGroup (required)   STR                             Create sets of marks (required).
             * OiIndex (required)   STR                             Assign unique number, originating at 0, for each mark.
             *                                                      To facilitate easy application control, the next available number is generated by incrementing by 1 the number just assigned and storing it in the default OiIndex mark.
             * OiAnText             OIAN_TEXTPRIVDATA               Display text annotation marks.
             * OiHypLnk             HYPERLINK_NB                    Turn mark into a hyperlink.
             */
            if (header.Name == "OiAnoDat")
            {
                // TODO - David Ometto - 2016-11-24 - Unit test this method
                return(ReadAnoDatBlock(properties, stream, header.Size));
            }
            else if (header.Name == "OiFilNam")
            {
                properties.SetFilename(WangAnnotationStructureReader.ReadCharString(stream, header.Size));
                return(true);
            }
            else if (header.Name == "OiDIB")
            {
                properties.SetDibInfo(WangAnnotationStructureReader.ReadDib(stream, header.Size));
                return(true);
            }
            else if (header.Name == "OiGroup")
            {
                properties.OiGroup = WangAnnotationStructureReader.ReadCharString(stream, header.Size);
                return(true);
            }
            else if (header.Name == "OiIndex")
            {
                properties.OiIndex = WangAnnotationStructureReader.ReadCharString(stream, header.Size);
                return(true);
            }
            else if (header.Name == "OiAnText")
            {
                WangDisplayText displayText = WangAnnotationStructureReader.ReadDisplayText(stream, header.Size);
                if (displayText == null)
                {
                    return(false);
                }
                properties.SetDisplayText(displayText);
                return(true);
            }
            else if (header.Name == "OiHypLnk")
            {
                WangHyperlink hyperlink = WangAnnotationStructureReader.ReadHyperlink(stream, header.Size);
                if (hyperlink == null)
                {
                    return(false);
                }
                properties.SetHyperlink(hyperlink);
                return(true);
            }
            else
            {
                // We just skip unknown data
                stream.SkipBytes(header.Size);
                return(true);
            }
        }