本文整理汇总了C#中Template.getContent方法的典型用法代码示例。如果您正苦于以下问题:C# Template.getContent方法的具体用法?C# Template.getContent怎么用?C# Template.getContent使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Template
的用法示例。
在下文中一共展示了Template.getContent方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Render
static void Render()
{
Template tpl = new Template("default.tpl");
tpl.selectSection ("BLOGGER");
foreach (Blogger b in bloggers.Bloggers) {
tpl.setField ("BLOGGER_ERROR_MSG", b.Error ? error_msg : b.DateError ? date_error_msg : "");
tpl.setField ("BLOGGER_ERROR_IMG", b.Error || b.DateError ? error_img : "");
tpl.setField ("BLOGGER_URL", b.HtmlUrl.ToString ());
tpl.setField ("BLOGGER_NAME", b.Name);
tpl.setField ("BLOGGER_HEAD", ProcessHeadEntryAndReturnUrl (b.Head));
if (b.IrcNick != null)
tpl.setField ("BLOGGER_IRCNICK", b.IrcNick);
else
tpl.setField ("BLOGGER_IRCNICK", String.Empty);
tpl.setField ("BLOGGER_RSSURL", b.RssUrl);
tpl.appendSection ();
}
tpl.deselectSection ();
tpl.selectSection ("BLOG_DAY");
foreach (ArrayList day in GetDaysCollectionList ()) {
tpl.setField ("DAY_DATE", ((RssItem)day [0]).PubDate.Date.ToString ("M"));
tpl.selectSection ("DAY_ENTRY");
foreach (RssItem itm in day) {
tpl.setField ("ENTRY_LINK", itm.Link.ToString ());
Blogger bl = bloggers [itm.Author];
if (bl != null) {
tpl.setField ("ENTRY_PERSON", bl.Name);
if (bl.IrcNick != null)
tpl.setField ("ENTRY_PERSON_IRCNICK", "(" + bl.IrcNick + ")");
else
tpl.setField ("ENTRY_PERSON_IRCNICK", "");
tpl.setField ("ENTRY_PERSON_HEAD", ProcessHeadEntryAndReturnUrl (bl.Head));
tpl.setField ("ENTRY_PERSON_URL", bl.HtmlUrl.ToString());
} else {
throw new Exception ("No blogger for " + itm.Author + ".");
}
itm.Title = itm.Title.Substring (itm.Title.IndexOf (":")+2);
tpl.setField ("ENTRY_TITLE", itm.Title);
tpl.setField ("ENTRY_HTML", itm.Content ?? itm.Description);
tpl.setField ("ENTRY_DATE", itm.PubDate.ToString ("h:mm tt 'GMT'"));
tpl.appendSection ();
}
tpl.deselectSection ();
tpl.appendSection ();
}
tpl.deselectSection ();
TextWriter w = new StreamWriter (File.Create (outputFile));
w.Write (tpl.getContent ());
w.Flush ();
}