Ejemplo n.º 1
0
 public static PluginLoader <T> Create(string appName,
                                       IPluginPaths paths                     = null,
                                       IAppDomain appDomain                   = null,
                                       IPluginLoaderSettings settings         = null,
                                       ITypeLoader <T> typeLoader             = null,
                                       IAssemblyCache assemblyDictionary      = null,
                                       IAssemblyNameReader assemblyNameReader = null,
                                       IAssemblyLoader assemblyLoader         = null,
                                       IWaiter waiter = null,
                                       IPluginDependencyResolverObjectCreator pluginDependencyResolverObjectCreator = null,
                                       IPluginDependencyResolverCacheFactory pluginDependencyResolverCacheFactory   = null,
                                       IPluginCacheFactory <T> pluginCacheFactory = null,
                                       IPluginLoaderLogger logger = null)
 {
     logger             = logger ?? PluginLoaderLogger.Factory(new AppSettings());
     appDomain          = appDomain ?? new AppDomainWrapper(AppDomain.CurrentDomain, logger);
     paths              = paths ?? new AppPluginPaths(appName, null, appDomain, logger);
     settings           = settings ?? PluginLoaderSettings.Default;
     typeLoader         = typeLoader ?? new TypeLoader <T>(settings, logger);
     assemblyNameReader = assemblyNameReader ?? new AssemblyNameReader();
     assemblyDictionary = assemblyDictionary ?? new AssemblyCache(appDomain, assemblyNameReader, logger);
     assemblyLoader     = assemblyLoader ?? new AssemblyLoader(appDomain, settings, assemblyDictionary, assemblyNameReader, logger);
     waiter             = waiter ?? new Waiter(logger);
     pluginDependencyResolverObjectCreator = pluginDependencyResolverObjectCreator ?? new PluginDependencyResolverObjectCreator(appDomain, settings, assemblyLoader, waiter, new AssemblyResolveCache(), logger);
     pluginDependencyResolverCacheFactory  = pluginDependencyResolverCacheFactory ?? new PluginDependencyResolverCacheFactory(pluginDependencyResolverObjectCreator, logger);
     pluginCacheFactory = pluginCacheFactory ?? new PluginCacheFactory <T>(typeLoader, pluginDependencyResolverCacheFactory, assemblyLoader, logger);
     return(new PluginLoader <T>(paths, pluginCacheFactory));
 }
 public static IPluginLoaderLogger Factory(IAppSettings appSettings)
 {
     return(Instance ?? (Instance = new PluginLoaderLogger(appSettings)));
 }