private void treeView1_AfterSelect(object sender, TreeViewEventArgs e)
{
// This allows for the bitmap viewer to be automatically shown when a [bitm] tag is selected and the
// default viewer for [bitm] is still bitmap viewer
if (e.Node.Parent != null)
if (e.Node.Parent.Text == "bitm" && ltmpTools.Visible)
{
ltmpTools.Visible = true;
ltmpTools.BringToFront();
}
else
{
ltmpTools.SendToBack();
}
// Display the tags by the selected listing view
switch (metaView)
{
#region TagType View
case FormFunctions.MetaView.TagTypeView:
if (e.Node.Parent == null)
{
// *** Do we really want to NULL out our selection?
// Map.SelectedMeta = null;
return;
}
int tagNum = map.Functions.ForMeta.FindByNameAndTagType(e.Node.Parent.Text, e.Node.Text);
if (tagNum != -1)
{
// If we are within the <ALL TAGS> listing, add to registry and main tag listing
if (((TreeView)sender).SelectedNode.FullPath.StartsWith(this.treeView1.Nodes[0].Text))
{
addToQuickList(map.MetaInfo.TagType[tagNum], map.FileNames.Name[tagNum]);
}
LoadMeta(tagNum);
return;
}
break;
#endregion
#region FolderView
case FormFunctions.MetaView.FolderView:
for (int x = 0; x < map.IndexHeader.metaCount; x++)
{
string[] tempn = map.FileNames.Name[x].Split('\\');
string tempi = tempn[tempn.Length - 1] + "." + map.MetaInfo.TagType[x];
int i = map.FileNames.Name[x].LastIndexOf('\\');
string tempp = string.Empty;
if (i != -1)
{
tempp = map.FileNames.Name[x].Substring(0, i) + "\\";
}
// MessageBox.Show(e.Node.Tag.ToString());
if (e.Node.Text == tempi &&
e.Node.Tag.ToString() == map.FileNames.Name[x] + "." + map.MetaInfo.TagType[x])
{
LoadMeta(x);
return;
}
}
map.SelectedMeta = null;
break;
#endregion
#region InfoView
case FormFunctions.MetaView.InfoView:
TreeNode tn = e.Node;
if (tn.Text.Contains("<HEADER>"))
{
Meta m = new Meta(map);
m.TagIndex = 99999;
m.offset = 0;
m.size = 2048;
m.ident = 0;
m.type = "HEAD";
map.OpenMap(MapTypes.Internal);
map.BR.BaseStream.Position = m.offset;
m.MS = new MemoryStream(m.size);
m.MS.Write(map.BR.ReadBytes(m.size), 0, m.size);
map.CloseMap();
map.SelectedMeta = m;
// Main Form Offsets/Idents/etc
metaOffsetBox.Text = "0x" + m.offset.ToString("X8") + "\n" + m.offset.ToString("N0") + " bytes";
metaSizeBox.Text = "0x" + m.size.ToString("X4") + "\n" + m.size.ToString("N0") + " bytes";
metaIdentBox.Text = m.ident.ToString("X");
metaTypeBox.Text = m.type;
if (referenceEditorToolStripMenuItem.Checked)
{
formFuncs.AddReferencesToListView(map.SelectedMeta, references, map.DisplayType);
}
if (metaEditorToolStripMenuItem.Checked)
{
metaEditor1.loadControls(map);
}
if (hexEditorToolStripMenuItem.Checked)
{
hexView1.Reload(map.SelectedMeta, map);
hexView1.Setup(map.filePath);
}
}
if (tn.Tag == null)
{
tn = e.Node.Parent;
}
if (tn == null)
{
return;
}
for (int x = 0; x < map.IndexHeader.metaCount; x++)
{
string fullPath = map.FileNames.Name[x] + "." + map.MetaInfo.TagType[x];
if (tn.Tag.ToString() == fullPath)
{
if (map.SelectedMeta == null)
{
LoadMeta(x);
}
else if (map.SelectedMeta.TagIndex != x)
{
LoadMeta(x);
}
return;
}
}
map.SelectedMeta = null;
break;
#endregion
}
}