示例#1
0
 public ExifRational(ExifTag <Rational> tag)
     : base(tag)
 {
 }
示例#2
0
 internal ExifDouble(ExifTag tag)
     : base(tag, ExifDataType.Double)
 {
 }
 internal static ExifSignedLong Create(ExifTag tag, int value) => new ExifSignedLong(tag)
 {
     Value = value
 };
示例#4
0
        internal static ExifValue Create(ExifTag tag, object value)
        {
            Throw.IfTrue("tag", tag == ExifTag.Unknown, "Invalid Tag");

            ExifValue exifValue = null;
            Type      type      = value != null?value.GetType() : null;

            if (type != null && type.IsArray)
            {
                type = type.GetElementType();
            }

            switch (tag)
            {
            case ExifTag.ImageDescription:
            case ExifTag.Make:
            case ExifTag.Model:
            case ExifTag.Software:
            case ExifTag.DateTime:
            case ExifTag.Artist:
            case ExifTag.HostComputer:
            case ExifTag.Copyright:
            case ExifTag.DocumentName:
            case ExifTag.PageName:
            case ExifTag.InkNames:
            case ExifTag.TargetPrinter:
            case ExifTag.ImageID:
            case ExifTag.SpectralSensitivity:
            case ExifTag.DateTimeOriginal:
            case ExifTag.DateTimeDigitized:
            case ExifTag.SubsecTime:
            case ExifTag.SubsecTimeOriginal:
            case ExifTag.SubsecTimeDigitized:
            case ExifTag.RelatedSoundFile:
            case ExifTag.ImageUniqueID:
            case ExifTag.GPSLatitudeRef:
            case ExifTag.GPSLongitudeRef:
            case ExifTag.GPSSatellites:
            case ExifTag.GPSStatus:
            case ExifTag.GPSMeasureMode:
            case ExifTag.GPSSpeedRef:
            case ExifTag.GPSTrackRef:
            case ExifTag.GPSImgDirectionRef:
            case ExifTag.GPSMapDatum:
            case ExifTag.GPSDestLatitudeRef:
            case ExifTag.GPSDestLongitudeRef:
            case ExifTag.GPSDestBearingRef:
            case ExifTag.GPSDestDistanceRef:
            case ExifTag.GPSDateStamp:
                exifValue = new ExifValue(tag, ExifDataType.Ascii, true);
                break;

            case ExifTag.ClipPath:
            case ExifTag.VersionYear:
            case ExifTag.XMP:
            case ExifTag.GPSVersionID:
                exifValue = new ExifValue(tag, ExifDataType.Byte, true);
                break;

            case ExifTag.FaxProfile:
            case ExifTag.ModeNumber:
            case ExifTag.GPSAltitudeRef:
                exifValue = new ExifValue(tag, ExifDataType.Byte, false);
                break;

            case ExifTag.FreeOffsets:
            case ExifTag.FreeByteCounts:
            case ExifTag.TileOffsets:
            case ExifTag.SMinSampleValue:
            case ExifTag.SMaxSampleValue:
            case ExifTag.JPEGQTables:
            case ExifTag.JPEGDCTables:
            case ExifTag.JPEGACTables:
            case ExifTag.StripRowCounts:
                exifValue = new ExifValue(tag, ExifDataType.Long, true);
                break;

            case ExifTag.SubIFDOffset:
            case ExifTag.GPSIFDOffset:
            case ExifTag.T4Options:
            case ExifTag.T6Options:
            case ExifTag.XClipPathUnits:
            case ExifTag.YClipPathUnits:
            case ExifTag.ProfileType:
            case ExifTag.CodingMethods:
            case ExifTag.JPEGInterchangeFormat:
            case ExifTag.JPEGInterchangeFormatLength:
                exifValue = new ExifValue(tag, ExifDataType.Long, false);
                break;

            case ExifTag.WhitePoint:
            case ExifTag.PrimaryChromaticities:
            case ExifTag.YCbCrCoefficients:
            case ExifTag.ReferenceBlackWhite:
            case ExifTag.GPSLatitude:
            case ExifTag.GPSLongitude:
            case ExifTag.GPSTimestamp:
            case ExifTag.GPSDestLatitude:
            case ExifTag.GPSDestLongitude:
                exifValue = new ExifValue(tag, ExifDataType.Rational, true);
                break;

            case ExifTag.XPosition:
            case ExifTag.YPosition:
            case ExifTag.XResolution:
            case ExifTag.YResolution:
            case ExifTag.ExposureTime:
            case ExifTag.FNumber:
            case ExifTag.CompressedBitsPerPixel:
            case ExifTag.ApertureValue:
            case ExifTag.MaxApertureValue:
            case ExifTag.SubjectDistance:
            case ExifTag.FocalLength:
            case ExifTag.FlashEnergy:
            case ExifTag.FocalPlaneXResolution:
            case ExifTag.FocalPlaneYResolution:
            case ExifTag.ExposureIndex:
            case ExifTag.DigitalZoomRatio:
            case ExifTag.GPSAltitude:
            case ExifTag.GPSDOP:
            case ExifTag.GPSSpeed:
            case ExifTag.GPSTrack:
            case ExifTag.GPSImgDirection:
            case ExifTag.GPSDestBearing:
            case ExifTag.GPSDestDistance:
                exifValue = new ExifValue(tag, ExifDataType.Rational, false);
                break;

            case ExifTag.BitsPerSample:
            case ExifTag.MinSampleValue:
            case ExifTag.MaxSampleValue:
            case ExifTag.GrayResponseCurve:
            case ExifTag.ColorMap:
            case ExifTag.ExtraSamples:
            case ExifTag.PageNumber:
            case ExifTag.TransferFunction:
            case ExifTag.Predictor:
            case ExifTag.HalftoneHints:
            case ExifTag.SampleFormat:
            case ExifTag.TransferRange:
            case ExifTag.DefaultImageColor:
            case ExifTag.JPEGLosslessPredictors:
            case ExifTag.JPEGPointTransforms:
            case ExifTag.YCbCrSubsampling:
            case ExifTag.ISOSpeedRatings:
            case ExifTag.SubjectArea:
            case ExifTag.SubjectLocation:
                exifValue = new ExifValue(tag, ExifDataType.Short, true);
                break;

            case ExifTag.Compression:
            case ExifTag.PhotometricInterpretation:
            case ExifTag.Threshholding:
            case ExifTag.CellWidth:
            case ExifTag.CellLength:
            case ExifTag.FillOrder:
            case ExifTag.Orientation:
            case ExifTag.SamplesPerPixel:
            case ExifTag.PlanarConfiguration:
            case ExifTag.GrayResponseUnit:
            case ExifTag.ResolutionUnit:
            case ExifTag.CleanFaxData:
            case ExifTag.InkSet:
            case ExifTag.NumberOfInks:
            case ExifTag.DotRange:
            case ExifTag.Indexed:
            case ExifTag.OPIProxy:
            case ExifTag.JPEGProc:
            case ExifTag.JPEGRestartInterval:
            case ExifTag.YCbCrPositioning:
            case ExifTag.ExposureProgram:
            case ExifTag.MeteringMode:
            case ExifTag.LightSource:
            case ExifTag.Flash:
            case ExifTag.ColorSpace:
            case ExifTag.FocalPlaneResolutionUnit:
            case ExifTag.SensingMethod:
            case ExifTag.CustomRendered:
            case ExifTag.ExposureMode:
            case ExifTag.WhiteBalance:
            case ExifTag.FocalLengthIn35mmFilm:
            case ExifTag.SceneCaptureType:
            case ExifTag.GainControl:
            case ExifTag.Contrast:
            case ExifTag.Saturation:
            case ExifTag.Sharpness:
            case ExifTag.SubjectDistanceRange:
            case ExifTag.GPSDifferential:
                exifValue = new ExifValue(tag, ExifDataType.Short, false);
                break;

            case ExifTag.Decode:
                exifValue = new ExifValue(tag, ExifDataType.SignedRational, true);
                break;

            case ExifTag.ShutterSpeedValue:
            case ExifTag.BrightnessValue:
            case ExifTag.ExposureBiasValue:
                exifValue = new ExifValue(tag, ExifDataType.SignedRational, false);
                break;

            case ExifTag.JPEGTables:
            case ExifTag.OECF:
            case ExifTag.ExifVersion:
            case ExifTag.ComponentsConfiguration:
            case ExifTag.MakerNote:
            case ExifTag.UserComment:
            case ExifTag.FlashpixVersion:
            case ExifTag.SpatialFrequencyResponse:
            case ExifTag.CFAPattern:
            case ExifTag.DeviceSettingDescription:
            case ExifTag.GPSProcessingMethod:
            case ExifTag.GPSAreaInformation:
                exifValue = new ExifValue(tag, ExifDataType.Undefined, true);
                break;

            case ExifTag.FileSource:
            case ExifTag.SceneType:
                exifValue = new ExifValue(tag, ExifDataType.Undefined, false);
                break;

            case ExifTag.StripOffsets:
            case ExifTag.TileByteCounts:
            case ExifTag.ImageLayer:
                exifValue = CreateNumber(tag, type, true);
                break;

            case ExifTag.ImageWidth:
            case ExifTag.ImageLength:
            case ExifTag.TileWidth:
            case ExifTag.TileLength:
            case ExifTag.BadFaxLines:
            case ExifTag.ConsecutiveBadFaxLines:
            case ExifTag.PixelXDimension:
            case ExifTag.PixelYDimension:
                exifValue = CreateNumber(tag, type, false);
                break;

            default:
                throw new NotImplementedException();
            }

            exifValue.Value = value;
            return(exifValue);
        }
