void resourcesTree_AfterSelect(object sender, TreeViewEventArgs e)
{
propertyGrid.SelectedObject = e.Node.Tag;
if (e.Node.Nodes.Count == 0)
{
if (e.Node.Tag is ResourceDirectory)
PopulateDirectory(e.Node, e.Node.Tag as ResourceDirectory);
if (e.Node.Tag is ResourceDirectoryEntry)
PopulateDirectoryEntry(e.Node, e.Node.Tag as ResourceDirectoryEntry);
}
if (e.Node.Tag is ResourceDataEntry)
{
try
{
if (currentStream != null)
currentStream.Dispose();
currentStream = (e.Node.Tag as ResourceDataEntry).GetStream();
hexBox.ByteProvider = new DynamicFileByteProvider(currentStream);
}
catch (Exception ex)
{
MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else
hexBox.ByteProvider = null;
}