public override void Completed(IndexedReader reader, int tiffHeaderOffset)
 {
     if (_storeThumbnailBytes)
     {
         // after the extraction process, if we have the correct tags, we may be able to store thumbnail information
         var thumbnailDirectory = Directories.OfType<ExifThumbnailDirectory>().FirstOrDefault();
         if (thumbnailDirectory != null && thumbnailDirectory.ContainsTag(ExifDirectoryBase.TagCompression))
         {
             int offset;
             int length;
             if (thumbnailDirectory.TryGetInt32(ExifThumbnailDirectory.TagThumbnailOffset, out offset) &&
                 thumbnailDirectory.TryGetInt32(ExifThumbnailDirectory.TagThumbnailLength, out length))
             {
                 try
                 {
                     var thumbnailData = reader.GetBytes(tiffHeaderOffset + offset, length);
                     thumbnailDirectory.ThumbnailData = thumbnailData;
                 }
                 catch (IOException ex)
                 {
                     thumbnailDirectory.AddError("Invalid thumbnail data specification: " + ex.Message);
                 }
             }
         }
     }
 }
 /// <exception cref="System.IO.IOException"/>
 public override bool CustomProcessTag(int tagOffset, ICollection<int> processedIfdOffsets, int tiffHeaderOffset, IndexedReader reader, int tagId, int byteCount)
 {
     // Custom processing for the Makernote tag
     if (tagId == ExifDirectoryBase.TagMakernote && CurrentDirectory is ExifSubIfdDirectory)
     {
         return ProcessMakernote(tagOffset, processedIfdOffsets, tiffHeaderOffset, reader);
     }
     // Custom processing for embedded IPTC data
     if (tagId == ExifDirectoryBase.TagIptcNaa && CurrentDirectory is ExifIfd0Directory)
     {
         // NOTE Adobe sets type 4 for IPTC instead of 7
         if (reader.GetSByte(tagOffset) == 0x1c)
         {
             var iptcBytes = reader.GetBytes(tagOffset, byteCount);
             Directories.Add(new IptcReader().Extract(new SequentialByteArrayReader(iptcBytes), iptcBytes.Length));
             return true;
         }
         return false;
     }
     return false;
 }