예제 #1
0
        public void LoadPlugins(string pluginPath)
        {
            _pluginResolver.ClearPlugins();

            List <string> plugins = Directory.GetDirectories(pluginPath)
                                    .Where(directory => File.Exists(Path.Combine(directory, Path.GetFileName(directory) + ".dll")))
                                    .Select(directory => Path.Combine(directory, Path.GetFileName(directory) + ".dll")).ToList();

            foreach (string plugin in plugins)
            {
                try
                {
                    Assembly assembly = Assembly.LoadFile(plugin);

                    LoadAppDashPlugins(assembly);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e);
                    throw;
                }
            }

            Console.WriteLine($"Loaded {_pluginResolver.GetPluginInstances().Count()} plugin(s).");
        }