Changeset 20715 for lang/csharp
- Timestamp:
- 10/04/08 23:01:35 (2 months ago)
- Location:
- lang/csharp/MMMMB/MMMMB
- Files:
-
- 2 modified
-
MiniBlogView.cs (modified) (1 diff)
-
Template.cs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
lang/csharp/MMMMB/MMMMB/MiniBlogView.cs
r20712 r20715 180 180 Filter deny = Filter.Parse(filterCheck.Checked ? InvokeComboText(denyInput) : ""); 181 181 Filter allow = Filter.Parse(filterCheck.Checked ? InvokeComboText(allowInput) : ""); 182 Template.ClearCache(); 182 183 StringBuilder sb = new StringBuilder(); 183 184 int count = 0; -
lang/csharp/MMMMB/MMMMB/Template.cs
r10019 r20715 9 9 class Template 10 10 { 11 private string tmpl; 11 private static Dictionary<string, string> tmplates = new Dictionary<string,string>(); 12 13 public static void ClearCache() 14 { 15 tmplates.Clear(); 16 } 17 18 private string filename; 12 19 private Dictionary<string, string> values = new Dictionary<string, string>(); 13 20 14 21 public Template(string filename) 15 22 { 16 this.tmpl = File.ReadAllText(filename + ".template"); 23 this.filename = filename + ".template"; 24 if (!tmplates.ContainsKey(this.filename)) 25 { 26 tmplates.Add(this.filename, File.ReadAllText(this.filename)); 27 } 17 28 } 18 29 … … 24 35 public override string ToString() 25 36 { 26 return Regex.Replace(this.tmpl, @"\[\[(.+?)\]\]", new MatchEvaluator(delegate(Match m){ 37 return Regex.Replace(tmplates[this.filename], @"\[\[(.+?)\]\]", new MatchEvaluator(delegate(Match m) 38 { 27 39 string key = m.Groups[1].Value; 28 40 if(!this.values.ContainsKey(key)) return m.Groups[0].Value;
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)