BBCode Parser (in Progress) 

Everu Component includes a BB Code Parser. You can parse a BBCode in 2 Types of Data.The first one is called BBBlockList.
It contains a List, where every Tag-change is a new list element.
Lets look at the follwing BBCode:


Hello [b]from [/b][i]BB[/i][u]code[/u]


With the BBBlockList parser, there would be 4 Element in the List:

  1.  "Hello "
  2. "from " (bold)
  3. "BB" (italic)
  4. "code" (underline)

Now, you have a list, you can convert in inline Element or sth. else.


There are 3 different kind of Tags:

  •  SimpleTag (for example: [br] )
  • ContentTag (for example: [b][/b] )
  • PropertyTag (for example: [url=http:www.codeplex.com]My link[/url])


Another feature of the Parser is that you can define your own BB Tags. (Or you can use the default Tags). This code shows how to define own Tags: 

using EveruComponent.Parser.BBCode;
 BBCodeParser BBParser = new BBCodeParser(false); //If you wanna use the default Tags use "true" as parameter.
BBParser.TagPool.AddDefinition(BBTagDefinitionElement.Create(BBTagDefinition.TagType.ContentTag, "b")); //define a own tag
BBBlockList ActBB = BBParser.ParseToBBList("Hello [b]from [/b][i]BB[/i][u]code[/u]");

The default Tags are:

Content tags:

  • b
  • i
  • u
  • url
  • img
  • quote (no inline support)

Property tags:

  • quote (no inline support)
  • url
  • font
  • color
  • size


Tags who not be defined will not be parsed. (Will treated as normal Text).

To convert the BBBlockList to Inlines use:

List<Inline> Inlines = ActBB.ToInlineList();





The random Class returnes random Numbers. But it use the System.Security.Cryptography.RandomNumberGenerator, so the Random Number are better, especially when you use it with multithreading.

EveruComponent.Random rnd = new EveruComponent.Random();
int i = rnd.NextInt32();

Last edited Jul 23, 2012 at 9:26 AM by Ahn1, version 6


No comments yet.