forked from Particular/ServiceInsight
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathCodeBlockPresenter.cs
More file actions
33 lines (29 loc) · 812 Bytes
/
CodeBlockPresenter.cs
File metadata and controls
33 lines (29 loc) · 812 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
using System.Windows.Documents;
namespace NServiceBus.Profiler.Desktop.CodeParser
{
public class CodeBlockPresenter
{
public CodeBlockPresenter()
: this(CodeLanguage.Plain)
{
}
public CodeBlockPresenter(CodeLanguage language)
{
CodeLanguage = language;
}
public void FillInlines(string text, InlineCollection collection)
{
text = text.Replace("\r", "");
var codeLexem = new CodeLexem(text);
var list = codeLexem.Parse(CodeLanguage);
foreach (CodeLexem current in list)
{
collection.Add(current.ToInline(CodeLanguage));
}
}
public CodeLanguage CodeLanguage
{
get; set;
}
}
}