コード例 #1
0
        public static IDocumentTransformer BuildTransformer(
            TransformerSettings settings,
            IDocumentTransformerFactoryBuilder transformerFactory)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            if (transformerFactory == null)
            {
                throw new ArgumentNullException(nameof(transformerFactory));
            }

            var factory = settings.BuildFactory();

            if (factory is IRowTransformerFactory <ICellContentTransformer> fact)
            {
                return(transformerFactory.BuildCellContentTransformerFactory(fact));
            }
            if (factory is IRowTransformerFactory <IStructureTransformer> fact2)
            {
                return(transformerFactory.BuildStructureTransformerFactory(fact2));
            }
            if (factory is IDocumentTransformerFactory <Filtering.IRowMatchEvaluator> fact3)
            {
                return(transformerFactory.BuildRowFiltererFactory(fact3));
            }

            throw new NotSupportedException($"Type: {settings.GetType().FullName}");
        }
コード例 #2
0
 public static IList <IDocumentTransformer> BuildTransformers(
     IEnumerable <TransformerSettings> settings,
     IDocumentTransformerFactoryBuilder documentTransformerFactory)
 {
     return(settings
            .Select(config => BuildTransformer(config, documentTransformerFactory))
            .ToArray());
 }
コード例 #3
0
        public static IList <IDocumentTransformer> GetTransformerChain(
            IDictionary <string, TransformerSettings[]> transformationProfiles,
            string profileName,
            IDocumentTransformerFactoryBuilder documentTransformerFactory)
        {
            IEnumerable <TransformerSettings> transformerSettings = GetTransformerSettingsChain(transformationProfiles, profileName);

            return(BuildTransformers(transformerSettings, documentTransformerFactory));
        }