private static void BuildIndex(string pluginPath, DataTable dtExporters, DataTable dtImporters) { if (!Directory.Exists(pluginPath)) { return; } string[] files = Directory.GetFiles(pluginPath, "*.dll", SearchOption.AllDirectories); string[] array = files; for (int i = 0; i < array.Length; i++) { string filename = array[i]; Assembly assembly = Assembly.Load(TransferContainer.LoadPluginFile(filename)); Type[] exportedTypes = assembly.GetExportedTypes(); for (int j = 0; j < exportedTypes.Length; j++) { Type type = exportedTypes[j]; if (type.BaseType != null) { if (type.BaseType.Name == "ExportAdapter") { TransferContainer.AddToExportIndex(type, filename, dtExporters); } else { if (type.BaseType.Name == "ImportAdapter") { TransferContainer.AddToImportIndex(type, filename, dtImporters); } } } } } }
private static Type GetPlugin(string fullName, string tableName) { DataSet dataSet = TransferContainer.TransferCache.Get(transferIndexesCacheKey) as DataSet; DataRow[] array = dataSet.Tables[tableName].Select("fullName='" + fullName.ToLower() + "'"); if (array.Length == 0 || !File.Exists(array[0]["filePath"].ToString())) { return(null); } Assembly assembly = Assembly.Load(TransferContainer.LoadPluginFile(array[0]["filePath"].ToString())); return(assembly.GetType(fullName, false, true)); }