Esempio n. 1
0
        public static ConversionResult Convert(Options options)
        {
            if (options == null)
            {
                throw new ArgumentNullException(nameof(options));
            }

            if (!options.Parsed)
            {
                throw new ArgumentOutOfRangeException(nameof(options));
            }

            var inputConverter  = _converterFactory.GetInputConverter(options.InputType);
            var outputConverter = _converterFactory.GetOutputConverter(options.OutputType);

            if (inputConverter != null && outputConverter != null)
            {
                if (inputConverter.GetInput(options.InputLocation, out IEnumerable <DataRecord> inputData))
                {
                    if (outputConverter.PushOutput(inputData, options.OutputLocation))
                    {
                        return(new ConversionResult(ConversionResultType.Successful));
                    }
                }
            }

            return(new ConversionResult(ConversionResultType.Failed));
        }