public bool addTLE(TLEset theElement) { if (!TLEs.Contains(theElement)) { _lastUpdate = DateTime.Now; TLEs.Add(theElement); if ((_TLEhistory > 0) && (TLEs.Count > _TLEhistory)) { TLEs.RemoveAt(0); } return true; } return false; }
public bool getLatestN(string[] norad, int elements) { bool changed = false; for (int idx = 0; idx < elements; idx++) { string updateList = ""; foreach (string catalogID in norad) { Satellite sat; if (satelliteList.TryGetValue(catalogID, out sat)) { if (sat.updateNeeded(_updateInterval)) { updateList += catalogID + ","; sat.updating(); } } else { updateList += catalogID + ","; } } updateList = updateList.Trim(new char[] { ',', }); if (updateList != string.Empty) { string predicateValues = "/class/tle_latest/ORDINAL/" + (idx + 1).ToString() + "/NORAD_CAT_ID/" + updateList + "/format/3le"; string[] lines = getSpaceTrack(predicateValues).Split(new string[] { "\r\n0 ", }, StringSplitOptions.RemoveEmptyEntries); for (int stuff = 0; stuff < lines.Length; stuff++) { TLEset tle = new TLEset(lines[stuff].Split(new string[] { "\r\n", }, StringSplitOptions.RemoveEmptyEntries)); Satellite sat = null; if (!satelliteList.TryGetValue(tle.getCatalogID(), out sat)) { sat = new Satellite(_TLEhistory); satelliteList.Add(tle.getCatalogID(), sat); } if (sat.addTLE(tle)) { changed = true; } } } } return changed; }