public string ReadPassword(uint byteIndex, uint length) { try { DateTime timeBeforeRead = DateTime.Now; byte[] data = null; using (Reader reader = Reader.Create("tmr:///" + Vars.comport.ToLower())) { reader.Connect(); TagOp tagOp = new Gen2.ReadData(Gen2.Bank.RESERVED, byteIndex, (byte)length); SimpleReadPlan plan = new SimpleReadPlan(null, TagProtocol.GEN2, null, tagOp, 1000); reader.ParamSet("/reader/read/plan", plan); data = reader.ReadTagMemBytes(tagData, (int)Gen2.Bank.RESERVED, (int)byteIndex, (int)length); } DateTime timeAfterRead = DateTime.Now; TimeSpan timeElapsed = timeAfterRead - timeBeforeRead; commandTotalTimeTextBox.Text = timeElapsed.TotalSeconds.ToString(); return ByteFormat.ToHex(data); } catch(Exception ex) { MessageBox.Show(ex.Message); return ""; } }
static void Main(string[] args) { // Program setup if (1 != args.Length) { Console.WriteLine(String.Join("\r\n", new string[] { "Please provide reader URL, such as:", "tmr:///com4", "tmr://my-reader.example.com", })); Environment.Exit(1); } try { // Create Reader object, connecting to physical device. // Wrap reader in a "using" block to get automatic // reader shutdown (using IDisposable interface). using (Reader r = Reader.Create(args[0])) { //Uncomment this line to add default transport listener. //r.Transport += r.SimpleTransportListener; r.Connect(); if (Reader.Region.UNSPEC == (Reader.Region)r.ParamGet("/reader/region/id")) { Reader.Region[] supportedRegions = (Reader.Region[])r.ParamGet("/reader/region/supportedRegions"); if (supportedRegions.Length < 1) { throw new FAULT_INVALID_REGION_Exception(); } else { r.ParamSet("/reader/region/id", supportedRegions[0]); } } Gen2ReadAllMemoryBanks prgm = new Gen2ReadAllMemoryBanks(); prgm.reader = r; // Read Plan byte length; string model = (string)r.ParamGet("/reader/version/model"); if ("M6e".Equals(model) || "M6e PRC".Equals(model) || "M6e Micro".Equals(model) || "Mercury6".Equals(model) || "Astra-EX".Equals(model)) { // Specifying the readLength = 0 will return full TID for any tag read in case of M6e varients, M6 and Astra-EX reader. length = 0; } else { length = 2; } prgm.PerformWriteOperation(); TagReadData[] tagReadsFilter = r.Read(500); if (tagReadsFilter.Length == 0) { Console.WriteLine("No tags found"); return; } TagFilter filter = new TagData(tagReadsFilter[0].EpcString); Console.WriteLine("Perform embedded and standalone tag operation - read only user memory without filter"); Console.WriteLine(); TagOp op = new Gen2.ReadData(Gen2.Bank.USER, 0, length); prgm.PerformReadAllMemOperation(null, op); Console.WriteLine(); Console.WriteLine("Perform embedded and standalone tag operation - read user memory, reserved memory, tid memory and epc memory without filter"); Console.WriteLine(); op = null; op = new Gen2.ReadData(Gen2.Bank.USER | Gen2.Bank.GEN2BANKUSERENABLED | Gen2.Bank.GEN2BANKRESERVEDENABLED | Gen2.Bank.GEN2BANKEPCENABLED | Gen2.Bank.GEN2BANKTIDENABLED, 0, length); prgm.PerformReadAllMemOperation(null, op); Console.WriteLine(); Console.WriteLine("Perform embedded and standalone tag operation - read only user memory with filter"); Console.WriteLine(); op = null; op = new Gen2.ReadData(Gen2.Bank.USER, 0, length); prgm.PerformReadAllMemOperation(filter, op); Console.WriteLine(); Console.WriteLine("Perform embedded and standalone tag operation - read user memory, reserved memory with filter"); Console.WriteLine(); op = null; op = new Gen2.ReadData(Gen2.Bank.USER | Gen2.Bank.GEN2BANKUSERENABLED | Gen2.Bank.GEN2BANKRESERVEDENABLED, 0, length); prgm.PerformReadAllMemOperation(filter, op); Console.WriteLine(); Console.WriteLine("Perform embedded and standalone tag operation - read user memory, reserved memory and tid memory with filter"); Console.WriteLine(); op = null; op = new Gen2.ReadData(Gen2.Bank.USER | Gen2.Bank.GEN2BANKUSERENABLED | Gen2.Bank.GEN2BANKRESERVEDENABLED | Gen2.Bank.GEN2BANKTIDENABLED, 0, length); prgm.PerformReadAllMemOperation(filter, op); Console.WriteLine(); Console.WriteLine("Perform embedded and standalone tag operation - read user memory, reserved memory, tid memory and epc memory with filter"); Console.WriteLine(); op = null; op = new Gen2.ReadData(Gen2.Bank.USER | Gen2.Bank.GEN2BANKUSERENABLED | Gen2.Bank.GEN2BANKRESERVEDENABLED | Gen2.Bank.GEN2BANKEPCENABLED | Gen2.Bank.GEN2BANKTIDENABLED, 0, length); prgm.PerformReadAllMemOperation(filter, op); Console.WriteLine(); } } catch (ReaderException re) { Console.WriteLine("Error: " + re.Message); } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); } }
/// <summary> /// Read additional reserved memory for m5e variants /// </summary> /// <param name="bank"></param> /// <param name="startAddress"></param> /// <param name="filter"></param> /// <param name="data"></param> private void ReadAdditionalReservedMemDataM5eVariants(Gen2.Bank bank, uint startAddress, TagFilter filter, out ushort[] data) { data = null; int words = 1; TagOp op; while (true) { try { op = new Gen2.ReadData(bank, startAddress, Convert.ToByte(words)); data = (ushort[])objReader.ExecuteTagOp(op, filter); words++; } catch (Exception) { throw; } } }
private void ReadReservedMemData(Gen2.Bank bank, TagFilter filter) { ushort [] reservedData; TagOp op; try { try { // Read kill password op = new Gen2.ReadData(Gen2.Bank.RESERVED, 0, 2); reservedData = (ushort[])objReader.ExecuteTagOp(op, filter); if (null != reservedData) { txtKillPassword.Text = ByteFormat.ToHex(ByteConv.ConvertFromUshortArray(reservedData), "", " "); } else { txtKillPassword.Text = ""; } } catch (Exception ex) { if (ex is FAULT_GEN2_PROTOCOL_MEMORY_OVERRUN_BAD_PC_Exception) { txtKillPassword.Text = "Read Error"; } else { txtKillPassword.Text = ex.Message; } } try { // Read access password reservedData = null; op = new Gen2.ReadData(Gen2.Bank.RESERVED, 2, 2); reservedData = (ushort[])objReader.ExecuteTagOp(op, filter); if (null != reservedData) { txtAcessPassword.Text = ByteFormat.ToHex(ByteConv.ConvertFromUshortArray(reservedData), "", " "); } else { txtAcessPassword.Text = ""; } } catch (Exception ex) { if (ex is FAULT_GEN2_PROTOCOL_MEMORY_OVERRUN_BAD_PC_Exception) { txtAcessPassword.Text = "Read Error"; } else { txtAcessPassword.Text = ex.Message; } } // Read additional memory password try { reservedData = null; if (model.Equals("M5e") || model.Equals("M5e EU") || model.Equals("M5e Compact") || model.Equals("Astra")) { ReadAdditionalReservedMemDataM5eVariants(Gen2.Bank.RESERVED, 4, filter, out reservedData); } else { op = new Gen2.ReadData(Gen2.Bank.RESERVED, 4, 0); reservedData = (ushort[])objReader.ExecuteTagOp(op, filter); } if (null != reservedData) { txtReservedMemUnusedValue.Text = ByteFormat.ToHex(ByteConv.ConvertFromUshortArray(reservedData), "", " "); // Visible additional memory textboxes lblAdditionalReservedMem.Visibility = System.Windows.Visibility.Visible; txtReservedMemUnusedValue.Visibility = System.Windows.Visibility.Visible; lblAdditionalReservedMemAdd.Visibility = System.Windows.Visibility.Visible; } else { txtReservedMemUnusedValue.Text = ""; } } catch { // catch the exception and move on. Only some tags has aditional memory txtReservedMemUnusedValue.Text = ""; // Hide additional memory textboxes lblAdditionalReservedMem.Visibility = System.Windows.Visibility.Collapsed; txtReservedMemUnusedValue.Visibility = System.Windows.Visibility.Collapsed; lblAdditionalReservedMemAdd.Visibility = System.Windows.Visibility.Collapsed; } } catch (Exception) { throw; } }
static void Main(string[] args) { // Program setup if (1 != args.Length) { Console.WriteLine(String.Join("\r\n", new string[] { "Please provide reader URL, such as:", "tmr:///com4", "tmr://my-reader.example.com", })); Environment.Exit(1); } try { // Create Reader object, connecting to physical device. // Wrap reader in a "using" block to get automatic // reader shutdown (using IDisposable interface). using (Reader r = Reader.Create(args[0])) { //Uncomment this line to add default transport listener. //r.Transport += r.SimpleTransportListener; r.Connect(); if ((r is SerialReader) || (r is LlrpReader)) { if (Reader.Region.UNSPEC == (Reader.Region)r.ParamGet("/reader/region/id")) { Reader.Region[] supportedRegions = (Reader.Region[])r.ParamGet("/reader/region/supportedRegions"); if (supportedRegions.Length < 1) { throw new FAULT_INVALID_REGION_Exception(); } else { r.ParamSet("/reader/region/id", supportedRegions[0]); } } Gen2.Password pass = new Gen2.Password(0x0); r.ParamSet("/reader/gen2/accessPassword", pass); // BlockWrite and read using ExecuteTagOp Gen2.BlockWrite blockwrite = new Gen2.BlockWrite(Gen2.Bank.USER, 0, new ushort[] { 0xFFF1, 0x1122 }); r.ExecuteTagOp(blockwrite, null); Gen2.ReadData read = new Gen2.ReadData(Gen2.Bank.USER, 0, 2); ushort[] readData = (ushort[])r.ExecuteTagOp(read, null); foreach (ushort word in readData) { Console.Write(String.Format(" {0:X4}", word)); } Console.WriteLine(); // BlockWrite and read using embedded read command SimpleReadPlan readplan; TagReadData[] tagreads; blockwrite = new Gen2.BlockWrite(Gen2.Bank.USER, 0, new ushort[] { 0x1234, 0x5678 }); readplan = new SimpleReadPlan(null, TagProtocol.GEN2, //null, new TagData("1234567890ABCDEF"), blockwrite, 0); r.ParamSet("/reader/read/plan", readplan); r.Read(500); readplan = new SimpleReadPlan(null, TagProtocol.GEN2, null, new Gen2.ReadData(Gen2.Bank.USER, 0, 2), 0); r.ParamSet("/reader/read/plan", readplan); tagreads = r.Read(500); foreach (TagReadData trd in tagreads) { foreach (byte b in trd.Data) { Console.Write(String.Format(" {0:X2}", b)); } Console.WriteLine(" " + trd.ToString()); } } else { Console.WriteLine("Error: This codelet works only for Serial Readers and Llrp Readers"); } } } catch (ReaderException re) { Console.WriteLine("Error: " + re.Message); } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); } }
static void Main(string[] args) { // Program setup if (1 != args.Length) { Console.WriteLine(String.Join("\r\n", new string[] { "Please provide reader URL, such as:", "tmr:///com4", "tmr://my-reader.example.com", })); Environment.Exit(1); } try { // Create Reader object, connecting to physical device. // Wrap reader in a "using" block to get automatic // reader shutdown (using IDisposable interface). using (Reader r = Reader.Create(args[0])) { //Uncomment this line to add default transport listener. //r.Transport += r.SimpleTransportListener; r.Connect(); if (Reader.Region.UNSPEC == (Reader.Region)r.ParamGet("/reader/region/id")) { Reader.Region[] supportedRegions = (Reader.Region[])r.ParamGet("/reader/region/supportedRegions"); if (supportedRegions.Length < 1) { throw new FAULT_INVALID_REGION_Exception(); } else { r.ParamSet("/reader/region/id", supportedRegions[0]); } } TagReadData[] tagReads; // Read Plan byte length; string model = (string)r.ParamGet("/reader/version/model"); if ("M6e".Equals(model) || "M6e PRC".Equals(model) || "M6e Micro".Equals(model) || "Mercury6".Equals(model) || "Astra-EX".Equals(model)) { // Specifying the readLength = 0 will return full TID for any tag read in case of M6e varients, M6 and Astra-EX reader. length = 0; } else { length = 2; } TagOp op = new Gen2.ReadData(Gen2.Bank.TID, 0, length); SimpleReadPlan plan = new SimpleReadPlan(null, TagProtocol.GEN2, null, op, 1000); r.ParamSet("/reader/read/plan", plan); // Read tags tagReads = r.Read(500); // Print tag reads foreach (TagReadData tr in tagReads) { Console.WriteLine(tr.ToString()); if (0 < tr.Data.Length) { Console.WriteLine(" Data:" + ByteFormat.ToHex(tr.Data, "", " ")); } } } } catch (ReaderException re) { Console.WriteLine("Error: " + re.Message); } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); } }
static void Main(string[] args) { // Program setup if (args.Length != 1) { Console.WriteLine("Please provide reader URL, such as:\n" + "tmr:///com4\n" + "tmr://my-reader.example.com\n"); Environment.Exit(1); } // Create Reader object, connecting to physical device try { Reader r; TagReadData[] tagReads, filteredTagReads; TagFilter filter; r = Reader.Create(args[0]); //Uncomment this line to add default transport listener. //r.Transport += r.SimpleTransportListener; r.Connect(); if (Reader.Region.UNSPEC == (Reader.Region)r.ParamGet("/reader/region/id")) { Reader.Region[] supportedRegions = (Reader.Region[])r.ParamGet("/reader/region/supportedRegions"); if (supportedRegions.Length < 1) { throw new FAULT_INVALID_REGION_Exception(); } else { r.ParamSet("/reader/region/id", supportedRegions[0]); } } // In the current system, sequences of Gen2 operations require Session 0, // since each operation resingulates the tag. In other sessions, // the tag will still be "asleep" from the preceding singulation. Gen2.Session oldSession = (Gen2.Session)r.ParamGet("/reader/gen2/session"); Gen2.Session newSession = Gen2.Session.S0; Console.WriteLine("Changing to Session "+newSession+" (from Session "+oldSession+")"); r.ParamSet("/reader/gen2/session", newSession); Console.WriteLine(); try { Console.WriteLine("Unfiltered Read:"); // Read the tags in the field tagReads = r.Read(500); foreach (TagReadData tr in tagReads) Console.WriteLine(tr.ToString()); Console.WriteLine(); if (0 == tagReads.Length) { Console.WriteLine("No tags found."); } else { // A TagData object may be used as a filter, for example to // perform a tag data operation on a particular tag. Console.WriteLine("Filtered Tagop:"); // Read kill password of tag found in previous operation filter = tagReads[0].Tag; Console.WriteLine("Read kill password of tag {0}", filter); Gen2.ReadData tagop = new Gen2.ReadData(Gen2.Bank.RESERVED, 0, 2); try { ushort[] data = (ushort[])r.ExecuteTagOp(tagop, filter); foreach (ushort word in data) { Console.Write("{0:X4}", word); } Console.WriteLine(); } catch (ReaderException ex) { Console.WriteLine("Can't read tag: {0}", ex.Message); } Console.WriteLine(); // Filter objects that apply to multiple tags are most useful in // narrowing the set of tags that will be read. This is // performed by setting a read plan that contains a filter. // A TagData with a short EPC will filter for tags whose EPC // starts with the same sequence. filter = new TagData(tagReads[0].Tag.EpcString.Substring(0, 4)); Console.WriteLine("EPCs that begin with {0}:", filter); r.ParamSet("/reader/read/plan", new SimpleReadPlan(null, TagProtocol.GEN2, filter, 1000)); filteredTagReads = r.Read(500); foreach (TagReadData tr in filteredTagReads) Console.WriteLine(tr.ToString()); Console.WriteLine(); // A filter can also be an full Gen2 Select operation. For // example, this filter matches all Gen2 tags where bits 8-19 of // the TID are 0x003 (that is, tags manufactured by Alien // Technology). Console.WriteLine("Tags with Alien Technology TID"); filter = new Gen2.Select(false, Gen2.Bank.TID, 8, 12, new byte[] { 0, 0x30 }); r.ParamSet("/reader/read/plan", new SimpleReadPlan(null, TagProtocol.GEN2, filter, 1000)); filteredTagReads = r.Read(500); foreach (TagReadData tr in filteredTagReads) Console.WriteLine(tr.ToString()); Console.WriteLine(); // Gen2 Select may also be inverted, to give all non-matching tags Console.WriteLine("Tags without Alien Technology TID"); filter = new Gen2.Select(true, Gen2.Bank.TID, 8, 12, new byte[] { 0, 0x30 }); r.ParamSet("/reader/read/plan", new SimpleReadPlan(null, TagProtocol.GEN2, filter, 1000)); filteredTagReads = r.Read(500); foreach (TagReadData tr in filteredTagReads) Console.WriteLine(tr.ToString()); Console.WriteLine(); // Filters can also be used to match tags that have already been // read. This form can only match on the EPC, as that's the only // data from the tag's memory that is contained in a TagData // object. // Note that this filter has invert=true. This filter will match // tags whose bits do not match the selection mask. // Also note the offset - the EPC code starts at bit 32 of the // EPC memory bank, after the StoredCRC and StoredPC. filter = new Gen2.Select(true, Gen2.Bank.EPC, 32, 2, new byte[] { (byte)0xC0 }); Console.WriteLine("EPCs with first 2 bits equal to zero (post-filtered):"); foreach (TagReadData tr in tagReads) // unfiltered tag reads from the first example if (filter.Matches(tr.Tag)) Console.WriteLine(tr.ToString()); Console.WriteLine(); } } finally { // Restore original settings Console.WriteLine("Restoring Session " + oldSession); r.ParamSet("/reader/gen2/session", oldSession); } // Shut down reader r.Destroy(); } catch (ReaderException re) { Console.WriteLine("Error: " + re.ToString()); } catch (Exception ex) { Console.WriteLine("Error: " + ex.Message); } }
/// <summary> /// Read reserved memory of the tag /// </summary> /// <param name="bank"></param> /// <param name="filter"></param> /// <param name="data"></param> private void ReadData(Gen2.Bank bank, TagFilter filter, out ushort[] data) { data = null; int words = 1; TagOp op; while (true) { try { op = new Gen2.ReadData(bank, 2, Convert.ToByte(words)); data = (ushort[])objReader.ExecuteTagOp(op, filter); words++; } catch (Exception ex) { if (ex is FAULT_GEN2_PROTOCOL_MEMORY_OVERRUN_BAD_PC_Exception || (-1 != ex.Message.IndexOf("Non-specific reader error")) || (-1 != ex.Message.IndexOf("Tag data access failed"))) { if (null != data) { // Just skip the exception and move on. So as not to lose the already read data. break; } else { // throw the exception if the data received is null for the first iteration itself throw; } } else { throw ex; } } } }
/// <summary> /// Populate access password of the tag /// </summary> private void PopulateUserData() { try { // Clear the previous error ResetLockActionCheckBoxes(); grpbxLockTgAccessPwd.IsEnabled = true; Mouse.SetCursor(Cursors.Wait); if ((bool)rbFirstTagLockTagTb.IsChecked) { antenna = GetSelectedAntennaList()[0]; } objReader.ParamSet("/reader/tagop/antenna", antenna); TagFilter searchSelect = null; if ((bool)rbSelectedTagLockTagTb.IsChecked) { if (lblSelectFilter.Content.ToString().Contains("EPC ID")) { searchSelect = new TagData(currentEPC); } else { int dataLength = 0; byte[] SearchSelectData = ByteFormat.FromHex(txtData.Text); if (null != SearchSelectData) { dataLength = SearchSelectData.Length; } searchSelect = new Gen2.Select(false, selectMemBank, Convert.ToUInt16(accessPwddStartAddress * 16), Convert.ToUInt16(dataLength * 8), SearchSelectData); } } else { searchSelect = new TagData(currentEPC); } //Read Reserved memory bank data TagOp op; ushort[] reservedData = null; txtbxAccesspaasword.Text = ""; try { string reservedBankData = string.Empty; if (model.Equals("M5e") || model.Equals("M5e EU") || model.Equals("M5e Compact") || model.Equals("Astra")) { ReadData(Gen2.Bank.RESERVED, searchSelect, out reservedData); } else { op = new Gen2.ReadData(Gen2.Bank.RESERVED, 2, 0); reservedData = (ushort[])objReader.ExecuteTagOp(op, searchSelect); } if (null != reservedData) reservedBankData = ByteFormat.ToHex(ByteConv.ConvertFromUshortArray(reservedData), "", " "); txtbxAccesspaasword.Text = reservedBankData.Trim(' '); grpbxLockTgApplyLocks.IsEnabled = true; grpbxLockTgLockActns.IsEnabled = true; btnWriteAccessPwd.IsEnabled = true; } catch (Exception ex) { // Show the error in access password section if failed txtblkErrorAccessPassword.Visibility = System.Windows.Visibility.Visible; grpbxLockTgApplyLocks.IsEnabled = false; grpbxLockTgLockActns.IsEnabled = false; btnWriteAccessPwd.IsEnabled = false; if (ex is FAULT_GEN2_PROTOCOL_MEMORY_OVERRUN_BAD_PC_Exception) { txtblkErrorAccessPassword.Text = "Error: Read Error"; } else if (ex is FAULT_GEN2_PROTOCOL_MEMORY_LOCKED_Exception) { txtblkErrorAccessPassword.Text = "Error: Could not read access password. Access Password may be locked. You must enter the correct Access Password to proceed with locking"; } else { txtblkErrorAccessPassword.Text = "Error: "+ex.Message; } } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } finally { Mouse.SetCursor(Cursors.Arrow); } }
/// <summary> /// Current access password, epc and tid need to be saved before applying the lock on access password" /// </summary> private void SaveAccessPassword() { try { MessageBox.Show("Current access password need to be saved before applying the lock on Access Password","Universal Reader Assistant", MessageBoxButton.OK, MessageBoxImage.Information); string accessPwdSaveFileDialogFileName = "AccessPwd"; SaveFileDialog accessPwdSaveFileDialog = new SaveFileDialog(); accessPwdSaveFileDialog.Filter = "Text Files (.txt)|*.txt"; accessPwdSaveFileDialog.FileName = accessPwdSaveFileDialogFileName; if ((bool)accessPwdSaveFileDialog.ShowDialog()) { accessPwdSaveFileDialogFileName = accessPwdSaveFileDialog.FileName; TextWriter txtWriter = new StreamWriter(accessPwdSaveFileDialogFileName); StringBuilder stringAccesspAssword = new StringBuilder(); Mouse.SetCursor(Cursors.Wait); if ((bool)rbFirstTagLockTagTb.IsChecked) { antenna = GetSelectedAntennaList()[0]; } objReader.ParamSet("/reader/tagop/antenna", antenna); TagFilter searchSelect = null; stringAccesspAssword.Append("EPC: "+currentEPC); stringAccesspAssword.Append(Environment.NewLine); if ((bool)rbSelectedTagLockTagTb.IsChecked) { if (lblSelectFilter.Content.ToString().Contains("EPC ID")) { searchSelect = new TagData(currentEPC); } else { int dataLength = 0; byte[] SearchSelectData = ByteFormat.FromHex(txtData.Text); if (null != SearchSelectData) { dataLength = SearchSelectData.Length; } searchSelect = new Gen2.Select(false, selectMemBank, Convert.ToUInt16(accessPwddStartAddress * 16), Convert.ToUInt16(dataLength * 8), SearchSelectData); } } else { searchSelect = new TagData(currentEPC); } //Read TID bank data ushort[] tidData = null; TagOp op; try { string tidBankData = string.Empty; if (model.Equals("M5e") || model.Equals("M5e EU") || model.Equals("M5e Compact") || model.Equals("Astra")) { ReadData(Gen2.Bank.TID, searchSelect, out tidData); } else { op = new Gen2.ReadData(Gen2.Bank.TID, 0, 0); tidData = (ushort[])objReader.ExecuteTagOp(op, searchSelect); } if (null != tidData) tidBankData = ByteFormat.ToHex(ByteConv.ConvertFromUshortArray(tidData), "", " "); if (tidBankData.Length > 0) { stringAccesspAssword.Append("TID: "+tidBankData.Replace(" ","")); } } catch (Exception ex) { if (ex is FAULT_GEN2_PROTOCOL_MEMORY_OVERRUN_BAD_PC_Exception) { stringAccesspAssword.Append("TID: Read Error"); } else { stringAccesspAssword.Append("TID: "+ex.Message); } } stringAccesspAssword.Append(Environment.NewLine); stringAccesspAssword.Append("AccessPassword: 0x"+txtbxAccesspaasword.Text.Replace(" ","")); stringAccesspAssword.Append(Environment.NewLine); txtWriter.WriteLine(stringAccesspAssword.ToString()); txtWriter.Close(); } } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButton.OK, MessageBoxImage.Error); } finally { Mouse.SetCursor(Cursors.Arrow); } }