Example #1
0
        private Assembly ResolveInstalledAssembly(AssemblyName assemblyName)
        {
            Assembly assembly;
            string   str = ProjectAssemblyHelper.CachedGetAssemblyFullName(assemblyName);

            Dictionary <string, Assembly> .ValueCollection.Enumerator enumerator = this.installedAssemblies.Values.GetEnumerator();
            try
            {
                while (enumerator.MoveNext())
                {
                    Assembly current = enumerator.Current;
                    if (current.FullName != str)
                    {
                        continue;
                    }
                    assembly = current;
                    return(assembly);
                }
                return(null);
            }
            finally
            {
                ((IDisposable)enumerator).Dispose();
            }
            return(assembly);
        }
        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);
        }
Example #3
0
        public Assembly GetCachedSatelliteAssembly(AssemblyName assemblyName)
        {
            Assembly assembly;

            if (this.satelliteAssemblies.TryGetValue(ProjectAssemblyHelper.CachedGetAssemblyFullName(assemblyName), out assembly))
            {
                return(assembly);
            }
            return(null);
        }
Example #4
0
        internal ProjectAssembly(IProjectItem projectItem, Assembly runtimeAssembly, string path, bool isImplicitlyResolvedAssembly)
        {
            this.Path            = path;
            this.RuntimeAssembly = runtimeAssembly;
            AssemblyName assemblyName = ProjectAssemblyHelper.GetAssemblyName(this.RuntimeAssembly);

            this.Name                 = assemblyName.Name;
            this.FullName             = ProjectAssemblyHelper.CachedGetAssemblyFullName(assemblyName);
            this.IsImplicitlyResolved = isImplicitlyResolvedAssembly;
            this.ProjectItem          = projectItem;
        }
Example #5
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);
        }
        public Assembly ResolveAssembly(AssemblyName assemblyName)
        {
            Assembly assembly;
            Assembly assembly1 = null;

            if (!this.hasEntered)
            {
                lock (this.syncLock)
                {
                    try
                    {
                        string str = ProjectAssemblyHelper.CachedGetAssemblyFullName(assemblyName);
                        this.hasEntered = true;
                        if (!this.blendAssemblies.TryGetValue(str, out assembly1))
                        {
                            foreach (KeyValuePair <string, string> delayLoadedAssembly in this.delayLoadedAssemblies)
                            {
                                if (!string.Equals(str, delayLoadedAssembly.Key, StringComparison.OrdinalIgnoreCase))
                                {
                                    continue;
                                }
                                assembly1 = (delayLoadedAssembly.Value == null ? ProjectAssemblyHelper.Load(str) : ProjectAssemblyHelper.LoadFrom(delayLoadedAssembly.Value));
                                if (assembly1 != null)
                                {
                                    this.blendAssemblies.Add(str, assembly1);
                                }
                                assembly = assembly1;
                                return(assembly);
                            }
                        }
                    }
                    finally
                    {
                        this.hasEntered = false;
                    }
                    return(assembly1);
                }
                return(assembly);
            }
            return(assembly1);
        }