コード例 #1
0
        public void TestExifTag()
        {
            var exifProfile = new ExifProfile();

            exifProfile.SetValue(ExifTag.ResolutionUnit, (ushort)1);
            IExifValue value = exifProfile.GetValue(ExifTag.ResolutionUnit);

            Assert.Equal("None", value.ToString());

            exifProfile.SetValue(ExifTag.ResolutionUnit, (ushort)2);
            value = exifProfile.GetValue(ExifTag.ResolutionUnit);
            Assert.Equal("Inches", value.ToString());

            exifProfile.SetValue(ExifTag.ResolutionUnit, (ushort)3);
            value = exifProfile.GetValue(ExifTag.ResolutionUnit);
            Assert.Equal("Centimeter", value.ToString());

            exifProfile.SetValue(ExifTag.ResolutionUnit, (ushort)4);
            value = exifProfile.GetValue(ExifTag.ResolutionUnit);
            Assert.Equal("4", value.ToString());

            exifProfile.SetValue(ExifTag.ImageWidth, 123U);
            value = exifProfile.GetValue(ExifTag.ImageWidth);
            Assert.Equal("123", value.ToString());
        }
コード例 #2
0
            public void ShouldReturnFalseWhenValueIsInvalidDataType3()
            {
                var profile = new ExifProfile();

                profile.SetValue(ExifTag.XResolution, new Rational(150.0));

                IExifValue value = profile.GetValue(ExifTag.XResolution);

                Assert.NotNull(value);
                Assert.Equal("150", value.ToString());

                Assert.False(value.SetValue("Magick.NET"));
            }
コード例 #3
0
        public void Properties()
        {
            IExifValue <string> value = this.GetExifValue();

            Assert.Equal(ExifDataType.Ascii, value.DataType);
            Assert.Equal(ExifTag.Software, value.Tag);
            Assert.False(value.IsArray);

            const string expected = "Windows Photo Editor 10.0.10011.16384";

            Assert.Equal(expected, value.ToString());
            Assert.Equal(expected, value.Value);
        }
コード例 #4
0
        private CameraData?GetCameraData(ExifProfile exifProfile)
        {
            IExifValue <string> model = exifProfile.GetValue(ExifTag.Model);
            IExifValue <string> make  = exifProfile.GetValue(ExifTag.Make);

            if (model?.GetValue() != null)
            {
                return(new CameraData
                {
                    Model = model.ToString(),
                    Make = make.ToString()
                });
            }

            return(null);
        }
コード例 #5
0
 protected override JProperty Transform(IExifValue value)
 {
     return(new JProperty(Name, value.ToString()));
 }
コード例 #6
0
 protected override JProperty Transform(IExifValue value)
 {
     return((DateTime.TryParseExact(value.ToString(), "yyyy:MM:dd hh:mm:ss", CultureInfo.InvariantCulture, DateTimeStyles.None, out DateTime dt)) ?
            new JProperty(Name, dt) :
            new JProperty(Name, value.ToString()));
 }