Fix Redundance Reference

This commit is contained in:
Thanakarn Klangkasame
2025-10-03 10:33:55 +07:00
parent 33470d5fd4
commit d266463c9f
20 changed files with 440 additions and 29 deletions

View File

@@ -1,6 +1,22 @@
using AMREZ.EOP.Abstractions.Applications.UseCases.Payments.SlipVerification.QrDecode;
using SkiaSharp;
using ZXing.SkiaSharp;
namespace AMREZ.EOP.Application.UseCases.Payments.SlipVerification.QrDecode;
public class ZxingQrDecoder
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;
}
}