Body Changes Only

This commit is contained in:
2024-08-31 08:17:11 -07:00
parent 3b63279545
commit f458af776a
11 changed files with 97 additions and 48 deletions

View File

@ -81,6 +81,7 @@ internal abstract class ImageHelper
internal static Size GetDimensions(BinaryReader binaryReader, int? faceRight, int? faceBottom)
{
Size? result = null;
#pragma warning disable IDE0230
Dictionary<byte[], Func<BinaryReader, Size>> _ImageFormatDecoders = new()
{
{ new byte[] { 0x42, 0x4D }, DecodeBitmap },
@ -89,6 +90,7 @@ internal abstract class ImageHelper
{ new byte[] { 0x89, 0x50, 0x4E, 0x47, 0x0D, 0x0A, 0x1A, 0x0A }, DecodePng },
{ new byte[] { 0xff, 0xd8 }, DecodeJfif },
};
#pragma warning restore IDE0230
int maxMagicBytesLength = _ImageFormatDecoders.Keys.OrderByDescending(x => x.Length).First().Length;
byte[] magicBytes = new byte[maxMagicBytesLength];
for (int i = 0; i < maxMagicBytesLength; i += 1)