Пример #1
0
        public AssemblyInformation ResolveAssembly(string path)
        {
            AssemblyName assemblyName = ProjectAssemblyHelper.CachedGetAssemblyNameFromPath(path);
            Assembly     assembly     = this.ResolvePlatformAssembly(assemblyName);

            if (assembly != null)
            {
                return(new AssemblyInformation(assembly)
                {
                    IsPlatformAssembly = true
                });
            }
            Assembly assembly1 = this.ResolveLibraryAssembly(assemblyName);

            if (assembly1 != null)
            {
                return(new AssemblyInformation(assembly1));
            }
            Assembly assembly2 = this.ResolveInstalledAssembly(path);

            if (assembly2 != null)
            {
                return(new AssemblyInformation(assembly2));
            }
            return(this.ResolveShadowCopyAssembly(path));
        }
        private Assembly LoadLibraryAssembly(AssemblyName assemblyName)
        {
            Assembly assembly;

            if (assemblyName == null)
            {
                return(null);
            }
            string str = ProjectAssemblyHelper.CachedGetAssemblyFullName(assemblyName);

            if (this.loadedAssemblies.TryGetValue(str, out assembly))
            {
                return(assembly);
            }
            if (this.librarySignatures.Contains(str))
            {
                foreach (string probingPath in this.probingPaths)
                {
                    string       str1          = string.Concat(PathHelper.ResolveCombinedPath(probingPath, assemblyName.Name), ".dll");
                    AssemblyName assemblyName1 = ProjectAssemblyHelper.CachedGetAssemblyNameFromPath(str1);
                    if (assemblyName1 == null || !ProjectAssemblyHelper.CachedGetAssemblyFullName(assemblyName1).Equals(str, StringComparison.OrdinalIgnoreCase))
                    {
                        continue;
                    }
                    assembly = ProjectAssemblyHelper.LoadFrom(str1);
                    if (assembly == null)
                    {
                        continue;
                    }
                    this.loadedAssemblies.Add(str, assembly);
                    break;
                }
            }
            return(assembly);
        }