示例#1
0
        private void AddGraphToComboBox(NetGraph graph)
        {
            foreach (KeyValuePair <Guid, BasePipelineNode> pair in graph.Nodes)
            {
                if (!pair.Value.Hidden)
                {
                    if (pair.Value is NetGraphContainerNode)
                    {
                        AddGraphToComboBox(((NetGraphContainerNode)pair.Value).ContainedGraph);
                    }
                    else if (pair.Value is LayerSectionNode)
                    {
                        LayerSectionNode node = pair.Value as LayerSectionNode;

                        if (node.IsMaster)
                        {
                            foreach (NetGraph subGraph in node.Graphs)
                            {
                                AddGraphToComboBox(subGraph);
                            }
                        }
                    }
                    else
                    {
                        comboBoxNodes.Items.Add(pair.Value);
                    }
                }
            }
        }
示例#2
0
        private void AddGraphToList(List <ListViewItem> items, NetGraph graph)
        {
            foreach (var pair in graph.Nodes)
            {
                BasePipelineNode node = pair.Value;

                if (_showHidden || !node.Hidden)
                {
                    NetGraphContainerNode container = node as NetGraphContainerNode;

                    if (node is NetGraphContainerNode)
                    {
                        AddGraphToList(items, ((NetGraphContainerNode)node).ContainedGraph);
                    }
                    else if (node is LayerSectionNode)
                    {
                        LayerSectionNode layerNode = (LayerSectionNode)node;

                        if (layerNode.IsMaster)
                        {
                            foreach (NetGraph subGraph in layerNode.Graphs)
                            {
                                AddGraphToList(items, subGraph);
                            }
                        }
                    }
                    else
                    {
                        ListViewItem item = new ListViewItem(node.ToString());
                        item.SubItems.Add(node.Enabled.ToString());
                        item.SubItems.Add(node.IsShutdown.ToString());
                        item.SubItems.Add(node.InputPacketCount.ToString());
                        item.SubItems.Add(node.OutputPacketCount.ToString());
                        item.SubItems.Add(node.ByteCount.ToString());
                        item.Tag = node;
                        items.Add(item);
                    }
                }
            }
        }
        /// <summary>
        /// OnCreate method
        /// </summary>
        /// <param name="logger">The logger for this graph</param>
        /// <param name="graph">The associated netgraph</param>
        /// <param name="stateDictionary">State dictionary</param>
        /// <returns>The new pipeline node</returns>
        protected override BasePipelineNode OnCreate(Logger logger, NetGraph graph, Dictionary <string, object> stateDictionary)
        {
            // If this node has been created by a slave return as appropriate
            if (stateDictionary.ContainsKey(Id.ToString()))
            {
                return((BasePipelineNode)stateDictionary[Id.ToString()]);
            }

            List <LayerSectionFilter> filters = new List <LayerSectionFilter>();

            foreach (LayerSectionFilterFactory factory in LayerFactories)
            {
                filters.Add(factory.Create());
            }

            LayerSectionNode ret = new LayerSectionNode(filters.ToArray(), DefaultMode, LayerSectionGraphDirection.ServerToClient);

            // Create paired slave node
            stateDictionary[SlaveFactory.Id.ToString()] = new LayerSectionNode(ret);

            return(ret);
        }