Пример #1
0
 private void AssertHasPlugins(ConversionParameter parameters)
 {
     if (_plugins.Count + parameters.AdditionalPlugins.Count <= 0)
     {
         throw new InvalidOperationException();
     }
 }
Пример #2
0
        public void Convert(ConversionParameter parameters)
        {
            AssertHasPlugins(parameters);

            var processingParameter = BuildProcessingParameter(parameters);
            var task = ProcessingTaskFactory(processingParameter);

            task.Run();
        }
Пример #3
0
        private ProcessingTaskParameter BuildProcessingParameter(ConversionParameter parameters)
        {
            var processingParameter = new ProcessingTaskParameter
            {
                Out          = new System.IO.StreamWriter(parameters.Stream, Encoding.UTF8),
                RootElements = parameters.Elements.ToArray(),
                Parallel     = parameters.Parallel
            };

            if (parameters.AdditionalPlugins.Any())
            {
                var allPlugins = _plugins.Concat(parameters.AdditionalPlugins);
                processingParameter.Processor =
                    ProcessorFactory(allPlugins.ToArray());
            }
            else
            {
                processingParameter.Processor = _processor;
            }
            return(processingParameter);
        }
Пример #4
0
        public void Convert(ConversionParameter parameter)
        {
            var conversionTask = _conversionTaskFactory.Build(parameter);

            ExecuteConversionTask(conversionTask);
        }