-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathEscherRecordTreeNode.cs
59 lines (53 loc) · 1.69 KB
/
EscherRecordTreeNode.cs
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
50
51
52
53
54
55
56
57
58
59
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using NPOI.DDF;
namespace NPOI.Tools.POIFSExplorer
{
public class EscherRecordTreeNode : AbstractRecordTreeNode
{
public EscherRecordTreeNode(EscherRecord record)
{
this.Record = record;
this.Text = record.GetType().Name;
if(record.ChildRecords.Count>0)
this.ImageKey = "Folder";
else
this.ImageKey = "Binary";
if (record is AbstractEscherOptRecord)
{
AbstractEscherOptRecord rec = ((AbstractEscherOptRecord)record);
foreach (EscherProperty ep in rec.EscherProperties )
{
EscherPropertyTreeNode cnode = new EscherPropertyTreeNode(ep);
this.Nodes.Add(cnode);
}
}
else
{
GetChildren(this);
}
}
private void GetChildren(EscherRecordTreeNode node)
{
EscherRecord record=((EscherRecord)node.Record);
for (int i = 0; i < record.ChildRecords.Count; i++)
{
EscherRecordTreeNode cnode=new EscherRecordTreeNode((EscherRecord)record.ChildRecords[i]);
this.Nodes.Add(cnode);
}
}
public override byte[] GetBytes()
{
EscherRecord record=(EscherRecord)this.Record;
byte[] bytes=new byte[record.RecordSize];
record.Serialize(0, bytes);
return bytes;
}
public override bool HasBinary
{
get { return true; }
}
}
}