From 6a95c2efc86ad5bd3018f60fe26d3e11e29ef261 Mon Sep 17 00:00:00 2001 From: g3gg0 Date: Fri, 22 Mar 2024 23:06:49 +0100 Subject: [PATCH] catch exceptions when operating reader --- TeddyBench/TeddyMain.cs | 40 +++++++++++++++++++++++++++++----------- 1 file changed, 29 insertions(+), 11 deletions(-) diff --git a/TeddyBench/TeddyMain.cs b/TeddyBench/TeddyMain.cs index 30cadfb..7b594e4 100644 --- a/TeddyBench/TeddyMain.cs +++ b/TeddyBench/TeddyMain.cs @@ -2240,19 +2240,25 @@ private void measureAnteannaToolStripMenuItem_Click(object sender, EventArgs e) TagOperationDialog opDlg = new TagOperationDialog(); opDlg.Show(); - Proxmark3.MeasurementResult result = RfidReader.MeasureAntenna(); + try + { + Proxmark3.MeasurementResult result = RfidReader.MeasureAntenna(); - opDlg.Close(); + opDlg.Close(); - if (result == null) - { - MessageBox.Show("Measurement failed.", "Failed"); - return; - } + if (result == null) + { + MessageBox.Show("Measurement failed.", "Failed"); + return; + } - PlotAntennaForm form = new PlotAntennaForm(result); + PlotAntennaForm form = new PlotAntennaForm(result); - form.ShowDialog(); + form.ShowDialog(); + } + catch (Exception ex) + { + } } private void flashFirmwareToolStripMenuItem_Click(object sender, EventArgs e) @@ -2263,7 +2269,13 @@ private void flashFirmwareToolStripMenuItem_Click(object sender, EventArgs e) dlg.Filter = "Firmware ELF files (*.elf)|*.elf|All files (*.*)|*.*"; if (dlg.ShowDialog() == DialogResult.OK) { - RfidReader.EnterBootloader(dlg.FileName); + try + { + RfidReader.EnterBootloader(dlg.FileName); + } + catch (Exception ex) + { + } } } @@ -2275,7 +2287,13 @@ private void flashBootloaderToolStripMenuItem_Click(object sender, EventArgs e) dlg.Filter = "Bootloader ELF files (*.elf)|*.elf|All files (*.*)|*.*"; if (dlg.ShowDialog() == DialogResult.OK) { - RfidReader.EnterBootloader(dlg.FileName); + try + { + RfidReader.EnterBootloader(dlg.FileName); + } + catch (Exception ex) + { + } } }