diff --git a/src/ImageSharp/Profiles/Exif/ExifValue.cs b/src/ImageSharp/Profiles/Exif/ExifValue.cs index 56dc410ce..8cd05b53c 100644 --- a/src/ImageSharp/Profiles/Exif/ExifValue.cs +++ b/src/ImageSharp/Profiles/Exif/ExifValue.cs @@ -10,10 +10,13 @@ namespace ImageSharp using System.Text; /// - /// A value of the exif profile. + /// Represent the value of the EXIF profile. /// public sealed class ExifValue : IEquatable { + /// + /// The exif value. + /// private object exifValue; /// @@ -41,6 +44,12 @@ namespace ImageSharp } } + /// + /// Initializes a new instance of the class. + /// + /// The tag. + /// The data type. + /// Whether the value is an array. internal ExifValue(ExifTag tag, ExifDataType dataType, bool isArray) { this.Tag = tag; @@ -53,6 +62,13 @@ namespace ImageSharp } } + /// + /// Initializes a new instance of the class. + /// + /// The tag. + /// The data type. + /// The value. + /// Whether the value is an array. internal ExifValue(ExifTag tag, ExifDataType dataType, object value, bool isArray) : this(tag, dataType, isArray) { @@ -92,6 +108,7 @@ namespace ImageSharp { return this.exifValue; } + set { this.CheckValue(value); @@ -99,6 +116,9 @@ namespace ImageSharp } } + /// + /// Gets a value indicating whether the EXIF value has a value. + /// internal bool HasValue { get @@ -117,6 +137,9 @@ namespace ImageSharp } } + /// + /// Gets the length of the EXIF value + /// internal int Length { get @@ -132,6 +155,9 @@ namespace ImageSharp } } + /// + /// Gets the number of components. + /// internal int NumberOfComponents { get @@ -151,25 +177,37 @@ namespace ImageSharp } /// - /// Determines whether the specified ExifValue instances are considered equal. + /// Compares two objects for equality. /// - /// The first ExifValue to compare. - /// The second ExifValue to compare. - /// The + /// + /// The on the left side of the operand. + /// + /// + /// The on the right side of the operand. + /// + /// + /// True if the parameter is equal to the parameter; otherwise, false. + /// public static bool operator ==(ExifValue left, ExifValue right) { - return Equals(left, right); + return ExifValue.Equals(left, right); } /// - /// Determines whether the specified ExifValue instances are not considered equal. + /// Compares two objects for equality. /// - /// The first ExifValue to compare. - /// The second ExifValue to compare. - /// + /// + /// The on the left side of the operand. + /// + /// + /// The on the right side of the operand. + /// + /// + /// True if the parameter is not equal to the parameter; otherwise, false. + /// public static bool operator !=(ExifValue left, ExifValue right) { - return !Equals(left, right); + return !ExifValue.Equals(left, right); } /// @@ -236,6 +274,17 @@ namespace ImageSharp return sb.ToString(); } + /// + /// Creates a new + /// + /// The tag. + /// The value. + /// + /// The . + /// + /// + /// Thrown if the tag is not supported. + /// internal static ExifValue Create(ExifTag tag, object value) { Guard.IsFalse(tag == ExifTag.Unknown, nameof(tag), "Invalid Tag"); @@ -578,6 +627,15 @@ namespace ImageSharp } } + /// + /// Returns an EXIF value with a numeric type for the given tag. + /// + /// The tag. + /// The numeric type. + /// Whether the value is an array. + /// + /// The . + /// private static ExifValue CreateNumber(ExifTag tag, Type type, bool isArray) { if (type == null || type == typeof(ushort)) @@ -598,6 +656,13 @@ namespace ImageSharp return new ExifValue(tag, ExifDataType.SignedLong, isArray); } + /// + /// Checks the value type of the given object. + /// + /// The value to check. + /// + /// Thrown if the object type is not supported. + /// private void CheckValue(object value) { if (value == null) @@ -663,6 +728,11 @@ namespace ImageSharp } } + /// + /// Converts the object value of this instance to its equivalent string representation + /// + /// The value + /// The private string ToString(object value) { string description = ExifTagDescriptionAttribute.GetDescription(this.Tag, value);