void ProcessTemplate(string templateFileName, string outputFileName)
        {
            CustomTextTemplateHost host = new CustomTextTemplateHost();
            Engine engine = new Engine();

            host._TemplateFileValue = templateFileName;

            //Read the text template.
            string input = File.ReadAllText(templateFileName);

            //Transform the text template.
            string output = engine.ProcessTemplate(input, host);

            outputFileName = outputFileName + host.FileExtension;

            if (!Directory.Exists(Path.GetDirectoryName(outputFileName)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(outputFileName));
            }

            File.WriteAllText(outputFileName, output, host.FileEncoding);

            foreach (CompilerError error in host.Errors)
            {
                this.Log.LogError(error.ToString());
            }
        }
示例#2
0
        void ProcessTemplate(string templateFileName, string outputFileName)
        {
            CustomTextTemplateHost host = new CustomTextTemplateHost();
            Engine engine = new Engine();

            host._TemplateFileValue = templateFileName;

            //Read the text template.
            string input = File.ReadAllText(templateFileName);

            //Transform the text template.
            string output = engine.ProcessTemplate(input, host);

            outputFileName = outputFileName + host.FileExtension;

            if (!Directory.Exists(Path.GetDirectoryName(outputFileName)))
            {
                Directory.CreateDirectory(Path.GetDirectoryName(outputFileName));
            }

            File.WriteAllText(outputFileName, output, host.FileEncoding);

            foreach (CompilerError error in host.Errors)
            {
                this.Log.LogError(error.ToString());
            }
        }