/// <summary> /// Create a new PrintCommand for the given file /// </summary> /// <param name="filename">The full path to the file that shall be printed</param> /// <param name="printer">The printer the command will print to</param> public PrintCommand(string filename, string printer, IFileAssoc fileAssoc) { if (filename == null) { throw new ArgumentNullException(nameof(filename)); } Filename = filename; Printer = printer; _fileAssoc = fileAssoc; if (!File.Exists(filename)) { CommandType = PrintType.Unprintable; return; } var extension = Path.GetExtension(filename); if (string.IsNullOrEmpty(extension)) { CommandType = PrintType.Unprintable; return; } if (!SupportsPrint() && !SupportsPrintTo()) { CommandType = PrintType.Unprintable; } else { CommandType = SupportsPrintTo() ? PrintType.PrintTo : PrintType.Print; } }
public void Setup() { _profile = new ConversionProfile(); _job = new Job(null, null, null) { Profile = _profile, OutputFiles = new List <string> { "FirstFile.pdf" } }; _fileList = new List <string>(); _fileList.Add("C:\\Kartoffel.pdf"); _fileList.Add("C:\\Salat.jpg"); _fileList.Add("C:\\Marvin.tiff"); _fileAssoc = Substitute.For <IFileAssoc>(); _defaultViewerAction = Substitute.For <IDefaultViewerAction>(); _commandLocator = Substitute.For <ICommandLocator>(); _settingsProvider = Substitute.For <ISettingsProvider>(); var pdfCreatorSettings = new PdfCreatorSettings(); pdfCreatorSettings.ApplicationSettings = new ApplicationSettings(); pdfCreatorSettings.DefaultViewers.Add(new DefaultViewer { IsActive = true, OutputFormat = OutputFormat.Pdf }); _settingsProvider.Settings.Returns(pdfCreatorSettings); _interactionInvoker = Substitute.For <IInteractionInvoker>(); }
public PrintFileHelperComFactory(IPrinterHelper printerHelper, ISettingsProvider settingsProvider, IFileAssoc fileAssoc) { _printerHelper = printerHelper; _settingsProvider = settingsProvider; _fileAssoc = fileAssoc; }
protected PrintFileHelperBase(IPrinterHelper printerHelper, ISettingsProvider settingsProvider, IFileAssoc fileAssoc, IDirectory directory, IFile file) { _printerHelper = printerHelper; _settingsProvider = settingsProvider; _fileAssoc = fileAssoc; _directory = directory; _file = file; }
public QuickActionOpenWithDefaultCommand(ITranslationUpdater translationUpdater, IDefaultViewerAction action, IFileAssoc fileAssoc, ICommandLocator commandLocator, ISettingsProvider settingsProvider, IInteractionInvoker interactionInvoker) : base(translationUpdater) { Action = action; FileAssoc = fileAssoc; CommandLocator = commandLocator; SettingsProvider = settingsProvider; InteractionInvoker = interactionInvoker; }
public PrintFileHelperComFactory(IPrinterHelper printerHelper, ISettingsProvider settingsProvider, IFileAssoc fileAssoc, IDirectory directory, IFile file) { _printerHelper = printerHelper; _settingsProvider = settingsProvider; _fileAssoc = fileAssoc; _directory = directory; _file = file; }
/// <summary> /// Create a new PrintCommand for the given file /// </summary> /// <param name="filename">The full path to the file that shall be printed</param> /// <param name="printer">The printer the command will print to</param> /// <param name="fileAssoc">The IFileAssoc implementation used to detect if the is printable</param> /// <param name="printerHelper">PrinterHelper to determine the DefaultPrinter</param> /// <param name="timeout">Timeout in seconds after which a print stops</param> public PrintCommand(string filename, string printer, IFileAssoc fileAssoc, IPrinterHelper printerHelper, IFile file, int timeout) { _specialFileTypes = new List <SpecialShellCommand> { new SpecialShellCommand("jpegfile", "printto", "rundll32.exe", _pictureFallbackCommandParams), new SpecialShellCommand("pngfile", "printto", "rundll32.exe", _pictureFallbackCommandParams), new SpecialShellCommand("TIFImage.Document", "printto", "rundll32.exe", _pictureFallbackCommandParams) }; if (filename == null) { throw new ArgumentNullException(nameof(filename)); } Filename = filename; Printer = printer; _fileAssoc = fileAssoc; _printerHelper = printerHelper; _file = file; _timeout = timeout; RegisterSpecialFileTypesToFileAssoc(); Logger.Trace($"Checking PrintCommand for '{filename}'"); if (!_file.Exists(filename)) { Logger.Trace($"The file '{filename}' does not exist!"); CommandType = PrintType.Unprintable; return; } var extension = Path.GetExtension(filename); if (string.IsNullOrEmpty(extension)) { Logger.Trace("Unprintable: The file as no extension!"); CommandType = PrintType.Unprintable; return; } if (!SupportsPrint() && !SupportsPrintTo()) { Logger.Trace("Unprintable: The file does not support print or printto!"); CommandType = PrintType.Unprintable; } else { CommandType = SupportsPrintTo() ? PrintType.PrintTo : PrintType.Print; Logger.Trace($"The file is printable: {CommandType}"); } }
/// <summary> /// Creates a new default viewer action. /// </summary> public DefaultViewerAction(IFileAssoc fileAssoc, IRecommendArchitect recommendArchitect, IPdfArchitectCheck pdfArchitectCheck, ISettingsProvider settingsProvider, OutputFormatHelper outputFormatHelper, IProcessStarter processStarter, IDefaultViewerCheck defaultViewerCheck) { _fileAssoc = fileAssoc; _recommendArchitect = recommendArchitect; _pdfArchitectCheck = pdfArchitectCheck; _settingsProvider = settingsProvider; _outputFormatHelper = outputFormatHelper; _processStarter = processStarter; _defaultViewerCheck = defaultViewerCheck; }
/// <summary> /// Create a new PrintCommand for the given file /// </summary> /// <param name="filename">The full path to the file that shall be printed</param> /// <param name="printer">The printer the command will print to</param> /// <param name="fileAssoc">The IFileAssoc implementation used to detect if the is printable</param> public PrintCommand(string filename, string printer, IFileAssoc fileAssoc) { if (filename == null) { throw new ArgumentNullException(nameof(filename)); } Filename = filename; Printer = printer; _fileAssoc = fileAssoc; Logger.Trace($"Checking PrintCommand for '{filename}'"); if (!File.Exists(filename)) { Logger.Trace($"The file '{filename}' does not exist!"); CommandType = PrintType.Unprintable; return; } var extension = Path.GetExtension(filename); if (string.IsNullOrEmpty(extension)) { Logger.Trace("Unprintable: The file as no extension!"); CommandType = PrintType.Unprintable; return; } if (!SupportsPrint() && !SupportsPrintTo()) { Logger.Trace("Unprintable: The file does not support print or printto!"); CommandType = PrintType.Unprintable; } else { CommandType = SupportsPrintTo() ? PrintType.PrintTo : PrintType.Print; Logger.Trace($"The file is printable: {CommandType}"); } }
public void SetUp() { _settings = new PdfCreatorSettings(); _fileAssoc = Substitute.For <IFileAssoc>(); _recommendArchitect = Substitute.For <IRecommendArchitect>(); _pdfArchitectCheck = Substitute.For <IPdfArchitectCheck>(); _pdfArchitectCheck.GetInstallationPath().Returns(ArchitectPath); _settingsProvider = Substitute.For <ISettingsProvider>(); _settingsProvider.Settings.Returns(_settings); _outputFormatHelper = new OutputFormatHelper(); _processStarter = Substitute.For <IProcessStarter>(); _defaultViewerCheck = Substitute.For <IDefaultViewerCheck>(); _defaultViewer = new DefaultViewer(); _defaultViewer.OutputFormat = OutputFormat.Pdf; _defaultViewer.Path = DefaultViewerPath; _settings.DefaultViewers.Add(_defaultViewer); _job = new Job(new JobInfo(), new ConversionProfile(), new Accounts()); _profile = new ConversionProfile(); _defaultViewerAction = new DefaultViewerAction(_fileAssoc, _recommendArchitect, _pdfArchitectCheck, _settingsProvider, _outputFormatHelper, _processStarter, _defaultViewerCheck); }
public PrintFileAssistant(IInteractionInvoker interactionInvoker, IPrinterHelper printerHelper, ISettingsProvider settingsProvider, ITranslationUpdater translationUpdater, IFileAssoc fileAssoc, IDirectory directory, IFile file) : base(printerHelper, settingsProvider, fileAssoc, directory, file) { _interactionInvoker = interactionInvoker; translationUpdater.RegisterAndSetTranslation(tf => _translation = tf.UpdateOrCreateTranslation(_translation)); }
internal PrintFileHelperCom(IPrinterHelper printerHelper, ISettingsProvider settingsProvider, IFileAssoc fileAssoc) : base(printerHelper, settingsProvider, fileAssoc) { }
protected PrintFileHelperBase(IPrinterHelper printerHelper, ISettingsProvider settingsProvider, IFileAssoc fileAssoc) { _printerHelper = printerHelper; _settingsProvider = settingsProvider; _fileAssoc = fileAssoc; }
/// <summary> /// Creates a new default viewer action. /// </summary> public DefaultViewerAction(IFileAssoc fileAssoc, IRecommendArchitect recommendArchitect, IPdfArchitectCheck architectCheck) { _fileAssoc = fileAssoc; _recommendArchitect = recommendArchitect; _architectCheck = architectCheck; }
public PrintFileAssistant(IInteractionInvoker interactionInvoker, IPrinterHelper printerHelper, ISettingsProvider settingsProvider, ITranslator translator, IFileAssoc fileAssoc) : base(printerHelper, settingsProvider, fileAssoc) { _interactionInvoker = interactionInvoker; _translator = translator; }
internal PrintFileHelperCom(IPrinterHelper printerHelper, ISettingsProvider settingsProvider, IFileAssoc fileAssoc, IDirectory directory, IFile file) : base(printerHelper, settingsProvider, fileAssoc, directory, file) { }