Esempio n. 1
0
 private static void BuildIndex(string pluginPath, DataTable dtExporters, DataTable dtImporters)
 {
     if (Directory.Exists(pluginPath))
     {
         string[] files = Directory.GetFiles(pluginPath, "*.dll", SearchOption.AllDirectories);
         string[] array = files;
         foreach (string filename in array)
         {
             Assembly assembly      = Assembly.Load(TransferContainer.LoadPluginFile(filename));
             Type[]   exportedTypes = assembly.GetExportedTypes();
             foreach (Type type in exportedTypes)
             {
                 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);
                     }
                 }
             }
         }
     }
 }
Esempio n. 2
0
 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);
                 }
             }
         }
     }
 }
Esempio n. 3
0
        private static Type GetPlugin(string fullName, string tableName)
        {
            DataSet dataSet = TransferContainer.TransferCache.Get("Hishop_TransferIndexes") as DataSet;

            DataRow[] array = dataSet.Tables[tableName].Select("fullName='" + fullName.ToLower() + "'");
            if (array.Length != 0 && File.Exists(array[0]["filePath"].ToString()))
            {
                Assembly assembly = Assembly.Load(TransferContainer.LoadPluginFile(array[0]["filePath"].ToString()));
                return(assembly.GetType(fullName, false, true));
            }
            return(null);
        }