示例#1
0
        public ElevationController(IElevationFileReader elevationFileReader, IOptions <ElevationDataOptions> options, IMemoryCache cache)
        {
            if (options.Value.ElevationDataPath == null)
            {
                throw new ArgumentException("No elevation data path specified in configuration file.");
            }
            if (!Directory.Exists(options.Value.ElevationDataPath))
            {
                throw new DirectoryNotFoundException($"Directory '{options.Value.ElevationDataPath}' does not exist.");
            }

            _elevationDataPath   = options.Value.ElevationDataPath;
            _elevationFileReader = elevationFileReader;
            _cache = cache;
        }
        public ElevationDataSetFileSystemRepository(
            IElevationFileReader elevationFileReader, 
            IHgtFileNameParser fileNameParser, 
            String elevationDataPath)
        {
            if (elevationFileReader == null)
                throw new ArgumentNullException("elevationFileReader is null");
            if (fileNameParser == null)
                throw new ArgumentNullException("fileNameParser is null");
            if (String.IsNullOrEmpty(elevationDataPath))
                throw new ArgumentNullException("elevationDataPath is null or empty");

            _elevationFileReader = elevationFileReader;
            _elevationDataPath = elevationDataPath;
            _fileNameParser = fileNameParser;
        }