-
Notifications
You must be signed in to change notification settings - Fork 1
/
LogRoot.cs
83 lines (60 loc) · 1.67 KB
/
LogRoot.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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
using System;
using System.IO;
using System.Collections.Generic;
using System.Linq;
namespace evtxsharp
{
public class LogRoot : INode
{
public LogRoot (BinaryReader log, long chunkOffset, uint length, EventLog parent)
{
this.ParentLog = parent;
this.Position = log.BaseStream.Position;
this.ChunkOffset = chunkOffset;
this.Nodes = new List<INode>();
this.Strings = new Dictionary<long, string>();
this.Length = length;
while (this.Length >= 0 && !this.ReachedEOS)
{
INode node = LogNode.NewNode(log, this, chunkOffset, this);
this.Nodes.Add(node);
this.Length -= node.Length;
if (node is _x00)
this.ReachedEOS = true;
}
this.SubstitutionArray = new SubstitutionArray(log, chunkOffset, this);
}
public long Position { get; set; }
public SubstitutionArray SubstitutionArray { get; set; }
public int TagState { get; set; }
public int ElementType { get; set; }
public List<INode> Nodes { get; set; }
public string String { get; set; }
public Dictionary<long, string> Strings { get; set; }
public long Length { get; set; }
public bool ReachedEOS { get; set; }
public string DeferedXML { get; set; }
public EventLog ParentLog { get; set; }
public long AmountRead { get; set; }
public long Offset { get; set; }
public bool SelfEnclosed { get; set; }
public string ToXML()
{
string xml = string.Empty;
foreach (INode node in this.Nodes)
xml += node.ToXML();
return xml;
}
#region INode implementation
public INode Parent {
get {
return null;
}
set {
return;
}
}
public long ChunkOffset { get; set; }
#endregion
}
}