/// <summary>
 /// OnDone has to be called when the whole data have been read.
 /// </summary>
 /// <remarks>
 /// The previous mark is sent to the handler if necessary.
 /// </remarks>
 /// <param name="handler">The Wang annotation handler.</param>
 /// <param name="propertiesCurrent">The current properties.</param>
 private static bool OnDone(IWangAnnotationHandler handler, WangAnnotationProperties propertiesCurrent)
 {
     if (propertiesCurrent.HasMarkAttributes)
     {
         return(WangAnnotationTranslator.Send(handler, propertiesCurrent));
     }
     return(true);
 }
        /// <summary>
        /// OnNewMark has to be called when a new mark starts.
        /// </summary>
        /// <remarks>
        /// The previous mark is sent to the handler and the properties are initialized with default properties and the mark attributes.
        /// </remarks>
        /// <param name="handler">The Wang annotation handler.</param>
        /// <param name="propertiesCurrent">The current properties.</param>
        /// <param name="stream">The stream to read the data in.</param>
        /// <param name="dataSize">The size of the block.</param>
        /// <param name="propertiesDefault">The default properties.</param>
        /// <returns>true if the operation succeeded otherwise returns false.</returns>
        private static bool OnNewMark(IWangAnnotationHandler handler, WangAnnotationProperties propertiesCurrent,
                                      IWangStream stream, int dataSize, WangAnnotationProperties propertiesDefault)
        {
            if (propertiesCurrent.HasMarkAttributes && !WangAnnotationTranslator.Send(handler, propertiesCurrent))
            {
                return(false);
            }

            propertiesCurrent.CopyFrom(propertiesDefault);

            WangMarkAttributes markAttributes = WangAnnotationStructureReader.ReadMarkAttributes(stream, dataSize);

            if (markAttributes == null)
            {
                return(false);
            }
            propertiesCurrent.SetMarkAttributes(markAttributes);
            return(true);
        }