/// <summary>
        /// Creates a metafile reader for the specified metafile path.
        /// </summary>
        /// <param name="path">The path.</param>
        /// <param name="option">The path option.</param>
        /// <returns>The valid metafile reader for the path if any; otherwise, <c>null</c>.</returns>
        /// <exception cref="System.ArgumentNullException">The path is null.</exception>
        /// <exception cref="System.ArgumentException">
        /// The path is empty.
        /// or
        /// The path is invalid.
        /// or
        /// The path is a zero-length string, contains only white space, or contains one or more invalid characters.
        /// or
        /// The path, file name, or both exceed the system-defined maximum length.
        /// </exception>
        /// <exception cref="System.UnauthorizedAccessException">
        /// The file on path is hidden.
        /// or
        /// The file on path is read-only.
        /// or
        /// The caller does not have the required permission for the path.</exception>
        /// <exception cref="System.NotSupportedException">The metafile format is not supported.</exception>
        public static GeoTiffMetafileReader CreateReader(String path, GeoTiffMetafilePathOption option)
        {
            if (path == null)
            {
                throw new ArgumentNullException("path", "The path is null.");
            }

            switch (option)
            {
            case GeoTiffMetafilePathOption.IsMetafilePath:
                return(GetReader(path));

            case GeoTiffMetafilePathOption.IsDirectoryPath:
                return(GetReaderInDirectory(path));

            case GeoTiffMetafilePathOption.IsGeoTiffFilePath:
                return(GetReaderFromGeoTiffFileName(path));

            case GeoTiffMetafilePathOption.IsSearchPattern:
                return(GetReaderFromSearchPattern(path));
            }

            return(null);
        }
 /// <summary>
 /// Creates a metafile reader for the specified metafile path.
 /// </summary>
 /// <param name="path">The path.</param>
 /// <param name="option">The path option.</param>
 /// <returns>The produced metafile reader.</returns>
 /// <exception cref="System.ArgumentNullException">The path is null.</exception>
 /// <exception cref="System.ArgumentException">
 /// The path is empty.
 /// or
 /// The path is invalid.
 /// or
 /// The path is a zero-length string, contains only white space, or contains one or more invalid characters.
 /// or
 /// The path, file name, or both exceed the system-defined maximum length.
 /// </exception>
 /// <exception cref="System.UnauthorizedAccessException">
 /// The file on path is hidden.
 /// or
 /// The file on path is read-only.
 /// or
 /// The caller does not have the required permission for the path.</exception>
 /// <exception cref="System.NotSupportedException">The metafile format is not supported.</exception>
 public static GeoTiffMetafileReader CreateReader(Uri path, GeoTiffMetafilePathOption option)
 {
     return(CreateReader(path.IsAbsoluteUri ? path.AbsolutePath : path.OriginalString, option));
 }