Use statically initialized data

This commit is contained in:
Jason Nelson 2024-03-13 18:36:47 -07:00 committed by BobLd
parent 4653671b2d
commit e508d6714e
3 changed files with 8 additions and 15 deletions

View File

@ -15,15 +15,15 @@
private const byte Offset = (byte)'!';
private const byte EmptyCharacterPadding = (byte) 'u';
private static readonly byte[] EndOfDataBytes = { (byte)'~', (byte)'>' };
private static ReadOnlySpan<byte> EndOfDataBytes => [(byte)'~', (byte)'>'];
private static readonly int[] PowerByIndex = {
private static readonly int[] PowerByIndex = [
1,
85,
85 * 85,
85 * 85 * 85,
85 * 85 * 85 *85
};
];
/// <inheritdoc />
public bool IsSupported { get; } = true;

View File

@ -26,18 +26,7 @@
/// </summary>
private const int EndOfFileSearchRange = 2048;
private static readonly byte[] StartXRefBytes =
{
(byte) 's',
(byte) 't',
(byte) 'a',
(byte) 'r',
(byte) 't',
(byte) 'x',
(byte) 'r',
(byte) 'e',
(byte) 'f'
};
private static ReadOnlySpan<byte> StartXRefBytes => "startxref"u8;
public static long GetFirstCrossReferenceOffset(IInputBytes bytes, ISeekableTokenScanner scanner, bool isLenientParsing)
{

View File

@ -31,6 +31,10 @@
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='net462' OR '$(TargetFramework)'=='net47'">
<PackageReference Include="System.ValueTuple" Version="4.5.0" />
<PackageReference Include="System.Memory" Version="4.5.5" />
</ItemGroup>
<ItemGroup Condition="'$(TargetFramework)'=='netstandard2.0'">
<PackageReference Include="System.Memory" Version="4.5.5" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\UglyToad.PdfPig.Core\UglyToad.PdfPig.Core.csproj" />