Exemplo n.º 1
0
        private static void ProcessTemplate([NotNull] string templateFile, Model.Model model)
        {
            if (templateFile == null) throw new ArgumentNullException("templateFile");

            Template template = new TemplateGroupFile(templateFile)
                .GetInstanceOf(MAIN_TEMPLATE_NAME);

            if (template == null)
                throw new ArgumentException(string.Format("Template {0} not found", MAIN_TEMPLATE_NAME));

            template.Add(MODEL_VAR, model);

            File.WriteAllText(BuildTargetFileName(templateFile), template.Render());
        }
Exemplo n.º 2
0
        private static void ProcessTemplate(string templateFile, Model.Model model)
        {
            string targetFile = BuildTargetFileName(templateFile);

            Console.WriteLine("\ttemplate: " + templateFile);
            try
            {
                Template template = new TemplateGroupFile(templateFile)
                    .GetInstanceOf(MAIN_TEMPLATE_NAME);

                template.Add(MODEL_VAR, model);

                File.WriteAllText(targetFile, template.Render());
            }
            finally
            {
                Console.WriteLine("\toutput:   " + targetFile);
            }
        }