以下是代码片段:
StringWriter textBuffer = new StringWriter();
Match match= Regex.Match(HTMLStr,@"",RegexOptions.IgnoreCase | RegexOptions.Compiled);
if(match==null)
{
Response.Write(HTMLStr);
zurückkehren;
}
string codeType = match.Groups["codeType"].Value;
string content = match.Groups["codeContent"].Value;
if(codeType==String.Empty || content==String.Empty)
{
Response.Write(HTMLStr);
zurückkehren;
}
// MessageBox.Show(codeType);
// MessageBox.Show(content);
string[] sr = content.Split(Convert.ToChar("n"));
if(codeType=="C#")
{
textBuffer.Write("<Csharp>rn");
foreach(string sourceLine in sr)
{
textBuffer.Write(FixCSLine(sourceLine)) ;
textBuffer.Write("rn");
}
textBuffer.Write("</Csharp>");
}
sonst if(codeType=="JScript.Net")
{
textBuffer.Write("<JScript.Net>rn");
foreach(string sourceLine in sr)
{
textBuffer.Write(FixJSLine(sourceLine)) ;
textBuffer.Write("rn");
}
textBuffer.Write("</JScript.Net>");
}
sonst if(codeType=="VB")
{
textBuffer.Write("<VB>rn");
foreach(string sourceLine in sr)
{
textBuffer.Write(FixVBLine(sourceLine)) ;
textBuffer.Write("rn");
}
textBuffer.Write("</VB>");
}