Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Newer
Older
100644 36 lines (31 sloc) 0.873 kb
d9ec7e3 @jkbbwr Committing the new version!
authored
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 using System.IO;
6
7 using Antlr3.ST;
8 using Antlr3.ST.Language;
9
10 namespace TaoEngine
11 {
12 class FileTemplate : ITemplate
13 {
14 private string path;
15 private StreamReader fileobj;
16 private string content;
17
18 public FileTemplate(string path)
19 {
20 this.path = path;
21 this.fileobj = new StreamReader(path);
22 this.content = this.fileobj.ReadToEnd();
23 }
24
25 public string render(Dictionary<string, string> nmspace)
26 {
27 StringTemplate template = new StringTemplate(this.content, typeof(TemplateLexer));
28 foreach (String key in nmspace.Keys)
29 {
30 template.SetAttribute(key, nmspace[key]);
31 }
32 return template.ToString();
33 }
34 }
35 }
Something went wrong with that request. Please try again.