Emgu.CV.CvInvoke.LoadUnmanagedModules C# (CSharp) Метод

LoadUnmanagedModules() публичный статический Метод

Attemps to load opencv modules from the specific location
If loadDirectory is null, the default location on windows is the dll's path appended by either "x64" or "x86", depends on the applications current mode.
public static LoadUnmanagedModules ( String loadDirectory ) : bool
loadDirectory String The directory where the unmanaged modules will be loaded. If it is null, the default location will be used.
Результат bool
        public static bool LoadUnmanagedModules(String loadDirectory, params String[] unmanagedModules)
        {
            if (loadDirectory == null)
             {
            System.Reflection.Assembly asm = System.Reflection.Assembly.GetExecutingAssembly();
            FileInfo file = new FileInfo(asm.Location);
            DirectoryInfo directory = file.Directory;
            loadDirectory = directory.FullName;
            if (Platform.OperationSystem == Emgu.Util.TypeEnum.OS.Windows)
            {
               if (IntPtr.Size == 8)
               {  //64bit process
                  loadDirectory = Path.Combine(loadDirectory, "x64");
               } else
               {
                  loadDirectory = Path.Combine(loadDirectory, "x86");
               }
            } else if (Platform.OperationSystem == Emgu.Util.TypeEnum.OS.MacOSX)
            {
               loadDirectory = Path.Combine(loadDirectory, "..");
            }

             }

             if (!Directory.Exists(loadDirectory))
            return false;

             String oldDir = Environment.CurrentDirectory;
             Environment.CurrentDirectory = loadDirectory;
             bool success = true;

             string prefix = string.Empty;
             if (Platform.OperationSystem == Emgu.Util.TypeEnum.OS.MacOSX)
             {
            prefix = "lib";
             }

             foreach (String module in unmanagedModules)
             {
            String fullPath = Path.Combine(loadDirectory, Path.Combine(prefix, module));
            success &= (File.Exists(fullPath) && !IntPtr.Zero.Equals(Toolbox.LoadLibrary(fullPath)));
             }
             Environment.CurrentDirectory = oldDir;

             return success;
        }
CvInvoke