Files
Thanakarn Klangkasame d266463c9f Fix Redundance Reference
2025-10-03 10:33:55 +07:00

22 lines
668 B
C#

using AMREZ.EOP.Abstractions.Applications.UseCases.Payments.SlipVerification.QrDecode;
using SkiaSharp;
using ZXing.SkiaSharp;
namespace AMREZ.EOP.Application.UseCases.Payments.SlipVerification.QrDecode;
public sealed class ZxingQrDecoder : IQrDecoder
{
public string? TryDecodeText(byte[] imageBytes)
{
using var bmp = SKBitmap.Decode(imageBytes);
if (bmp is null) return null;
var reader = new BarcodeReader
{
AutoRotate = true,
Options = { TryHarder = true, PossibleFormats = new[] { ZXing.BarcodeFormat.QR_CODE } }
};
var res = reader.Decode(bmp);
return res?.Text;
}
}