Free cookie consent management tool by TermsFeed Policy Generator

source: branches/SimulationCore/HeuristicLab.SimulationCore.Dsl/Dsl/GeneratedCode/DirectiveProcessor.cs @ 10525

Last change on this file since 10525 was 10525, checked in by abeham, 10 years ago

#1610: added visual model

File size: 25.4 KB
Line 
1//------------------------------------------------------------------------------
2// <auto-generated>
3//     This code was generated by a tool.
4//
5//     Changes to this file may cause incorrect behavior and will be lost if
6//     the code is regenerated.
7// </auto-generated>
8//------------------------------------------------------------------------------
9namespace HeuristicLab.SimulationCore
10{
11  #region Using directives
12  using DslModeling = global::Microsoft.VisualStudio.Modeling;
13  using DslValidation = global::Microsoft.VisualStudio.Modeling.Validation;
14  using VSTextTemplating = global::Microsoft.VisualStudio.TextTemplating;
15  #endregion
16 
17  /// <summary>
18  /// Double-derived template directive processor that provides HLSim files
19  /// The implementation is done in HLSimDirectiveProcessorBase. This class
20  /// exist so users can customize behavior easily.
21  /// </summary>
22  public sealed partial class HLSimDirectiveProcessor : HLSimDirectiveProcessorBase
23  {
24    /// <summary>
25    /// Constructor
26    /// </summary>
27    public HLSimDirectiveProcessor()
28      : base()
29    {
30    }
31  }
32 
33  /// <summary>
34  /// Base implementation for template directive processor that provides HLSim files
35  /// </summary>
36  public class HLSimDirectiveProcessorBase : VSTextTemplating::RequiresProvidesDirectiveProcessor
37  {
38    /// <summary>
39    /// The friendly name of this processor.
40    /// </summary>
41    public const string HLSimDirectiveProcessorName = "HLSimDirectiveProcessor";
42 
43    /// <summary>
44    /// The name for the requires parameter that provides the filename of the model
45    /// </summary>
46    private const string requiresFileParameter = "FileName";
47 
48    /// <summary>
49    /// The name for the requires parameter that provides the validation categories to run.
50    /// The value for this parameter defaults to String.Empty
51    /// </summary>
52    private const string requiresValidationParameter = "Validation";
53 
54    /// <summary>
55    /// The name for the provides parameter whose value decides the name of the property
56    /// generated by this DirectiveProcessor. The property returns the root element of
57    /// the model in the given file.
58    /// </summary>
59    private const string providesModelParameter = "SimulationModel";
60 
61    /// <summary>
62    /// The default value of the provides parameter above. It defaults to the name of
63    /// the parameter itself.
64    /// </summary>
65    private const string defaultProvidesModelParameter = providesModelParameter;
66 
67    /// <summary>
68    /// The directive name that is supported by this direcive processor. This defaults
69    /// to the name of the model.
70    /// </summary>
71    private const string supportedDirectiveName = "HLSim";
72   
73    /// <summary>
74    /// Flag to ensure that some code is only generated once regardless of how many times the processor is used.
75    /// </summary>
76    private bool oneTimeCodeGenerated;
77   
78    /// <summary>
79    /// Constructor
80    /// </summary>
81    public HLSimDirectiveProcessorBase()
82      : base()
83    {
84    }
85 
86    /// <summary>
87    /// The friendly name of this processor.
88    /// </summary>
89    protected override string FriendlyName
90    {
91      get
92      {
93        return HLSimDirectiveProcessorName;
94      }
95    }
96 
97    /// <summary>
98    /// Check if the directive name is supported by this directive processor
99    /// </summary>
100    /// <param name="directiveName"></param>
101    /// <returns></returns>
102    public override bool IsDirectiveSupported(string directiveName)
103    {
104      return (global::System.StringComparer.OrdinalIgnoreCase.Compare(directiveName, supportedDirectiveName) == 0);
105    }
106 
107    /// <summary>
108    /// Override StartProcessingRun to reset the helpers flag.
109    /// </summary>
110    /// <param name="languageProvider"></param>
111    /// <param name="templateContents"></param>
112    /// <param name="errors"></param>
113    public override void StartProcessingRun(global::System.CodeDom.Compiler.CodeDomProvider languageProvider, string templateContents, global::System.CodeDom.Compiler.CompilerErrorCollection errors)
114    {
115      this.oneTimeCodeGenerated = false;
116      base.StartProcessingRun(languageProvider, templateContents, errors);
117    }
118 
119 
120    /// <summary>
121    /// Override to initialize requires dictionary
122    /// </summary>
123    /// <param name="directiveName"></param>
124    /// <param name="requiresDictionary"></param>
125    protected override void InitializeRequiresDictionary(string directiveName, global::System.Collections.Generic.IDictionary<string, string> requiresDictionary)
126    {
127      if ((global::System.StringComparer.OrdinalIgnoreCase.Compare(directiveName, supportedDirectiveName) == 0))
128      {
129        requiresDictionary[requiresFileParameter] = null;
130        requiresDictionary[requiresValidationParameter] = "";
131      }
132    }
133 
134    /// <summary>
135    /// Override to initialize provides dictinoary
136    /// </summary>
137    /// <param name="directiveName"></param>
138    /// <param name="providesDictionary"></param>
139    protected override void InitializeProvidesDictionary(string directiveName, global::System.Collections.Generic.IDictionary<string, string> providesDictionary)
140    {
141      if ((global::System.StringComparer.OrdinalIgnoreCase.Compare(directiveName, supportedDirectiveName) == 0))
142      {
143        providesDictionary[providesModelParameter] = defaultProvidesModelParameter;
144      }
145    }
146 
147    /// <summary>
148    /// Generate the code to access the model. Use to CodeDomProvider so we are language-agnostic
149    /// </summary>
150    /// <param name="directiveName"></param>
151    /// <param name="codeBuffer"></param>
152    /// <param name="languageProvider"></param>
153    /// <param name="requiresArguments"></param>
154    /// <param name="providesArguments"></param>
155    [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Justification = "Generated code is not meant for normalization purpose.")]
156    [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling", Justification = "Generated code.")]
157    protected override void GenerateTransformCode(string directiveName, global::System.Text.StringBuilder codeBuffer, global::System.CodeDom.Compiler.CodeDomProvider languageProvider, global::System.Collections.Generic.IDictionary<string, string> requiresArguments, global::System.Collections.Generic.IDictionary<string, string> providesArguments)
158    {
159      if ((global::System.StringComparer.OrdinalIgnoreCase.Compare(directiveName, supportedDirectiveName) == 0))
160      {
161        if (languageProvider != null)
162        {
163          // Create a field to store the model once it is loaded
164          global::System.CodeDom.CodeMemberField rootElement = new global::System.CodeDom.CodeMemberField();
165          rootElement.Name = providesArguments[providesModelParameter].ToLower(global::System.Globalization.CultureInfo.InvariantCulture) + "Value";
166          rootElement.Type = new global::System.CodeDom.CodeTypeReference(typeof(global::HeuristicLab.SimulationCore.SimulationModel));
167          rootElement.Attributes = global::System.CodeDom.MemberAttributes.Private;
168 
169          // Create a property for the Model that delay-loads the model
170          global::System.CodeDom.CodeMemberProperty rootElementProperty = new global::System.CodeDom.CodeMemberProperty();
171          rootElementProperty.Name = providesArguments[providesModelParameter];
172          rootElementProperty.Type = new global::System.CodeDom.CodeTypeReference(typeof(global::HeuristicLab.SimulationCore.SimulationModel));
173          rootElementProperty.Attributes = global::System.CodeDom.MemberAttributes.Private;
174          rootElementProperty.HasSet = false;
175          rootElementProperty.HasGet = true;
176          rootElementProperty.GetStatements.Add(new global::System.CodeDom.CodeMethodReturnStatement(new global::System.CodeDom.CodeFieldReferenceExpression(new global::System.CodeDom.CodeThisReferenceExpression(), rootElement.Name)));
177 
178          // Create a helper method for resolving relative paths
179          global::System.CodeDom.CodeMemberMethod resolver = null;
180          if (!this.oneTimeCodeGenerated && global::System.IO.File.Exists(this.Host.TemplateFile))
181          {
182            resolver = new global::System.CodeDom.CodeMemberMethod();
183            resolver.Name = "Convert" + "SimulationModel" + "RelativePathToTemplateRelativePath";
184            resolver.ReturnType = new global::System.CodeDom.CodeTypeReference(typeof(string));
185            resolver.Parameters.Add(new global::System.CodeDom.CodeParameterDeclarationExpression(typeof(string), "path"));
186            resolver.Attributes = global::System.CodeDom.MemberAttributes.Public;
187            global::System.CodeDom.CodeVariableDeclarationStatement declaration = new global::System.CodeDom.CodeVariableDeclarationStatement(typeof(string), "modelPath", new global::System.CodeDom.CodePrimitiveExpression((string)(requiresArguments[requiresFileParameter])));
188            resolver.Statements.Add(declaration);
189            declaration = new global::System.CodeDom.CodeVariableDeclarationStatement(typeof(string), "templatePath", new global::System.CodeDom.CodePrimitiveExpression((string)(this.Host.TemplateFile)));
190            resolver.Statements.Add(declaration);
191            global::System.CodeDom.CodeMethodReturnStatement returnStatement = new global::System.CodeDom.CodeMethodReturnStatement(
192              new global::System.CodeDom.CodeMethodInvokeExpression(
193                new global::System.CodeDom.CodeMethodReferenceExpression(new global::System.CodeDom.CodeTypeReferenceExpression("Microsoft.VisualStudio.TextTemplating.VSHost.ModelingTextTransformation"), "ConvertModelRelativePathToTemplateRelativePath"),
194                new global::System.CodeDom.CodeVariableReferenceExpression("modelPath"),
195                new global::System.CodeDom.CodeVariableReferenceExpression("templatePath"),
196                new global::System.CodeDom.CodeVariableReferenceExpression("path")));
197            resolver.Statements.Add(returnStatement);
198          }
199 
200          // Generate the actual code using the CodeDomProvider
201          global::System.CodeDom.Compiler.CodeGeneratorOptions options = new global::System.CodeDom.Compiler.CodeGeneratorOptions();
202          options.BlankLinesBetweenMembers = true;
203          options.IndentString = "    ";
204          options.VerbatimOrder = true;
205          options.BracingStyle = "C";
206          using (global::System.IO.StringWriter writer = new global::System.IO.StringWriter(codeBuffer, global::System.Globalization.CultureInfo.InvariantCulture))
207          {
208            languageProvider.GenerateCodeFromMember(rootElement, writer, options);
209            languageProvider.GenerateCodeFromMember(rootElementProperty, writer, options);
210            if (resolver != null)
211            {
212              languageProvider.GenerateCodeFromMember(resolver, writer, options);
213            }
214          }
215          this.oneTimeCodeGenerated = true;
216        }
217      }
218    }
219 
220    /// <summary>
221    /// Contribute additively to initialization code for the TextTransformation generated class.
222    /// </summary>
223    /// <remarks>
224    /// This code will be added before the call to the base class.
225    /// </remarks>
226    /// <param name="directiveName"></param>
227    /// <param name="codeBuffer"></param>
228    /// <param name="languageProvider"></param>
229    /// <param name="requiresArguments"></param>
230    /// <param name="providesArguments"></param>
231    protected override void GeneratePreInitializationCode(string directiveName, global::System.Text.StringBuilder codeBuffer, global::System.CodeDom.Compiler.CodeDomProvider languageProvider, global::System.Collections.Generic.IDictionary<string, string> requiresArguments, global::System.Collections.Generic.IDictionary<string, string> providesArguments)
232    {
233      if ((global::System.StringComparer.OrdinalIgnoreCase.Compare(directiveName, supportedDirectiveName) == 0))
234      {
235        if (languageProvider != null)
236        {
237          string[] domainModels = {
238            "HeuristicLab.SimulationCore.HLSimDomainModel",
239          };
240 
241          global::System.CodeDom.Compiler.CodeGeneratorOptions options = new global::System.CodeDom.Compiler.CodeGeneratorOptions();
242          options.BlankLinesBetweenMembers = true;
243          options.IndentString = "    ";
244          options.VerbatimOrder = true;
245          options.BracingStyle = "C";
246          using (global::System.IO.StringWriter writer = new global::System.IO.StringWriter(codeBuffer, global::System.Globalization.CultureInfo.InvariantCulture))
247          {
248            foreach (string domainModel in domainModels)
249            {
250              global::System.CodeDom.CodeExpressionStatement addModel = new global::System.CodeDom.CodeExpressionStatement(new global::System.CodeDom.CodeMethodInvokeExpression(new global::System.CodeDom.CodeMethodReferenceExpression(new global::System.CodeDom.CodeThisReferenceExpression(), "AddDomainModel"), new global::System.CodeDom.CodeTypeOfExpression(domainModel)));
251              languageProvider.GenerateCodeFromStatement(addModel, writer, options);
252            }
253          }
254        }
255      }
256    }
257   
258    /// <summary>
259    /// Property that indicates whether this directive processor needs access to diagram data as well as
260    /// model data.  Normally, this is not the case so the default value of this property is false.
261    /// Derived classes may override this property to change the value.
262    /// </summary>
263    protected virtual bool LoadDiagramData
264    {
265      get
266      {
267        return false;
268      }
269    }
270 
271    /// <summary>
272    /// Contribute additively to initialization code for the TextTransformation generated class.
273    /// </summary>
274    /// <remarks>
275    /// This code will be added after the call to the base class.
276    /// </remarks>
277    /// <param name="directiveName"></param>
278    /// <param name="codeBuffer"></param>
279    /// <param name="languageProvider"></param>
280    /// <param name="requiresArguments"></param>
281    /// <param name="providesArguments"></param>
282    [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Globalization", "CA1308:NormalizeStringsToUppercase", Justification = "Generated code is not meant for normalization purpose.")]
283    [global::System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Maintainability", "CA1506:AvoidExcessiveClassCoupling", Justification = "Generated code.")]
284    protected override void GeneratePostInitializationCode(string directiveName, global::System.Text.StringBuilder codeBuffer, global::System.CodeDom.Compiler.CodeDomProvider languageProvider, global::System.Collections.Generic.IDictionary<string, string> requiresArguments, global::System.Collections.Generic.IDictionary<string, string> providesArguments)
285    {
286      if ((global::System.StringComparer.OrdinalIgnoreCase.Compare(directiveName, supportedDirectiveName) == 0))
287      {
288        // We check the encoding of the model file, and ask the host to use that
289        // encoding to write the output. This is to make sure we use the correct encoding
290        // if the model file contains international characters that could be used in
291        // the template output.
292        string fileName = requiresArguments[requiresFileParameter];
293        if (!string.IsNullOrEmpty(fileName) && global::System.IO.File.Exists(fileName))
294        {
295          Host.SetOutputEncoding(VSTextTemplating::EncodingHelper.GetEncoding(fileName), false);
296        }
297 
298        if (languageProvider != null)
299        {
300          global::System.CodeDom.CodeMethodInvokeExpression invokeLoad;
301          global::System.String transactionName = providesArguments[providesModelParameter].ToLower(global::System.Globalization.CultureInfo.InvariantCulture) + "Transaction";
302          global::System.CodeDom.CodeVariableDeclarationStatement transactionDeclaration = new global::System.CodeDom.CodeVariableDeclarationStatement(new global::System.CodeDom.CodeTypeReference(typeof(DslModeling::Transaction)), transactionName, new global::System.CodeDom.CodePrimitiveExpression(null));
303          global::System.CodeDom.CodeStatement finallyStatement = new global::System.CodeDom.CodeConditionStatement(new global::System.CodeDom.CodeBinaryOperatorExpression(new global::System.CodeDom.CodeVariableReferenceExpression(transactionName), global::System.CodeDom.CodeBinaryOperatorType.IdentityInequality, new global::System.CodeDom.CodePrimitiveExpression(null)), new global::System.CodeDom.CodeExpressionStatement(new global::System.CodeDom.CodeMethodInvokeExpression(new global::System.CodeDom.CodeVariableReferenceExpression(transactionName), "Dispose")));
304          global::System.Collections.Generic.List<global::System.CodeDom.CodeStatement> txTryStatements = new global::System.Collections.Generic.List<global::System.CodeDom.CodeStatement>();
305          global::System.CodeDom.CodeVariableDeclarationStatement serializationResultDeclaration = new global::System.CodeDom.CodeVariableDeclarationStatement(new global::System.CodeDom.CodeTypeReference(typeof(DslModeling::SerializationResult)), "serializationResult", new global::System.CodeDom.CodeObjectCreateExpression(new global::System.CodeDom.CodeTypeReference(typeof(DslModeling::SerializationResult))));
306 
307          global::System.CodeDom.CodeMethodInvokeExpression invokeEnableDiagramRules = null;
308          global::System.CodeDom.CodeVariableDeclarationStatement diagramFileDeclaration = null;
309          global::System.CodeDom.CodeAssignStatement diagramFileAssign = null;
310          if(LoadDiagramData)
311          {
312            // generate code to enable diagram fixup rules and load the diagram if required.
313            invokeEnableDiagramRules = new global::System.CodeDom.CodeMethodInvokeExpression(
314              new global::System.CodeDom.CodeMethodReferenceExpression(new global::System.CodeDom.CodeTypeReferenceExpression("HLSimDomainModel"), "EnableDiagramRules"), new global::System.CodeDom.CodePropertyReferenceExpression(new global::System.CodeDom.CodeThisReferenceExpression(), "Store"));
315            diagramFileDeclaration = new global::System.CodeDom.CodeVariableDeclarationStatement(new global::System.CodeDom.CodeTypeReference("System.String"), "diagramFileName");
316            diagramFileAssign = new global::System.CodeDom.CodeAssignStatement(new global::System.CodeDom.CodeVariableReferenceExpression("diagramFileName"), new global::System.CodeDom.CodeBinaryOperatorExpression(new global::System.CodeDom.CodePrimitiveExpression(requiresArguments[requiresFileParameter]), global::System.CodeDom.CodeBinaryOperatorType.Add, new global::System.CodeDom.CodePrimitiveExpression(".diagram")));
317            invokeLoad = new global::System.CodeDom.CodeMethodInvokeExpression(
318              new global::System.CodeDom.CodeMethodReferenceExpression(new global::System.CodeDom.CodeFieldReferenceExpression(new global::System.CodeDom.CodeTypeReferenceExpression(typeof(HLSimSerializationHelper)), "Instance"), "LoadModelAndDiagram"), new global::System.CodeDom.CodeVariableReferenceExpression("serializationResult"), new global::System.CodeDom.CodePropertyReferenceExpression(new global::System.CodeDom.CodeThisReferenceExpression(), "Store"), new global::System.CodeDom.CodePrimitiveExpression(requiresArguments[requiresFileParameter]), new global::System.CodeDom.CodeVariableReferenceExpression("diagramFileName"), new global::System.CodeDom.CodePrimitiveExpression(null), new global::System.CodeDom.CodePrimitiveExpression(null), new global::System.CodeDom.CodePrimitiveExpression(null));
319          }
320          else
321          {
322            invokeLoad = new global::System.CodeDom.CodeMethodInvokeExpression(
323              new global::System.CodeDom.CodeMethodReferenceExpression(new global::System.CodeDom.CodeFieldReferenceExpression(new global::System.CodeDom.CodeTypeReferenceExpression(typeof(HLSimSerializationHelper)), "Instance"), "LoadModel"), new global::System.CodeDom.CodeVariableReferenceExpression("serializationResult"), new global::System.CodeDom.CodePropertyReferenceExpression(new global::System.CodeDom.CodeThisReferenceExpression(), "Store"), new global::System.CodeDom.CodePrimitiveExpression(requiresArguments[requiresFileParameter]), new global::System.CodeDom.CodePrimitiveExpression(null), new global::System.CodeDom.CodePrimitiveExpression(null), new global::System.CodeDom.CodePrimitiveExpression(null));
324          }
325 
326          global::System.CodeDom.CodeAssignStatement loadAssign = new global::System.CodeDom.CodeAssignStatement(new global::System.CodeDom.CodeFieldReferenceExpression(new global::System.CodeDom.CodeThisReferenceExpression(), providesArguments[providesModelParameter].ToLower(global::System.Globalization.CultureInfo.InvariantCulture) + "Value"), invokeLoad);
327          txTryStatements.Add(serializationResultDeclaration);
328          txTryStatements.Add(new global::System.CodeDom.CodeAssignStatement(new global::System.CodeDom.CodeVariableReferenceExpression(transactionName), new global::System.CodeDom.CodeMethodInvokeExpression(new global::System.CodeDom.CodePropertyReferenceExpression(new global::System.CodeDom.CodePropertyReferenceExpression(new global::System.CodeDom.CodeThisReferenceExpression(), "Store"), "TransactionManager"), "BeginTransaction", new global::System.CodeDom.CodePrimitiveExpression("Load"), new global::System.CodeDom.CodePrimitiveExpression(true))));
329          txTryStatements.Add(loadAssign);
330          global::System.CodeDom.CodeConditionStatement serializationResultCheck = new global::System.CodeDom.CodeConditionStatement(
331            new global::System.CodeDom.CodePropertyReferenceExpression(new global::System.CodeDom.CodeVariableReferenceExpression("serializationResult"), "Failed"),
332            new global::System.CodeDom.CodeThrowExceptionStatement(new global::System.CodeDom.CodeObjectCreateExpression(new global::System.CodeDom.CodeTypeReference(typeof(DslModeling::SerializationException)), new global::System.CodeDom.CodeVariableReferenceExpression("serializationResult")))
333          );
334          txTryStatements.Add(serializationResultCheck);
335          txTryStatements.Add(new global::System.CodeDom.CodeExpressionStatement(new global::System.CodeDom.CodeMethodInvokeExpression(new global::System.CodeDom.CodeVariableReferenceExpression(transactionName), "Commit")));
336          global::System.CodeDom.CodeTryCatchFinallyStatement txTryStatement = new global::System.CodeDom.CodeTryCatchFinallyStatement(txTryStatements.ToArray(), new global::System.CodeDom.CodeCatchClause[] { }, new global::System.CodeDom.CodeStatement[] { finallyStatement });
337 
338 
339          // We check if the user has requested validation to be performed. If so, we call
340          // ValidateStore() on the base ModelingTextTransformation class.
341          string validationCategories = requiresArguments[requiresValidationParameter];
342          global::System.CodeDom.CodeMethodInvokeExpression validationInvoke = null;
343          if (!string.IsNullOrEmpty(validationCategories))
344          {
345            validationInvoke = new global::System.CodeDom.CodeMethodInvokeExpression(new global::System.CodeDom.CodeThisReferenceExpression(), "ValidateStore", new global::System.CodeDom.CodePrimitiveExpression(validationCategories), new global::System.CodeDom.CodePropertyReferenceExpression(new global::System.CodeDom.CodeThisReferenceExpression(), "Errors"));
346          }
347 
348          global::System.CodeDom.Compiler.CodeGeneratorOptions options = new global::System.CodeDom.Compiler.CodeGeneratorOptions();
349          options.BlankLinesBetweenMembers = true;
350          options.IndentString = "    ";
351          options.VerbatimOrder = true;
352          options.BracingStyle = "C";
353          using (global::System.IO.StringWriter writer = new global::System.IO.StringWriter(codeBuffer, global::System.Globalization.CultureInfo.InvariantCulture))
354          {
355            if(invokeEnableDiagramRules != null)
356            {
357              languageProvider.GenerateCodeFromStatement(new global::System.CodeDom.CodeExpressionStatement(invokeEnableDiagramRules), writer, options);
358            }
359           
360            if(diagramFileDeclaration != null)
361            {
362              languageProvider.GenerateCodeFromStatement(diagramFileDeclaration, writer, options);
363              languageProvider.GenerateCodeFromStatement(diagramFileAssign, writer, options);
364            }
365           
366            languageProvider.GenerateCodeFromStatement(transactionDeclaration, writer, options);
367            languageProvider.GenerateCodeFromStatement(txTryStatement, writer, options);
368           
369            if (validationInvoke != null)
370            {
371              languageProvider.GenerateCodeFromStatement(new global::System.CodeDom.CodeExpressionStatement(validationInvoke), writer, options);
372            }
373          }
374        }
375      }
376    }
377 
378    /// <summary>
379    /// Process arguments
380    /// </summary>
381    /// <param name="directiveName"></param>
382    /// <param name="requiresArguments"></param>
383    /// <param name="providesArguments"></param>
384    protected override void PostProcessArguments(string directiveName, global::System.Collections.Generic.IDictionary<string, string> requiresArguments, global::System.Collections.Generic.IDictionary<string, string> providesArguments)
385    {
386      if ((global::System.StringComparer.OrdinalIgnoreCase.Compare(directiveName, supportedDirectiveName) == 0))
387      {
388        // Give the host a chance to resolve the fileName
389        requiresArguments[requiresFileParameter] = this.Host.ResolvePath(requiresArguments[requiresFileParameter]);
390      }
391    }
392 
393    /// <summary>
394    /// Return namespace imports necessary for running template
395    /// </summary>
396    /// <returns></returns>
397    public override string[] GetImportsForProcessingRun()
398    {
399      global::System.Collections.Generic.List<string> imports = new global::System.Collections.Generic.List<string>(base.GetImportsForProcessingRun());
400 
401      imports.Add("Microsoft.VisualStudio.Modeling");
402      imports.Add("System.CodeDom.Compiler");
403      imports.Add("HeuristicLab.SimulationCore");
404 
405      return imports.ToArray();
406    }
407 
408    /// <summary>
409    /// Get assembly references needed for running template
410    /// </summary>
411    /// <returns></returns>
412    public override string[] GetReferencesForProcessingRun()
413    {
414      global::System.Collections.Generic.List<string> references = new global::System.Collections.Generic.List<string>(base.GetReferencesForProcessingRun());
415      references.Add(this.GetType().Assembly.Location);
416      references.Add(typeof(global::Microsoft.VisualStudio.Modeling.Diagrams.Diagram).Assembly.Location);
417      references.Add(typeof(DslModeling::Store).Assembly.Location);
418      references.Add("Microsoft.VisualStudio.TextTemplating.Modeling.12.0");
419      return references.ToArray();
420    }
421  }
422}
423
Note: See TracBrowser for help on using the repository browser.