2018-01-11 03:49:32 +08:00
|
|
|
|
namespace UglyToad.PdfPig.Content
|
2017-11-10 03:14:09 +08:00
|
|
|
|
{
|
2020-01-26 23:30:20 +08:00
|
|
|
|
using System;
|
|
|
|
|
|
2018-01-04 04:15:25 +08:00
|
|
|
|
internal class HeaderVersion
|
2017-11-10 03:14:09 +08:00
|
|
|
|
{
|
|
|
|
|
public decimal Version { get; }
|
|
|
|
|
|
|
|
|
|
public string VersionString { get; }
|
|
|
|
|
|
2020-01-26 23:30:20 +08:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The offset in bytes from the start of the file to the start of the version comment.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public long OffsetInFile { get; }
|
|
|
|
|
|
|
|
|
|
public HeaderVersion(decimal version, string versionString, long offsetInFile)
|
2017-11-10 03:14:09 +08:00
|
|
|
|
{
|
|
|
|
|
Version = version;
|
|
|
|
|
VersionString = versionString;
|
2020-01-26 23:30:20 +08:00
|
|
|
|
if (offsetInFile < 0)
|
|
|
|
|
{
|
|
|
|
|
throw new ArgumentOutOfRangeException($"Invalid offset for header version, must be positive. Got: {offsetInFile}.");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
OffsetInFile = offsetInFile;
|
2017-11-10 03:14:09 +08:00
|
|
|
|
}
|
2018-01-04 04:15:25 +08:00
|
|
|
|
|
|
|
|
|
public override string ToString()
|
|
|
|
|
{
|
|
|
|
|
return $"Version: {VersionString}";
|
|
|
|
|
}
|
2017-11-10 03:14:09 +08:00
|
|
|
|
}
|
|
|
|
|
}
|