Added QRResult and null guard for qr code

This commit is contained in:
Savya Bikram Shah
2026-05-07 14:27:36 +05:45
parent 2223b2d3ae
commit 08d59d63c8
4 changed files with 78 additions and 29 deletions

View File

@@ -55,6 +55,8 @@ namespace Darkmatter.Fonepay
public static bool[,] GenerateMatrix(string text, EccLevel ecc = EccLevel.M)
{
if (string.IsNullOrEmpty(text))
throw new System.ArgumentException("QR text must be non-empty", nameof(text));
byte[] data = System.Text.Encoding.UTF8.GetBytes(text);
var (version, ecBlocks) = ChooseVersion(data.Length, ecc);
byte[] codewords = BuildCodewords(data, version, ecc, ecBlocks);