Skip to content

Commit

Permalink
Do not write time information for GPSDateStamp. Fixes #58
Browse files Browse the repository at this point in the history
  • Loading branch information
oozcitak committed Oct 17, 2018
1 parent 3092164 commit c58acb9
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 2 deletions.
28 changes: 28 additions & 0 deletions ExifLibrary/ExifExtendedProperty.cs
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,34 @@ public override ExifInterOperability Interoperability
}
}

/// <summary>
/// Represents an ASCII string formatted as Date. (EXIF Specification: ASCII) Used for the date fields.
/// </summary>
public class ExifDate : ExifProperty
{
protected DateTime mValue;
protected override object _Value { get { return Value; } set { Value = (DateTime)value; } }
public new DateTime Value { get { return mValue; } set { mValue = value; } }

static public implicit operator DateTime(ExifDate obj) { return obj.mValue; }

public override string ToString() { return mValue.ToString("yyyy.MM.dd"); }

public ExifDate(ExifTag tag, DateTime value)
: base(tag)
{
mValue = value;
}

public override ExifInterOperability Interoperability
{
get
{
return new ExifInterOperability(ExifTagFactory.GetTagID(mTag), 2, (uint)11, ExifBitConverter.GetBytes(mValue, false));
}
}
}

/// <summary>
/// Represents the exif version as a 4 byte ASCII string. (EXIF Specification: UNDEFINED)
/// Used for the ExifVersion, FlashpixVersion and InteroperabilityVersion fields.
Expand Down
4 changes: 2 additions & 2 deletions ExifLibrary/ExifPropertyFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -169,8 +169,8 @@ public static ExifProperty Get(ushort tag, ushort type, uint count, byte[] value
return new ExifEnumProperty<GPSDirectionRef>(ExifTag.GPSDestBearingRef, (GPSDirectionRef)value[0]);
else if (tag == 25) // GPSDestDistanceRef
return new ExifEnumProperty<GPSDistanceRef>(ExifTag.GPSDestDistanceRef, (GPSDistanceRef)value[0]);
else if (tag == 29) // GPSDate
return new ExifDateTime(ExifTag.GPSDateStamp, ExifBitConverter.ToDateTime(value, false));
else if (tag == 29) // GPSDateStamp
return new ExifDate(ExifTag.GPSDateStamp, ExifBitConverter.ToDateTime(value, false));
else if (tag == 30) // GPSDifferential
return new ExifEnumProperty<GPSDifferential>(ExifTag.GPSDifferential, (GPSDifferential)conv.ToUInt16(value, 0));
}
Expand Down

0 comments on commit c58acb9

Please sign in to comment.