public byte[] GenQR(PKM pokemon) { try { string data = QRMessageUtil.GetMessage(pokemon); QRCodeGenerator qrGenerator = new QRCodeGenerator(); QRCodeData qrCodeData = qrGenerator.CreateQrCode(data, QRCodeGenerator.ECCLevel.L); PngByteQRCode qrCode = new PngByteQRCode(qrCodeData); byte[] qrCodeAsPngByteArr = qrCode.GetGraphic(3); qrCode.Dispose(); qrGenerator.Dispose(); return(qrCodeAsPngByteArr); } catch (Exception e) { Console.WriteLine(e.ToString()); return(null); } }