public static void  CreateQrFile(string code)
        {
            QRCodeGenerator qrGenerator = new QRCodeGenerator();
            QRCodeData      qrCodeData  = qrGenerator.CreateQrCode(code, QRCodeGenerator.ECCLevel.Q);

            qrCodeData.SaveRawData("wwwroot/qrr/file-" + code + ".qrr",
                                   QRCodeData.Compression.Uncompressed);
        }
        public IActionResult Index(string qrTexto)
        {
            String cryptText = qrTexto.Crypt();

            cryptText = HttpUtility.UrlEncode(cryptText);
            String filePath   = String.Format("wwwroot/qrr/-{0}-.qrr", cryptText);
            bool   fileExists = false;

            String[] files = Directory.GetFiles("wwwroot/qrr");

            for (int i = 0; i < files.Length; i++)
            {
                if (files[i].Contains(cryptText))
                {
                    fileExists = true;
                    break;
                }
            }


            if (!fileExists)
            {
                QRCodeGenerator qrGerador  = new QRCodeGenerator();
                QRCodeData      qrCodeData = qrGerador.CreateQrCode(qrTexto, QRCodeGenerator.ECCLevel.Q);

                qrCodeData.SaveRawData(filePath,
                                       QRCodeData.Compression.Uncompressed);
            }

            QRCodeData qrCodeData1 = new QRCodeData(filePath,
                                                    QRCodeData.Compression.Uncompressed);

            QRCode qrCode      = new QRCode(qrCodeData1);
            Bitmap qrCodeImage = qrCode.GetGraphic(20);

            //Graphics graphics = Graphics.FromImage(qrCodeImage);

            //var pen = new Pen(Color.Red, 20);
            //var rect = new Rectangle(200, 600, 600, 100);

            //graphics.SmoothingMode = SmoothingMode.AntiAlias;
            //graphics.InterpolationMode = InterpolationMode.HighQualityBicubic;
            //graphics.PixelOffsetMode = PixelOffsetMode.HighQuality;
            //graphics.DrawString("ALGUM TEXTO AQUI", new Font("Roboto", 50, FontStyle.Bold), Brushes.Red, rect);

            //graphics.DrawArc(pen, rect, 90, 90);

            ViewData["QrCodeText"] = qrTexto;

            return(View(BitmapToBytes(qrCodeImage)));
        }
        public IActionResult GenerateFile(string qrText)
        {
            QRCodeGenerator qrGenerator = new QRCodeGenerator();
            QRCodeData      qrCodeData  = qrGenerator.CreateQrCode(qrText, QRCodeGenerator.ECCLevel.Q);
            string          fileGuid    = Guid.NewGuid().ToString().Substring(0, 4);

            qrCodeData.SaveRawData("wwwroot/qrr/file-" + fileGuid + ".qrr", QRCodeData.Compression.Uncompressed);

            QRCodeData qrCodeData1 = new QRCodeData("wwwroot/qrr/file-" + fileGuid + ".qrr", QRCodeData.Compression.Uncompressed);
            QRCode     qrCode      = new QRCode(qrCodeData1);
            Bitmap     qrCodeImage = qrCode.GetGraphic(20);

            return(View(BitmapToBytes(qrCodeImage)));
        }