private string[] GetValidExtensions(OutputFormat outputFormat) { if (outputFormat.IsPdf()) { return new[] { ".pdf" } } ; switch (outputFormat) { case OutputFormat.Jpeg: return(new[] { ".jpg", ".jpeg" }); case OutputFormat.Png: return(new[] { ".png" }); case OutputFormat.Tif: return(new[] { ".tif", ".tiff" }); case OutputFormat.Txt: return(new[] { ".txt" }); } throw new NotImplementedException($"OutputFormat '{outputFormat}' is not known to {nameof(OutputFormatHelper)}!"); }
private void AddNotExistingFileError(ActionResult result, OutputFormat format) { if (format.IsPdf()) { result.Add(ErrorCode.DefaultViewer_FileDoesNotExist_For_Pdf); } switch (format) { case OutputFormat.Jpeg: result.Add(ErrorCode.DefaultViewer_FileDoesNotExist_For_Jpeg); break; case OutputFormat.Png: result.Add(ErrorCode.DefaultViewer_FileDoesNotExist_For_Png); break; case OutputFormat.Tif: result.Add(ErrorCode.DefaultViewer_FileDoesNotExist_For_Tif); break; case OutputFormat.Txt: result.Add(ErrorCode.DefaultViewer_FileDoesNotExist_For_Txt); break; default: break; } }
private void AddMissingPathError(ActionResult result, OutputFormat format) { if (format.IsPdf()) { result.Add(ErrorCode.DefaultViewer_PathIsEmpty_for_Pdf); } switch (format) { case OutputFormat.Jpeg: result.Add(ErrorCode.DefaultViewer_PathIsEmpty_for_Jpeg); break; case OutputFormat.Png: result.Add(ErrorCode.DefaultViewer_PathIsEmpty_for_Png); break; case OutputFormat.Tif: result.Add(ErrorCode.DefaultViewer_PathIsEmpty_for_Tif); break; case OutputFormat.Txt: result.Add(ErrorCode.DefaultViewer_PathIsEmpty_for_Txt); break; default: break; } }
private bool ShouldRecommendArchitect(OutputFormat outputFormat) { if (!outputFormat.IsPdf()) { return(false); } if (_pdfArchitectCheck.IsInstalled()) { return(false); } if (!_fileAssoc.HasOpen(".pdf")) { return(true); } return(false); }
private bool ShouldOpenWithArchitect(OutputFormat outputFormat, bool openWithPdfArchitectSetting) { if (!outputFormat.IsPdf()) { return(false); } if (_pdfArchitectCheck.IsInstalled()) { if (openWithPdfArchitectSetting) { return(true); } if (!_fileAssoc.HasOpen(".pdf")) { return(true); } } return(false); }