private AssemblyEntry FindCacheByPath(string path)
        {
            AssemblyEntry entry3;

            using (ReaderWriterLockHelper.CreateReaderLock(this._lock))
            {
                AssemblyEntry entry = null;
                using (Dictionary <string, AssemblyEntry> .ValueCollection.Enumerator enumerator = this.Cache.Values.GetEnumerator())
                {
                    AssemblyEntry current;
                    while (enumerator.MoveNext())
                    {
                        current = enumerator.Current;
                        if ((current != null) && (current.AssemblyPath == path))
                        {
                            goto Label_0046;
                        }
                    }
                    goto Label_0058;
Label_0046:
                    entry = current;
                }
Label_0058:
                entry3 = entry;
            }
            return(entry3);
        }
        private Assembly ResolveAssembly(IAssemblyMetadata metadata, Func <AssemblyName, bool> stopWhen, bool tryCache)
        {
            string        assemblyFullPath = this.GetAssemblyFullPath(metadata);
            AssemblyEntry entry            = this.FindCacheByPath(assemblyFullPath);

            if (entry == null)
            {
                TryStartBundle(this.Framework.GetBundleBySymbolicName(metadata.Owner.SymbolicName));
                entry = this.FindCacheByPath(assemblyFullPath);
                if (entry == null)
                {
                    entry = new AssemblyEntry {
                        Assembly     = Assembly.LoadFile(assemblyFullPath),
                        ProvidedBy   = metadata,
                        AssemblyPath = assemblyFullPath
                    };
                    using (ReaderWriterLockHelper.CreateWriterLock(this._lock))
                    {
                        if (!this.Cache.ContainsKey(entry.Assembly.FullName))
                        {
                            this.Cache.Add(entry.Assembly.FullName, entry);
                        }
                    }
                }
            }
            if ((stopWhen != null) && stopWhen(entry.Assembly.GetName()))
            {
                return(entry.Assembly);
            }
            return(entry.Assembly);
        }