示例#1
0
        public ConvertOperation(ConvertOperationOptions arguments, ILoggerFactory loggerFactory)
        {
            _arguments     = arguments;
            _loggerFactory = loggerFactory;
            _converter     = new FhirConverterWrapper(arguments.ToFhirVersion, arguments.FromFhirVersion);

            _logger = loggerFactory.CreateLogger <ConvertOperation>();

            Validate(arguments);
        }
示例#2
0
        private void Validate(ConvertOperationOptions arguments)
        {
            foreach (var path in arguments.SourcePath)
            {
                path.Validate("files");
            }

            if (arguments.SourcePath.Count() > 1 || arguments.SourcePath.First().IsDirectory())
            {
                arguments.OutputIsDirectory = true;
                if (File.Exists(arguments.OutPath))
                {
                    throw new SemanticArgumentException($"output must point to a directory when converting multiple files", nameof(arguments.OutPath));
                }
            }
        }