|
|
|
@ -2,6 +2,7 @@ |
|
|
|
// Licensed under the Apache License, Version 2.0.
|
|
|
|
|
|
|
|
using System; |
|
|
|
using System.Buffers.Binary; |
|
|
|
|
|
|
|
namespace SixLabors.ImageSharp.Formats.Png |
|
|
|
{ |
|
|
|
@ -26,16 +27,7 @@ namespace SixLabors.ImageSharp.Formats.Png |
|
|
|
|
|
|
|
private bool IsSupportedFileFormat(ReadOnlySpan<byte> header) |
|
|
|
{ |
|
|
|
// TODO: This should be in constants
|
|
|
|
return header.Length >= this.HeaderSize && |
|
|
|
header[0] == 0x89 && |
|
|
|
header[1] == 0x50 && // P
|
|
|
|
header[2] == 0x4E && // N
|
|
|
|
header[3] == 0x47 && // G
|
|
|
|
header[4] == 0x0D && // CR
|
|
|
|
header[5] == 0x0A && // LF
|
|
|
|
header[6] == 0x1A && // EOF
|
|
|
|
header[7] == 0x0A; // LF
|
|
|
|
return header.Length >= this.HeaderSize && BinaryPrimitives.ReadUInt64BigEndian(header) == PngConstants.HeaderValue; |
|
|
|
} |
|
|
|
} |
|
|
|
} |