/// <summary> /// Advances the enumerator to the next element of the collection. /// </summary> /// <returns> /// true if the enumerator was successfully advanced to the next element; /// false if the enumerator has passed the end of the collection. /// </returns> /// <exception cref="T:System.InvalidOperationException">The collection was modified after the enumerator was created. </exception> public bool MoveNext() { if (_shpBinaryReader.PeekChar() != -1) { // Mark Jacquin: add a try catch when some shapefile have extra char at the end but no record try { int recordNumber = _shpBinaryReader.ReadInt32BE(); int contentLength = _shpBinaryReader.ReadInt32BE(); _geometry = _handler.Read(_shpBinaryReader, _parent._geometryFactory); } catch (Exception) { return(false); } return(true); } else { // Reached end of file, so close the reader. //_shpBinaryReader.Close(); return(false); } }