Exemplo n.º 1
0
        protected override IEnumerable <Export> GetExportsCore(ImportDefinition definition, AtomicComposition atomicComposition)
        {
            var contractName = definition.ContractName;

            if (contractName == typeof(ILogger).FullName)
            {
                var logger = new DefaultLogger();
                logger.AddLogger(new PluginLogger(PluginHost));
                yield return(new Export(contractName, () => logger));
            }
            else if (contractName.StartsWith("VVVV.PluginInterfaces"))
            {
                var typeToExport = ExportProviderUtils.GetImportDefinitionType(definition);

                if (typeof(IPluginHost).IsAssignableFrom(typeToExport) ||
                    typeof(IPluginHost2).IsAssignableFrom(typeToExport) ||
                    typeof(INode).IsAssignableFrom(typeToExport))
                {
                    yield return(new Export(contractName, () => PluginHost));

                    yield break;
                }
            }
        }