Example #1
0
        /// <summary>
        ///     Copies metadata from the given file..
        /// </summary>
        /// <param name='file'>
        ///     File to copy metadata from.
        /// </param>
        public void CopyFrom(TagLib.Image.File file)
        {
            EnsureAvailableTags();
            var from_tag = file.ImageTag;
            var to_tag   = ImageTag;

#if PORTABLE
            foreach (var prop in typeof(TagLib.Image.ImageTag).GetTypeInfo().DeclaredProperties)
            {
#else
            foreach (var prop in typeof(TagLib.Image.ImageTag).GetProperties())
            {
#endif
                if (!prop.CanWrite || prop.Name == "TagTypes")
                {
                    continue;
                }

                var value = prop.GetValue(from_tag, null);
                prop.SetValue(to_tag, value, null);
            }
        }

        #endregion
    }
Example #2
0
        string ReadImageData(TagLib.Image.File file)
        {
            if (!IsSupportedImageFile(file))
            {
                Assert.Fail("Unsupported type for data reading: " + file);
            }

            file.Mode = File.AccessMode.Read;
            var    v = file.ReadBlock((int)file.Length);
            string md5Sum;

            if (file.MimeType == "taglib/tiff")
            {
                // TODO, ImageSharp doesn't support tiff yet (4/25/2020): https://github.com/SixLabors/ImageSharp/issues/12
                md5Sum = "";                // Utils.Md5Encode (v.Data);
            }
            else
            {
                using var image = Image.Load(v.Data);
                byte[] result = MemoryMarshal.AsBytes(image.GetPixelSpan()).ToArray();
                md5Sum = Utils.Md5Encode(result);
            }

            file.Mode = File.AccessMode.Closed;
            return(md5Sum);
        }
Example #3
0
        /// <summary>
        ///    Parses the XMP file identified by resource and replaces the XMP
        ///    tag of file by the parsed data.
        /// </summary>
        public static bool ParseXmpSidecar(this TagLib.Image.File file, TagLib.File.IFileAbstraction resource)
        {
            string xmp;

            try {
                using (var stream = resource.ReadStream) {
                    using (var reader = new StreamReader(stream)) {
                        xmp = reader.ReadToEnd();
                    }
                }
            } catch (Exception e) {
                Log.DebugFormat($"Sidecar cannot be read for file {file.Name}");
                Log.DebugException(e);
                return(false);
            }

            XmpTag tag = null;

            try {
                tag = new XmpTag(xmp, file);
            } catch (Exception e) {
                Log.DebugFormat($"Metadata of Sidecar cannot be parsed for file {file.Name}");
                Log.DebugException(e);
                return(false);
            }

            var xmp_tag = file.GetTag(TagLib.TagTypes.XMP, true) as XmpTag;

            xmp_tag.ReplaceFrom(tag);
            return(true);
        }
Example #4
0
        public static bool SaveXmpSidecar(this TagLib.Image.File file, TagLib.File.IFileAbstraction resource)
        {
            var xmp_tag = file.GetTag(TagLib.TagTypes.XMP, false) as XmpTag;

            if (xmp_tag == null)
            {
                // TODO: Delete File
                return(true);
            }

            var xmp = xmp_tag.Render();

            try {
                using (var stream = resource.WriteStream) {
                    stream.SetLength(0);
                    using (var writer = new StreamWriter(stream)) {
                        writer.Write(xmp);
                    }
                    resource.CloseStream(stream);
                }
            } catch (Exception e) {
                Log.DebugFormat($"Sidecar cannot be saved: {resource.Name}");
                Log.DebugException(e);
                return(false);
            }

            return(true);
        }
