コード例 #1
0
        private string RemoveExtension(string filePath)
        {
            var pathSafe             = new PathWrapSafe();
            var directory            = pathSafe.GetDirectoryName(filePath);
            var fileWithoutExtension = pathSafe.GetFileNameWithoutExtension(filePath);

            return(Path.Combine(directory, fileWithoutExtension));
        }
コード例 #2
0
        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);
        }
コード例 #3
0
        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;
            }
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        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;
        }
コード例 #6
0
        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);
        }
コード例 #7
0
        public string GetCurrentAssemblyDirectory()
        {
            var assembly = GetCurrentAssemblyFromStackTrace();

            return(_pathWrapSafe.GetDirectoryName(GetAssemblyPath(assembly)));
        }
コード例 #8
0
 public string GetAssemblyDirectory()
 {
     return(_pathWrapSafe.GetDirectoryName(GetAssemblyPath(_assembly)));
 }