public static void Block(this TextTransformation textTransformation, Action action)
 {
     WriteNewLine(textTransformation);
     textTransformation.WriteLine("{");
     Tab(textTransformation, action);
     WriteNewLine(textTransformation);
     textTransformation.Write("}");
 }
コード例 #2
0
        /// <summary>
        /// Appends generated <paramref name="content"/> to standard output of the <paramref name="transformation"/>.
        /// </summary>
        /// <param name="output">
        /// An <see cref="OutputInfo"/> object that describes content generated by a template.
        /// </param>
        /// <param name="content">
        /// A <see cref="String"/> that contains content generated by a template.
        /// </param>
        /// <param name="host">
        /// An <see cref="ITextTemplatingEngineHost"/> object hosting the <paramref name="transformation"/>.
        /// </param>
        /// <param name="transformation">
        /// <see cref="TextTransformation"/> object generated by T4 based on top-level .tt file.
        /// </param>
        private void AppendToStandardOutput(OutputInfo output, string content, ITextTemplatingEngineHost host, TextTransformation transformation)
        {
            // If some content was already written to the standard output
            if (this.standardOutput != null)
            {
                Validate(output, this.standardOutput);
            }

            transformation.Write(content);
            host.SetOutputEncoding(output.Encoding, false);

            if (this.standardOutput == null)
            {
                this.standardOutput          = new OutputInfo();
                this.standardOutput.Project  = GetFullProjectPath(output);
                this.standardOutput.Encoding = output.Encoding;
            }

            this.standardOutput.AppendReferences(output.References);
        }