Example #1
0
        //private static Logger _logger = LogManager.GetCurrentClassLogger();

        public string MakePipedCommand(string template, object model)
        {
            //_logger.Info("Entering Pipe command mode");
            string serverApp = "rtc.exe";
            string result    = string.Empty;

            using (PipedChildProcess process = new PipedChildProcess())
            {
                process.FileName  = serverApp;
                process.Arguments = "-m NamedPipes";
                process.PipeName  = "InProc";
                process.Start();
                string value = JsonConvert.SerializeObject(model);
                result = process.Run("Render", "-tc", template, "-mc", value);
            }
            return(result);
        }
Example #2
0
        static void TestWithNamedPipes()
        {
            string serverApp = Path.Combine("../../../../Src/ArtOfNet.RazorTemplateCommand.Cmd/bin/Debug/", "rtc.exe");

            if (!File.Exists(serverApp))
            {
                Console.WriteLine("{0} was not found");
                return;
            }

            using (PipedChildProcess process = new PipedChildProcess())
            {
                process.FileName  = serverApp;
                process.Arguments = "-m NamedPipes";
                process.PipeName  = "InProc";
                process.Start();
                var    ano    = new { Name = "Rui", List = new[] { "one", "two", "three" } };
                string value  = JsonConvert.SerializeObject(ano);
                string result = process.Run("Render", "-tc", "Hello @Model.Name, values : @Model.List.Count", "-mc", value);
                Console.WriteLine("Templated result : {0}", result);

                Console.Read();
            }
        }