/// <summary> /// Tries to open the specified file into the object browser. /// </summary> public bool OpenFile(string fileName) { Exception savedException = null; try { AssemblySupport.OpenFile(fileName); return(true); } catch (Exception ex) { savedException = ex; } try { ComSupport.OpenFile(fileName); return(true); } catch (Exception ex) { if (savedException == null) { savedException = ex; } } TraceUtil.WriteLineWarning(null, String.Concat("Error opening file ", fileName, ": " + savedException)); ErrorDialog.Show(savedException, "Error opening file " + fileName + "\n\n" + "The Inspector can only open .NET assemblies, ActiveX controls or ActiveX type libraries.", "Error opening file " + fileName, MessageBoxIcon.Error); return(false); }
protected void OpenClick(object sender, EventArgs e) { ListViewItem li = SelectedItems[0]; if (li.Tag != null) { FileInfo fi = (FileInfo)li.Tag; String fileName = fi.DirectoryName + "\\" + fi.Name; // The open mechanism will select the assembly tree // node whether or not it was actually opened (that is, // it might have been already opened) // Open can sometimes take a while Cursor save = Cursor.Current; Cursor.Current = Cursors.WaitCursor; AssemblySupport.OpenFile(fileName); Cursor.Current = save; } else { ErrorDialog.Show("Invalid GAC entry; cannot be opened", "Invalid GAC Entry", MessageBoxIcon.Error); } }