Пример #1
0
        public void Convert(FileExtension inputExtension, Stream inputStream, FileExtension outputExtension, Stream outputStream)
        {
            IDocumentReader reader = ReaderCatalog.FirstOrDefault(x => x.FileExtension == inputExtension);

            if (reader == null)
            {
                return;
            }

            IDocumentWriter writer = WriterCatalog.FirstOrDefault(x => x.FileExtension == outputExtension);

            writer?.Convert(reader.Convert(inputStream), outputStream);
        }
Пример #2
0
        public FileExtension Convert(string inputExtension, Stream inputStream, string outputExtension, Stream outputStream)
        {
            IDocumentReader reader = ReaderCatalog.BestMatch(inputExtension);

            if (reader == null)
            {
                return(default(FileExtension));
            }

            IDocumentWriter writer = WriterCatalog.BestMatch(outputExtension);

            if (writer == null)
            {
                return(default(FileExtension));
            }

            writer.Convert(reader.Convert(inputStream), outputStream);
            return(writer.FileExtension);
        }