OleViewDotNet.COMRegistryViewer.viewTypeLibraryToolStripMenuItem_Click C# (CSharp) Method

viewTypeLibraryToolStripMenuItem_Click() private method

private viewTypeLibraryToolStripMenuItem_Click ( object sender, EventArgs e ) : void
sender object
e System.EventArgs
return void
        private void viewTypeLibraryToolStripMenuItem_Click(object sender, EventArgs e)
        {
            TreeNode node = treeComRegistry.SelectedNode;

            if (node != null)
            {
                COMTypeLibVersionEntry ent = node.Tag as COMTypeLibVersionEntry;

                if (ent == null)
                {
                    COMCLSIDEntry clsid = node.Tag as COMCLSIDEntry;
                    COMProgIDEntry progid = node.Tag as COMProgIDEntry;
                    if(progid != null)
                    {
                        clsid = m_reg.MapClsidToEntry(progid.Clsid);
                    }

                    if(clsid != null && m_reg.Typelibs.ContainsKey(clsid.TypeLib))
                    {
                        ent = m_reg.Typelibs[clsid.TypeLib].Versions.First();
                    }
                }
                
                if(ent != null)
                {
                    try
                    {
                        Assembly typeLibary = COMUtilities.LoadTypeLib(ent.NativePath);
                       
                        TypeLibControl view = new TypeLibControl(ent, typeLibary);
                        Program.GetMainForm().HostControl(view);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    }
                }
            }
        }