/// <summary> /// Creates a file that contains a list of the bad tags /// </summary> /// <param name="destination"> File path for bad file </param> /// <param name="dualList"> DualList object containing list of tags /// </param> public static void buildBadFile(string destination, DualList dualList) { StreamWriter writer = new StreamWriter(destination); string[] tids = dualList.getBadTidList(); string[] epcs = dualList.getBadEpcList(); for (int i = 0; i < tids.Length; i++) { if ((epcs[i] == "") || (epcs[i] == null)) { } else { writer.WriteLine(epcs[i] + "," + tids[i]); } } writer.Close(); }
public void main(Boolean isPred) { TextParser parser = new TextParser(24, 24); if (isPred) { String epc = ""; String tid = ""; String time = ""; String theDate = ""; String line = ""; using (StreamReader reader = new StreamReader(this.fileToRead)) { while ((line = reader.ReadLine()) != null) { parser.ParsePredator(ref line, ref epc, ref tid, ref time, ref theDate); dualList.addTag(epc, tid, theDate, time); } } } else { String line; String epc = ""; String tid = ""; String time = ""; String theDate = ""; using (StreamReader reader = new StreamReader(this.fileToRead)) { while ((line = reader.ReadLine()) != null) { parser.parsePickUp(ref line, ref epc, ref tid, ref time, ref theDate); dualList.addTag(epc, tid, theDate, time); } } } dualList.checkMissing(); try { FileBuilder.buildBadFile("W://Public/RFID/" + orderNumber + "/" + orderNumber + "BAD_TAGS", dualList); FileBuilder.buildBadFile("W://Public/RFID/" + orderNumber + "/" + orderNumber + "GOOD_TAGS", dualList); if (dualList.getNumBadTags() == 0) { FileBuilder.buildAssociationFile("W://Public/RFID/" + orderNumber + "/" + orderNumber + "ASSOCIATION_FILE", dualList); } } catch (Exception e) { FileBuilder.buildBadFile("C://Users/Public/BAD_TAGS", dualList); FileBuilder.buildGoodFile("C://Users/Public/Good_TAGS", dualList); if (dualList.getBadEpcList().Length == 0) { FileBuilder.buildAssociationFile("C://Users/Public/ASSOCIATION_FILE", dualList); } } MessageBox.Show("Number of badtags " + dualList.getNumBadTags().ToString()); }