Example #1
0
        public Type[] GetModules()
        {
            var modules = new List <Type>();

            foreach (var filePath in FilePaths)
            {
                var assembly = AssemblyLoadContext.Default.LoadFromAssemblyPath(filePath);

                try
                {
                    foreach (var type in assembly.GetTypes())
                    {
                        if (AcwModule.IsAcwModule(type))
                        {
                            modules.AddIfNotContains(type);
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw new AcwException("Could not get module types from assembly: " + assembly.FullName, ex);
                }
            }

            return(modules.ToArray());
        }
        public Type[] GetModules()
        {
            var modules = new List <Type>();

            foreach (var assembly in GetAssemblies())
            {
                try
                {
                    foreach (var type in assembly.GetTypes())
                    {
                        if (AcwModule.IsAcwModule(type))
                        {
                            modules.AddIfNotContains(type);
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw new AcwException("Could not get module types from assembly: " + assembly.FullName, ex);
                }
            }

            return(modules.ToArray());
        }