[VB.Net] CodeSyntax - BBcode Syntax Highlighter v1.0 05-31-2011, 10:08 AM
#1
CodeSyntax - BBcode Syntax Highlighter v1.0
![[Image: cSGwF.png]](http://i.imgur.com/cSGwF.png)
![[Image: cSGwF.png]](http://i.imgur.com/cSGwF.png)
Info:
CodeSyntax is a BBcode highlighter for languages like VB.Net and C#.
Since we do not have codeblock for programming languages and [php] codeblock looks confusing to recreate, I made this for syntax highlighting.
You can probably fool the program in one way or the other if you look carefully, so don't get too over-excited and shout "BUGGY" on top of your lungs. Just post here and I'll try to fix them.

Input:
Code:
If ArrLines(intL).Contains("//") AndAlso ArrLines(intL).Contains("""//""") = False Then
ArrWords(intW) = "[color=#32CD32]" & ArrWords(intW) & "[/color]"
Else
If My.Resources.csharpSyntax.Contains(ArrWords(intW)) Then
ArrWords(intW) = "[color=#87CEEB]" & ArrWords(intW) & "[/color]"
'Else
' ArrWords(intW) = ArrWords(intW)
End If
End IfOutput:
If ArrLines(intL).Contains("//") AndAlso ArrLines(intL).Contains("""//""") = False Then
ArrWords(intW) = "[color=# 32CD32]" & ArrWords(intW) & "[/ color]"
Else
If My.Resources.csharpSyntax.Contains(ArrWords(intW)) Then
ArrWords(intW) = "[color=# 87CEEB]" & ArrWords(intW) & "[/ color]"
'Else
' ArrWords(intW) = ArrWords(intW)
End If
End If
[link=http://hotfile.com/dl/119439886/9a59567/CodeSyntax.exe.html]![[Image: Download.png]](http://c.imagehost.org/0663/Download.png)
CodeSyntax - BBcode Syntax Highlighter v1.0 (69 Kb)
[/link]
![[Image: Download.png]](http://c.imagehost.org/0663/Download.png)
CodeSyntax - BBcode Syntax Highlighter v1.0 (69 Kb)
[/link]
Spoiler: Source
Code:
Private Sub btnMain_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnVBnet.Click, btnCsharp.Click
Dim ArrLines As String() = richText.Lines
Dim tempBuilder As New System.Text.StringBuilder
For intL As Integer = 0 To ArrLines.Length - 1
Dim ArrWords As String() = ArrLines(intL).Split(" ")
If ArrWords.Length > 1 Then
For intW As Integer = 0 To ArrWords.Length - 1
If ArrWords(intW).Length > 0 Then
If CType(sender, Button).Text = "C#" Then
If ArrLines(intL).Contains("//") AndAlso ArrLines(intL).Contains("""//""") = False Then
ArrWords(intW) = "[color=#32CD32]" & ArrWords(intW) & "[/color]"
Else
If My.Resources.csharpSyntax.Contains(ArrWords(intW)) Then
ArrWords(intW) = "[color=#87CEEB]" & ArrWords(intW) & "[/color]"
End If
End If
Else
If ArrLines(intL).Contains("'") AndAlso ArrLines(intL).Contains("""'""") = False Then
ArrWords(intW) = "[color=#32CD32]" & ArrWords(intW) & "[/color]"
Else
If My.Resources.vbSyntax.Contains(ArrWords(intW)) Then
ArrWords(intW) = "[color=#87CEEB]" & ArrWords(intW) & "[/color]"
End If
End If
End If
End If
tempBuilder.Append(ArrWords(intW) & " ")
Next
End If
tempBuilder.Append(vbCrLf)
Next
richText.Text = tempBuilder.ToString
End SubNote:
Tabs and spaces in code are not preserved since no current MyBB codeblock provides blank space preservation other than [code] ( it ignores every BBcode so it doesn't matter).
This is a huge problem and a big code output from CodeSyntax looks confusing without blank spaces. Unfortunately nothing can be done for it currently.
![[Image: rytwG00.png]](http://i.imgur.com/rytwG00.png)
Redcat Revolution!





![[+]](https://sinister.li/images/modern/collapse_collapsed.png)