Exemplo n.º 1
0
        public IEnumerable <IPsiModuleReference> GetReferences(IModuleReferenceResolveContext _)
        {
            var references       = new PsiModuleReferenceAccumulator(TargetFrameworkId);
            var moduleReferences = AssemblyReferenceManager
                                   .AssemblyReferences
                                   .Concat(AssemblyReferenceManager.ProjectReferences)
                                   .SelectNotNull(assembly => PsiModules.GetPrimaryPsiModule(assembly, TargetFrameworkId))
                                   .Select(it => new PsiModuleReference(it));

            references.AddRange(moduleReferences);
            return(references.GetReferences());
        }
Exemplo n.º 2
0
        /// <summary>
        /// Gets all modules referenced by this module.
        /// </summary>
        /// <returns>All referenced modules.</returns>
        public IEnumerable <IPsiModuleReference> GetReferences(IModuleReferenceResolveContext moduleReferenceResolveContext)
        {
            _shellLocks.AssertReadAccessAllowed();

            var references = new PsiModuleReferenceAccumulator(TargetFrameworkId);

            foreach (IAssemblyCookie cookie in _assemblyReferences.Values)
            {
                if (cookie.Assembly == null)
                {
                    continue;
                }

                IPsiModule psiModule = _psiModules.GetPrimaryPsiModule(cookie.Assembly, TargetFrameworkId);

                // Normal assembly.
                if (psiModule != null)
                {
                    references.Add(new PsiModuleReference(psiModule));
                }

                // Assembly that is the output of a current project: reference the project instead.
                else
                {
                    IProject project = _outputAssemblies.GetProjectByOutputAssembly(cookie.Assembly);
                    if (project != null)
                    {
                        psiModule = _psiModules.GetPrimaryPsiModule(project, TargetFrameworkId);
                        if (psiModule != null)
                        {
                            references.Add(new PsiModuleReference(psiModule));
                        }
                    }
                }
            }

            return(references.GetReferences());
        }
Exemplo n.º 3
0
        /// <summary>
        /// Gets all modules referenced by this module.
        /// </summary>
        /// <returns>All referenced modules.</returns>
        public IEnumerable <IPsiModuleReference> GetReferences()
        {
            _shellLocks.AssertReadAccessAllowed();

            var references = new PsiModuleReferenceAccumulator();

            foreach (IAssemblyCookie cookie in _assemblyReferences.Values)
            {
                if (cookie.Assembly == null)
                {
                    continue;
                }

                IPsiModule psiModule = _psiModuleManager.GetPrimaryPsiModule(cookie.Assembly);

                // Normal assembly.
                if (psiModule != null)
                {
                    references.Add(new PsiModuleReference(psiModule));
                }

                // Assembly that is the output of a current project: reference the project instead.
                else
                {
                    foreach (IProject project in _outputAssembliesCache.GetProjectsByAssembly(cookie.Assembly))
                    {
                        psiModule = _psiModuleManager.GetPrimaryPsiModule(project);
                        if (psiModule != null)
                        {
                            references.Add(new PsiModuleReference(psiModule));
                        }
                    }
                }
            }

            return(references.GetReferences());
        }
Exemplo n.º 4
0
        /// <summary>
        /// Gets all modules referenced by this module.
        /// </summary>
        /// <returns>All referenced modules.</returns>
        public IEnumerable<IPsiModuleReference> GetReferences(IModuleReferenceResolveContext moduleReferenceResolveContext)
        {
            _shellLocks.AssertReadAccessAllowed();

            var references = new PsiModuleReferenceAccumulator(TargetFrameworkId);

            foreach (IAssemblyCookie cookie in _assemblyReferences.Values) {
                if (cookie.Assembly == null)
                    continue;

                IPsiModule psiModule = _psiModules.GetPrimaryPsiModule(cookie.Assembly, TargetFrameworkId);

                // Normal assembly.
                if (psiModule != null)
                    references.Add(new PsiModuleReference(psiModule));

                // Assembly that is the output of a current project: reference the project instead.
                else {
                    IProject project = _outputAssemblies.GetProjectByOutputAssembly(cookie.Assembly);
                    if (project != null) {
                        psiModule = _psiModules.GetPrimaryPsiModule(project, TargetFrameworkId);
                        if (psiModule != null)
                            references.Add(new PsiModuleReference(psiModule));
                    }
                }
            }

            return references.GetReferences();
        }
Exemplo n.º 5
0
        /// <summary>
        /// Gets all modules referenced by this module.
        /// </summary>
        /// <returns>All referenced modules.</returns>
        public IEnumerable<IPsiModuleReference> GetReferences()
        {
            _shellLocks.AssertReadAccessAllowed();

            var references = new PsiModuleReferenceAccumulator();

            foreach (IAssemblyCookie cookie in _assemblyReferences.Values) {
                if (cookie.Assembly == null)
                    continue;

                IPsiModule psiModule = _psiModuleManager.GetPrimaryPsiModule(cookie.Assembly);

                // Normal assembly.
                if (psiModule != null)
                    references.Add(new PsiModuleReference(psiModule));

                // Assembly that is the output of a current project: reference the project instead.
                else {
                    foreach (IProject project in _outputAssembliesCache.GetProjectsByAssembly(cookie.Assembly)) {
                        psiModule = _psiModuleManager.GetPrimaryPsiModule(project);
                        if (psiModule != null)
                            references.Add(new PsiModuleReference(psiModule));
                    }
                }
            }

            return references.GetReferences();
        }