Tuesday

template engine .net

 
using System.Collections;

namespace Business.CustomerServices
{
public class SimpleTemplateEngine
{

public string ReadFile(string f)
{
System.IO.StreamReader file = new System.IO.StreamReader(f);
string testxmldata = file.ReadToEnd(); file.Close();
return testxmldata;
}


public string RenderFile(Hashtable values, string fileName)
{
return Render(values, ReadFile(fileName));
}


public string Render(Hashtable values, string template)
{
foreach (DictionaryEntry entry in values)
{
template = template.Replace("{$" + entry.Key + "}",""+ entry.Value);
}
return template;
}

}

}

No comments:

imagemagic add text to image

rem different types of text annotations on existing images rem cyan yellow orange gold rem -gravity SouthWest rem draw text and anno...