Beispiel #1
0
 public static List <Assembly> LoadPlugins()
 {
     if (!Directory.Exists(Option.AddinLocationFolder))
     {
         throw new ArgumentNullException("The plugin path is null or the plugin path directory does not exist.");
     }
     if (PluginEngine.IsLoaded)
     {
         return(PluginEngine.AssemblyList);
     }
     PluginEngine.IsLoaded = true;
     PluginEngine.SetEnvironmentPath();
     string[] files = Directory.GetFiles(Option.AddinLocationFolder, "*.dll");
     PluginEngine.AssemblyList = new List <Assembly>();
     PluginEngine.CppDLLList   = new List <string>();
     PluginEngine.LoadAssembly(files, PluginEngine.AssemblyList, PluginEngine.CppDLLList);
     return(PluginEngine.AssemblyList);
 }
Beispiel #2
0
 private static void LoadAssembly(string[] fileArray, List <Assembly> assemblyList, List <string> cppdllList)
 {
     foreach (string file in fileArray)
     {
         try
         {
             if (PluginEngine.IsManagedAssembly(file))
             {
                 Assembly assembly = Assembly.LoadFrom(file);
                 assemblyList.Add(assembly);
             }
             else
             {
                 DllAPIWrap.LoadLibrary(file);
                 cppdllList.Add(file);
             }
         }
         catch (Exception ex)
         {
             LogConfig.Output.Error((object)("load managed dll failed. The file is " + file), ex);
         }
     }
 }
Beispiel #3
0
 private static void LoadAssembly(string[] fileArray, List <Assembly> assemblyList, List <string> cppdllList)
 {
     for (int i = 0; i < fileArray.Length; i++)
     {
         string text = fileArray[i];
         try
         {
             if (PluginEngine.IsManagedAssembly(text))
             {
                 Assembly item = Assembly.LoadFrom(text);
                 assemblyList.Add(item);
             }
             else
             {
                 DllAPIWrap.LoadLibrary(text);
                 cppdllList.Add(text);
             }
         }
         catch (Exception exception)
         {
             LogConfig.Output.Error("load managed dll failed. The file is " + text, exception);
         }
     }
 }