mirror of https://github.com/SixLabors/ImageSharp
14 changed files with 233 additions and 115 deletions
@ -0,0 +1,34 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
/// <content/>
|
|||
public abstract partial class ExifTag |
|||
{ |
|||
/// <summary>
|
|||
/// Gets the title tag used by Windows (encoded in UCS2).
|
|||
/// </summary>
|
|||
public static ExifTag<string> XPTitle => new ExifTag<string>(ExifTagValue.XPTitle); |
|||
|
|||
/// <summary>
|
|||
/// Gets the comment tag used by Windows (encoded in UCS2).
|
|||
/// </summary>
|
|||
public static ExifTag<string> XPComment => new ExifTag<string>(ExifTagValue.XPComment); |
|||
|
|||
/// <summary>
|
|||
/// Gets the author tag used by Windows (encoded in UCS2).
|
|||
/// </summary>
|
|||
public static ExifTag<string> XPAuthor => new ExifTag<string>(ExifTagValue.XPAuthor); |
|||
|
|||
/// <summary>
|
|||
/// Gets the keywords tag used by Windows (encoded in UCS2).
|
|||
/// </summary>
|
|||
public static ExifTag<string> XPKeywords => new ExifTag<string>(ExifTagValue.XPKeywords); |
|||
|
|||
/// <summary>
|
|||
/// Gets the subject tag used by Windows (encoded in UCS2).
|
|||
/// </summary>
|
|||
public static ExifTag<string> XPSubject => new ExifTag<string>(ExifTagValue.XPSubject); |
|||
} |
|||
} |
|||
@ -0,0 +1,47 @@ |
|||
// Copyright (c) Six Labors.
|
|||
// Licensed under the Apache License, Version 2.0.
|
|||
|
|||
namespace SixLabors.ImageSharp.Metadata.Profiles.Exif |
|||
{ |
|||
internal sealed class ExifUcs2String : ExifValue<string> |
|||
{ |
|||
public ExifUcs2String(ExifTag<string> tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
public ExifUcs2String(ExifTagValue tag) |
|||
: base(tag) |
|||
{ |
|||
} |
|||
|
|||
private ExifUcs2String(ExifUcs2String value) |
|||
: base(value) |
|||
{ |
|||
} |
|||
|
|||
public override ExifDataType DataType => ExifDataType.Byte; |
|||
|
|||
protected override string StringValue => this.Value; |
|||
|
|||
public override object GetValue() => this.Value; |
|||
|
|||
public override bool TrySetValue(object value) |
|||
{ |
|||
if (base.TrySetValue(value)) |
|||
{ |
|||
return true; |
|||
} |
|||
|
|||
if (value is byte[] buffer) |
|||
{ |
|||
this.Value = ExifUcs2StringHelpers.Ucs2Encoding.GetString(buffer); |
|||
return true; |
|||
} |
|||
|
|||
return false; |
|||
} |
|||
|
|||
public override IExifValue DeepClone() => new ExifUcs2String(this); |
|||
} |
|||
} |
|||
Loading…
Reference in new issue