// Convert QR Code back to URL private void btnConvert_Click(object sender, EventArgs e) { QRCodeDecoder decoder = new QRCodeDecoder(); MessageBox.Show(decoder.decode(new QRCodeBitmapImage(pbQR.Image as Bitmap))); }
public static string GetCodeFromPicture(Bitmap pic) { QRCodeDecoder decoder = new QRCodeDecoder(); MessagingToolkit.QRCode.Codec.Data.QRCodeBitmapImage image = new QRCodeBitmapImage(pic); return decoder.Decode(image, Encoding.Unicode); }
public Dictionary <string, string> LerVariosQRCode(string caminhoPDF, string diretorio) { Dictionary <string, string> output = new Dictionary <string, string>(); caminhos = ImageConvertor.ConvertPDFToImage(new PdfReader(caminhoPDF), diretorio, new PdfReader(caminhoPDF).NumberOfPages).ToList(); MessagingToolkit.QRCode.Codec.QRCodeDecoder dec = new MessagingToolkit.QRCode.Codec.QRCodeDecoder(); try { foreach (var caminho in caminhos) { try { Bitmap bitmap = new Bitmap(System.Drawing.Image.FromFile(caminho)); output.Add(caminho, dec.decode(new MessagingToolkit.QRCode.Codec.Data.QRCodeBitmapImage(bitmap))); bitmap.Dispose(); GC.SuppressFinalize(bitmap); } catch (Exception) { continue; } } return(output); } finally { GC.SuppressFinalize(dec); GC.SuppressFinalize(output); File.Delete(caminhoPDF); } }
public DecodeResult(QRCodeDecoder enclosingInstance, sbyte[] decodedBytes, int numErrors, bool correctionSucceeded) { InitBlock(enclosingInstance); this.decodedBytes = decodedBytes; this.numCorrections = numErrors; this.correctionSucceeded = correctionSucceeded; }
public DecodeResult(QRCodeDecoder enclosingInstance, sbyte[] decodedBytes, int numErrors, bool correctionSucceeded) { InitBlock(enclosingInstance); this.decodedBytes = decodedBytes; this.numCorrections = numErrors; this.correctionSucceeded = correctionSucceeded; }
public static Store ReadImage(Bitmap file) { using (file) { MessagingToolkit.QRCode.Codec.QRCodeDecoder decoder = new MessagingToolkit.QRCode.Codec.QRCodeDecoder(); string res = decoder.decode(new QRCodeBitmapImage(file)); return(JsonConvert.DeserializeObject <Store>(res)); } }
private void decode_Qr() { QRCodeBitmapImage qbm = new QRCodeBitmapImage(de_bmp); QRCodeDecoder decodeer = new QRCodeDecoder(); textBox1.Text= decodeer.Decode(qbm); }
private void InitBlock(QRCodeDecoder enclosingInstance) { this.enclosingInstance = enclosingInstance; }
public DecodeResult(QRCodeDecoder enclosingInstance, sbyte[] decodedBytes, int numCorrectionFailures) { InitBlock(enclosingInstance); this.decodedBytes = decodedBytes; this.numCorrectionFailures = numCorrectionFailures; }
/// <summary> /// Click on the camera. Opens a QRCode for prefiled code. /// </summary> /// <param name="sender">Button.</param> /// <param name="e">Nothing.</param> void Btn_imageClick(object sender, EventArgs e) { if (ofd_picture.ShowDialog() == DialogResult.OK) { try { QRCodeDecoder decoder = new QRCodeDecoder(); QRCodeImage img = new QRCodeBitmapImage((Bitmap)Bitmap.FromFile(ofd_picture.FileName)); string data = decoder.Decode(img); Uri u = new Uri(data); if (u.Scheme != "otpauth" || u.Host != "totp") { throw new Exception(); } if (u.AbsolutePath.Length > 1) { txt_name.Text = System.Uri.UnescapeDataString(u.AbsolutePath.Substring(1)); } if (u.Query.Length > 8) { txt_code.Text = u.Query.Substring(8); } } catch { MessageBox.Show("Error loading image", "Error while loading image. Is it a QRCode with totp data ?", MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
private void InitBlock(QRCodeDecoder enclosingInstance) { this.enclosingInstance = enclosingInstance; }
public DecodeResult(QRCodeDecoder enclosingInstance, sbyte[] decodedBytes, int numCorrectionFailures) { this.InitBlock(enclosingInstance); this.decodedBytes = decodedBytes; this.numCorrectionFailures = numCorrectionFailures; }