mirror of
https://github.com/UglyToad/PdfPig.git
synced 2026-03-10 00:23:29 +08:00
Fix InlineImageDataToken not checking Data length before comparing bytes Use a more straightforward compare Dictionary Content
46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
namespace UglyToad.PdfPig.Tokens
|
|
{
|
|
/// <summary>
|
|
/// A comment from a PDF document. Any occurrence of the percent sign character (%) outside a string or stream
|
|
/// introduces a comment. The comment consists of all characters between the percent sign and the end of the line.
|
|
/// </summary>
|
|
public class CommentToken : IDataToken<string>
|
|
{
|
|
/// <summary>
|
|
/// The text of the comment (excluding the initial percent '%' sign).
|
|
/// </summary>
|
|
public string Data { get; }
|
|
|
|
/// <summary>
|
|
/// Create a new <see cref="CommentToken"/>.
|
|
/// </summary>
|
|
/// <param name="data">The text of the comment.</param>
|
|
public CommentToken(string data)
|
|
{
|
|
Data = data ?? string.Empty;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public override string ToString()
|
|
{
|
|
return Data;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public bool Equals(IToken obj)
|
|
{
|
|
if (ReferenceEquals(this, obj))
|
|
{
|
|
return true;
|
|
}
|
|
|
|
if (!(obj is CommentToken other))
|
|
{
|
|
return false;
|
|
}
|
|
|
|
return other.Data == Data;
|
|
}
|
|
}
|
|
}
|