Example #5
0
        private void Validate(TagLib.Image.File file)
        {
            // Note: these don't correspond to the image data, only to the metadata. We hacked the file for size.
            Assert.AreEqual(2000, file.Properties.PhotoWidth);
            Assert.AreEqual(3008, file.Properties.PhotoHeight);
            Assert.AreEqual(96, file.Properties.PhotoQuality);

            var tag = file.GetTag(TagTypes.TiffIFD) as IFDTag;

            Assert.IsNotNull(tag, "IFD tag not found");

            var structure = tag.Structure;

            // Image.0x010F (Make/Ascii/18) "NIKON CORPORATION"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.Make);
                Assert.IsNotNull(entry, "Entry 0x010F missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("NIKON CORPORATION", (entry as StringIFDEntry).Value);
            }

            XmpTag xmp = file.GetTag(TagTypes.XMP) as XmpTag;
            // Xmp.MicrosoftPhoto_1_.DateAcquired (XmpText/20) "2009-08-04T20:42:36Z"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.MS_PHOTO_NS, "DateAcquired");
                Assert.IsNotNull(node);
                Assert.AreEqual("2009-08-04T20:42:36Z", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
        }
Example #6
0
        public void ValidateMetadataInvariants(TagLib.Image.File file)
        {
            Assert.IsNotNull(file);
            Assert.IsNotNull(file.Properties);

            Assert.AreEqual(12, file.Properties.PhotoWidth);
            Assert.AreEqual(37, file.Properties.PhotoHeight);
        }
Example #7
0
        /// <summary>
        /// Implements TagLib.Image.File and TagLib.Tiff.File
        /// </summary>
        /// <param name="file"></param>
        /// <param name="fullPath"></param>
        /// <returns></returns>
        private PhotoFile ProcessTagFile(TagLib.Image.File file, string fullPath)
        {
            var      exif        = file.ImageTag.Exif;
            DateTime createdDate = File.GetCreationTime(fullPath);
            DateTime date        = (exif != null ? (exif.DateTimeOriginal ?? exif.DateTime) : null) ?? file.ImageTag.DateTime ?? createdDate;

            return(new PhotoFile(fullPath, date, createdDate));
        }
Example #8
0
 /// <summary>
 ///    Creates the tag if needed.
 /// </summary>
 public override void ModifyMetadata(TagLib.Image.File file)
 {
     if (!tag_present)
     {
         file.GetTag(type, true);
     }
     base.ModifyMetadata(file);
 }
Example #9
0
        public static TagLib.Image.File Parse(SafeUri uri)
        {
            // Detect mime-type
            string mime;

            try {
                var gfile = FileFactory.NewForUri(uri);
                var info  = gfile.QueryInfo("standard::content-type", FileQueryInfoFlags.None, null);
                mime = info.ContentType;
            } catch (Exception e) {
                Hyena.Log.DebugException(e);
                return(null);
            }

            if (mime.StartsWith("application/x-extension-"))
            {
                // Works around broken metadata detection - https://bugzilla.gnome.org/show_bug.cgi?id=624781
                mime = String.Format("taglib/{0}", mime.Substring(24));
            }

            // Parse file
            var res = new GIOTagLibFileAbstraction()
            {
                Uri = uri
            };
            var sidecar_uri = GetSidecarUri(uri);
            var sidecar_res = new GIOTagLibFileAbstraction()
            {
                Uri = sidecar_uri
            };

            TagLib.Image.File file = null;
            try {
                file = TagLib.File.Create(res, mime, ReadStyle.Average) as TagLib.Image.File;
            } catch (Exception) {
                Hyena.Log.DebugFormat("Loading of metadata failed for file: {0}, trying extension fallback", uri);

                try {
                    file = TagLib.File.Create(res, ReadStyle.Average) as TagLib.Image.File;
                } catch (Exception e) {
                    Hyena.Log.DebugFormat("Loading of metadata failed for file: {0}", uri);
                    Hyena.Log.DebugException(e);
                    return(null);
                }
            }

            // Load XMP sidecar
            var sidecar_file = GLib.FileFactory.NewForUri(sidecar_uri);

            if (sidecar_file.Exists)
            {
                file.ParseXmpSidecar(sidecar_res);
            }

            return(file);
        }
Example #10
0
 public override void ValidatePreModification(TagLib.Image.File file)
 {
     if (!tag_present)
     {
         Assert.IsNull(GetTag(file));
     }
     else
     {
         Assert.IsNotNull(GetTag(file));
         base.ValidatePreModification(file);
     }
 }
Example #11
0
 private string getPropertyValue(string imagePath, System.Drawing.Image image, int id)
 {
     try
     {
         if (image.PropertyIdList.Contains(id))
         {
             return(getPropertyValue(image.GetPropertyItem(id)));
         }
         else
         {
             TagLib.Image.File tagImage = TagLib.File.Create(imagePath)
                                          as TagLib.Image.File;
             string result = null;
             if (id == manufacturerId && tagImage.ImageTag.Make != null && tagImage.ImageTag.Make.Length > 0)
             {
                 result = tagImage.ImageTag.Make;
             }
             else if (id == modelId && tagImage.ImageTag.Model != null && tagImage.ImageTag.Model.Length > 0)
             {
                 result = tagImage.ImageTag.Model;
             }
             else if (id == dateTakenId && tagImage.ImageTag.DateTime.HasValue)
             {
                 result = tagImage.ImageTag.DateTime.Value.ToString(CultureStrings.FormatDateTaken);
             }
             else if (id == dateTakenId && !tagImage.ImageTag.DateTime.HasValue)
             {
                 result = getPropertyValue(image.GetPropertyItem(dateTimeId));
             }
             else if (id == latitudeLongitudeId && tagImage.ImageTag.Latitude.HasValue && tagImage.ImageTag.Longitude.HasValue)
             {
                 result = tagImage.ImageTag.Latitude + "," + tagImage.ImageTag.Longitude;
             }
             tagImage.Dispose();
             if (result != null)
             {
                 return(result);
             }
             else
             {
                 FileWriterWithAppendMode.GlobalWrite(string.Format(CultureStrings.InfomationImageProperties, doubleQuoteText(imagePath), id, convertIntsToText(image.PropertyIdList)));
             }
         }
     }
     catch (System.Exception ex)
     {
         logException(ex);
     }
     return(null);
 }
Example #12
0
        public void CopyFrom(TagLib.Image.File file)
        {
            EnsureAvailableTags();
            var from_tag = file.ImageTag;
            var to_tag   = ImageTag;

            foreach (var prop in typeof(TagLib.Image.ImageTag).GetProperties())
            {
                if (!prop.CanWrite || prop.Name == "TagTypes")
                {
                    continue;
                }
                var value = prop.GetValue(from_tag, null);
                prop.SetValue(to_tag, value, null);
            }
        }
Example #13
0
        string ReadImageData(TagLib.Image.File file)
        {
            if (!IsSupportedImageFile(file))
            {
                Assert.Fail("Unsupported type for data reading: " + file);
            }

            file.Mode = File.AccessMode.Read;
            var v = file.ReadBlock((int)file.Length);

            byte[] result = null;
            using (var buf = new Pixbuf(v.Data))
                result = buf.SaveToBuffer("png");
            file.Mode = File.AccessMode.Closed;
            return(Utils.Md5Encode(result));
        }
Example #14
0
        protected override void ExtractMetadata(TagLib.Image.File metadata)
        {
            base.ExtractMetadata(metadata);

            if (metadata == null)
            {
                return;
            }

            try {
                var tag       = metadata.GetTag(TagTypes.TiffIFD) as IFDTag;
                var structure = tag.Structure;
                var entry     = structure.GetEntry(0, (ushort)IFDEntryTag.StripOffsets);
                offset = (entry as StripOffsetsIFDEntry).Values [0];
            } catch (Exception e) {
                Log.DebugException(e);
            }
        }
Example #15
0
        public static TagLib.Image.File Parse(Uri uri)
        {
            // Detect mime-type
            string mime = MimeTypesMap.GetMimeType(Path.GetFileName(uri.AbsolutePath));

            if (mime.StartsWith("application/x-extension-"))
            {
                // Works around broken metadata detection - https://bugzilla.gnome.org/show_bug.cgi?id=624781
                mime = $"taglib/{mime.Substring (24)}";
            }

            // Parse file
            var res = new TagLibFileAbstraction {
                Uri = uri
            };
            var sidecar_uri = GetSidecarUri(uri);
            var sidecar_res = new TagLibFileAbstraction {
                Uri = sidecar_uri
            };

            TagLibFile file = null;

            try {
                file = TagLib.File.Create(res, mime, ReadStyle.Average) as TagLibFile;
            } catch (Exception) {
                //Log.Debug ($"Loading of metadata failed for file: {uri}, trying extension fallback");

                try {
                    file = TagLib.File.Create(res, ReadStyle.Average) as TagLibFile;
                } catch (Exception e) {
                    //Log.Debug ($"Loading of metadata failed for file: {uri}");
                    // Log.DebugException (e);
                    return(null);
                }
            }

            // Load XMP sidecar
            if (System.IO.File.Exists(sidecar_uri.AbsolutePath))
            {
                file.ParseXmpSidecar(sidecar_res);
            }

            return(file);
        }
Example #16
0
        protected override void ExtractMetadata(TagLib.Image.File metadata)
        {
            base.ExtractMetadata(metadata);

            if (metadata == null)
            {
                return;
            }

            try {
                var tag                 = metadata.GetTag(TagTypes.TiffIFD) as IFDTag;
                var structure           = tag.Structure;
                var SubImage1_structure = (structure.GetEntry(0, (ushort)IFDEntryTag.SubIFDs) as SubIFDArrayEntry).Entries [0];
                var entry               = SubImage1_structure.GetEntry(0, (ushort)IFDEntryTag.JPEGInterchangeFormat);
                jpeg_data = (entry as ThumbnailDataIFDEntry).Data.Data;
            } catch (Exception e) {
                Log.DebugException(e);
                jpeg_data = null;
            }
        }
Example #17
0
        public static void SaveSafely(this TagLib.Image.File metadata, Uri photoUri, bool alwaysSidecar)
        {
            if (alwaysSidecar || !metadata.Writeable || metadata.PossiblyCorrupt)
            {
                if (!alwaysSidecar && metadata.PossiblyCorrupt)
                {
                    Log.Warning($"Metadata of file {photoUri} may be corrupt, refusing to write to it, falling back to XMP sidecar.");
                }

                var sidecar_res = new TagLibFileAbstraction()
                {
                    Uri = GetSidecarUri(photoUri)
                };

                metadata.SaveXmpSidecar(sidecar_res);
            }
            else
            {
                metadata.Save();
            }
        }
Example #18
0
        public void ValidateMetadataInvariants(TagLib.Image.File file)
        {
            Assert.IsNotNull(file);
            //
            //  ---------- Start of ImageTag tests ----------

            var imagetag = file.ImageTag;

            Assert.IsNotNull(imagetag);
            Assert.AreEqual(String.Empty, imagetag.Comment, "Comment");
            Assert.AreEqual(new string[] { }, imagetag.Keywords, "Keywords");
            Assert.AreEqual(null, imagetag.Rating, "Rating");
            Assert.AreEqual(TagLib.Image.ImageOrientation.TopLeft, imagetag.Orientation, "Orientation");
            Assert.AreEqual(null, imagetag.Software, "Software");
            Assert.AreEqual(null, imagetag.Latitude, "Latitude");
            Assert.AreEqual(null, imagetag.Longitude, "Longitude");
            Assert.AreEqual(null, imagetag.Altitude, "Altitude");
            Assert.AreEqual(0.004, imagetag.ExposureTime, "ExposureTime");
            Assert.AreEqual(11, imagetag.FNumber, "FNumber");
            Assert.AreEqual(100, imagetag.ISOSpeedRatings, "ISOSpeedRatings");
            Assert.AreEqual(7, imagetag.FocalLength, "FocalLength");
            Assert.AreEqual(null, imagetag.FocalLengthIn35mmFilm, "FocalLengthIn35mmFilm");
            Assert.AreEqual("LEICA", imagetag.Make, "Make");
            Assert.AreEqual("DIGILUX 2", imagetag.Model, "Model");
            Assert.AreEqual(null, imagetag.Creator, "Creator");

            var properties = file.Properties;

            Assert.IsNotNull(properties);
            Assert.AreEqual(2564, properties.PhotoWidth, "PhotoWidth");
            Assert.AreEqual(1924, properties.PhotoHeight, "PhotoHeight");

            //  ---------- End of ImageTag tests ----------

            //  ---------- Start of IFD tests ----------
            //		--> Omitted, because the test generator doesn't handle them yet.
            //		--> If the above works, I'm happy.
            //  ---------- End of IFD tests ----------
        }
Example #19
0
 private void ValidateChangedMetadata(TagLib.Image.File file)
 {
     Assert.AreEqual("Testing!", file.ImageTag.Comment);
     Assert.AreEqual(new string [] { "One", "Two", "Three" }, file.ImageTag.Keywords);
 }
Example #20
0
        public void ValidateMetadataInvariants(TagLib.Image.File file)
        {
            Assert.IsNotNull(file);
            //  ---------- Start of IFD tests ----------

            var tag = file.GetTag(TagTypes.TiffIFD) as IFDTag;

            Assert.IsNotNull(tag, "IFD tag not found");

            var structure = tag.Structure;

            // Image.0x010F (Make/Ascii/16) "Hewlett-Packard"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.Make);
                Assert.IsNotNull(entry, "Entry 0x010F missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("Hewlett-Packard", (entry as StringIFDEntry).Value);
            }
            // Image.0x0110 (Model/Ascii/28) "HP PhotoSmart C812 (V09.26)"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.Model);
                Assert.IsNotNull(entry, "Entry 0x0110 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("HP PhotoSmart C812 (V09.26)", (entry as StringIFDEntry).Value);
            }
            // Image.0x0112 (Orientation/Short/1) "0"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.Orientation);
                Assert.IsNotNull(entry, "Entry 0x0112 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(0, (entry as ShortIFDEntry).Value);
            }
            // Image.0x011A (XResolution/Rational/1) "72/1"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.XResolution);
                Assert.IsNotNull(entry, "Entry 0x011A missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(72, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Image.0x011B (YResolution/Rational/1) "72/1"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.YResolution);
                Assert.IsNotNull(entry, "Entry 0x011B missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(72, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Image.0x0128 (ResolutionUnit/Short/1) "2"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.ResolutionUnit);
                Assert.IsNotNull(entry, "Entry 0x0128 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(2, (entry as ShortIFDEntry).Value);
            }
            // Image.0x0213 (YCbCrPositioning/Short/1) "1"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.YCbCrPositioning);
                Assert.IsNotNull(entry, "Entry 0x0213 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(1, (entry as ShortIFDEntry).Value);
            }
            // Image.0x8769 (ExifTag/SubIFD/1) "2984"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.ExifIFD);
                Assert.IsNotNull(entry, "Entry 0x8769 missing in IFD 0");
                Assert.IsNotNull(entry as SubIFDEntry, "Entry is not a sub IFD!");
            }

            var exif = structure.GetEntry(0, (ushort)IFDEntryTag.ExifIFD) as SubIFDEntry;

            Assert.IsNotNull(exif, "Exif tag not found");
            var exif_structure = exif.Structure;

            // Photo.0x829A (ExposureTime/Rational/1) "1666/100000"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ExposureTime);
                Assert.IsNotNull(entry, "Entry 0x829A missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(1666, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(100000, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Photo.0x829D (FNumber/Rational/1) "260/100"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.FNumber);
                Assert.IsNotNull(entry, "Entry 0x829D missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(260, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(100, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Photo.0x8827 (ISOSpeedRatings/Short/1) "200"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ISOSpeedRatings);
                Assert.IsNotNull(entry, "Entry 0x8827 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(200, (entry as ShortIFDEntry).Value);
            }
            // Photo.0x9000 (ExifVersion/Undefined/4) "48 50 49 48"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ExifVersion);
                Assert.IsNotNull(entry, "Entry 0x9000 missing in IFD 0");
                Assert.IsNotNull(entry as UndefinedIFDEntry, "Entry is not an undefined IFD entry!");
                var parsed_bytes = (entry as UndefinedIFDEntry).Data.Data;
                var bytes        = new byte[] { 48, 50, 49, 48 };
                Assert.AreEqual(bytes, parsed_bytes);
            }
            // Photo.0x9003 (DateTimeOriginal/Ascii/20) "2002:01:02 05:00:30"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.DateTimeOriginal);
                Assert.IsNotNull(entry, "Entry 0x9003 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("2002:01:02 05:00:30", (entry as StringIFDEntry).Value);
            }
            // Photo.0x9004 (DateTimeDigitized/Ascii/20) "2002:01:02 05:00:30"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.DateTimeDigitized);
                Assert.IsNotNull(entry, "Entry 0x9004 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("2002:01:02 05:00:30", (entry as StringIFDEntry).Value);
            }
            // Photo.0x9101 (ComponentsConfiguration/Undefined/4) "1 2 3 0"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ComponentsConfiguration);
                Assert.IsNotNull(entry, "Entry 0x9101 missing in IFD 0");
                Assert.IsNotNull(entry as UndefinedIFDEntry, "Entry is not an undefined IFD entry!");
                var parsed_bytes = (entry as UndefinedIFDEntry).Data.Data;
                var bytes        = new byte[] { 1, 2, 3, 0 };
                Assert.AreEqual(bytes, parsed_bytes);
            }
            // Photo.0x9203 (BrightnessValue/SRational/1) "-567/100"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.BrightnessValue);
                Assert.IsNotNull(entry, "Entry 0x9203 missing in IFD 0");
                Assert.IsNotNull(entry as SRationalIFDEntry, "Entry is not a srational!");
                Assert.AreEqual(-567, (entry as SRationalIFDEntry).Value.Numerator);
                Assert.AreEqual(100, (entry as SRationalIFDEntry).Value.Denominator);
            }
            // Photo.0x9206 (SubjectDistance/Rational/1) "11691/1000"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.SubjectDistance);
                Assert.IsNotNull(entry, "Entry 0x9206 missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(11691, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1000, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Photo.0x9208 (LightSource/Short/1) "4"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.LightSource);
                Assert.IsNotNull(entry, "Entry 0x9208 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(4, (entry as ShortIFDEntry).Value);
            }
            // Photo.0x9209 (Flash/Short/1) "1"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.Flash);
                Assert.IsNotNull(entry, "Entry 0x9209 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(1, (entry as ShortIFDEntry).Value);
            }
            // Photo.0x920A (FocalLength/Rational/1) "760/100"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.FocalLength);
                Assert.IsNotNull(entry, "Entry 0x920A missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(760, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(100, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Photo.0xA000 (FlashpixVersion/Undefined/4) "48 49 48 48"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.FlashpixVersion);
                Assert.IsNotNull(entry, "Entry 0xA000 missing in IFD 0");
                Assert.IsNotNull(entry as UndefinedIFDEntry, "Entry is not an undefined IFD entry!");
                var parsed_bytes = (entry as UndefinedIFDEntry).Data.Data;
                var bytes        = new byte[] { 48, 49, 48, 48 };
                Assert.AreEqual(bytes, parsed_bytes);
            }
            // Photo.0xA001 (ColorSpace/Short/1) "1"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ColorSpace);
                Assert.IsNotNull(entry, "Entry 0xA001 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(1, (entry as ShortIFDEntry).Value);
            }
            // Photo.0xA002 (PixelXDimension/Long/1) "2272"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.PixelXDimension);
                Assert.IsNotNull(entry, "Entry 0xA002 missing in IFD 0");
                Assert.IsNotNull(entry as LongIFDEntry, "Entry is not a long!");
                Assert.AreEqual(2272, (entry as LongIFDEntry).Value);
            }
            // Photo.0xA003 (PixelYDimension/Long/1) "1712"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.PixelYDimension);
                Assert.IsNotNull(entry, "Entry 0xA003 missing in IFD 0");
                Assert.IsNotNull(entry as LongIFDEntry, "Entry is not a long!");
                Assert.AreEqual(1712, (entry as LongIFDEntry).Value);
            }
            // Photo.0xA005 (InteroperabilityTag/SubIFD/1) "3378"
            {
                var entry = exif_structure.GetEntry(0, (ushort)IFDEntryTag.InteroperabilityIFD);
                Assert.IsNotNull(entry, "Entry 0xA005 missing in IFD 0");
                Assert.IsNotNull(entry as SubIFDEntry, "Entry is not a sub IFD!");
            }

            var iop = exif_structure.GetEntry(0, (ushort)IFDEntryTag.InteroperabilityIFD) as SubIFDEntry;

            Assert.IsNotNull(iop, "Iop tag not found");
            var iop_structure = iop.Structure;

            // Iop.0x0001 (InteroperabilityIndex/Ascii/4) "R98"
            {
                var entry = iop_structure.GetEntry(0, (ushort)IOPEntryTag.InteroperabilityIndex);
                Assert.IsNotNull(entry, "Entry 0x0001 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("R98", (entry as StringIFDEntry).Value);
            }
            // Iop.0x0002 (InteroperabilityVersion/Undefined/4) "48 49 48 48"
            {
                var entry = iop_structure.GetEntry(0, (ushort)IOPEntryTag.InteroperabilityVersion);
                Assert.IsNotNull(entry, "Entry 0x0002 missing in IFD 0");
                Assert.IsNotNull(entry as UndefinedIFDEntry, "Entry is not an undefined IFD entry!");
                var parsed_bytes = (entry as UndefinedIFDEntry).Data.Data;
                var bytes        = new byte[] { 48, 49, 48, 48 };
                Assert.AreEqual(bytes, parsed_bytes);
            }
            // Photo.0xA20B (FlashEnergy/Rational/1) "1000/1"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.FlashEnergy);
                Assert.IsNotNull(entry, "Entry 0xA20B missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(1000, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Image.0x92D6 (0x92d6/Undefined/0) ""
            {
                // TODO: Unknown IFD tag: Image / 0x92D6
                var entry = structure.GetEntry(0, 0x92D6);
                Assert.IsNotNull(entry, "Entry 0x92D6 missing in IFD 0");
                Assert.IsNotNull(entry as UndefinedIFDEntry, "Entry is not an undefined IFD entry!");
                var parsed_bytes = (entry as UndefinedIFDEntry).Data.Data;
                var bytes        = new byte[] { };
                Assert.AreEqual(bytes, parsed_bytes);
            }
            // Thumbnail.0x0103 (Compression/Short/1) "6"
            {
                var entry = structure.GetEntry(1, (ushort)IFDEntryTag.Compression);
                Assert.IsNotNull(entry, "Entry 0x0103 missing in IFD 1");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(6, (entry as ShortIFDEntry).Value);
            }
            // Thumbnail.0x011A (XResolution/Rational/1) "72/1"
            {
                var entry = structure.GetEntry(1, (ushort)IFDEntryTag.XResolution);
                Assert.IsNotNull(entry, "Entry 0x011A missing in IFD 1");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(72, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Thumbnail.0x011B (YResolution/Rational/1) "72/1"
            {
                var entry = structure.GetEntry(1, (ushort)IFDEntryTag.YResolution);
                Assert.IsNotNull(entry, "Entry 0x011B missing in IFD 1");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(72, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Thumbnail.0x0128 (ResolutionUnit/Short/1) "2"
            {
                var entry = structure.GetEntry(1, (ushort)IFDEntryTag.ResolutionUnit);
                Assert.IsNotNull(entry, "Entry 0x0128 missing in IFD 1");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(2, (entry as ShortIFDEntry).Value);
            }
            // Thumbnail.0x0201 (JPEGInterchangeFormat/ThumbnailDataIFD/1) "3826"
            {
                var entry = structure.GetEntry(1, (ushort)IFDEntryTag.JPEGInterchangeFormat);
                Assert.IsNotNull(entry, "Entry 0x0201 missing in IFD 1");
                Assert.IsNotNull(entry as ThumbnailDataIFDEntry, "Entry is not a thumbnail IFD!");
            }
            // Thumbnail.0x0202 (JPEGInterchangeFormatLength/Long/1) "7591"
            {
                var entry = structure.GetEntry(1, (ushort)IFDEntryTag.JPEGInterchangeFormatLength);
                Assert.IsNotNull(entry, "Entry 0x0202 missing in IFD 1");
                Assert.IsNotNull(entry as LongIFDEntry, "Entry is not a long!");
                Assert.AreEqual(7591, (entry as LongIFDEntry).Value);
            }

            //  ---------- End of IFD tests ----------
        }
Example #21
0
        public void ValidateMetadataInvariants(TagLib.Image.File file)
        {
            Assert.IsNotNull(file);
            //  ---------- Start of IFD tests ----------

            var tag = file.GetTag(TagTypes.TiffIFD) as IFDTag;

            Assert.IsNotNull(tag, "IFD tag not found");

            var structure = tag.Structure;

            // Image.0x010F (Make/Ascii/18) "NIKON CORPORATION"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.Make);
                Assert.IsNotNull(entry, "Entry 0x010F missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("NIKON CORPORATION", (entry as StringIFDEntry).Value);
            }
            // Image.0x0110 (Model/Ascii/11) "NIKON D70s"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.Model);
                Assert.IsNotNull(entry, "Entry 0x0110 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("NIKON D70s", (entry as StringIFDEntry).Value);
            }
            // Image.0x011A (XResolution/Rational/1) "150/1"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.XResolution);
                Assert.IsNotNull(entry, "Entry 0x011A missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(150, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Image.0x011B (YResolution/Rational/1) "150/1"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.YResolution);
                Assert.IsNotNull(entry, "Entry 0x011B missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(150, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Image.0x0128 (ResolutionUnit/Short/1) "2"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.ResolutionUnit);
                Assert.IsNotNull(entry, "Entry 0x0128 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(2, (entry as ShortIFDEntry).Value);
            }
            // Image.0x0131 (Software/Ascii/17) "Bibble 5 Pro 5.0"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.Software);
                Assert.IsNotNull(entry, "Entry 0x0131 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("Bibble 5 Pro 5.0", (entry as StringIFDEntry).Value);
            }
            // Image.0x8769 (ExifTag/SubIFD/1) "8"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.ExifIFD);
                Assert.IsNotNull(entry, "Entry 0x8769 missing in IFD 0");
                Assert.IsNotNull(entry as SubIFDEntry, "Entry is not a sub IFD!");
            }

            var exif = structure.GetEntry(0, (ushort)IFDEntryTag.ExifIFD) as SubIFDEntry;

            Assert.IsNotNull(exif, "Exif tag not found");
            var exif_structure = exif.Structure;

            // Photo.0x010F (0x010f/Ascii/18) "NIKON CORPORATION"
            {
                var entry = exif_structure.GetEntry(0, (ushort)IFDEntryTag.Make);
                Assert.IsNotNull(entry, "Entry 0x010F missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("NIKON CORPORATION", (entry as StringIFDEntry).Value);
            }
            // Photo.0x0110 (0x0110/Ascii/11) "NIKON D70s"
            {
                var entry = exif_structure.GetEntry(0, (ushort)IFDEntryTag.Model);
                Assert.IsNotNull(entry, "Entry 0x0110 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("NIKON D70s", (entry as StringIFDEntry).Value);
            }
            // Photo.0x0132 (0x0132/Ascii/20) "2010:02:03 11:02:18"
            {
                var entry = exif_structure.GetEntry(0, (ushort)IFDEntryTag.DateTime);
                Assert.IsNotNull(entry, "Entry 0x0132 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("2010:02:03 11:02:18", (entry as StringIFDEntry).Value);
            }
            // Photo.0x829A (ExposureTime/Rational/1) "10/7500"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ExposureTime);
                Assert.IsNotNull(entry, "Entry 0x829A missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(10, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(7500, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Photo.0x829D (FNumber/Rational/1) "13/1"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.FNumber);
                Assert.IsNotNull(entry, "Entry 0x829D missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(13, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Photo.0x8822 (ExposureProgram/Short/1) "2"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ExposureProgram);
                Assert.IsNotNull(entry, "Entry 0x8822 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(2, (entry as ShortIFDEntry).Value);
            }
            // Photo.0x8827 (ISOSpeedRatings/Short/1) "1600"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ISOSpeedRatings);
                Assert.IsNotNull(entry, "Entry 0x8827 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(1600, (entry as ShortIFDEntry).Value);
            }
            // Photo.0x9003 (DateTimeOriginal/Ascii/20) "2007:02:15 17:07:48"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.DateTimeOriginal);
                Assert.IsNotNull(entry, "Entry 0x9003 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("2007:02:15 17:07:48", (entry as StringIFDEntry).Value);
            }
            // Photo.0x9004 (DateTimeDigitized/Ascii/20) "2007:02:15 17:07:48"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.DateTimeDigitized);
                Assert.IsNotNull(entry, "Entry 0x9004 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("2007:02:15 17:07:48", (entry as StringIFDEntry).Value);
            }
            // Photo.0x9204 (ExposureBiasValue/SRational/1) "0/6"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ExposureBiasValue);
                Assert.IsNotNull(entry, "Entry 0x9204 missing in IFD 0");
                Assert.IsNotNull(entry as SRationalIFDEntry, "Entry is not a srational!");
                Assert.AreEqual(0, (entry as SRationalIFDEntry).Value.Numerator);
                Assert.AreEqual(6, (entry as SRationalIFDEntry).Value.Denominator);
            }
            // Photo.0x9205 (MaxApertureValue/Rational/1) "50/10"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.MaxApertureValue);
                Assert.IsNotNull(entry, "Entry 0x9205 missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(50, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(10, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Photo.0x9207 (MeteringMode/Short/1) "5"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.MeteringMode);
                Assert.IsNotNull(entry, "Entry 0x9207 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(5, (entry as ShortIFDEntry).Value);
            }
            // Photo.0x9208 (LightSource/Short/1) "0"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.LightSource);
                Assert.IsNotNull(entry, "Entry 0x9208 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(0, (entry as ShortIFDEntry).Value);
            }
            // Photo.0x920A (FocalLength/Rational/1) "50/1"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.FocalLength);
                Assert.IsNotNull(entry, "Entry 0x920A missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(50, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Photo.0x9290 (SubSecTime/Ascii/4) "889"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.SubsecTime);
                Assert.IsNotNull(entry, "Entry 0x9290 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("889", (entry as StringIFDEntry).Value);
            }
            // Photo.0x9291 (SubSecTimeOriginal/Ascii/4) "800"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.SubsecTimeOriginal);
                Assert.IsNotNull(entry, "Entry 0x9291 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("800", (entry as StringIFDEntry).Value);
            }
            // Photo.0x9292 (SubSecTimeDigitized/Ascii/4) "800"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.SubsecTimeDigitized);
                Assert.IsNotNull(entry, "Entry 0x9292 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("800", (entry as StringIFDEntry).Value);
            }
            // Photo.0xA402 (ExposureMode/Short/1) "0"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ExposureMode);
                Assert.IsNotNull(entry, "Entry 0xA402 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(0, (entry as ShortIFDEntry).Value);
            }
            // Photo.0xA403 (WhiteBalance/Short/1) "0"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.WhiteBalance);
                Assert.IsNotNull(entry, "Entry 0xA403 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(0, (entry as ShortIFDEntry).Value);
            }
            // Photo.0xA405 (FocalLengthIn35mmFilm/Short/1) "75"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.FocalLengthIn35mmFilm);
                Assert.IsNotNull(entry, "Entry 0xA405 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(75, (entry as ShortIFDEntry).Value);
            }
            // Photo.0xA406 (SceneCaptureType/Short/1) "0"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.SceneCaptureType);
                Assert.IsNotNull(entry, "Entry 0xA406 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(0, (entry as ShortIFDEntry).Value);
            }
            // Photo.0xA408 (Contrast/Short/1) "0"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.Contrast);
                Assert.IsNotNull(entry, "Entry 0xA408 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(0, (entry as ShortIFDEntry).Value);
            }
            // Photo.0xA409 (Saturation/Short/1) "0"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.Saturation);
                Assert.IsNotNull(entry, "Entry 0xA409 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(0, (entry as ShortIFDEntry).Value);
            }
            // Photo.0xA40A (Sharpness/Short/1) "1"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.Sharpness);
                Assert.IsNotNull(entry, "Entry 0xA40A missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(1, (entry as ShortIFDEntry).Value);
            }
            // Photo.0xA40C (SubjectDistanceRange/Short/1) "0"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.SubjectDistanceRange);
                Assert.IsNotNull(entry, "Entry 0xA40C missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(0, (entry as ShortIFDEntry).Value);
            }

            //  ---------- End of IFD tests ----------


            //  ---------- Start of XMP tests ----------

            var xmp = file.GetTag(TagTypes.XMP) as XmpTag;
            // Xmp.tiff.Model (XmpText/10) "NIKON D70s"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.TIFF_NS, "Model");
                Assert.IsNotNull(node);
                Assert.AreEqual("NIKON D70s", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.tiff.Make (XmpText/17) "NIKON CORPORATION"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.TIFF_NS, "Make");
                Assert.IsNotNull(node);
                Assert.AreEqual("NIKON CORPORATION", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.tiff.ImageWidth (XmpText/4) "3024"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.TIFF_NS, "ImageWidth");
                Assert.IsNotNull(node);
                Assert.AreEqual("3024", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.tiff.ImageLength (XmpText/4) "1998"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.TIFF_NS, "ImageLength");
                Assert.IsNotNull(node);
                Assert.AreEqual("1998", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.tiff.FNumber (XmpText/6) "130/10"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.TIFF_NS, "FNumber");
                Assert.IsNotNull(node);
                Assert.AreEqual("130/10", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.tiff.XResolution (XmpText/5) "150/1"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.TIFF_NS, "XResolution");
                Assert.IsNotNull(node);
                Assert.AreEqual("150/1", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.tiff.YResolution (XmpText/5) "150/1"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.TIFF_NS, "YResolution");
                Assert.IsNotNull(node);
                Assert.AreEqual("150/1", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.tiff.ResolutionUnit (XmpText/1) "2"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.TIFF_NS, "ResolutionUnit");
                Assert.IsNotNull(node);
                Assert.AreEqual("2", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.exif.ExposureProgram (XmpText/1) "2"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.EXIF_NS, "ExposureProgram");
                Assert.IsNotNull(node);
                Assert.AreEqual("2", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.exif.MeteringMode (XmpText/1) "5"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.EXIF_NS, "MeteringMode");
                Assert.IsNotNull(node);
                Assert.AreEqual("5", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.exif.LightSource (XmpText/1) "0"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.EXIF_NS, "LightSource");
                Assert.IsNotNull(node);
                Assert.AreEqual("0", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.exif.ExposureMode (XmpText/1) "0"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.EXIF_NS, "ExposureMode");
                Assert.IsNotNull(node);
                Assert.AreEqual("0", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.exif.WhiteBalance (XmpText/1) "0"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.EXIF_NS, "WhiteBalance");
                Assert.IsNotNull(node);
                Assert.AreEqual("0", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.exif.FocalLengthIn35mmFilm (XmpText/2) "75"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.EXIF_NS, "FocalLengthIn35mmFilm");
                Assert.IsNotNull(node);
                Assert.AreEqual("75", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.exif.SceneCaptureType (XmpText/1) "0"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.EXIF_NS, "SceneCaptureType");
                Assert.IsNotNull(node);
                Assert.AreEqual("0", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.exif.Contrast (XmpText/1) "0"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.EXIF_NS, "Contrast");
                Assert.IsNotNull(node);
                Assert.AreEqual("0", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.exif.Saturation (XmpText/1) "0"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.EXIF_NS, "Saturation");
                Assert.IsNotNull(node);
                Assert.AreEqual("0", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.exif.Sharpness (XmpText/1) "1"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.EXIF_NS, "Sharpness");
                Assert.IsNotNull(node);
                Assert.AreEqual("1", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.exif.SubjectDistanceRange (XmpText/1) "0"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.EXIF_NS, "SubjectDistanceRange");
                Assert.IsNotNull(node);
                Assert.AreEqual("0", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.exif.ISOSpeedRating (XmpText/4) "1600"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.EXIF_NS, "ISOSpeedRating");
                Assert.IsNotNull(node);
                Assert.AreEqual("1600", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.exif.MaxApertureValue (XmpText/5) "50/10"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.EXIF_NS, "MaxApertureValue");
                Assert.IsNotNull(node);
                Assert.AreEqual("50/10", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.exif.ExposureTime (XmpText/7) "10/7500"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.EXIF_NS, "ExposureTime");
                Assert.IsNotNull(node);
                Assert.AreEqual("10/7500", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.exif.ExposureBiasValue (XmpText/3) "0/6"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.EXIF_NS, "ExposureBiasValue");
                Assert.IsNotNull(node);
                Assert.AreEqual("0/6", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.exif.FocalLength (XmpText/6) "500/10"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.EXIF_NS, "FocalLength");
                Assert.IsNotNull(node);
                Assert.AreEqual("500/10", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.photoshop.DateCreated (XmpText/24) "2007-02-15T17:07:48.800Z"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.PHOTOSHOP_NS, "DateCreated");
                Assert.IsNotNull(node);
                Assert.AreEqual("2007-02-15T17:07:48.800Z", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }
            // Xmp.xmp.Rating (XmpText/1) "0"
            {
                var node = xmp.NodeTree;
                node = node.GetChild(XmpTag.XAP_NS, "Rating");
                Assert.IsNotNull(node);
                Assert.AreEqual("0", node.Value);
                Assert.AreEqual(XmpNodeType.Simple, node.Type);
                Assert.AreEqual(0, node.Children.Count);
            }

            //  ---------- End of XMP tests ----------
        }
Example #22
0
 public void ValidatePreModification(TagLib.Image.File file)
 {
     Assert.AreEqual(contained_types, file.TagTypes);
 }
Example #23
0
 public void ModifyMetadata(TagLib.Image.File file)
 {
     file.RemoveTags(remove_types);
 }
Example #24
0
 /// <summary>
 ///    Only files we can actually render are supported, for most types
 ///    this just means adding the type here. RAW files need extra
 ///    attention.
 /// </summary>
 bool IsSupportedImageFile(TagLib.Image.File file)
 {
     return((file is TagLib.Jpeg.File) || (file is TagLib.Tiff.File) || (file is TagLib.Gif.File) || (file is TagLib.Png.File));
 }
        public void ValidateMetadataInvariants(TagLib.Image.File file)
        {
            Assert.IsNotNull(file);
            //  ---------- Start of IFD tests ----------

            var tag = file.GetTag(TagTypes.TiffIFD) as IFDTag;

            Assert.IsNotNull(tag, "IFD tag not found");

            var structure = tag.Structure;

            // Image.0x010E (ImageDescription/Ascii/32) "                               "
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.ImageDescription);
                Assert.IsNotNull(entry, "Entry 0x010E missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("                               ", (entry as StringIFDEntry).Value);
            }
            // Image.0x010F (Make/Ascii/5) "SONY"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.Make);
                Assert.IsNotNull(entry, "Entry 0x010F missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("SONY", (entry as StringIFDEntry).Value);
            }
            // Image.0x0110 (Model/Ascii/7) "DSC-P8"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.Model);
                Assert.IsNotNull(entry, "Entry 0x0110 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("DSC-P8", (entry as StringIFDEntry).Value);
            }
            // Image.0x0112 (Orientation/Short/1) "6"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.Orientation);
                Assert.IsNotNull(entry, "Entry 0x0112 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(6, (entry as ShortIFDEntry).Value);
            }
            // Image.0x011A (XResolution/Rational/1) "72/1"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.XResolution);
                Assert.IsNotNull(entry, "Entry 0x011A missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(72, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Image.0x011B (YResolution/Rational/1) "72/1"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.YResolution);
                Assert.IsNotNull(entry, "Entry 0x011B missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(72, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Image.0x0128 (ResolutionUnit/Short/1) "2"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.ResolutionUnit);
                Assert.IsNotNull(entry, "Entry 0x0128 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(2, (entry as ShortIFDEntry).Value);
            }
            // Image.0x0131 (Software/Ascii/22) "f-spot version 0.1.11"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.Software);
                Assert.IsNotNull(entry, "Entry 0x0131 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("f-spot version 0.1.11", (entry as StringIFDEntry).Value);
            }
            // Image.0x0132 (DateTime/Ascii/20) "2006:06:12 13:30:01"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.DateTime);
                Assert.IsNotNull(entry, "Entry 0x0132 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("2006:06:12 13:30:01", (entry as StringIFDEntry).Value);
            }
            // Image.0x0213 (YCbCrPositioning/Short/1) "2"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.YCbCrPositioning);
                Assert.IsNotNull(entry, "Entry 0x0213 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(2, (entry as ShortIFDEntry).Value);
            }
            // Image.0x8769 (ExifTag/SubIFD/1) "250"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.ExifIFD);
                Assert.IsNotNull(entry, "Entry 0x8769 missing in IFD 0");
                Assert.IsNotNull(entry as SubIFDEntry, "Entry is not a sub IFD!");
            }

            var exif = structure.GetEntry(0, (ushort)IFDEntryTag.ExifIFD) as SubIFDEntry;

            Assert.IsNotNull(exif, "Exif tag not found");
            var exif_structure = exif.Structure;

            // Photo.0x829A (ExposureTime/Rational/1) "10/80"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ExposureTime);
                Assert.IsNotNull(entry, "Entry 0x829A missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(10, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(80, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Photo.0x829D (FNumber/Rational/1) "28/10"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.FNumber);
                Assert.IsNotNull(entry, "Entry 0x829D missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(28, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(10, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Photo.0x8822 (ExposureProgram/Short/1) "2"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ExposureProgram);
                Assert.IsNotNull(entry, "Entry 0x8822 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(2, (entry as ShortIFDEntry).Value);
            }
            // Photo.0x8827 (ISOSpeedRatings/Short/1) "320"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ISOSpeedRatings);
                Assert.IsNotNull(entry, "Entry 0x8827 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(320, (entry as ShortIFDEntry).Value);
            }
            // Photo.0x9000 (ExifVersion/Undefined/4) "48 50 50 48"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ExifVersion);
                Assert.IsNotNull(entry, "Entry 0x9000 missing in IFD 0");
                Assert.IsNotNull(entry as UndefinedIFDEntry, "Entry is not an undefined IFD entry!");
                var parsed_bytes = (entry as UndefinedIFDEntry).Data.Data;
                var bytes        = new byte[] { 48, 50, 50, 48 };
                Assert.AreEqual(bytes, parsed_bytes);
            }
            // Photo.0x9003 (DateTimeOriginal/Ascii/20) "2006:06:12 13:28:25"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.DateTimeOriginal);
                Assert.IsNotNull(entry, "Entry 0x9003 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("2006:06:12 13:28:25", (entry as StringIFDEntry).Value);
            }
            // Photo.0x9004 (DateTimeDigitized/Ascii/20) "2006:06:12 13:28:25"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.DateTimeDigitized);
                Assert.IsNotNull(entry, "Entry 0x9004 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("2006:06:12 13:28:25", (entry as StringIFDEntry).Value);
            }
            // Photo.0x9101 (ComponentsConfiguration/Undefined/4) "1 2 3 0"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ComponentsConfiguration);
                Assert.IsNotNull(entry, "Entry 0x9101 missing in IFD 0");
                Assert.IsNotNull(entry as UndefinedIFDEntry, "Entry is not an undefined IFD entry!");
                var parsed_bytes = (entry as UndefinedIFDEntry).Data.Data;
                var bytes        = new byte[] { 1, 2, 3, 0 };
                Assert.AreEqual(bytes, parsed_bytes);
            }
            // Photo.0x9102 (CompressedBitsPerPixel/Rational/1) "4/1"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.CompressedBitsPerPixel);
                Assert.IsNotNull(entry, "Entry 0x9102 missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(4, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Photo.0x9204 (ExposureBiasValue/SRational/1) "0/10"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ExposureBiasValue);
                Assert.IsNotNull(entry, "Entry 0x9204 missing in IFD 0");
                Assert.IsNotNull(entry as SRationalIFDEntry, "Entry is not a srational!");
                Assert.AreEqual(0, (entry as SRationalIFDEntry).Value.Numerator);
                Assert.AreEqual(10, (entry as SRationalIFDEntry).Value.Denominator);
            }
            // Photo.0x9205 (MaxApertureValue/Rational/1) "48/16"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.MaxApertureValue);
                Assert.IsNotNull(entry, "Entry 0x9205 missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(48, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(16, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Photo.0x9207 (MeteringMode/Short/1) "5"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.MeteringMode);
                Assert.IsNotNull(entry, "Entry 0x9207 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(5, (entry as ShortIFDEntry).Value);
            }
            // Photo.0x9208 (LightSource/Short/1) "0"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.LightSource);
                Assert.IsNotNull(entry, "Entry 0x9208 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(0, (entry as ShortIFDEntry).Value);
            }
            // Photo.0x9209 (Flash/Short/1) "0"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.Flash);
                Assert.IsNotNull(entry, "Entry 0x9209 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(0, (entry as ShortIFDEntry).Value);
            }
            // Photo.0x920A (FocalLength/Rational/1) "60/10"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.FocalLength);
                Assert.IsNotNull(entry, "Entry 0x920A missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(60, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(10, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Photo.0x927C (MakerNote/MakerNote/1504) "(Value ommitted)"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.MakerNote);
                Assert.IsNotNull(entry, "Entry 0x927C missing in IFD 0");
                Assert.IsNotNull(entry as MakernoteIFDEntry, "Entry is not a makernote IFD!");
            }

            var makernote = exif_structure.GetEntry(0, (ushort)ExifEntryTag.MakerNote) as MakernoteIFDEntry;

            Assert.IsNotNull(makernote, "MakerNote tag not found");
            var makernote_structure = makernote.Structure;

            // Sony.0x9001 (0x9001/Undefined/148) "0 55 0 0 0 8 0 136 147 53 0 194 66 169 0 125 23 0 0 0 0 203 0 0 0 0 0 0 0 203 0 1 91 213 255 0 0 216 0 0 105 4 149 0 255 106 224 125 64 220 14 136 255 74 255 240 0 0 0 74 136 0 136 125 5 74 136 0 136 125 5 74 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0 0 140"
            {
                // TODO: Unknown IFD tag: Sony / 0x9001
                var entry = makernote_structure.GetEntry(0, 0x9001);
                Assert.IsNotNull(entry, "Entry 0x9001 missing in IFD 0");
                Assert.IsNotNull(entry as UndefinedIFDEntry, "Entry is not an undefined IFD entry!");
                var parsed_bytes = (entry as UndefinedIFDEntry).Data.Data;
                var bytes        = new byte[] { 0, 55, 0, 0, 0, 8, 0, 136, 147, 53, 0, 194, 66, 169, 0, 125, 23, 0, 0, 0, 0, 203, 0, 0, 0, 0, 0, 0, 0, 203, 0, 1, 91, 213, 255, 0, 0, 216, 0, 0, 105, 4, 149, 0, 255, 106, 224, 125, 64, 220, 14, 136, 255, 74, 255, 240, 0, 0, 0, 74, 136, 0, 136, 125, 5, 74, 136, 0, 136, 125, 5, 74, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 140 };
                Assert.AreEqual(bytes, parsed_bytes);
            }
            // Sony.0x9002 (0x9002/Undefined/200) "2 239 0 140 2 239 0 0 0 125 0 0 0 0 0 0 0 0 0 0 0 0 205 0 0 0 0 0 112 0 112 42 14 172 205 0 0 0 0 0 0 0 0 0 112 143 138 95 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 27 11 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 182 8 92 0 125 0 182 0 0 0 4 0 63 63 0 112 170 112 170 112 42 64 0 0 0 220 220 115 70 0 79"
            {
                // TODO: Unknown IFD tag: Sony / 0x9002
                var entry = makernote_structure.GetEntry(0, 0x9002);
                Assert.IsNotNull(entry, "Entry 0x9002 missing in IFD 0");
                Assert.IsNotNull(entry as UndefinedIFDEntry, "Entry is not an undefined IFD entry!");
                var parsed_bytes = (entry as UndefinedIFDEntry).Data.Data;
                var bytes        = new byte[] { 2, 239, 0, 140, 2, 239, 0, 0, 0, 125, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 205, 0, 0, 0, 0, 0, 112, 0, 112, 42, 14, 172, 205, 0, 0, 0, 0, 0, 0, 0, 0, 0, 112, 143, 138, 95, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 27, 11, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 182, 8, 92, 0, 125, 0, 182, 0, 0, 0, 4, 0, 63, 63, 0, 112, 170, 112, 170, 112, 42, 64, 0, 0, 0, 220, 220, 115, 70, 0, 79 };
                Assert.AreEqual(bytes, parsed_bytes);
            }
            // Sony.0x9003 (0x9003/Undefined/200) "0 239 0 110 0 91 0 50 0 43 0 219 0 115 57 131 26 208 135 188 26 208 26 177 234 34 125 13 163 57 219 57 219 57 219 7 148 194 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 255 0 1 217 0 91 0 147 216 8 48 136 0 0 48 136 1 238 1 139 1 1 0 255 231 253 231 168 123 219 60 123 0 0 75 234 187 7 207 27 146 131 2 11 92 82 121 97 7 238 7 133 16 171 1 42 58 253 185 174 154 252 5 92 140 45 40 130 108 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 189 32 8 27 0 1 220 220 188 95 16 0 0 8 231 8 182"
            {
                // TODO: Unknown IFD tag: Sony / 0x9003
                var entry = makernote_structure.GetEntry(0, 0x9003);
                Assert.IsNotNull(entry, "Entry 0x9003 missing in IFD 0");
                Assert.IsNotNull(entry as UndefinedIFDEntry, "Entry is not an undefined IFD entry!");
                var parsed_bytes = (entry as UndefinedIFDEntry).Data.Data;
                var bytes        = new byte[] { 0, 239, 0, 110, 0, 91, 0, 50, 0, 43, 0, 219, 0, 115, 57, 131, 26, 208, 135, 188, 26, 208, 26, 177, 234, 34, 125, 13, 163, 57, 219, 57, 219, 57, 219, 7, 148, 194, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 255, 0, 1, 217, 0, 91, 0, 147, 216, 8, 48, 136, 0, 0, 48, 136, 1, 238, 1, 139, 1, 1, 0, 255, 231, 253, 231, 168, 123, 219, 60, 123, 0, 0, 75, 234, 187, 7, 207, 27, 146, 131, 2, 11, 92, 82, 121, 97, 7, 238, 7, 133, 16, 171, 1, 42, 58, 253, 185, 174, 154, 252, 5, 92, 140, 45, 40, 130, 108, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 189, 32, 8, 27, 0, 1, 220, 220, 188, 95, 16, 0, 0, 8, 231, 8, 182 };
                Assert.AreEqual(bytes, parsed_bytes);
            }
            // Sony.0x9004 (0x9004/Undefined/26) "8 234 8 138 0 227 0 150 0 227 0 227 0 0 0 0 0 1 0 0 1 1 0 0 0 0"
            {
                // TODO: Unknown IFD tag: Sony / 0x9004
                var entry = makernote_structure.GetEntry(0, 0x9004);
                Assert.IsNotNull(entry, "Entry 0x9004 missing in IFD 0");
                Assert.IsNotNull(entry as UndefinedIFDEntry, "Entry is not an undefined IFD entry!");
                var parsed_bytes = (entry as UndefinedIFDEntry).Data.Data;
                var bytes        = new byte[] { 8, 234, 8, 138, 0, 227, 0, 150, 0, 227, 0, 227, 0, 0, 0, 0, 0, 1, 0, 0, 1, 1, 0, 0, 0, 0 };
                Assert.AreEqual(bytes, parsed_bytes);
            }
            // Sony.0x9005 (0x9005/Undefined/120) "0 14 0 0 0 0 0 58 0 0 0 0 0 0 0 216 0 0 0 0 0 27 0 0 0 1 0 1 0 1 0 1 0 0 0 1 0 1 0 8 0 0 0 0 14 4 234 234 136 108 149 129 86 125 8 0 0 0 0 0 0 187 182 0 0 0 0 255 255 0 255 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 64 0 64 0 64 0 0 0 0 0 0"
            {
                // TODO: Unknown IFD tag: Sony / 0x9005
                var entry = makernote_structure.GetEntry(0, 0x9005);
                Assert.IsNotNull(entry, "Entry 0x9005 missing in IFD 0");
                Assert.IsNotNull(entry as UndefinedIFDEntry, "Entry is not an undefined IFD entry!");
                var parsed_bytes = (entry as UndefinedIFDEntry).Data.Data;
                var bytes        = new byte[] { 0, 14, 0, 0, 0, 0, 0, 58, 0, 0, 0, 0, 0, 0, 0, 216, 0, 0, 0, 0, 0, 27, 0, 0, 0, 1, 0, 1, 0, 1, 0, 1, 0, 0, 0, 1, 0, 1, 0, 8, 0, 0, 0, 0, 14, 4, 234, 234, 136, 108, 149, 129, 86, 125, 8, 0, 0, 0, 0, 0, 0, 187, 182, 0, 0, 0, 0, 255, 255, 0, 255, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 0, 64, 0, 64, 0, 0, 0, 0, 0, 0 };
                Assert.AreEqual(bytes, parsed_bytes);
            }
            // Sony.0x9006 (0x9006/Undefined/252) "236 109 0 0 190 132 0 0 190 70 0 0 190 216 0 0 182 150 0 0 138 148 0 0 32 216 0 0 48 131 0 0 105 103 0 0 105 139 0 0 105 102 0 0 112 88 0 0 112 84 0 0 32 20 0 0 136 243 0 0 105 85 0 0 215 44 0 0 129 198 0 0 136 157 0 0 136 144 0 0 129 124 0 0 182 35 0 0 138 119 0 0 136 3 0 0 136 120 0 0 182 175 0 0 105 81 0 0 48 76 0 0 138 216 0 0 5 106 0 0 182 63 0 0 105 210 0 0 138 128 0 0 182 45 0 0 48 234 0 0 5 236 0 0 205 117 0 0 182 9 0 0 136 149 0 0 112 189 0 0 112 234 0 0 182 54 0 0 205 172 0 0 4 117 0 0 234 174 0 0 138 125 0 0 205 15 0 0 234 99 0 0 234 181 194 127 246 246 246 127 194 194 127 246 246 246 127 194 127 246 238 56 238 246 127 246 238 208 131 208 238 246 246 56 131 74 131 56 246 246 238 208 131 208 238 246 127 246 238 56 238 246 127 0 0 0 0 0 234 93 234 189"
            {
                // TODO: Unknown IFD tag: Sony / 0x9006
                var entry = makernote_structure.GetEntry(0, 0x9006);
                Assert.IsNotNull(entry, "Entry 0x9006 missing in IFD 0");
                Assert.IsNotNull(entry as UndefinedIFDEntry, "Entry is not an undefined IFD entry!");
                var parsed_bytes = (entry as UndefinedIFDEntry).Data.Data;
                var bytes        = new byte[] { 236, 109, 0, 0, 190, 132, 0, 0, 190, 70, 0, 0, 190, 216, 0, 0, 182, 150, 0, 0, 138, 148, 0, 0, 32, 216, 0, 0, 48, 131, 0, 0, 105, 103, 0, 0, 105, 139, 0, 0, 105, 102, 0, 0, 112, 88, 0, 0, 112, 84, 0, 0, 32, 20, 0, 0, 136, 243, 0, 0, 105, 85, 0, 0, 215, 44, 0, 0, 129, 198, 0, 0, 136, 157, 0, 0, 136, 144, 0, 0, 129, 124, 0, 0, 182, 35, 0, 0, 138, 119, 0, 0, 136, 3, 0, 0, 136, 120, 0, 0, 182, 175, 0, 0, 105, 81, 0, 0, 48, 76, 0, 0, 138, 216, 0, 0, 5, 106, 0, 0, 182, 63, 0, 0, 105, 210, 0, 0, 138, 128, 0, 0, 182, 45, 0, 0, 48, 234, 0, 0, 5, 236, 0, 0, 205, 117, 0, 0, 182, 9, 0, 0, 136, 149, 0, 0, 112, 189, 0, 0, 112, 234, 0, 0, 182, 54, 0, 0, 205, 172, 0, 0, 4, 117, 0, 0, 234, 174, 0, 0, 138, 125, 0, 0, 205, 15, 0, 0, 234, 99, 0, 0, 234, 181, 194, 127, 246, 246, 246, 127, 194, 194, 127, 246, 246, 246, 127, 194, 127, 246, 238, 56, 238, 246, 127, 246, 238, 208, 131, 208, 238, 246, 246, 56, 131, 74, 131, 56, 246, 246, 238, 208, 131, 208, 238, 246, 127, 246, 238, 56, 238, 246, 127, 0, 0, 0, 0, 0, 234, 93, 234, 189 };
                Assert.AreEqual(bytes, parsed_bytes);
            }
            // Sony.0x9007 (0x9007/Undefined/200) "205 208 5 136 5 253 112 229 105 211 136 29 48 131 190 134 0 163 112 161 182 88 105 28 136 132 48 116 215 21 187 90 12 90 236 140 108 109 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 64 183 64 187 27 253 64 234 64 105 64 90 64 53 125 12 125 29 216 13 0 163 64 53 64 144 64 254 125 138 125 196 125 58 216 36 94 36 14 249 4 114 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 14 199 231 0 14 13 14 67 231 26 231 84 231 74 4 26 4 58 86 194 0 163 138 95 138 233 138 107 138 201 112 234 112 172 112 65 112 204 112 133 112 143 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0"
            {
                // TODO: Unknown IFD tag: Sony / 0x9007
                var entry = makernote_structure.GetEntry(0, 0x9007);
                Assert.IsNotNull(entry, "Entry 0x9007 missing in IFD 0");
                Assert.IsNotNull(entry as UndefinedIFDEntry, "Entry is not an undefined IFD entry!");
                var parsed_bytes = (entry as UndefinedIFDEntry).Data.Data;
                var bytes        = new byte[] { 205, 208, 5, 136, 5, 253, 112, 229, 105, 211, 136, 29, 48, 131, 190, 134, 0, 163, 112, 161, 182, 88, 105, 28, 136, 132, 48, 116, 215, 21, 187, 90, 12, 90, 236, 140, 108, 109, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 64, 183, 64, 187, 27, 253, 64, 234, 64, 105, 64, 90, 64, 53, 125, 12, 125, 29, 216, 13, 0, 163, 64, 53, 64, 144, 64, 254, 125, 138, 125, 196, 125, 58, 216, 36, 94, 36, 14, 249, 4, 114, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 14, 199, 231, 0, 14, 13, 14, 67, 231, 26, 231, 84, 231, 74, 4, 26, 4, 58, 86, 194, 0, 163, 138, 95, 138, 233, 138, 107, 138, 201, 112, 234, 112, 172, 112, 65, 112, 204, 112, 133, 112, 143, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 };
                Assert.AreEqual(bytes, parsed_bytes);
            }
            // Sony.0x9008 (0x9008/Undefined/200) "0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 2 0 1 0 2 0"
            {
                // TODO: Unknown IFD tag: Sony / 0x9008
                var entry = makernote_structure.GetEntry(0, 0x9008);
                Assert.IsNotNull(entry, "Entry 0x9008 missing in IFD 0");
                Assert.IsNotNull(entry as UndefinedIFDEntry, "Entry is not an undefined IFD entry!");
                var parsed_bytes = (entry as UndefinedIFDEntry).Data.Data;
                var bytes        = new byte[] { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 0, 2, 0 };
                Assert.AreEqual(bytes, parsed_bytes);
            }

            //  ---------- End of IFD tests ----------
        }
Example #26
0
        public void ValidateMetadataInvariants(TagLib.Image.File file)
        {
            Assert.IsNotNull(file);

            var properties = file.Properties;

            Assert.IsNotNull(properties);
            Assert.AreEqual(3920, properties.PhotoWidth, "PhotoWidth");
            Assert.AreEqual(2638, properties.PhotoHeight, "PhotoHeight");

            //  ---------- Start of IFD tests ----------

            var tag = file.GetTag(TagTypes.TiffIFD) as IFDTag;

            Assert.IsNotNull(tag, "IFD tag not found");

            var structure = tag.Structure;

            // Image.0x00FE (NewSubfileType/Long/1) "1"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.NewSubfileType);
                Assert.IsNotNull(entry, "Entry 0x00FE missing in IFD 0");
                Assert.IsNotNull(entry as LongIFDEntry, "Entry is not a long!");
                Assert.AreEqual(1, (entry as LongIFDEntry).Value);
            }
            // Image.0x0100 (ImageWidth/Long/1) "320"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.ImageWidth);
                Assert.IsNotNull(entry, "Entry 0x0100 missing in IFD 0");
                Assert.IsNotNull(entry as LongIFDEntry, "Entry is not a long!");
                Assert.AreEqual(320, (entry as LongIFDEntry).Value);
            }
            // Image.0x0101 (ImageLength/Long/1) "240"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.ImageLength);
                Assert.IsNotNull(entry, "Entry 0x0101 missing in IFD 0");
                Assert.IsNotNull(entry as LongIFDEntry, "Entry is not a long!");
                Assert.AreEqual(240, (entry as LongIFDEntry).Value);
            }
            // Image.0x0102 (BitsPerSample/Short/3) "8 8 8"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.BitsPerSample);
                Assert.IsNotNull(entry, "Entry 0x0102 missing in IFD 0");
                Assert.IsNotNull(entry as ShortArrayIFDEntry, "Entry is not a short array!");
                Assert.AreEqual(new ushort[] { 8, 8, 8 }, (entry as ShortArrayIFDEntry).Values);
            }
            // Image.0x0103 (Compression/Short/1) "1"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.Compression);
                Assert.IsNotNull(entry, "Entry 0x0103 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(1, (entry as ShortIFDEntry).Value);
            }
            // Image.0x0106 (PhotometricInterpretation/Short/1) "2"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.PhotometricInterpretation);
                Assert.IsNotNull(entry, "Entry 0x0106 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(2, (entry as ShortIFDEntry).Value);
            }
            // Image.0x010F (Make/Ascii/16) "Leica Camera AG"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.Make);
                Assert.IsNotNull(entry, "Entry 0x010F missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("Leica Camera AG", (entry as StringIFDEntry).Value);
            }
            // Image.0x0110 (Model/Ascii/18) "M8 Digital Camera"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.Model);
                Assert.IsNotNull(entry, "Entry 0x0110 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("M8 Digital Camera", (entry as StringIFDEntry).Value);
            }
            // Image.0x0111 (StripOffsets/StripOffsets/4) "3936 69216 134496 199776"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.StripOffsets);
                Assert.IsNotNull(entry, "Entry 0x0111 missing in IFD 0");
                Assert.IsNotNull(entry as StripOffsetsIFDEntry, "Entry is not a strip offsets entry!");
                Assert.AreEqual(4, (entry as StripOffsetsIFDEntry).Values.Length);
            }
            // Image.0x0112 (Orientation/Short/1) "1"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.Orientation);
                Assert.IsNotNull(entry, "Entry 0x0112 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(1, (entry as ShortIFDEntry).Value);
            }
            // Image.0x0115 (SamplesPerPixel/Short/1) "3"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.SamplesPerPixel);
                Assert.IsNotNull(entry, "Entry 0x0115 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(3, (entry as ShortIFDEntry).Value);
            }
            // Image.0x0116 (RowsPerStrip/Long/1) "68"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.RowsPerStrip);
                Assert.IsNotNull(entry, "Entry 0x0116 missing in IFD 0");
                Assert.IsNotNull(entry as LongIFDEntry, "Entry is not a long!");
                Assert.AreEqual(68, (entry as LongIFDEntry).Value);
            }
            // Image.0x0117 (StripByteCounts/Long/4) "65280 65280 65280 34560"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.StripByteCounts);
                Assert.IsNotNull(entry, "Entry 0x0117 missing in IFD 0");
                Assert.IsNotNull(entry as LongArrayIFDEntry, "Entry is not a long array!");
                Assert.AreEqual(new long[] { 65280, 65280, 65280, 34560 }, (entry as LongArrayIFDEntry).Values);
            }
            // Image.0x011A (XResolution/Rational/1) "72/1"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.XResolution);
                Assert.IsNotNull(entry, "Entry 0x011A missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(72, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Image.0x011B (YResolution/Rational/1) "72/1"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.YResolution);
                Assert.IsNotNull(entry, "Entry 0x011B missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(72, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Image.0x011C (PlanarConfiguration/Short/1) "1"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.PlanarConfiguration);
                Assert.IsNotNull(entry, "Entry 0x011C missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(1, (entry as ShortIFDEntry).Value);
            }
            // Image.0x0128 (ResolutionUnit/Short/1) "2"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.ResolutionUnit);
                Assert.IsNotNull(entry, "Entry 0x0128 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(2, (entry as ShortIFDEntry).Value);
            }
            // Image.0x0131 (Software/Ascii/6) "1.107"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.Software);
                Assert.IsNotNull(entry, "Entry 0x0131 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("1.107", (entry as StringIFDEntry).Value);
            }
            // Image.0x013B (Artist/Ascii/1) ""
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.Artist);
                Assert.IsNotNull(entry, "Entry 0x013B missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("", (entry as StringIFDEntry).Value.Trim());
            }

            var SubImage1_structure = (structure.GetEntry(0, (ushort)IFDEntryTag.SubIFDs) as SubIFDArrayEntry).Entries[0];

            Assert.IsNotNull(SubImage1_structure, "SubImage1 structure not found");

            // SubImage1.0x00FE (NewSubfileType/Long/1) "0"
            {
                var entry = SubImage1_structure.GetEntry(0, (ushort)IFDEntryTag.NewSubfileType);
                Assert.IsNotNull(entry, "Entry 0x00FE missing in IFD 0");
                Assert.IsNotNull(entry as LongIFDEntry, "Entry is not a long!");
                Assert.AreEqual(0, (entry as LongIFDEntry).Value);
            }
            // SubImage1.0x0100 (ImageWidth/Long/1) "3920"
            {
                var entry = SubImage1_structure.GetEntry(0, (ushort)IFDEntryTag.ImageWidth);
                Assert.IsNotNull(entry, "Entry 0x0100 missing in IFD 0");
                Assert.IsNotNull(entry as LongIFDEntry, "Entry is not a long!");
                Assert.AreEqual(3920, (entry as LongIFDEntry).Value);
            }
            // SubImage1.0x0101 (ImageLength/Long/1) "2638"
            {
                var entry = SubImage1_structure.GetEntry(0, (ushort)IFDEntryTag.ImageLength);
                Assert.IsNotNull(entry, "Entry 0x0101 missing in IFD 0");
                Assert.IsNotNull(entry as LongIFDEntry, "Entry is not a long!");
                Assert.AreEqual(2638, (entry as LongIFDEntry).Value);
            }
            // SubImage1.0x0102 (BitsPerSample/Short/1) "8"
            {
                var entry = SubImage1_structure.GetEntry(0, (ushort)IFDEntryTag.BitsPerSample);
                Assert.IsNotNull(entry, "Entry 0x0102 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(8, (entry as ShortIFDEntry).Value);
            }
            // SubImage1.0x0103 (Compression/Short/1) "1"
            {
                var entry = SubImage1_structure.GetEntry(0, (ushort)IFDEntryTag.Compression);
                Assert.IsNotNull(entry, "Entry 0x0103 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(1, (entry as ShortIFDEntry).Value);
            }
            // SubImage1.0x0106 (PhotometricInterpretation/Short/1) "32803"
            {
                var entry = SubImage1_structure.GetEntry(0, (ushort)IFDEntryTag.PhotometricInterpretation);
                Assert.IsNotNull(entry, "Entry 0x0106 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(32803, (entry as ShortIFDEntry).Value);
            }
            // SubImage1.0x0111 (StripOffsets/StripOffsets/165) "234336 297056 359776 422496 485216 547936 610656 673376 736096 798816 861536 924256 986976 1049696 1112416 1175136 1237856 1300576 1363296 1426016 1488736 1551456 1614176 1676896 1739616 1802336 1865056 1927776 1990496 2053216 2115936 2178656 2241376 2304096 2366816 2429536 2492256 2554976 2617696 2680416 2743136 2805856 2868576 2931296 2994016 3056736 3119456 3182176 3244896 3307616 3370336 3433056 3495776 3558496 3621216 3683936 3746656 3809376 3872096 3934816 3997536 4060256 4122976 4185696 4248416 4311136 4373856 4436576 4499296 4562016 4624736 4687456 4750176 4812896 4875616 4938336 5001056 5063776 5126496 5189216 5251936 5314656 5377376 5440096 5502816 5565536 5628256 5690976 5753696 5816416 5879136 5941856 6004576 6067296 6130016 6192736 6255456 6318176 6380896 6443616 6506336 6569056 6631776 6694496 6757216 6819936 6882656 6945376 7008096 7070816 7133536 7196256 7258976 7321696 7384416 7447136 7509856 7572576 7635296 7698016 7760736 7823456 7886176 7948896 8011616 8074336 8137056 8199776 8262496 8325216 8387936 8450656 8513376 8576096 8638816 8701536 8764256 8826976 8889696 8952416 9015136 9077856 9140576 9203296 9266016 9328736 9391456 9454176 9516896 9579616 9642336 9705056 9767776 9830496 9893216 9955936 10018656 10081376 10144096 10206816 10269536 10332256 10394976 10457696 10520416"
            {
                var entry = SubImage1_structure.GetEntry(0, (ushort)IFDEntryTag.StripOffsets);
                Assert.IsNotNull(entry, "Entry 0x0111 missing in IFD 0");
                Assert.IsNotNull(entry as StripOffsetsIFDEntry, "Entry is not a strip offsets entry!");
                Assert.AreEqual(165, (entry as StripOffsetsIFDEntry).Values.Length);
            }
            // SubImage1.0x0115 (SamplesPerPixel/Short/1) "1"
            {
                var entry = SubImage1_structure.GetEntry(0, (ushort)IFDEntryTag.SamplesPerPixel);
                Assert.IsNotNull(entry, "Entry 0x0115 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(1, (entry as ShortIFDEntry).Value);
            }
            // SubImage1.0x0116 (RowsPerStrip/Long/1) "16"
            {
                var entry = SubImage1_structure.GetEntry(0, (ushort)IFDEntryTag.RowsPerStrip);
                Assert.IsNotNull(entry, "Entry 0x0116 missing in IFD 0");
                Assert.IsNotNull(entry as LongIFDEntry, "Entry is not a long!");
                Assert.AreEqual(16, (entry as LongIFDEntry).Value);
            }
            // SubImage1.0x0117 (StripByteCounts/Long/165) "62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 62720 54880"
            {
                var entry = SubImage1_structure.GetEntry(0, (ushort)IFDEntryTag.StripByteCounts);
                Assert.IsNotNull(entry, "Entry 0x0117 missing in IFD 0");
                Assert.IsNotNull(entry as LongArrayIFDEntry, "Entry is not a long array!");
                Assert.AreEqual(new long[] { 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 62720, 54880 }, (entry as LongArrayIFDEntry).Values);
            }
            // SubImage1.0x011A (XResolution/Rational/1) "300/1"
            {
                var entry = SubImage1_structure.GetEntry(0, (ushort)IFDEntryTag.XResolution);
                Assert.IsNotNull(entry, "Entry 0x011A missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(300, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Denominator);
            }
            // SubImage1.0x011B (YResolution/Rational/1) "300/1"
            {
                var entry = SubImage1_structure.GetEntry(0, (ushort)IFDEntryTag.YResolution);
                Assert.IsNotNull(entry, "Entry 0x011B missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(300, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Denominator);
            }
            // SubImage1.0x011C (PlanarConfiguration/Short/1) "1"
            {
                var entry = SubImage1_structure.GetEntry(0, (ushort)IFDEntryTag.PlanarConfiguration);
                Assert.IsNotNull(entry, "Entry 0x011C missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(1, (entry as ShortIFDEntry).Value);
            }
            // SubImage1.0x0128 (ResolutionUnit/Short/1) "2"
            {
                var entry = SubImage1_structure.GetEntry(0, (ushort)IFDEntryTag.ResolutionUnit);
                Assert.IsNotNull(entry, "Entry 0x0128 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(2, (entry as ShortIFDEntry).Value);
            }
            // SubImage1.0x828D (CFARepeatPatternDim/Short/2) "2 2"
            {
                // TODO: Unknown IFD tag: SubImage1 / 0x828D
                var entry = SubImage1_structure.GetEntry(0, 0x828D);
                Assert.IsNotNull(entry, "Entry 0x828D missing in IFD 0");
                Assert.IsNotNull(entry as ShortArrayIFDEntry, "Entry is not a short array!");
                Assert.AreEqual(new ushort[] { 2, 2 }, (entry as ShortArrayIFDEntry).Values);
            }
            // SubImage1.0x828E (CFAPattern/Byte/4) "0 1 1 2"
            {
                // TODO: Unknown IFD tag: SubImage1 / 0x828E
                var entry = SubImage1_structure.GetEntry(0, 0x828E);
                Assert.IsNotNull(entry, "Entry 0x828E missing in IFD 0");
                Assert.IsNotNull(entry as ByteVectorIFDEntry, "Entry is not a byte array!");
                var parsed_bytes = (entry as ByteVectorIFDEntry).Data.Data;
                var bytes        = new byte[] { 0, 1, 1, 2 };
                Assert.AreEqual(bytes, parsed_bytes);
            }
            // SubImage1.0xC618 (LinearizationTable/Short/256) "0 0 1 2 4 6 9 12 16 20 25 30 36 42 49 56 64 72 81 90 100 110 121 132 144 156 169 182 196 210 225 240 256 272 289 306 324 342 361 380 400 420 441 462 484 506 529 552 576 600 625 650 676 702 729 756 784 812 841 870 900 930 961 992 1024 1056 1089 1122 1156 1190 1225 1260 1296 1332 1369 1406 1444 1482 1521 1560 1600 1640 1681 1722 1764 1806 1849 1892 1936 1980 2025 2070 2116 2162 2209 2256 2304 2352 2401 2450 2500 2550 2601 2652 2704 2756 2809 2862 2916 2970 3025 3080 3136 3192 3249 3306 3364 3422 3481 3540 3600 3660 3721 3782 3844 3906 3969 4032 4096 4160 4225 4290 4356 4422 4489 4556 4624 4692 4761 4830 4900 4970 5041 5112 5184 5256 5329 5402 5476 5550 5625 5700 5776 5852 5929 6006 6084 6162 6241 6320 6400 6480 6561 6642 6724 6806 6889 6972 7056 7140 7225 7310 7396 7482 7569 7656 7744 7832 7921 8010 8100 8190 8281 8372 8464 8556 8649 8742 8836 8930 9025 9120 9216 9312 9409 9506 9604 9702 9801 9900 10000 10100 10201 10302 10404 10506 10609 10712 10816 10920 11025 11130 11236 11342 11449 11556 11664 11772 11881 11990 12100 12210 12321 12432 12544 12656 12769 12882 12996 13110 13225 13340 13456 13572 13689 13806 13924 14042 14161 14280 14400 14520 14641 14762 14884 15006 15129 15252 15376 15500 15625 15750 15876 16002 16129 16256"
            {
                var entry = SubImage1_structure.GetEntry(0, (ushort)IFDEntryTag.LinearizationTable);
                Assert.IsNotNull(entry, "Entry 0xC618 missing in IFD 0");
                Assert.IsNotNull(entry as ShortArrayIFDEntry, "Entry is not a short array!");
                Assert.AreEqual(new ushort[] { 0, 0, 1, 2, 4, 6, 9, 12, 16, 20, 25, 30, 36, 42, 49, 56, 64, 72, 81, 90, 100, 110, 121, 132, 144, 156, 169, 182, 196, 210, 225, 240, 256, 272, 289, 306, 324, 342, 361, 380, 400, 420, 441, 462, 484, 506, 529, 552, 576, 600, 625, 650, 676, 702, 729, 756, 784, 812, 841, 870, 900, 930, 961, 992, 1024, 1056, 1089, 1122, 1156, 1190, 1225, 1260, 1296, 1332, 1369, 1406, 1444, 1482, 1521, 1560, 1600, 1640, 1681, 1722, 1764, 1806, 1849, 1892, 1936, 1980, 2025, 2070, 2116, 2162, 2209, 2256, 2304, 2352, 2401, 2450, 2500, 2550, 2601, 2652, 2704, 2756, 2809, 2862, 2916, 2970, 3025, 3080, 3136, 3192, 3249, 3306, 3364, 3422, 3481, 3540, 3600, 3660, 3721, 3782, 3844, 3906, 3969, 4032, 4096, 4160, 4225, 4290, 4356, 4422, 4489, 4556, 4624, 4692, 4761, 4830, 4900, 4970, 5041, 5112, 5184, 5256, 5329, 5402, 5476, 5550, 5625, 5700, 5776, 5852, 5929, 6006, 6084, 6162, 6241, 6320, 6400, 6480, 6561, 6642, 6724, 6806, 6889, 6972, 7056, 7140, 7225, 7310, 7396, 7482, 7569, 7656, 7744, 7832, 7921, 8010, 8100, 8190, 8281, 8372, 8464, 8556, 8649, 8742, 8836, 8930, 9025, 9120, 9216, 9312, 9409, 9506, 9604, 9702, 9801, 9900, 10000, 10100, 10201, 10302, 10404, 10506, 10609, 10712, 10816, 10920, 11025, 11130, 11236, 11342, 11449, 11556, 11664, 11772, 11881, 11990, 12100, 12210, 12321, 12432, 12544, 12656, 12769, 12882, 12996, 13110, 13225, 13340, 13456, 13572, 13689, 13806, 13924, 14042, 14161, 14280, 14400, 14520, 14641, 14762, 14884, 15006, 15129, 15252, 15376, 15500, 15625, 15750, 15876, 16002, 16129, 16256 }, (entry as ShortArrayIFDEntry).Values);
            }
            // SubImage1.0xC61D (WhiteLevel/Long/1) "16383"
            {
                var entry = SubImage1_structure.GetEntry(0, (ushort)IFDEntryTag.WhiteLevel);
                Assert.IsNotNull(entry, "Entry 0xC61D missing in IFD 0");
                Assert.IsNotNull(entry as LongIFDEntry, "Entry is not a long!");
                Assert.AreEqual(16383, (entry as LongIFDEntry).Value);
            }
            // SubImage1.0xC61F (DefaultCropOrigin/Short/2) "2 2"
            {
                var entry = SubImage1_structure.GetEntry(0, (ushort)IFDEntryTag.DefaultCropOrigin);
                Assert.IsNotNull(entry, "Entry 0xC61F missing in IFD 0");
                Assert.IsNotNull(entry as ShortArrayIFDEntry, "Entry is not a short array!");
                Assert.AreEqual(new ushort[] { 2, 2 }, (entry as ShortArrayIFDEntry).Values);
            }
            // SubImage1.0xC620 (DefaultCropSize/Short/2) "3916 2634"
            {
                var entry = SubImage1_structure.GetEntry(0, (ushort)IFDEntryTag.DefaultCropSize);
                Assert.IsNotNull(entry, "Entry 0xC620 missing in IFD 0");
                Assert.IsNotNull(entry as ShortArrayIFDEntry, "Entry is not a short array!");
                Assert.AreEqual(new ushort[] { 3916, 2634 }, (entry as ShortArrayIFDEntry).Values);
            }
            // SubImage1.0xC62D (BayerGreenSplit/Long/1) "500"
            {
                var entry = SubImage1_structure.GetEntry(0, (ushort)IFDEntryTag.BayerGreenSplit);
                Assert.IsNotNull(entry, "Entry 0xC62D missing in IFD 0");
                Assert.IsNotNull(entry as LongIFDEntry, "Entry is not a long!");
                Assert.AreEqual(500, (entry as LongIFDEntry).Value);
            }
            // SubImage1.0xC632 (AntiAliasStrength/Rational/1) "0/1"
            {
                var entry = SubImage1_structure.GetEntry(0, (ushort)IFDEntryTag.AntiAliasStrength);
                Assert.IsNotNull(entry, "Entry 0xC632 missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(0, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Image.0x8298 (Copyright/Ascii/1) ""
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.Copyright);
                Assert.IsNotNull(entry, "Entry 0x8298 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("", (entry as StringIFDEntry).Value.Trim());
            }
            // Image.0x8769 (ExifTag/SubIFD/1) "764"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.ExifIFD);
                Assert.IsNotNull(entry, "Entry 0x8769 missing in IFD 0");
                Assert.IsNotNull(entry as SubIFDEntry, "Entry is not a sub IFD!");
            }

            var exif = structure.GetEntry(0, (ushort)IFDEntryTag.ExifIFD) as SubIFDEntry;

            Assert.IsNotNull(exif, "Exif tag not found");
            var exif_structure = exif.Structure;

            // Photo.0x829A (ExposureTime/Rational/1) "12000000/1000000"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ExposureTime);
                Assert.IsNotNull(entry, "Entry 0x829A missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(12000000, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1000000, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Photo.0x8822 (ExposureProgram/Short/1) "1"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ExposureProgram);
                Assert.IsNotNull(entry, "Entry 0x8822 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(1, (entry as ShortIFDEntry).Value);
            }
            // Photo.0x8827 (ISOSpeedRatings/Short/1) "160"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ISOSpeedRatings);
                Assert.IsNotNull(entry, "Entry 0x8827 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(160, (entry as ShortIFDEntry).Value);
            }
            // Photo.0x9000 (ExifVersion/Undefined/4) "48 50 50 48"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ExifVersion);
                Assert.IsNotNull(entry, "Entry 0x9000 missing in IFD 0");
                Assert.IsNotNull(entry as UndefinedIFDEntry, "Entry is not an undefined IFD entry!");
                var parsed_bytes = (entry as UndefinedIFDEntry).Data.Data;
                var bytes        = new byte[] { 48, 50, 50, 48 };
                Assert.AreEqual(bytes, parsed_bytes);
            }
            // Photo.0x9004 (DateTimeDigitized/Ascii/20) "2007:08:02 22:13:49"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.DateTimeDigitized);
                Assert.IsNotNull(entry, "Entry 0x9004 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("2007:08:02 22:13:49", (entry as StringIFDEntry).Value);
            }
            // Photo.0x9201 (ShutterSpeedValue/SRational/1) "-229376/65536"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ShutterSpeedValue);
                Assert.IsNotNull(entry, "Entry 0x9201 missing in IFD 0");
                Assert.IsNotNull(entry as SRationalIFDEntry, "Entry is not a srational!");
                Assert.AreEqual(-229376, (entry as SRationalIFDEntry).Value.Numerator);
                Assert.AreEqual(65536, (entry as SRationalIFDEntry).Value.Denominator);
            }
            // Photo.0x9204 (ExposureBiasValue/SRational/1) "0/65536"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ExposureBiasValue);
                Assert.IsNotNull(entry, "Entry 0x9204 missing in IFD 0");
                Assert.IsNotNull(entry as SRationalIFDEntry, "Entry is not a srational!");
                Assert.AreEqual(0, (entry as SRationalIFDEntry).Value.Numerator);
                Assert.AreEqual(65536, (entry as SRationalIFDEntry).Value.Denominator);
            }
            // Photo.0x9205 (MaxApertureValue/Rational/1) "131072/65536"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.MaxApertureValue);
                Assert.IsNotNull(entry, "Entry 0x9205 missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(131072, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(65536, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Photo.0x9207 (MeteringMode/Short/1) "2"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.MeteringMode);
                Assert.IsNotNull(entry, "Entry 0x9207 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(2, (entry as ShortIFDEntry).Value);
            }
            // Photo.0x9208 (LightSource/Short/1) "0"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.LightSource);
                Assert.IsNotNull(entry, "Entry 0x9208 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(0, (entry as ShortIFDEntry).Value);
            }
            // Photo.0x9209 (Flash/Short/1) "0"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.Flash);
                Assert.IsNotNull(entry, "Entry 0x9209 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(0, (entry as ShortIFDEntry).Value);
            }
            // Photo.0x920A (FocalLength/Rational/1) "50000/1000"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.FocalLength);
                Assert.IsNotNull(entry, "Entry 0x920A missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(50000, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1000, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Photo.0x927C (MakerNote/MakerNote/220) ""
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.MakerNote);
                Assert.IsNotNull(entry, "Entry 0x927C missing in IFD 0");
                Assert.IsNotNull(entry as MakernoteIFDEntry, "Entry is not a makernote IFD!");
            }
            // Photo.0xA300 (FileSource/Undefined/1) "3"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.FileSource);
                Assert.IsNotNull(entry, "Entry 0xA300 missing in IFD 0");
                Assert.IsNotNull(entry as UndefinedIFDEntry, "Entry is not an undefined IFD entry!");
                var parsed_bytes = (entry as UndefinedIFDEntry).Data.Data;
                var bytes        = new byte[] { 3 };
                Assert.AreEqual(bytes, parsed_bytes);
            }
            // Photo.0xA301 (SceneType/Undefined/1) "1"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.SceneType);
                Assert.IsNotNull(entry, "Entry 0xA301 missing in IFD 0");
                Assert.IsNotNull(entry as UndefinedIFDEntry, "Entry is not an undefined IFD entry!");
                var parsed_bytes = (entry as UndefinedIFDEntry).Data.Data;
                var bytes        = new byte[] { 1 };
                Assert.AreEqual(bytes, parsed_bytes);
            }
            // Photo.0xA403 (WhiteBalance/Short/1) "0"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.WhiteBalance);
                Assert.IsNotNull(entry, "Entry 0xA403 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(0, (entry as ShortIFDEntry).Value);
            }
            // Photo.0xA404 (DigitalZoomRatio/Rational/1) "0/1"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.DigitalZoomRatio);
                Assert.IsNotNull(entry, "Entry 0xA404 missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(0, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Photo.0xA405 (FocalLengthIn35mmFilm/Short/1) "67"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.FocalLengthIn35mmFilm);
                Assert.IsNotNull(entry, "Entry 0xA405 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(67, (entry as ShortIFDEntry).Value);
            }
            // Photo.0xA406 (SceneCaptureType/Short/1) "0"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.SceneCaptureType);
                Assert.IsNotNull(entry, "Entry 0xA406 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(0, (entry as ShortIFDEntry).Value);
            }
            // Photo.0xA420 (ImageUniqueID/Ascii/33) "00000000000000000000000000000147"
            {
                var entry = exif_structure.GetEntry(0, (ushort)ExifEntryTag.ImageUniqueID);
                Assert.IsNotNull(entry, "Entry 0xA420 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("00000000000000000000000000000147", (entry as StringIFDEntry).Value);
            }
            // Image.0x882B (SelfTimerMode/Short/1) "0"
            {
                // TODO: Unknown IFD tag: Image / 0x882B
                var entry = structure.GetEntry(0, 0x882B);
                Assert.IsNotNull(entry, "Entry 0x882B missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(0, (entry as ShortIFDEntry).Value);
            }
            // Image.0x9003 (DateTimeOriginal/Ascii/20) "2007:08:02 22:13:49"
            {
                var entry = structure.GetEntry(0, (ushort)ExifEntryTag.DateTimeOriginal);
                Assert.IsNotNull(entry, "Entry 0x9003 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("2007:08:02 22:13:49", (entry as StringIFDEntry).Value);
            }
            // Image.0x920E (FocalPlaneXResolution/Rational/1) "3729/1"
            {
                // TODO: Unknown IFD tag: Image / 0x920E
                var entry = structure.GetEntry(0, 0x920E);
                Assert.IsNotNull(entry, "Entry 0x920E missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(3729, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Image.0x920F (FocalPlaneYResolution/Rational/1) "3764/1"
            {
                // TODO: Unknown IFD tag: Image / 0x920F
                var entry = structure.GetEntry(0, 0x920F);
                Assert.IsNotNull(entry, "Entry 0x920F missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(3764, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Image.0x9210 (FocalPlaneResolutionUnit/Short/1) "2"
            {
                // TODO: Unknown IFD tag: Image / 0x9210
                var entry = structure.GetEntry(0, 0x9210);
                Assert.IsNotNull(entry, "Entry 0x9210 missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(2, (entry as ShortIFDEntry).Value);
            }
            // Image.0x9216 (TIFFEPStandardID/Byte/4) "0 0 0 1"
            {
                // TODO: Unknown IFD tag: Image / 0x9216
                var entry = structure.GetEntry(0, 0x9216);
                Assert.IsNotNull(entry, "Entry 0x9216 missing in IFD 0");
                Assert.IsNotNull(entry as ByteVectorIFDEntry, "Entry is not a byte array!");
                var parsed_bytes = (entry as ByteVectorIFDEntry).Data.Data;
                var bytes        = new byte[] { 0, 0, 0, 1 };
                Assert.AreEqual(bytes, parsed_bytes);
            }
            // Image.0xC612 (DNGVersion/Byte/4) "1 0 0 0"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.DNGVersion);
                Assert.IsNotNull(entry, "Entry 0xC612 missing in IFD 0");
                Assert.IsNotNull(entry as ByteVectorIFDEntry, "Entry is not a byte array!");
                var parsed_bytes = (entry as ByteVectorIFDEntry).Data.Data;
                var bytes        = new byte[] { 1, 0, 0, 0 };
                Assert.AreEqual(bytes, parsed_bytes);
            }
            // Image.0xC614 (UniqueCameraModel/Ascii/18) "M8 Digital Camera"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.UniqueCameraModel);
                Assert.IsNotNull(entry, "Entry 0xC614 missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("M8 Digital Camera", (entry as StringIFDEntry).Value);
            }
            // Image.0xC621 (ColorMatrix1/SRational/9) "10469/10000 -5314/10000 1280/10000 -4326/10000 12176/10000 2419/10000 -886/10000 2473/10000 7160/10000"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.ColorMatrix1);
                Assert.IsNotNull(entry, "Entry 0xC621 missing in IFD 0");
                Assert.IsNotNull(entry as SRationalArrayIFDEntry, "Entry is not a srational array!");
                var parts = (entry as SRationalArrayIFDEntry).Values;
                Assert.AreEqual(9, parts.Length);
                Assert.AreEqual(10469, parts[0].Numerator);
                Assert.AreEqual(10000, parts[0].Denominator);
                Assert.AreEqual(-5314, parts[1].Numerator);
                Assert.AreEqual(10000, parts[1].Denominator);
                Assert.AreEqual(1280, parts[2].Numerator);
                Assert.AreEqual(10000, parts[2].Denominator);
                Assert.AreEqual(-4326, parts[3].Numerator);
                Assert.AreEqual(10000, parts[3].Denominator);
                Assert.AreEqual(12176, parts[4].Numerator);
                Assert.AreEqual(10000, parts[4].Denominator);
                Assert.AreEqual(2419, parts[5].Numerator);
                Assert.AreEqual(10000, parts[5].Denominator);
                Assert.AreEqual(-886, parts[6].Numerator);
                Assert.AreEqual(10000, parts[6].Denominator);
                Assert.AreEqual(2473, parts[7].Numerator);
                Assert.AreEqual(10000, parts[7].Denominator);
                Assert.AreEqual(7160, parts[8].Numerator);
                Assert.AreEqual(10000, parts[8].Denominator);
            }
            // Image.0xC622 (ColorMatrix2/SRational/9) "7675/10000 -2195/10000 -305/10000 -5860/10000 14118/10000 1857/10000 -2425/10000 4007/10000 6578/10000"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.ColorMatrix2);
                Assert.IsNotNull(entry, "Entry 0xC622 missing in IFD 0");
                Assert.IsNotNull(entry as SRationalArrayIFDEntry, "Entry is not a srational array!");
                var parts = (entry as SRationalArrayIFDEntry).Values;
                Assert.AreEqual(9, parts.Length);
                Assert.AreEqual(7675, parts[0].Numerator);
                Assert.AreEqual(10000, parts[0].Denominator);
                Assert.AreEqual(-2195, parts[1].Numerator);
                Assert.AreEqual(10000, parts[1].Denominator);
                Assert.AreEqual(-305, parts[2].Numerator);
                Assert.AreEqual(10000, parts[2].Denominator);
                Assert.AreEqual(-5860, parts[3].Numerator);
                Assert.AreEqual(10000, parts[3].Denominator);
                Assert.AreEqual(14118, parts[4].Numerator);
                Assert.AreEqual(10000, parts[4].Denominator);
                Assert.AreEqual(1857, parts[5].Numerator);
                Assert.AreEqual(10000, parts[5].Denominator);
                Assert.AreEqual(-2425, parts[6].Numerator);
                Assert.AreEqual(10000, parts[6].Denominator);
                Assert.AreEqual(4007, parts[7].Numerator);
                Assert.AreEqual(10000, parts[7].Denominator);
                Assert.AreEqual(6578, parts[8].Numerator);
                Assert.AreEqual(10000, parts[8].Denominator);
            }
            // Image.0xC623 (CameraCalibration1/SRational/9) "1/1 0/1 0/1 0/1 1/1 0/1 0/1 0/1 1/1"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.CameraCalibration1);
                Assert.IsNotNull(entry, "Entry 0xC623 missing in IFD 0");
                Assert.IsNotNull(entry as SRationalArrayIFDEntry, "Entry is not a srational array!");
                var parts = (entry as SRationalArrayIFDEntry).Values;
                Assert.AreEqual(9, parts.Length);
                Assert.AreEqual(1, parts[0].Numerator);
                Assert.AreEqual(1, parts[0].Denominator);
                Assert.AreEqual(0, parts[1].Numerator);
                Assert.AreEqual(1, parts[1].Denominator);
                Assert.AreEqual(0, parts[2].Numerator);
                Assert.AreEqual(1, parts[2].Denominator);
                Assert.AreEqual(0, parts[3].Numerator);
                Assert.AreEqual(1, parts[3].Denominator);
                Assert.AreEqual(1, parts[4].Numerator);
                Assert.AreEqual(1, parts[4].Denominator);
                Assert.AreEqual(0, parts[5].Numerator);
                Assert.AreEqual(1, parts[5].Denominator);
                Assert.AreEqual(0, parts[6].Numerator);
                Assert.AreEqual(1, parts[6].Denominator);
                Assert.AreEqual(0, parts[7].Numerator);
                Assert.AreEqual(1, parts[7].Denominator);
                Assert.AreEqual(1, parts[8].Numerator);
                Assert.AreEqual(1, parts[8].Denominator);
            }
            // Image.0xC624 (CameraCalibration2/SRational/9) "1/1 0/1 0/1 0/1 1/1 0/1 0/1 0/1 1/1"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.CameraCalibration2);
                Assert.IsNotNull(entry, "Entry 0xC624 missing in IFD 0");
                Assert.IsNotNull(entry as SRationalArrayIFDEntry, "Entry is not a srational array!");
                var parts = (entry as SRationalArrayIFDEntry).Values;
                Assert.AreEqual(9, parts.Length);
                Assert.AreEqual(1, parts[0].Numerator);
                Assert.AreEqual(1, parts[0].Denominator);
                Assert.AreEqual(0, parts[1].Numerator);
                Assert.AreEqual(1, parts[1].Denominator);
                Assert.AreEqual(0, parts[2].Numerator);
                Assert.AreEqual(1, parts[2].Denominator);
                Assert.AreEqual(0, parts[3].Numerator);
                Assert.AreEqual(1, parts[3].Denominator);
                Assert.AreEqual(1, parts[4].Numerator);
                Assert.AreEqual(1, parts[4].Denominator);
                Assert.AreEqual(0, parts[5].Numerator);
                Assert.AreEqual(1, parts[5].Denominator);
                Assert.AreEqual(0, parts[6].Numerator);
                Assert.AreEqual(1, parts[6].Denominator);
                Assert.AreEqual(0, parts[7].Numerator);
                Assert.AreEqual(1, parts[7].Denominator);
                Assert.AreEqual(1, parts[8].Numerator);
                Assert.AreEqual(1, parts[8].Denominator);
            }
            // Image.0xC628 (AsShotNeutral/Rational/3) "16384/34488 16384/16384 16384/20567"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.AsShotNeutral);
                Assert.IsNotNull(entry, "Entry 0xC628 missing in IFD 0");
                Assert.IsNotNull(entry as RationalArrayIFDEntry, "Entry is not a rational array!");
                var parts = (entry as RationalArrayIFDEntry).Values;
                Assert.AreEqual(3, parts.Length);
                Assert.AreEqual(16384, parts[0].Numerator);
                Assert.AreEqual(34488, parts[0].Denominator);
                Assert.AreEqual(16384, parts[1].Numerator);
                Assert.AreEqual(16384, parts[1].Denominator);
                Assert.AreEqual(16384, parts[2].Numerator);
                Assert.AreEqual(20567, parts[2].Denominator);
            }
            // Image.0xC62B (BaselineNoise/Rational/1) "1/1"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.BaselineNoise);
                Assert.IsNotNull(entry, "Entry 0xC62B missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Image.0xC62C (BaselineSharpness/Rational/1) "1/1"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.BaselineSharpness);
                Assert.IsNotNull(entry, "Entry 0xC62C missing in IFD 0");
                Assert.IsNotNull(entry as RationalIFDEntry, "Entry is not a rational!");
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Numerator);
                Assert.AreEqual(1, (entry as RationalIFDEntry).Value.Denominator);
            }
            // Image.0xC62F (CameraSerialNumber/Ascii/8) "3106091"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.CameraSerialNumber);
                Assert.IsNotNull(entry, "Entry 0xC62F missing in IFD 0");
                Assert.IsNotNull(entry as StringIFDEntry, "Entry is not a string!");
                Assert.AreEqual("3106091", (entry as StringIFDEntry).Value);
            }
            // Image.0xC65A (CalibrationIlluminant1/Short/1) "17"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.CalibrationIlluminant1);
                Assert.IsNotNull(entry, "Entry 0xC65A missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(17, (entry as ShortIFDEntry).Value);
            }
            // Image.0xC65B (CalibrationIlluminant2/Short/1) "21"
            {
                var entry = structure.GetEntry(0, (ushort)IFDEntryTag.CalibrationIlluminant2);
                Assert.IsNotNull(entry, "Entry 0xC65B missing in IFD 0");
                Assert.IsNotNull(entry as ShortIFDEntry, "Entry is not a short!");
                Assert.AreEqual(21, (entry as ShortIFDEntry).Value);
            }

            //  ---------- End of IFD tests ----------
        }
 /// <summary>
 ///    Returns the tag that should be tested. Default
 ///    behavior is no specific tag.
 /// </summary>
 public virtual TagLib.Image.ImageTag GetTag(TagLib.Image.File file)
 {
     return(file.ImageTag);
 }
Example #28
0
 public void ValidatePostModification(TagLib.Image.File file)
 {
     Assert.AreEqual(contained_types & (~remove_types), file.TagTypes);
 }
Example #29
0
 private void ChangeMetadata(TagLib.Image.File file)
 {
     file.ImageTag.Comment  = "Testing!";
     file.ImageTag.Keywords = new string [] { "One", "Two", "Three" };
     file.Save();
 }
Example #30
0
 public override TagLib.Image.ImageTag GetTag(TagLib.Image.File file)
 {
     return(file.GetTag(type, false) as TagLib.Image.ImageTag);
 }