コード例 #1
0
ファイル: ScriptActionTest.cs プロジェクト: zsy960/PDFCreator
        public void ComposeScriptPath_WithoutTokens_ConcatenatesParamsAndFiles()
        {
            var tokenReplacer = new TokenReplacer();

            tokenReplacer.AddStringToken("foo", "bar");

            var result = ScriptAction.ComposeScriptParameters("--myparam", new[] { @"C:\file1.pdf" }, tokenReplacer);

            Assert.AreEqual("--myparam \"C:\\file1.pdf\"", result);
        }
コード例 #2
0
ファイル: ScriptActionTest.cs プロジェクト: zsy960/PDFCreator
        public void ComposeScriptPath_WithTokensInParams_ReplacesTokens()
        {
            var tokenReplacer = new TokenReplacer();

            tokenReplacer.AddStringToken("foo", "bar");

            var result = ScriptAction.ComposeScriptParameters("--myparam <foo>", new[] { @"C:\file1.pdf" }, tokenReplacer);

            Assert.AreEqual("--myparam bar \"C:\\file1.pdf\"", result);
        }
コード例 #3
0
        private string ComposeSampleCommand(string scriptPath, string additionalParams)
        {
            if ((string.IsNullOrEmpty(scriptPath)) || (scriptPath.Trim().Length == 0))
            {
                return("");
            }

            //TokenReplacer tokenReplacer = TokenHelper.TokenReplacerWithPlaceHolders;

            string scriptCall = Path.GetFileName(ScriptAction.ComposeScriptPath(scriptPath, _tokenReplacer));

            if (!string.IsNullOrEmpty(additionalParams))
            {
                scriptCall += " " + ScriptAction.ComposeScriptParameters(additionalParams, new[] { @"C:\File1.pdf", @"C:\File2.pdf" }, _tokenReplacer);
            }
            else
            {
                scriptCall += @" C:\File1.pdf C:\File2.pdf";
            }

            return(scriptCall);
        }