public void clearForImport(FileStream fs, CacheStore store) { XmlReader rdr = XmlReader.Create(fs); rdr.Settings.IgnoreWhitespace = true; List<String> waypoints = new List<String>(); while (rdr.Read()) { if (rdr.LocalName == "name" && rdr.IsStartElement()) { waypoints.Add(CacheStore.SQLEscape(rdr.ReadElementContentAsString())); } } rdr.Close(); store.ClearTBs(waypoints); if (m_purgeLogs) store.ClearLogs(waypoints); store.ClearAttributes(waypoints); return; }
public int PreParseForSingle(FileStream fs, CacheStore store) { XmlReader rdr = XmlReader.Create(fs); rdr.Settings.IgnoreWhitespace = true; int count = 0; List<String> waypoints = new List<String>(); while (rdr.Read()) { if (rdr.Name == "wpt" && rdr.IsStartElement()) { count++; } else if (rdr.Name == "waypoint" && rdr.IsStartElement()) { count++; } else if (rdr.LocalName == "name" && rdr.IsStartElement()) { waypoints.Add(CacheStore.SQLEscape(rdr.ReadElementContentAsString())); } } rdr.Close(); store.ClearTBs(waypoints); if (m_purgeLogs) store.ClearLogs(waypoints); store.ClearAttributes(waypoints); return count; }