-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMessageNode.cs
More file actions
49 lines (43 loc) · 1.39 KB
/
MessageNode.cs
File metadata and controls
49 lines (43 loc) · 1.39 KB
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Mooege.Net.GS.Message;
using System.Drawing;
namespace GameMessageViewer
{
public class MessageNode : TreeNode, HighlightingNode
{
public GameMessage gameMessage;
public int mStart;
public int mEnd;
public MessageNode(GameMessage message, int start, int end)
{
this.gameMessage = message;
this.mStart = start;
this.mEnd = end;
Text = String.Join(".", (message.GetType().ToString().Split('.').Skip(5)));
}
public new MessageNode Clone()
{
return new MessageNode(gameMessage, mStart, mEnd);
}
public void Highlight(RichTextBox r)
{
this.BackColor = Color.Yellow;
Highlight(r, Color.Green);
}
public void Unhighlight(RichTextBox r)
{
this.BackColor = Color.White;
(Parent as HighlightingNode).Highlight(r);
}
public void Highlight(RichTextBox input, Color color)
{
input.SelectionStart = mStart >> 2;
input.SelectionLength = ((mEnd - mStart) % 4) == 0 ? (mEnd - mStart) >> 2 : ((mEnd - mStart) >> 2) + 1;
input.SelectionBackColor = color;
}
}
}