Skip to content

Commit 9351f3d

Browse files
authored
Merge pull request #56 from hgy59/gpsversion_only
Gpsversion fixed
2 parents 9713d45 + 94ed442 commit 9351f3d

File tree

2 files changed

+24
-2
lines changed

2 files changed

+24
-2
lines changed

ExifLibrary/ExifExtendedProperty.cs

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ public override ExifInterOperability Interoperability
148148

149149
/// <summary>
150150
/// Represents the exif version as a 4 byte ASCII string. (EXIF Specification: UNDEFINED)
151-
/// Used for the ExifVersion, FlashpixVersion, InteroperabilityVersion and GPSVersionID fields.
151+
/// Used for the ExifVersion, FlashpixVersion and InteroperabilityVersion fields.
152152
/// </summary>
153153
public class ExifVersion : ExifProperty
154154
{
@@ -189,6 +189,28 @@ public override ExifInterOperability Interoperability
189189
}
190190
}
191191

192+
/// <summary>
193+
/// Represents a version as a 4 byte byte array. (Specification: int8u[4])
194+
/// Used for the GPSVersionID field.
195+
/// </summary>
196+
public class VersionID : ExifByteArray
197+
{
198+
public VersionID(ExifTag tag, byte [] value)
199+
: base(tag, value)
200+
{
201+
}
202+
203+
public override string ToString()
204+
{
205+
StringBuilder sb = new StringBuilder();
206+
foreach (var b in Value)
207+
{
208+
sb.Append(b).Append('.');
209+
}
210+
return sb.ToString().TrimEnd('.');
211+
}
212+
}
213+
192214
/// <summary>
193215
/// Represents the location and area of the subject (EXIF Specification: 2xSHORT)
194216
/// The coordinate values, width, and height are expressed in relation to the

ExifLibrary/ExifPropertyFactory.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public static ExifProperty Get(ushort tag, ushort type, uint count, byte[] value
134134
else if (ifd == IFD.GPS)
135135
{
136136
if (tag == 0) // GPSVersionID
137-
return new ExifVersion(ExifTag.GPSVersionID, ExifBitConverter.ToString(value));
137+
return new VersionID(ExifTag.GPSVersionID, value);
138138
else if (tag == 1) // GPSLatitudeRef
139139
return new ExifEnumProperty<GPSLatitudeRef>(ExifTag.GPSLatitudeRef, (GPSLatitudeRef)value[0]);
140140
else if (tag == 2) // GPSLatitude

0 commit comments

Comments
 (0)