public void SearchAllPlugins() { var stopWatch = Stopwatch.StartNew(); var phonemizerFactories = new List <PhonemizerFactory>(); phonemizerFactories.Add(PhonemizerFactory.Get(typeof(DefaultPhonemizer))); var transformerFactories = new List <TransformerFactory>(); foreach (var file in Directory.EnumerateFiles(PathManager.Inst.PluginsPath, "*.dll", SearchOption.AllDirectories)) { Assembly assembly; try { assembly = Assembly.LoadFile(file); foreach (var type in assembly.GetExportedTypes()) { if (type.IsAbstract) { continue; } if (type.IsSubclassOf(typeof(Transformer))) { transformerFactories.Add(TransformerFactory.Get(type)); } else if (type.IsSubclassOf(typeof(Phonemizer))) { phonemizerFactories.Add(PhonemizerFactory.Get(type)); } } } catch (Exception e) { Log.Warning(e, $"Failed to load {file}."); continue; } } PhonemizerFactories = phonemizerFactories.ToArray(); TransformerFactories = transformerFactories.ToArray(); stopWatch.Stop(); Log.Information($"Search all plugins: {stopWatch.Elapsed}"); }