/// <summary> /// Moves to the next changeset. /// </summary> /// <returns></returns> public override bool MoveNext() { while (_reader.Read()) { if (_reader.NodeType == XmlNodeType.Element && (_reader.Name == "modify" || _reader.Name == "create" || _reader.Name == "delete")) { // create a stream for only this element. string name = _reader.Name; string next_element = _reader.ReadOuterXml(); XmlReader reader = XmlReader.Create(new MemoryStream(Encoding.UTF8.GetBytes(next_element))); object osm_obj = null; // select type of element. switch (name) { case "delete": osm_obj = _ser_delete.Deserialize(reader); if (osm_obj is OsmSharp.Osm.Xml.v0_6.delete) { _next = XmlSimpleConverter.ConvertToSimple(osm_obj as OsmSharp.Osm.Xml.v0_6.delete); return(true); } break; case "modify": osm_obj = _ser_modify.Deserialize(reader); if (osm_obj is OsmSharp.Osm.Xml.v0_6.modify) { _next = XmlSimpleConverter.ConvertToSimple(osm_obj as OsmSharp.Osm.Xml.v0_6.modify); return(true); } break; case "create": osm_obj = _ser_create.Deserialize(reader); if (osm_obj is OsmSharp.Osm.Xml.v0_6.create) { _next = XmlSimpleConverter.ConvertToSimple(osm_obj as OsmSharp.Osm.Xml.v0_6.create); return(true); } break; } } } _next = null; return(false); }
public override bool MoveNext() { while (this._reader.Read()) { if (this._reader.NodeType == XmlNodeType.Element && (this._reader.Name == "modify" || this._reader.Name == "create" || this._reader.Name == "delete")) { string name = this._reader.Name; XmlReader xmlReader = XmlReader.Create((Stream) new MemoryStream(Encoding.UTF8.GetBytes(this._reader.ReadOuterXml()))); if (!(name == "delete")) { if (!(name == "modify")) { if (name == "create") { object obj = this._ser_create.Deserialize(xmlReader); if (obj is create) { this._next = XmlSimpleConverter.ConvertToSimple(obj as create); return(true); } } } else { object obj = this._ser_modify.Deserialize(xmlReader); if (obj is modify) { this._next = XmlSimpleConverter.ConvertToSimple(obj as modify); return(true); } } } else { object obj = this._ser_delete.Deserialize(xmlReader); if (obj is delete) { this._next = XmlSimpleConverter.ConvertToSimple(obj as delete); return(true); } } } } this._next = (ChangeSet)null; return(false); }