public void ClearData() { CircuitCount = -1; PanelLength = null; PanelWidth = null; CircuitList.Clear(); FileType = null; FileName = null; FullFilePath = null; CustomerDbName = null; ProgramName = null; MainCircuitName = null; MachineName = null; Pass = null; DateCreated = null; Lines.Clear(); Refdesmap.Clear(); Feedermap.Clear(); BypassedRefDesMap.Clear(); PlacementMap.Clear(); }
private void PopulateFeederMap(string line) { if (line.Contains("Reject") || line.Contains("DUMP") || line.Contains("HANDPLACE") || line.Contains("NOBOM")) { return; } Regex reColonsNquotes = new Regex(@"^Slot\s:\s""([^""]+)""\s(?:""([^""]+)""\s:\s""([^""]*)""\s?)+"); // //this regex parses out a feeder list line in a ci2. Capture Groups = 1- "Slot: " + slot, 2- field names, 3- field values // sauce *** new Regex(@"^Slot\s:\s""([^""]+)""\s(?:""([^""]+)""\s:\s""([^""]+)""\s?)+"); //Number of captures in Groups 2+3 == 4 for a normal feeder and == 3 for a PTF part // string feeder = null; string compid = null; string slot = null; try { Match match = reColonsNquotes.Match(line); if (match.Success) { feeder = match.Groups[3].Captures[0].Value; compid = match.Groups[3].Captures[1].Value; slot = match.Groups[3].Captures[2].Value; if (slot.Equals("0")) { return; } else if (match.Groups[3].Captures[0].Value.Contains("PTF RR BTWN RAIL")) { if (Feedermap.ContainsKey(compid)) { Feedermap[compid].Add(feeder); Feedermap[compid].Add(slot); Feedermap[compid].Add("Tray"); Feedermap[compid].Add(match.Groups[3].Captures[3].Value);//rotation field for tray parts } else { Feedermap.Add(compid, new List <string> { feeder, slot, "Tray", match.Groups[3].Captures[3].Value }); } } else { string track = null; string rotation = null; //string track = match.Groups[3].Captures[3].Value; //string rotation = match.Groups[3].Captures[4].Value; if (match.Groups[3].Captures.Count > 4) { track = match.Groups[3].Captures[3].Value; } else { track = "1"; } if (match.Groups[3].Captures.Count > 4) { rotation = match.Groups[3].Captures[4].Value; } else { rotation = match.Groups[3].Captures[3].Value; } if (Feedermap.ContainsKey(compid)) { Feedermap[compid].Add(feeder); Feedermap[compid].Add(slot); Feedermap[compid].Add(track); Feedermap[compid].Add(rotation); } else { Feedermap.Add(compid, new List <string> { feeder, slot, track, rotation }); } } } } catch (Exception) { MessageBox.Show("Error updating Feeder Map\nFeeder = " + feeder + "\nSlot = " + slot + "\nPN = " + compid, "PopulateFeederMap()", MessageBoxButton.OK, MessageBoxImage.Error); ClearData(); IsValid = false; } }