示例#1
0
        /// <summary>
        /// Scans all loaded assemblies. The given method provides the types to look for.
        /// </summary>
        /// <param name="sharedScanner">True if you'd like the scanners to be stored
        /// globally. They'll then be used on any newly loaded assemblies.</param>
        public static void ScanAllNow(AssemblyScannerMethod mtd, bool sharedScanner)
        {
            // Create an assembly scanner:
            Modular.AssemblyScanner scanner = new Modular.AssemblyScanner();

            // Add the checkers:
            mtd(scanner);

            // Scan all assemblies now:
            scanner.ScanAll();

            // Merge now:
            if (sharedScanner)
            {
                if (StartInfo.SharedScanner == null)
                {
                    StartInfo.SharedScanner = scanner;
                }
                else
                {
                    // merge!
                    scanner.MergeInto(StartInfo.SharedScanner);
                    scanner = StartInfo.SharedScanner;
                }
            }
        }
示例#2
0
        /// <summary>
        /// Scans the assembly containing the given method
        /// which adds the types to look for.</summary>
        public static void ScanThisNow(AssemblyScannerMethod mtd)
        {
            // Create an assembly scanner:
            Modular.AssemblyScanner scanner = new Modular.AssemblyScanner();

            // Add the checkers:
            mtd(scanner);

            // Scan "this" assembly now:
            scanner.Scan(mtd.GetType());
        }
示例#3
0
 /// <summary>
 /// Scans all loaded assemblies. The given method provides the types to look for.
 /// Stores the scanner globally so any newly loaded assemblies will get scanned too.
 /// </summary>
 public static void ScanAllNow(AssemblyScannerMethod mtd)
 {
     ScanAllNow(mtd, true);
 }