예제 #1
0
        private void Validate(TransformOperationOptions arguments)
        {
            if (arguments.JustTransform != null)
            {
                arguments.JustTransform.Validate("just");
            }

            if (arguments.XslTransform != null)
            {
                arguments.XslTransform.Validate("xslt");
            }

            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));
                }
            }
        }
예제 #2
0
        public TransformOperation(TransformOperationOptions arguments, ILoggerFactory loggerFactory)
        {
            _arguments     = arguments;
            _loggerFactory = loggerFactory;

            _logger = loggerFactory.CreateLogger <TransformOperation>();

            if (_arguments.JustTransform != null)
            {
                _justTransformer = new JustTransform(_arguments.JustTransform.Path);
            }
            if (_arguments.XslTransform != null)
            {
                _xslTransformer = new XslTransform(_arguments.XslTransform.Path);
            }

            Validate(arguments);
        }