public bool Read(out GpxObjectType type) { bool result = doRead(); type = this.objectType; return(result); }
private void ReadHeader() { while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: if (reader.Name != "gpx") { throw new FormatException(reader.Name); } Attributes = ReadGpxAttributes(); objectType = GpxObjectType.Attributes; return; } } throw new FormatException(); }
private bool doRead() { if (this.Attributes == null) { ReadHeader(); return(true); } if (objectType == GpxObjectType.None) { return(false); } while (reader.Read()) { switch (reader.NodeType) { case XmlNodeType.Element: switch (reader.Name) { case "metadata": Metadata = ReadGpxMetadata(); objectType = GpxObjectType.Metadata; return(true); case GpxSymbol.Waypoint: WayPoint = ReadGpxWayPoint(); objectType = GpxObjectType.WayPoint; return(true); case "rte": Route = ReadGpxRoute(); objectType = GpxObjectType.Route; return(true); case GpxSymbol.Track: Track = ReadGpxTrack(); objectType = GpxObjectType.Track; return(true); default: reader.SkipElement(); break; } break; case XmlNodeType.EndElement: if (reader.Name != "gpx") { throw new FormatException(reader.Name); } objectType = GpxObjectType.None; return(false); } } objectType = GpxObjectType.None; return(false); }