Пример #1
0
        public (FileExtension extension, TOutput result) Convert(string inputExtension, TInput content, string outputExtension)
        {
            IDocumentInput <TInput> input = InputCatalog.BestMatch(inputExtension);

            if (input == null)
            {
                return(default((FileExtension, TOutput)));
            }

            IDocumentOutput <TOutput> output = OutputCatalog.BestMatch(outputExtension);

            return(output != null ? (output.FileExtension, output.Convert(input.Convert(content))) : default((FileExtension, TOutput)));
        }
Пример #2
0
        public TOutput Convert(FileExtension inputExtension, TInput content, FileExtension outputExtension)
        {
            IDocumentInput <TInput> input = InputCatalog.FirstOrDefault(x => x.FileExtension == inputExtension);

            if (input == null)
            {
                return(default(TOutput));
            }

            IDocumentOutput <TOutput> output = OutputCatalog.FirstOrDefault(x => x.FileExtension == outputExtension);

            return(output != null?output.Convert(input.Convert(content)) : default(TOutput));
        }