public void AddFileToQueue(string path) { PathCheck(path); var fileExtension = _pathSafe.GetExtension(path) ?? string.Empty; var legalFileTypes = new List <string> { ".ps", ".pdf" }; fileExtension = fileExtension.ToLowerInvariant(); if (!legalFileTypes.Contains(fileExtension)) { throw new COMException("Only .ps and .pdf files can be directly added to the queue."); } var spoolFolder = _spoolerProvider.SpoolFolder; if (!_spoolFolderAccess.CanAccess()) { throw new COMException("Accessing the spool folder failed."); } var isPdf = fileExtension.EndsWith(".pdf"); var fileHelper = isPdf ? _directConversionProvider.GetPdfConversion() : _directConversionProvider.GetPsConversion(); var infFile = fileHelper.TransformToInfFile(path, spoolFolder); _jobInfoQueue.Add(_jobInfoManager.ReadFromInfFile(infFile)); }
private IDirectConversion GetCorrectConverterForFile(string file) { return(IsPdfFile(file) ? _provider.GetPdfConversion() : _provider.GetPsConversion()); }