Exemplo n.º 1
0
        public static void UpdateExcutingAssemblies(this AppDomain @this)
        {
            try
            {
                var assemblies = ReflectionUtil.GetAssemblies(new AssemblyFilter(@this.GetActualDomainPath()));

                excutingAssembiles = @this.GetExcutingAssemblies().Union(assemblies)
                                     .Union(new[] { Assembly.GetCallingAssembly(), Assembly.GetExecutingAssembly() }).Distinct();
            }
            catch
            {
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// 获取引用了Shriek的程序集
        /// </summary>
        /// <param name="this"></param>
        /// <param name="type"></param>
        /// <returns></returns>
        public static IEnumerable <Assembly> GetExcutingAssembiles(this AppDomain @this, Type type = null)
        {
            type = type ?? typeof(AppDomainExtensions);

            if (excutingAssembiles == null || !excutingAssembiles.Any())
            {
                excutingAssembiles = ReflectionUtil.GetAssemblies(new AssemblyFilter(@this.GetActualDomainPath()))
                                     .Where(assembly =>
                {
                    return(type.AssemblyQualifiedName != null &&
                           (!assembly.IsDynamic && assembly.FullName == type.AssemblyQualifiedName.Replace(type.FullName + ", ", "") ||
                            assembly.GetReferencedAssemblies().Any(ass => ass.FullName == type.AssemblyQualifiedName.Replace(type.FullName + ", ", ""))));
                });
            }

            return(excutingAssembiles.Union(@this.GetAssemblies()).Distinct());
        }
Exemplo n.º 3
0
        /// <summary>
        /// 获取引用了Shriek的程序集
        /// </summary>
        /// <param name="this"></param>
        /// <returns></returns>
        public static IEnumerable <Assembly> GetExcutingAssemblies(this AppDomain @this)
        {
            if (excutingAssembiles == null || !excutingAssembiles.Any())
            {
                lock (Locker)
                {
                    if (excutingAssembiles == null || !excutingAssembiles.Any())
                    {
                        excutingAssembiles = ReflectionUtil.GetAssemblies(new AssemblyFilter(@this.GetActualDomainPath()));
                    }
                }
            }

            return(excutingAssembiles);
        }