public TemplateExecutionResult ExecuteSingleTemplate(string workingDirectory, Template template, Dictionary <string, object> parameters)
        {
            Generator generator = new Generator(template, parameters, workingDirectory);
            TemplateExecutionResult executionResult = generator.ExecuteTemplateCustomHost();

            executionResult.TransformedText = AppendHash(executionResult.TransformedText);

            if (parameters.Keys.Contains("destinationFilename"))
            {
                SaveToDisk(executionResult.TransformedText, (string)parameters["destinationFilename"]);
            }

            return(executionResult);
        }
        public List <TemplateExecutionResult> ExecuteForEachTemplate(string workingDirectory, Template template, Dictionary <string, object> parameters, XElement treeParameters)
        {
            List <TemplateExecutionResult> executionResults = new List <TemplateExecutionResult>();

            parameters["treeParameter"] = treeParameters.ToString();

            Generator generator = new Generator(template, parameters, workingDirectory);
            TemplateExecutionResult executionResult = generator.ExecuteTemplateCustomHost();

            executionResult.TransformedText = AppendHash(executionResult.TransformedText);
            executionResults.Add(executionResult);

            if (parameters.Keys.Contains("destinationFilename"))
            {
                SaveToDisk(executionResult.TransformedText, (string)parameters["destinationFilename"]);
            }

            return(executionResults);
        }
        public TemplateExecutionResult ExecuteTemplateCustomHost()
        {
            try
            {
                TemplateExecutionResult result = new TemplateExecutionResult();
                Engine engine = new Engine();
                Classes.Generation.CustomGenerationHost host = new Classes.Generation.CustomGenerationHost();
                host.TemplateFileValue = WriteTemplateToDisk(this._workingDirectory, this._template.TemplateText);
                host.Session           = CreateSession(this._parameters);

                result.TransformedText = engine.ProcessTemplate(this._template.TemplateText, host).Trim();
                result.ErrorMessage    = GetErrors(host);
                result.Success         = true;

                return(result);
            }
            catch (Exception)
            {
                throw;
            }
        }