コード例 #1
0
        /// <summary>
        /// Reads all content from file and stores them.
        /// </summary>
        private void LoadData()
        {
            try
            {
                using (StreamReader streamReader = new StreamReader(_baseStream))
                {
                    _geo = JsonConvert.DeserializeObject <GeoJsonObject>(streamReader.ReadToEnd(), new GeoJsonConvert());
                    streamReader.Close();
                }

                if (_geo == null || (_geo.Type == "Feature" && (_geo as Feature).Geometry == null))
                {
                    _numElements = 0;
                }
                else if (_geo.Type == "FeatureCollection")
                {
                    _numElements = (_geo as FeatureCollection).Features.Length;
                }
                else
                {
                    _numElements = 1;
                }
            } catch (Exception)
            {
                throw new IOException(MessageContentInvalid);
            }
        }
コード例 #2
0
        /// <summary>
        /// Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
        /// </summary>
        /// <param name="disposing">A value indicating whether disposing is performed on the object.</param>
        protected override void Dispose(Boolean disposing)
        {
            if (_geo != null)
            {
                _geo = null;
            }

            base.Dispose(disposing);
        }