14 using System.Collections.Generic;
21 #line 1 "C:\DEV\paradox\sources\tools\SiliconStudio.Paradox.VisualStudio.Commands\Shaders\ShaderKeySourceGenerator.tt"
22 [global::System.CodeDom.Compiler.GeneratedCodeAttribute(
"Microsoft.VisualStudio.TextTemplating",
"11.0.0.0")]
23 internal partial
class ShaderKeySourceGenerator : ShaderKeySourceGeneratorBase
29 public virtual string TransformText()
31 this.Write(
@"// AUTO-GENERATED, DO NOT MODIFY!
33 using SiliconStudio.Paradox.Effects;
34 using SiliconStudio.Paradox.Graphics;
35 using SiliconStudio.Core.Mathematics;
36 using Buffer = SiliconStudio.Paradox.Graphics.Buffer;
38 namespace SiliconStudio.Paradox.Effects.Modules
42 #line 15 "C:\DEV\paradox\sources\tools\SiliconStudio.Paradox.VisualStudio.Commands\Shaders\ShaderKeySourceGenerator.tt"
43 if (ShaderKeyClass != null) {
47 this.Write(
" public static partial class ");
49 #line 16 "C:\DEV\paradox\sources\tools\SiliconStudio.Paradox.VisualStudio.Commands\Shaders\ShaderKeySourceGenerator.tt"
50 this.Write(this.ToStringHelper.ToStringWithCulture(ShaderKeyClass.Name));
54 this.Write(
"\r\n {\r\n");
56 #line 18 "C:\DEV\paradox\sources\tools\SiliconStudio.Paradox.VisualStudio.Commands\Shaders\ShaderKeySourceGenerator.tt"
57 foreach (var shaderKeyVariable
in ShaderKeyClass.Variables) {
62 this.Write(
" public static readonly ParameterKey<");
64 #line 20 "C:\DEV\paradox\sources\tools\SiliconStudio.Paradox.VisualStudio.Commands\Shaders\ShaderKeySourceGenerator.tt"
65 this.Write(this.ToStringHelper.ToStringWithCulture(shaderKeyVariable.Type));
71 #line 20 "C:\DEV\paradox\sources\tools\SiliconStudio.Paradox.VisualStudio.Commands\Shaders\ShaderKeySourceGenerator.tt"
72 this.Write(this.ToStringHelper.ToStringWithCulture(shaderKeyVariable.Name));
78 #line 20 "C:\DEV\paradox\sources\tools\SiliconStudio.Paradox.VisualStudio.Commands\Shaders\ShaderKeySourceGenerator.tt"
79 if (shaderKeyVariable.Map == null){
83 this.Write(
"ParameterKeys.New<");
85 #line 20 "C:\DEV\paradox\sources\tools\SiliconStudio.Paradox.VisualStudio.Commands\Shaders\ShaderKeySourceGenerator.tt"
86 this.Write(this.ToStringHelper.ToStringWithCulture(shaderKeyVariable.Type));
92 #line 20 "C:\DEV\paradox\sources\tools\SiliconStudio.Paradox.VisualStudio.Commands\Shaders\ShaderKeySourceGenerator.tt"
93 this.Write(this.ToStringHelper.ToStringWithCulture(shaderKeyVariable.InitialValue ?? string.Empty));
99 #line 20 "C:\DEV\paradox\sources\tools\SiliconStudio.Paradox.VisualStudio.Commands\Shaders\ShaderKeySourceGenerator.tt"
105 #line 20 "C:\DEV\paradox\sources\tools\SiliconStudio.Paradox.VisualStudio.Commands\Shaders\ShaderKeySourceGenerator.tt"
106 this.Write(this.ToStringHelper.ToStringWithCulture(shaderKeyVariable.Map));
111 #line 20 "C:\DEV\paradox\sources\tools\SiliconStudio.Paradox.VisualStudio.Commands\Shaders\ShaderKeySourceGenerator.tt"
118 #line 21 "C:\DEV\paradox\sources\tools\SiliconStudio.Paradox.VisualStudio.Commands\Shaders\ShaderKeySourceGenerator.tt"
123 this.Write(
" }\r\n");
125 #line 23 "C:\DEV\paradox\sources\tools\SiliconStudio.Paradox.VisualStudio.Commands\Shaders\ShaderKeySourceGenerator.tt"
131 return this.GenerationEnvironment.ToString();
141 [global::System.CodeDom.Compiler.GeneratedCodeAttribute(
"Microsoft.VisualStudio.TextTemplating",
"11.0.0.0")]
142 internal class ShaderKeySourceGeneratorBase
145 private global::System.Text.StringBuilder generationEnvironmentField;
146 private global::System.CodeDom.Compiler.CompilerErrorCollection errorsField;
147 private global::System.Collections.Generic.List<
int> indentLengthsField;
148 private string currentIndentField =
"";
149 private bool endsWithNewline;
150 private global::System.Collections.Generic.IDictionary<string,
object> sessionField;
156 protected System.Text.StringBuilder GenerationEnvironment
160 if ((this.generationEnvironmentField == null))
162 this.generationEnvironmentField =
new global::System.Text.StringBuilder();
164 return this.generationEnvironmentField;
168 this.generationEnvironmentField = value;
174 public System.CodeDom.Compiler.CompilerErrorCollection Errors
178 if ((this.errorsField == null))
180 this.errorsField =
new global::System.CodeDom.Compiler.CompilerErrorCollection();
182 return this.errorsField;
188 private System.Collections.Generic.List<
int> indentLengths
192 if ((this.indentLengthsField == null))
194 this.indentLengthsField =
new global::System.Collections.Generic.List<
int>();
196 return this.indentLengthsField;
202 public string CurrentIndent
206 return this.currentIndentField;
212 public virtual global::System.Collections.Generic.IDictionary<string,
object>
Session
216 return this.sessionField;
220 this.sessionField = value;
224 #region Transform-time helpers
228 public void Write(
string textToAppend)
230 if (
string.IsNullOrEmpty(textToAppend))
236 if (((this.GenerationEnvironment.Length == 0)
237 ||
this.endsWithNewline))
239 this.GenerationEnvironment.Append(this.currentIndentField);
240 this.endsWithNewline =
false;
243 if (textToAppend.EndsWith(global::System.Environment.NewLine, global::System.StringComparison.CurrentCulture))
245 this.endsWithNewline =
true;
249 if ((this.currentIndentField.Length == 0))
251 this.GenerationEnvironment.Append(textToAppend);
255 textToAppend = textToAppend.Replace(global::System.Environment.NewLine, (global::System.Environment.NewLine + this.currentIndentField));
258 if (this.endsWithNewline)
260 this.GenerationEnvironment.Append(textToAppend, 0, (textToAppend.Length - this.currentIndentField.Length));
264 this.GenerationEnvironment.Append(textToAppend);
270 public void WriteLine(
string textToAppend)
272 this.Write(textToAppend);
273 this.GenerationEnvironment.AppendLine();
274 this.endsWithNewline =
true;
279 public void Write(
string format, params
object[] args)
281 this.Write(string.Format(global::System.Globalization.CultureInfo.CurrentCulture,
format, args));
286 public void WriteLine(
string format, params
object[] args)
288 this.WriteLine(string.Format(global::System.Globalization.CultureInfo.CurrentCulture,
format, args));
293 public void Error(
string message)
295 System.CodeDom.Compiler.CompilerError error =
new global::System.CodeDom.Compiler.CompilerError();
296 error.ErrorText = message;
297 this.Errors.Add(error);
302 public void Warning(
string message)
304 System.CodeDom.Compiler.CompilerError error =
new global::System.CodeDom.Compiler.CompilerError();
305 error.ErrorText = message;
306 error.IsWarning =
true;
307 this.Errors.Add(error);
312 public void PushIndent(
string indent)
314 if ((indent == null))
316 throw new global::System.ArgumentNullException(
"indent");
318 this.currentIndentField = (this.currentIndentField + indent);
319 this.indentLengths.Add(indent.Length);
324 public string PopIndent()
326 string returnValue =
"";
327 if ((this.indentLengths.Count > 0))
329 int indentLength = this.indentLengths[(this.indentLengths.Count - 1)];
330 this.indentLengths.RemoveAt((this.indentLengths.Count - 1));
331 if ((indentLength > 0))
333 returnValue = this.currentIndentField.Substring((this.currentIndentField.Length - indentLength));
334 this.currentIndentField = this.currentIndentField.Remove((this.currentIndentField.Length - indentLength));
342 public void ClearIndent()
344 this.indentLengths.Clear();
345 this.currentIndentField =
"";
348 #region ToString Helpers
354 private System.IFormatProvider formatProviderField = global::System.Globalization.CultureInfo.InvariantCulture;
358 public System.IFormatProvider FormatProvider
362 return this.formatProviderField ;
368 this.formatProviderField = value;
377 if ((objectToConvert == null))
379 throw new global::System.ArgumentNullException(
"objectToConvert");
381 System.Type t = objectToConvert.GetType();
382 System.Reflection.MethodInfo method = t.GetMethod(
"ToString",
new System.Type[] {
383 typeof(System.IFormatProvider)});
384 if ((method == null))
386 return objectToConvert.ToString();
390 return ((
string)(method.Invoke(objectToConvert,
new object[] {
391 this.formatProviderField })));
395 private ToStringInstanceHelper toStringHelperField =
new ToStringInstanceHelper();
399 public ToStringInstanceHelper ToStringHelper
403 return this.toStringHelperField;
string ToStringWithCulture(object objectToConvert)
This is called from the compile/run appdomain to convert objects within an expression block to a stri...
Utility class to produce culture-oriented representation of an object as a string.
An error message (level 4).
_In_ size_t _In_ size_t _In_ DXGI_FORMAT format
The template can be applied to an existing PackageSession.
A warning message (level 3).