Exemplo n.º 1
0
 public virtual int ExecuteTemplate(GenerationHost genHost, string templateFilename, string outputFilename, object[] templateParameters)
 {
     try
     {
         genHost.Initialize(this.Settings);
         genHost.CallTemplateToFile(templateFilename, outputFilename, templateParameters);
         return 0;
     }
     catch (CompilationFailedException ex)
     {
         Console.WriteLine(String.Format("Compilation failed for file: {0}", ex.Filename));
         foreach (CompilerError err in ex.Errors)
         {
             Console.WriteLine(String.Format("{0} {1}: {2}\r\n  \"{3}\", line #{4}",
                 err.IsWarning ? "Warning" : "Error",
                 err.ErrorNumber,
                 err.ErrorText,
                 err.FileName,
                 err.Line));
         }
         return 2;
     }
     catch (RuntimeException ex)
     {
         Console.WriteLine("Runtime exception: ");
         Console.WriteLine(ex.InnerException);
         return 1;
     }
 }
Exemplo n.º 2
0
 public virtual int ExecuteTemplate(GenerationHost genHost)
 {
     return this.ExecuteTemplate(genHost, this.Settings["template"], this.settings["output"], this.TemplateParameters);
 }
Exemplo n.º 3
0
 public TemplateInfo(string filename, GenerationHost host)
 {
     this.templatefileinfo = new FileInfo(filename);
     this.host             = host;
 }