private string RemoveExtension(string filePath) { var pathSafe = new PathWrapSafe(); var directory = pathSafe.GetDirectoryName(filePath); var fileWithoutExtension = pathSafe.GetFileNameWithoutExtension(filePath); return(Path.Combine(directory, fileWithoutExtension)); }
public void ShowSaveFileDialog_SetValuesFromUserInput_SetFilepathAndOutputFormatInJob() { var pathSafe = new PathWrapSafe(); var skipPrintDialogCommand = BuildCommand(); var job = BuildJob(_pdfProfile); skipPrintDialogCommand.Execute(job); var result = _saveFileQuery .GetFileName(pathSafe.GetDirectoryName(job.OutputFilenameTemplate), pathSafe.GetFileName(job.OutputFilenameTemplate), job.Profile.OutputFormat); Assert.AreEqual(result.Data.Filepath, job.OutputFilenameTemplate); Assert.AreEqual(result.Data.OutputFormat, job.Profile.OutputFormat); }
public void Execute(object parameter) { var job = parameter as Job; var folder = _pathSafe.GetDirectoryName(job.OutputFilenameTemplate) ?? ""; var filename = _pathSafe.GetFileName(job.OutputFilenameTemplate) ?? ""; var result = _saveFileQuery.GetFileName(folder, filename, job.Profile.OutputFormat); if (result.Success) { job.OutputFilenameTemplate = result.Data.Filepath; job.Profile.OutputFormat = result.Data.OutputFormat; } }
private void AddTokensForDocumentTitle(SourceFileInfo sfi, Metadata metadata) { var titleFilename = ""; var titleFolder = ""; if (_pathUtil.IsValidRootedPath(sfi.DocumentTitle)) { titleFilename = _pathWrapSafe.GetFileNameWithoutExtension(sfi.DocumentTitle); titleFolder = _pathWrapSafe.GetDirectoryName(sfi.DocumentTitle); } else { titleFilename = metadata.PrintJobName; } _tokenReplacer.AddStringToken("InputFilename", titleFilename); _tokenReplacer.AddStringToken("InputFilePath", titleFolder); }
public void Execute(object parameter) { var job = parameter as Job; var folder = _pathSafe.GetDirectoryName(job.OutputFilenameTemplate) ?? ""; var filename = _pathSafe.GetFileName(job.OutputFilenameTemplate) ?? ""; var result = _saveFileQuery.GetFileName(folder, filename, job.Profile.OutputFormat); if (!result.Success) { throw new AbortWorkflowException("User cancelled in SaveFileDialog"); } job.OutputFilenameTemplate = result.Data.Filepath; job.Profile.OutputFormat = result.Data.OutputFormat; }
public void ShowSaveFileDialog_SetValuesFromUserInput_FilepathAndOutputFormatHasChanged() { var pathSafe = new PathWrapSafe(); var skipPrintDialogCommand = BuildCommand(); var job = BuildJob(_pdfProfile); var diffFilenameTemplate = job.OutputFilenameTemplate; var diffOutputFormat = job.Profile.OutputFormat; skipPrintDialogCommand.Execute(job); _saveFileQuery .GetFileName(pathSafe.GetDirectoryName(job.OutputFilenameTemplate), pathSafe.GetFileName(job.OutputFilenameTemplate), job.Profile.OutputFormat); Assert.AreNotEqual(job.OutputFilenameTemplate, diffFilenameTemplate); Assert.AreNotEqual(job.Profile.OutputFormat, diffOutputFormat); }
public string GetCurrentAssemblyDirectory() { var assembly = GetCurrentAssemblyFromStackTrace(); return(_pathWrapSafe.GetDirectoryName(GetAssemblyPath(assembly))); }
public string GetAssemblyDirectory() { return(_pathWrapSafe.GetDirectoryName(GetAssemblyPath(_assembly))); }