嘻哈人间,我醉逍遥

while(true){this.StudyDotNet(DotNetLanguage.CSharp);}

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理
核心代码来自AspNetForums.

StringWriter textBuffer = new StringWriter();
Match match= Regex.Match(HTMLStr,@"\",RegexOptions.IgnoreCase | RegexOptions.Compiled);
if(match==null)
{
Response.Write(HTMLStr);
return;
}

string codeType = match.Groups["codeType"].Value;
string content = match.Groups["codeContent"].Value;
if(codeType==String.Empty || content==String.Empty)
{
Response.Write(HTMLStr);
return;
}
// MessageBox.Show(codeType);
// MessageBox.Show(content);
string[] sr = content.Split(Convert.ToChar("\n"));
if(codeType=="C#")
{
textBuffer.Write("<Csharp>\r\n");
foreach(string sourceLine in sr)
{
textBuffer.Write(FixCSLine(sourceLine)) ;
textBuffer.Write("\r\n");
}
textBuffer.Write("</Csharp>");
}
else if(codeType=="JScript.Net")
{
textBuffer.Write("<JScript.Net>\r\n");
foreach(string sourceLine in sr)
{
textBuffer.Write(FixJSLine(sourceLine)) ;
textBuffer.Write("\r\n");
}
textBuffer.Write("</JScript.Net>");
}
else if(codeType=="VB")
{
textBuffer.Write("<VB>\r\n");
foreach(string sourceLine in sr)
{
textBuffer.Write(FixVBLine(sourceLine)) ;
textBuffer.Write("\r\n");
}
textBuffer.Write("</VB>");
}


效果如下:

http://forums.coder.cn/forum/topic.aspx?author_id=2&topic_id=11&category_id=9
posted on 2004-04-17 01:12  嘻哈呵嘿  阅读(876)  评论(2编辑  收藏  举报
欢迎访问无垠IT教学网论坛