/// <summary> /// Creates an assembly reference node from a file path. /// </summary> protected virtual AssemblyReferenceNode CreateAssemblyReferenceNode(string fileName) { AssemblyReferenceNode node = null; try { node = new AssemblyReferenceNode(this.ProjectManager, fileName); } catch (ArgumentNullException e) { Trace.WriteLine("Exception : " + e.Message); } catch (FileNotFoundException e) { Trace.WriteLine("Exception : " + e.Message); } catch (BadImageFormatException e) { Trace.WriteLine("Exception : " + e.Message); } catch (FileLoadException e) { Trace.WriteLine("Exception : " + e.Message); } catch (System.Security.SecurityException e) { Trace.WriteLine("Exception : " + e.Message); } return(node); }
/// <summary> /// Checks if an assembly is already added. The method parses all references and compares the full /// assembly names, or the location of the assemblies to decide whether two assemblies are the same. /// </summary> /// <returns>true if the assembly has already been added.</returns> protected internal override bool IsAlreadyAdded(out ReferenceNode existingReference) { ReferenceContainerNode referencesFolder = this.ProjectMgr.FindChild(ReferenceContainerNode.ReferencesNodeVirtualName) as ReferenceContainerNode; Debug.Assert(referencesFolder != null, "Could not find the References node"); bool shouldCheckPath = !string.IsNullOrEmpty(this.Url); for (HierarchyNode n = referencesFolder.FirstChild; n != null; n = n.NextSibling) { AssemblyReferenceNode assemblyReferenceNode = n as AssemblyReferenceNode; if (null != assemblyReferenceNode) { // We will check if the full assembly names are the same or if the Url of the assemblies is the same. if (String.Compare(assemblyReferenceNode.AssemblyName.FullName, this.assemblyName.FullName, StringComparison.OrdinalIgnoreCase) == 0 || (shouldCheckPath && NativeMethods.IsSamePath(assemblyReferenceNode.Url, this.Url))) { existingReference = assemblyReferenceNode; return(true); } } } existingReference = null; return(false); }
/// <summary> /// Creates an assembly reference node from a file path. /// </summary> protected virtual AssemblyReferenceNode CreateAssemblyReferenceNode(string fileName) { AssemblyReferenceNode node = null; try { node = new AssemblyReferenceNode(this.ProjectMgr, fileName); } catch (ArgumentNullException e) { XSharpProjectPackage.Instance.DisplayException(e); } catch (FileNotFoundException e) { XSharpProjectPackage.Instance.DisplayException(e); } catch (BadImageFormatException e) { XSharpProjectPackage.Instance.DisplayException(e); } catch (FileLoadException e) { XSharpProjectPackage.Instance.DisplayException(e); } catch (System.Security.SecurityException e) { XSharpProjectPackage.Instance.DisplayException(e); } return(node); }
/// <summary> /// Creates an assembly reference node from a project element. /// </summary> protected virtual AssemblyReferenceNode CreateAssemblyReferenceNode(ProjectElement element) { AssemblyReferenceNode node = null; try { node = new AssemblyReferenceNode(this.ProjectMgr, element); } catch (Exception e) { XSettings.LogException(e, "CreateAssemblyReferenceNode"); } return(node); }
/// <summary> /// Creates an assembly reference node from a file path. /// </summary> protected virtual AssemblyReferenceNode CreateAssemblyReferenceNode(string fileName) { AssemblyReferenceNode node = null; try { node = new AssemblyReferenceNode(this.ProjectMgr, fileName); } catch(ArgumentNullException e) { Trace.WriteLine("Exception : " + e.Message); } catch(FileNotFoundException e) { Trace.WriteLine("Exception : " + e.Message); } catch(BadImageFormatException e) { Trace.WriteLine("Exception : " + e.Message); } catch(FileLoadException e) { Trace.WriteLine("Exception : " + e.Message); } catch(System.Security.SecurityException e) { Trace.WriteLine("Exception : " + e.Message); } return node; }