void Add(SwitchBoardCell cell) { SwitchBoardCell c; // make sure it's not already there, // to prevend loops in the list for (c = _cells; c != null; c = c._next) { if (c == cell) { return; } } cell._next = _cells; _cells = cell; }
// Cell: x, y // Itinerary: name // Text: string void ParseCell(string pp) { int i; string line; string p1; string p = pp; string p2; SwitchBoardCell cell = null; p = GlobalFunctions.scan_line(p, out line); int x = wxPorting.Strtol(line, out i, 10); p1 = line.Substring(1); if (p1[0] == wxPorting.T(',')) { p1 = p1.Substring(1); } int y = wxPorting.Strtol(p1, out i, 10); p1 = line.Substring(1); cell = new SwitchBoardCell(); cell._x = x; cell._y = y; do { p2 = p; p = GlobalFunctions.scan_line(p, out line); p1 = string.Copy(line); if (p1.Equals(wxPorting.T("Itinerary:"))) { cell._itinerary = p1; continue; } if (p1.Equals(wxPorting.T("Text:"))) { cell._text = p1; continue; } p = p2; break; } while(p.Length > 0); Add(cell); pp = string.Copy(p); }