private Guid GetGuidFromType(TreeNode node)
{
Guid guid = Guid.Empty;
if (node != null)
{
object tag = node.Tag;
if (tag is COMCLSIDEntry)
{
guid = ((COMCLSIDEntry)tag).Clsid;
}
else if (tag is COMInterfaceEntry)
{
guid = ((COMInterfaceEntry)tag).Iid;
}
else if (tag is COMProgIDEntry)
{
COMProgIDEntry ent = (COMProgIDEntry)tag;
if (m_reg.MapClsidToEntry(ent.Clsid) != null)
{
guid = ent.Clsid;
}
}
else if (tag is COMTypeLibEntry)
{
guid = ((COMTypeLibEntry)tag).TypelibId;
}
else if (tag is Guid)
{
guid = (Guid)tag;
}
else if (tag is COMAppIDEntry)
{
guid = ((COMAppIDEntry)tag).AppId;
}
}
return guid;
}