private MapFile() { // only to create a dummy empty file. databaseIndexCache = null; fileSize = 0; inputStream = null; mapFileHeader = null; timestamp = DateTime.Now; }
/// <summary> /// Opens the given map file, reads its header data and validates them. /// </summary> /// <param name="stream"> the map file. </param> /// <param name="language"> the language to use (may be null). </param> /// <exception cref="MapFileException"> if the given map file is null or invalid. </exception> public MapFile(Stream stream, string language) { this.preferredLanguage = language; if (stream == null) { throw new MapFileException("map file must not be null"); } this.inputStream = stream; this.fileSize = this.inputStream.Length; ReadBuffer readBuffer = new ReadBuffer(this.inputStream); this.mapFileHeader = new MapFileHeader(); this.mapFileHeader.ReadHeader(readBuffer, this.fileSize); this.databaseIndexCache = new IndexCache(this.inputStream, INDEX_CACHE_SIZE); // TODO: Find the creation date of file this.timestamp = DateTime.Now; // mapFile.lastModified(); }