示例#5
0
        private static IExifValue GetOffsetValue(Collection <IExifValue> ifdValues, Collection <IExifValue> values, ExifTag offsetTag)
        {
            var index = -1;

            for (var i = 0; i < ifdValues.Count; i++)
            {
                if (ifdValues[i].Tag == offsetTag)
                {
                    index = i;
                }
            }

            if (values.Count > 0)
            {
                if (index != -1)
                {
                    return(ifdValues[index]);
                }

                var result = ExifValues.Create(offsetTag);
                ifdValues.Add(result);

                return(result);
            }
            else if (index != -1)
            {
                ifdValues.RemoveAt(index);
            }

            return(null);
        }
示例#6
0
 internal ExifSignedRational(ExifTag <SignedRational> tag)
     : base(tag, default)
 {
 }
 internal ExifSignedRational(ExifTag tag)
     : base(tag, ExifDataType.SignedRational)
 {
 }
示例#8
0
 public ExifByte(ExifTag <byte> tag, ExifDataType dataType)
     : base(tag) => DataType = dataType;
示例#9
0
 internal ExifByte(ExifTag tag, ExifDataType dataType)
     : base(tag, dataType)
 {
 }
示例#10
0
 internal static ExifByte Create(ExifTag tag, ExifDataType dataType, byte value) => new ExifByte(tag, dataType)
 {
     Value = value
 };
