AaltoTLS.PluginInterface.CipherSuitePluginManager.FindCipherSuitePlugins C# (CSharp) Method

FindCipherSuitePlugins() private method

private FindCipherSuitePlugins ( string path ) : AaltoTLS.PluginInterface.CipherSuitePlugin[]
path string
return AaltoTLS.PluginInterface.CipherSuitePlugin[]
        private CipherSuitePlugin[] FindCipherSuitePlugins(string path)
        {
            List<CipherSuitePlugin> pluginList = new List<CipherSuitePlugin>();

            foreach (string fileName in Directory.GetFiles(path)) {
                FileInfo fileInfo = new FileInfo(fileName);
                if (!fileInfo.Extension.ToLower().Equals(".dll")) {
                    continue;
                }

                Assembly pluginAssembly = Assembly.LoadFrom(fileName);
                foreach (Type pluginType in pluginAssembly.GetTypes()) {
                    if (!pluginType.IsPublic || pluginType.IsAbstract) continue;

                    /* Check that the correct interface exists with this type */
                    Type cipherSuitePluginType = typeof(CipherSuitePlugin);
                    if (!pluginType.IsSubclassOf(cipherSuitePluginType)) {
                        continue;
                    }

                    CipherSuitePlugin plugin = (CipherSuitePlugin) Activator.CreateInstance(pluginType);
                    Console.WriteLine("Adding plugin: " + plugin.ToString());
                    pluginList.Add(plugin);
                }
            }

            return pluginList.ToArray();
        }