Example #1
0
 protected virtual bool GetDataServiceImplementers(PluginInstanceFinder pluginFinder, string inAssemblyPath,
                                                   ref OrderedSet <SimpleDataService> ioImplementers)
 {
     try
     {
         return(pluginFinder.FindPluginInstances(inAssemblyPath, ref ioImplementers));
     }
     catch (Exception)
     {
         DebugUtils.CheckDebuggerBreak();
         return(false);
     }
 }
Example #2
0
        protected virtual ICollection <SimpleDataService> GetDataServiceImplementersInDirectory(string inDirectoryPath,
                                                                                                bool ignoreInstallingAssemblies)
        {
            OrderedSet <SimpleDataService> implementers = new OrderedSet <SimpleDataService>();

            if (Directory.Exists(inDirectoryPath))
            {
                OrderedSet <string>        processedAssemblies = new OrderedSet <string>();
                PluginDomainInstanceLoader loader = null;
                try
                {
                    PluginInstanceFinder pluginFinder = null;
                    foreach (string dllPath in Directory.GetFiles(inDirectoryPath, "*.dll", SearchOption.AllDirectories))
                    {
                        if (!ignoreInstallingAssemblies || !IsInstallingPluginAssemblyPath(dllPath))
                        {
                            string assemblyName = Path.GetFileName(dllPath);
                            if (!processedAssemblies.Contains(assemblyName))
                            {
                                string assemblyPath = GetPluginFilePathInDirectory(assemblyName, inDirectoryPath,
                                                                                   ignoreInstallingAssemblies);
                                if (assemblyPath != null)
                                {
                                    if (loader == null)
                                    {
                                        // Don't need to load spring objects here
                                        loader       = GetPluginInstanceLoader(null, assemblyPath);
                                        pluginFinder = loader.GetInstance <PluginInstanceFinder>();
                                    }
                                    GetDataServiceImplementers(pluginFinder, assemblyPath, ref implementers);
                                }
                                processedAssemblies.Add(assemblyName);
                            }
                        }
                    }
                }
                finally
                {
                    DisposableBase.SafeDispose(ref loader);
                }
            }
            return(implementers);
        }