以下是代码片段:
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("\r\n");
foreach(string sourceLine in sr)
textBuffer.Write(FixCSLine(sourceLine)) ;
textBuffer.Write("\r\n");
textBuffer.Write(" ");
else if(codeType=="JScript.Net")
textBuffer.Write("\r\n");
foreach(string sourceLine in sr)
textBuffer.Write(FixJSLine(sourceLine)) ;
textBuffer.Write("\r\n");
textBuffer.Write(" ");
else if(codeType=="VB")
textBuffer.Write("\r\n");
foreach(string sourceLine in sr)
textBuffer.Write(FixVBLine(sourceLine)) ;
textBuffer.Write("\r\n");
textBuffer.Write(" ");
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("
foreach(string sourceLine in sr)
textBuffer.Write(FixCSLine(sourceLine)) ;
textBuffer.Write("\r\n");
textBuffer.Write("
else if(codeType=="JScript.Net")
textBuffer.Write("
foreach(string sourceLine in sr)
textBuffer.Write(FixJSLine(sourceLine)) ;
textBuffer.Write("\r\n");
textBuffer.Write("
else if(codeType=="VB")
textBuffer.Write("
foreach(string sourceLine in sr)
textBuffer.Write(FixVBLine(sourceLine)) ;
textBuffer.Write("\r\n");
textBuffer.Write("