Skip to content

Commit

Permalink
Make info a root node
Browse files Browse the repository at this point in the history
  • Loading branch information
xPaw committed Oct 18, 2021
1 parent 1b0437d commit 2905b40
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 31 deletions.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Resources/NetHookAnalyzer2/NetHookAnalyzer2/MainForm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -388,7 +388,7 @@ void RepopulateTreeView()
}

itemExplorerTreeView.Nodes.Clear();
itemExplorerTreeView.Nodes.AddRange(BuildTree(item).Nodes.Cast<TreeNode>().ToArray());
itemExplorerTreeView.Nodes.Add(BuildTree(item));
itemExplorerTreeView.Nodes[0].EnsureVisible(); // Scroll to top
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,47 +55,44 @@ TreeNode CreateTreeNodeCore(bool displayUnsetFields)
{
var configuration = new TreeNodeObjectExplorerConfiguration { ShowUnsetFields = displayUnsetFields };

var node = new TreeNode();
using var stream = item.OpenStream();

using (var stream = item.OpenStream())
{
var rawEMsg = PeekUInt(stream);
var rawEMsg = PeekUInt(stream);
var node = BuildInfoNode(rawEMsg);
node.Expand();

node.Nodes.Add(BuildInfoNode(rawEMsg));
var header = ReadHeader(rawEMsg, stream);
node.Nodes.Add(new TreeNodeObjectExplorer("Header", header, configuration).TreeNode);

var header = ReadHeader(rawEMsg, stream);
node.Nodes.Add(new TreeNodeObjectExplorer("Header", header, configuration).TreeNode);
var body = ReadBody(rawEMsg, stream, header);
var bodyNode = new TreeNodeObjectExplorer("Body", body, configuration).TreeNode;
node.Nodes.Add(bodyNode);

var body = ReadBody(rawEMsg, stream, header);
var bodyNode = new TreeNodeObjectExplorer("Body", body, configuration).TreeNode;
node.Nodes.Add(bodyNode);
var payload = ReadPayload(stream);
if (payload != null && payload.Length > 0)
{
node.Nodes.Add(new TreeNodeObjectExplorer("Payload", payload, configuration).TreeNode);
}

var payload = ReadPayload(stream);
if (payload != null && payload.Length > 0)
if (Specializations != null)
{
var objectsToSpecialize = new[] { body };
while (objectsToSpecialize.Any())
{
node.Nodes.Add(new TreeNodeObjectExplorer("Payload", payload, configuration).TreeNode);
}
var specializations = objectsToSpecialize.SelectMany(o => Specializations.SelectMany(x => x.ReadExtraObjects(o)));

if (Specializations != null)
{
var objectsToSpecialize = new[] { body };
while (objectsToSpecialize.Any())
if (!specializations.Any())
{
var specializations = objectsToSpecialize.SelectMany(o => Specializations.SelectMany(x => x.ReadExtraObjects(o)));

if (!specializations.Any())
{
break;
}
break;
}

bodyNode.Collapse(ignoreChildren: true);
bodyNode.Collapse(ignoreChildren: true);

var extraNodes = specializations.Select(x => new TreeNodeObjectExplorer(x.Key, x.Value, configuration).TreeNode).ToArray();
node.Nodes.AddRange(extraNodes);
var extraNodes = specializations.Select(x => new TreeNodeObjectExplorer(x.Key, x.Value, configuration).TreeNode).ToArray();
node.Nodes.AddRange(extraNodes);

// Let the specializers examine any new message objects.
objectsToSpecialize = specializations.Select(x => x.Value).ToArray();
}
// Let the specializers examine any new message objects.
objectsToSpecialize = specializations.Select(x => x.Value).ToArray();
}
}

Expand Down

0 comments on commit 2905b40

Please sign in to comment.