public static ContainerDetail BuildContainerDetails(Container container)
        {
            IList<PluginTypeDetail> pluginTypeDetails = new List<PluginTypeDetail>();
            foreach (IPluginTypeConfiguration pluginType in container.Model.PluginTypes)
            {
                IList<InstanceDetail> instances = new List<InstanceDetail>();
                IList<InstanceRef> usedInstances = new List<InstanceRef>();

                if (pluginType.Default != null)
                {
                    instances.Add(buildInstanceDetail(pluginType.Default));
                    usedInstances.Add(pluginType.Default);
                }
                foreach (InstanceRef instance in pluginType.Instances)
                {
                    if (usedInstances.Contains(instance)) continue;
                    instances.Add(buildInstanceDetail(instance));
                }

                var pluginTypeDetail = new PluginTypeDetail(pluginType.PluginType, pluginType.Lifecycle.GetType(),
                                                            instances.ToArray());
                pluginTypeDetails.Add(pluginTypeDetail);
            }

            return new ContainerDetail(container.PluginGraph.Log.Sources, pluginTypeDetails.ToArray());
        }
Beispiel #2
0
        public static ContainerDetail BuildContainerDetails(Container container)
        {
            IList <PluginTypeDetail> pluginTypeDetails = new List <PluginTypeDetail>();

            foreach (IPluginTypeConfiguration pluginType in container.Model.PluginTypes)
            {
                IList <InstanceDetail> instances     = new List <InstanceDetail>();
                IList <InstanceRef>    usedInstances = new List <InstanceRef>();

                if (pluginType.Default != null)
                {
                    instances.Add(buildInstanceDetail(pluginType.Default));
                    usedInstances.Add(pluginType.Default);
                }
                foreach (InstanceRef instance in pluginType.Instances)
                {
                    if (usedInstances.Contains(instance))
                    {
                        continue;
                    }
                    instances.Add(buildInstanceDetail(instance));
                }

                var pluginTypeDetail = new PluginTypeDetail(pluginType.PluginType, pluginType.Lifecycle.GetType(),
                                                            instances.ToArray());
                pluginTypeDetails.Add(pluginTypeDetail);
            }

            return(new ContainerDetail(container.PluginGraph.Log.Sources, pluginTypeDetails.ToArray()));
        }
Beispiel #3
0
        private static void addPluginType(TreeNode pluginTypesRoot, PluginTypeDetail pluginType)
        {
            TreeNode pluginNode = pluginTypesRoot.Nodes.Add(pluginType.Type.AsCSharp());
            pluginNode.Nodes.Add("FullName: " + pluginType.Type.AsCSharp(t => t.FullName ?? t.Name));
            pluginNode.Nodes.Add("Assembly: " + pluginType.Type.Assembly);
            pluginNode.Nodes.Add("BuildPolicy: " + pluginType.BuildPolicy.Name);
            if (pluginType.Instances.Length == 0) return;

            TreeNode instancesRoot = pluginNode.Nodes.Add("Instances");
            foreach (InstanceDetail instance in pluginType.Instances.OrderBy(i => i.Name))
            {
                addInstance(instancesRoot, instance);
            }
        }
Beispiel #4
0
        private static void addPluginType(TreeNode pluginTypesRoot, PluginTypeDetail pluginType)
        {
            TreeNode pluginNode = pluginTypesRoot.Nodes.Add(pluginType.Type.AsCSharp());

            pluginNode.Nodes.Add("FullName: " + pluginType.Type.AsCSharp(t => t.FullName ?? t.Name));
            pluginNode.Nodes.Add("Assembly: " + pluginType.Type.Assembly);
            pluginNode.Nodes.Add("BuildPolicy: " + pluginType.BuildPolicy.Name);
            if (pluginType.Instances.Length == 0)
            {
                return;
            }

            TreeNode instancesRoot = pluginNode.Nodes.Add("Instances");

            foreach (InstanceDetail instance in pluginType.Instances.OrderBy(i => i.Name))
            {
                addInstance(instancesRoot, instance);
            }
        }
 public ContainerDetail(string[] sources, PluginTypeDetail[] types)
 {
     _sources = sources;
     _pluginTypeDetails = types;
 }