private KmlFile LoadFile(string path) { try { byte[] data = _fileResolver.ReadFile(path); using (var stream = new MemoryStream(data, false)) { if (path.EndsWith(".kml", StringComparison.OrdinalIgnoreCase)) { return(KmlFile.Load(stream)); } if (path.EndsWith(".kmz", StringComparison.OrdinalIgnoreCase)) { if (_fileResolver.SupportsKmz) { return(_fileResolver.ExtractDefaultKmlFileFromKmzArchive(stream)); } } } } catch (IOException) { // Silently fail } return(null); }