/// <summary>
        /// Gets the first importer that match the parameter criteria.
        /// </summary>
        /// <param name="documentType">Type of the document.</param>
        /// <param name="loadPath">The save path.</param>
        /// <returns></returns>
        public IImporter GetFirstImporter(DocumentTypes documentType, string loadPath)
        {
            string targetExtension = ExportHandler.GetExtension(loadPath);

            foreach (IImporter iImporter in this.LoadImporter())
            {
                foreach (DocumentSupportInfo documentSupportInfo in iImporter.DocumentSupportInfos)
                {
                    if (documentSupportInfo.Extension.ToLower().Equals(targetExtension.ToLower()))
                    {
                        if (documentSupportInfo.DocumentType == documentType)
                        {
                            return(iImporter);
                        }
                    }
                }
            }

            throw new AODLException("No importer available for type " + documentType.ToString() + " and extension " + targetExtension);
        }
Exemple #2
0
        /// <summary>
        /// Gets the first importer that match the parameter criteria.
        /// </summary>
        /// <param name="documentType">Type of the document.</param>
        /// <param name="loadPath">The save path.</param>
        /// <returns></returns>
        public IImporter GetFirstImporter(DocumentTypes documentType, string loadPath, string tmpPath)
        {
            string targetExtension = ExportHandler.GetExtension(loadPath);

            foreach (IImporter iImporter in this.LoadImporter())
            {
                foreach (DocumentSupportInfo documentSupportInfo in iImporter.DocumentSupportInfos)
                {
                    if (documentSupportInfo.Extension.ToLower().Equals(targetExtension.ToLower()))
                    {
                        if (documentSupportInfo.DocumentType == documentType)
                        {
                            return(iImporter);
                        }
                    }
                }
            }

            AODLException exception = new AODLException("No importer available for type " + documentType.ToString() + " and extension " + targetExtension);

            exception.InMethod = AODLException.GetExceptionSourceInfo(new StackFrame(1, true));
            throw exception;
        }