Пример #1
0
        public void RemoveObsoleteAssemblyContexts(IEnumerable <String> locations)
        {
            var obsoleteKeys = Assemblycache.Keys.Where(k => !locations.Contains(k)).ToList();

            foreach (var key in obsoleteKeys)
            {
                Assemblycache.Remove(key);
            }
        }
Пример #2
0
        /// <summary>
        /// Synchronize assembly contexts with host' loaded assemblies
        /// </summary>
        /// <param name="assemblies">Assemblies</param>
        public override void SynchronizeAssemblyContexts(ICollection assemblies)
        {
            var locations = new List <string>();

            foreach (AssemblyDefinition adef in assemblies)
            {
                locations.Add(adef.MainModule.Image.FileName);
            }

            foreach (string location in new ArrayList(Assemblycache.Keys))
            {
                if (!locations.Contains(location))
                {
                    Assemblycache.Remove(location);
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Synchronize assembly contexts with host' loaded assemblies
        /// </summary>
        /// <param name="assemblies">Assemblies</param>
        public override void SynchronizeAssemblyContexts(ICollection assemblies)
        {
            var locations = new List <string>();

            foreach (IAssembly asm in assemblies)
            {
                locations.Add(Environment.ExpandEnvironmentVariables(asm.Location));
            }

            foreach (string location in new ArrayList(Assemblycache.Keys))
            {
                if (!locations.Contains(location))
                {
                    Assemblycache.Remove(location);
                }
            }
        }