示例#11
0
 public ExifLong(ExifTag <uint> tag)
     : base(tag, default)
 {
 }
示例#12
0
 public ExifNumber(ExifTag <Number> tag)
     : base(tag, default)
 {
 }
示例#13
0
 internal static ExifDouble Create(ExifTag tag, double value) => new ExifDouble(tag)
 {
     Value = value
 };
示例#14
0
 public ExifDouble(ExifTag <double> tag)
     : base(tag)
 {
 }
 internal static ExifSignedRational Create(ExifTag tag, SignedRational value) => new ExifSignedRational(tag)
 {
     Value = value
 };
 public ExifValue(ExifTag <TValueType> tag)
     : base(tag)
 {
 }
示例#17
0
 public ExifShort(ExifTag <ushort> tag)
     : base(tag, default)
 {
 }
示例#18
0
        internal static IExifValue Create(ExifTag tag)
        {
            Throw.IfTrue(nameof(tag), tag == ExifTag.Unknown, "Invalid Tag");

            switch (tag)
            {
            case ExifTag.ClipPath:
            case ExifTag.VersionYear:
            case ExifTag.XMP:
            case ExifTag.CFAPattern2:
            case ExifTag.TIFFEPStandardID:
            case ExifTag.XPTitle:
            case ExifTag.XPComment:
            case ExifTag.XPAuthor:
            case ExifTag.XPKeywords:
            case ExifTag.XPSubject:
            case ExifTag.GPSVersionID:
                return(new ExifByteArray(tag, ExifDataType.Byte));

            case ExifTag.FaxProfile:
            case ExifTag.ModeNumber:
            case ExifTag.GPSAltitudeRef:
                return(new ExifByte(tag, ExifDataType.Byte));

            case ExifTag.FreeOffsets:
            case ExifTag.FreeByteCounts:
            case ExifTag.ColorResponseUnit:
            case ExifTag.TileOffsets:
            case ExifTag.SMinSampleValue:
            case ExifTag.SMaxSampleValue:
            case ExifTag.JPEGQTables:
            case ExifTag.JPEGDCTables:
            case ExifTag.JPEGACTables:
            case ExifTag.StripRowCounts:
            case ExifTag.IntergraphRegisters:
            case ExifTag.TimeZoneOffset:
                return(new ExifLongArray(tag));

            case ExifTag.SubfileType:
            case ExifTag.SubIFDOffset:
            case ExifTag.GPSIFDOffset:
            case ExifTag.T4Options:
            case ExifTag.T6Options:
            case ExifTag.XClipPathUnits:
            case ExifTag.YClipPathUnits:
            case ExifTag.ProfileType:
            case ExifTag.CodingMethods:
            case ExifTag.T82ptions:
            case ExifTag.JPEGInterchangeFormat:
            case ExifTag.JPEGInterchangeFormatLength:
            case ExifTag.MDFileTag:
            case ExifTag.StandardOutputSensitivity:
            case ExifTag.RecommendedExposureIndex:
            case ExifTag.ISOSpeed:
            case ExifTag.ISOSpeedLatitudeyyy:
            case ExifTag.ISOSpeedLatitudezzz:
            case ExifTag.FaxRecvParams:
            case ExifTag.FaxRecvTime:
            case ExifTag.ImageNumber:
                return(new ExifLong(tag));

            case ExifTag.WhitePoint:
            case ExifTag.PrimaryChromaticities:
            case ExifTag.YCbCrCoefficients:
            case ExifTag.ReferenceBlackWhite:
            case ExifTag.PixelScale:
            case ExifTag.IntergraphMatrix:
            case ExifTag.ModelTiePoint:
            case ExifTag.ModelTransform:
            case ExifTag.GPSLatitude:
            case ExifTag.GPSLongitude:
            case ExifTag.GPSTimestamp:
            case ExifTag.GPSDestLatitude:
            case ExifTag.GPSDestLongitude:
                return(new ExifRationalArray(tag));

            case ExifTag.XPosition:
            case ExifTag.YPosition:
            case ExifTag.XResolution:
            case ExifTag.YResolution:
            case ExifTag.BatteryLevel:
            case ExifTag.ExposureTime:
            case ExifTag.FNumber:
            case ExifTag.MDScalePixel:
            case ExifTag.CompressedBitsPerPixel:
            case ExifTag.ApertureValue:
            case ExifTag.MaxApertureValue:
            case ExifTag.SubjectDistance:
            case ExifTag.FocalLength:
            case ExifTag.FlashEnergy2:
            case ExifTag.FocalPlaneXResolution2:
            case ExifTag.FocalPlaneYResolution2:
            case ExifTag.ExposureIndex2:
            case ExifTag.Humidity:
            case ExifTag.Pressure:
            case ExifTag.Acceleration:
            case ExifTag.FlashEnergy:
            case ExifTag.FocalPlaneXResolution:
            case ExifTag.FocalPlaneYResolution:
            case ExifTag.ExposureIndex:
            case ExifTag.DigitalZoomRatio:
            case ExifTag.LensInfo:
            case ExifTag.GPSAltitude:
            case ExifTag.GPSDOP:
            case ExifTag.GPSSpeed:
            case ExifTag.GPSTrack:
            case ExifTag.GPSImgDirection:
            case ExifTag.GPSDestBearing:
            case ExifTag.GPSDestDistance:
                return(new ExifRational(tag));

            case ExifTag.BitsPerSample:
            case ExifTag.MinSampleValue:
            case ExifTag.MaxSampleValue:
            case ExifTag.GrayResponseCurve:
            case ExifTag.ColorMap:
            case ExifTag.ExtraSamples:
            case ExifTag.PageNumber:
            case ExifTag.TransferFunction:
            case ExifTag.Predictor:
            case ExifTag.HalftoneHints:
            case ExifTag.SampleFormat:
            case ExifTag.TransferRange:
            case ExifTag.DefaultImageColor:
            case ExifTag.JPEGLosslessPredictors:
            case ExifTag.JPEGPointTransforms:
            case ExifTag.YCbCrSubsampling:
            case ExifTag.CFARepeatPatternDim:
            case ExifTag.IntergraphPacketData:
            case ExifTag.ISOSpeedRatings:
            case ExifTag.SubjectArea:
            case ExifTag.SubjectLocation:
                return(new ExifShortArray(tag));

            case ExifTag.OldSubfileType:
            case ExifTag.Compression:
            case ExifTag.PhotometricInterpretation:
            case ExifTag.Thresholding:
            case ExifTag.CellWidth:
            case ExifTag.CellLength:
            case ExifTag.FillOrder:
            case ExifTag.Orientation:
            case ExifTag.SamplesPerPixel:
            case ExifTag.PlanarConfiguration:
            case ExifTag.GrayResponseUnit:
            case ExifTag.ResolutionUnit:
            case ExifTag.CleanFaxData:
            case ExifTag.InkSet:
            case ExifTag.NumberOfInks:
            case ExifTag.DotRange:
            case ExifTag.Indexed:
            case ExifTag.OPIProxy:
            case ExifTag.JPEGProc:
            case ExifTag.JPEGRestartInterval:
            case ExifTag.YCbCrPositioning:
            case ExifTag.Rating:
            case ExifTag.RatingPercent:
            case ExifTag.ExposureProgram:
            case ExifTag.Interlace:
            case ExifTag.SelfTimerMode:
            case ExifTag.SensitivityType:
            case ExifTag.MeteringMode:
            case ExifTag.LightSource:
            case ExifTag.FocalPlaneResolutionUnit2:
            case ExifTag.SensingMethod2:
            case ExifTag.Flash:
            case ExifTag.ColorSpace:
            case ExifTag.FocalPlaneResolutionUnit:
            case ExifTag.SensingMethod:
            case ExifTag.CustomRendered:
            case ExifTag.ExposureMode:
            case ExifTag.WhiteBalance:
            case ExifTag.FocalLengthIn35mmFilm:
            case ExifTag.SceneCaptureType:
            case ExifTag.GainControl:
            case ExifTag.Contrast:
            case ExifTag.Saturation:
            case ExifTag.Sharpness:
            case ExifTag.SubjectDistanceRange:
            case ExifTag.GPSDifferential:
                return(new ExifShort(tag));

            case ExifTag.Decode:
                return(new ExifSignedRationalArray(tag));

            case ExifTag.ShutterSpeedValue:
            case ExifTag.BrightnessValue:
            case ExifTag.ExposureBiasValue:
            case ExifTag.AmbientTemperature:
            case ExifTag.WaterDepth:
            case ExifTag.CameraElevationAngle:
                return(new ExifSignedRational(tag));

            case ExifTag.ImageDescription:
            case ExifTag.Make:
            case ExifTag.Model:
            case ExifTag.Software:
            case ExifTag.DateTime:
            case ExifTag.Artist:
            case ExifTag.HostComputer:
            case ExifTag.Copyright:
            case ExifTag.DocumentName:
            case ExifTag.PageName:
            case ExifTag.InkNames:
            case ExifTag.TargetPrinter:
            case ExifTag.ImageID:
            case ExifTag.MDLabName:
            case ExifTag.MDSampleInfo:
            case ExifTag.MDPrepDate:
            case ExifTag.MDPrepTime:
            case ExifTag.MDFileUnits:
            case ExifTag.SEMInfo:
            case ExifTag.SpectralSensitivity:
            case ExifTag.DateTimeOriginal:
            case ExifTag.DateTimeDigitized:
            case ExifTag.SubsecTime:
            case ExifTag.SubsecTimeOriginal:
            case ExifTag.SubsecTimeDigitized:
            case ExifTag.RelatedSoundFile:
            case ExifTag.FaxSubaddress:
            case ExifTag.OffsetTime:
            case ExifTag.OffsetTimeOriginal:
            case ExifTag.OffsetTimeDigitized:
            case ExifTag.SecurityClassification:
            case ExifTag.ImageHistory:
            case ExifTag.ImageUniqueID:
            case ExifTag.OwnerName:
            case ExifTag.SerialNumber:
            case ExifTag.LensMake:
            case ExifTag.LensModel:
            case ExifTag.LensSerialNumber:
            case ExifTag.GDALMetadata:
            case ExifTag.GDALNoData:
            case ExifTag.GPSLatitudeRef:
            case ExifTag.GPSLongitudeRef:
            case ExifTag.GPSSatellites:
            case ExifTag.GPSStatus:
            case ExifTag.GPSMeasureMode:
            case ExifTag.GPSSpeedRef:
            case ExifTag.GPSTrackRef:
            case ExifTag.GPSImgDirectionRef:
            case ExifTag.GPSMapDatum:
            case ExifTag.GPSDestLatitudeRef:
            case ExifTag.GPSDestLongitudeRef:
            case ExifTag.GPSDestBearingRef:
            case ExifTag.GPSDestDistanceRef:
            case ExifTag.GPSDateStamp:
                return(new ExifString(tag));

            case ExifTag.JPEGTables:
            case ExifTag.OECF:
            case ExifTag.ExifVersion:
            case ExifTag.ComponentsConfiguration:
            case ExifTag.MakerNote:
            case ExifTag.UserComment:
            case ExifTag.FlashpixVersion:
            case ExifTag.SpatialFrequencyResponse:
            case ExifTag.SpatialFrequencyResponse2:
            case ExifTag.Noise:
            case ExifTag.CFAPattern:
            case ExifTag.DeviceSettingDescription:
            case ExifTag.ImageSourceData:
            case ExifTag.GPSProcessingMethod:
            case ExifTag.GPSAreaInformation:
                return(new ExifByteArray(tag, ExifDataType.Undefined));

            case ExifTag.FileSource:
            case ExifTag.SceneType:
                return(new ExifByte(tag, ExifDataType.Undefined));

            default:
                throw new NotSupportedException();
            }
        }
 public ExifArrayValue(ExifTag <TValueType[]> tag)
     : base(tag)
 {
 }
示例#20
0
 public ExifNumber(ExifTag <Number> tag)
     : base(tag)
 {
 }
示例#21
0
 public ExifLong(ExifTag <uint> tag)
     : base(tag)
 {
 }
示例#22
0
 private ExifSignedLong(ExifTag tag)
     : base(tag, ExifDataType.SignedLong)
 {
 }
示例#23
0
 public ExifDouble(ExifTag <double> tag)
     : base(tag, default)
 {
 }
示例#24
0
 internal ExifValue(ExifTag tag, ExifDataType dataType, object value, bool isArray)
     : this(tag, dataType, isArray)
 {
     _Value = value;
 }
示例#25
0
 public ExifString(ExifTag <string> tag)
     : base(tag)
 {
 }
示例#26
0
 public ExifShort(ExifTag <ushort> tag)
     : base(tag)
 {
 }
 internal ExifArrayValue(ExifTag tag, ExifDataType dataType)
 {
     Tag      = tag;
     DataType = dataType;
 }
示例#28
0
 public ExifString(ExifTag <string> tag)
     : base(tag, string.Empty)
 {
 }
示例#29
0
 internal ExifRational(ExifTag tag)
     : base(tag, ExifDataType.Rational)
 {
 }