mirror of
https://github.com/bolucat/Archive.git
synced 2026-04-23 00:17:16 +08:00
15 lines
430 B
C#
15 lines
430 B
C#
using QRCoder;
|
|
|
|
namespace ServiceLib.Common
|
|
{
|
|
public class QRCodeHelper
|
|
{
|
|
public static byte[]? GenQRCode(string? url)
|
|
{
|
|
using QRCodeGenerator qrGenerator = new();
|
|
using var qrCodeData = qrGenerator.CreateQrCode(url ?? string.Empty, QRCodeGenerator.ECCLevel.Q);
|
|
using PngByteQRCode qrCode = new(qrCodeData);
|
|
return qrCode.GetGraphic(20);
|
|
}
|
|
}
|
|
} |