Пример #1
0
        internal static bool CanAssemblyBeFoundInReferenceFolders(AssemblyName assemblyName, string assemblyPath, FrameworkName targetFramework)
        {
            bool flag;

            if (targetFramework == null)
            {
                return(false);
            }
            IEnumerable <string> strs = ToolLocationHelper.GetPathToReferenceAssemblies(targetFramework).Concat <string>(ProjectAssemblyHelper.GetAssemblyFolderExLocations(targetFramework).Distinct <string>());

            using (IEnumerator <string> enumerator = strs.GetEnumerator())
            {
                while (enumerator.MoveNext())
                {
                    using (IEnumerator <string> enumerator1 = Directory.EnumerateFiles(enumerator.Current).GetEnumerator())
                    {
                        while (enumerator1.MoveNext())
                        {
                            string current = enumerator1.Current;
                            if (!Microsoft.Expression.Framework.Documents.PathHelper.ArePathsEquivalent(current, assemblyPath))
                            {
                                if (!string.Equals(ProjectAssemblyHelper.TrimFiletypeFromAssemblyNameOrPath(current), assemblyName.Name, StringComparison.OrdinalIgnoreCase))
                                {
                                    continue;
                                }
                                AssemblyName assemblyNameFromPath = ProjectAssemblyHelper.GetAssemblyNameFromPath(current);
                                if (assemblyNameFromPath == null || !string.Equals(assemblyNameFromPath.FullName, assemblyName.FullName, StringComparison.OrdinalIgnoreCase))
                                {
                                    continue;
                                }
                                flag = true;
                                return(flag);
                            }
                            else
                            {
                                flag = true;
                                return(flag);
                            }
                        }
                    }
                }
                return(false);
            }
            return(flag);
        }
Пример #2
0
        public static AssemblyName CachedGetAssemblyNameFromPath(string path)
        {
            if (string.IsNullOrEmpty(path))
            {
                return(null);
            }
            if (!ProjectAssemblyHelper.pathToAssemblyNameCache.ContainsKey(path))
            {
                ProjectAssemblyHelper.pathToAssemblyNameCache[path] = ProjectAssemblyHelper.GetAssemblyNameFromPath(path);
            }
            AssemblyName item = (AssemblyName)ProjectAssemblyHelper.pathToAssemblyNameCache[path];

            if (item != null)
            {
                ProjectAssemblyHelper.CachedGetAssemblyFullName(item);
            }
            return(item);
        }