예제 #1
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="factory">The node factory</param>
 public GraphNodeEntry(BaseNodeFactory factory)
 {
     Factory = factory;
 }
예제 #2
0
        private SwitchNodeFactory CreateBaseGraph(NetGraphBuilder builder, BaseNodeFactory inputNode, BaseNodeFactory outputNode, bool clientToServer)
        {
            SwitchNodeFactory switchNode = builder.AddNode(new SwitchNodeFactory(String.Format("{0} Switch {1}",
                _metaName, GetDirection(clientToServer)), Guid.NewGuid(),
                false, CANAPE.Nodes.SwitchNodeSelectionMode.ExactMatch));
            switchNode.Hidden = true;
            switchNode.SelectionPath = "#" + (String.IsNullOrWhiteSpace(_metaName) ? "Invalid" : _metaName.Trim());

            builder.AddLine(inputNode, switchNode, null);

            LogPacketNodeFactory log = builder.AddLog(String.Format("Invalid Traffic {0}", GetDirection(clientToServer)),
                    Guid.NewGuid(), new ColorValue(255, 0, 0), null, false);

            log.Hidden = true;
            builder.AddLine(switchNode, log, null);
            builder.AddLine(log, outputNode, null);

            return switchNode;
        }
예제 #3
0
        /// <summary>
        /// Create the linked node factory
        /// </summary>
        /// <param name="linkedNode"></param>
        /// <returns></returns>
        BaseNodeFactory ILinkedNodeConfig.CreateFactory(BaseNodeFactory linkedNode)
        {
            LayerSectionMasterNodeFactory factory = linkedNode as LayerSectionMasterNodeFactory;

            return factory.SlaveFactory;
        }
예제 #4
0
        private void AddStates(NetGraphBuilder builder, SwitchNodeFactory outputSwitch, SwitchNodeFactory inputSwitch, 
            BaseNodeFactory outputNode, BaseNodeFactory inputNode)
        {
            foreach (StateGraphEntry entry in _entries)
            {
                BaseNodeFactory currentInput = inputSwitch;
                BaseNodeFactory currentOutput = outputSwitch;
                NetGraphFactory graph = entry.Graph == null ? NetGraphBuilder.CreateDefaultProxyGraph(entry.StateName) : entry.Graph.Factory;

                LayerSectionMasterNodeFactory masterNode = new LayerSectionMasterNodeFactory(String.Format("{0} {1}", entry.StateName,
                    GetDirection(false)), Guid.NewGuid(), Guid.NewGuid());

                masterNode.DefaultMode = LayerSectionNodeDefaultMode.PassFrame;
                masterNode.Direction = LayerSectionGraphDirection.ServerToClient;

                builder.AddNode(masterNode);
                builder.AddNode(masterNode.SlaveFactory);

                LayerSectionFilterFactory[] filters = new LayerSectionFilterFactory[1];

                LayerSectionFilterFactory filter = new LayerSectionFilterFactory();

                filter.GraphFactory = graph;
                filter.LayerFactories = entry.GetLayerFactories();
                filter.SelectionPath = "";
                filter.FilterFactory = DataFrameFilterFactory.CreateDummyFactory();
                filter.IsolatedGraph = false;

                masterNode.LayerFactories = new LayerSectionFilterFactory[1] { filter };

                masterNode.SlaveFactory.Hidden = true;

                builder.AddLine(outputSwitch, masterNode, entry.StateName);
                builder.AddLine(inputSwitch, masterNode.SlaveFactory, entry.StateName);

                if (entry.LogPackets)
                {
                    currentOutput = AddLog(builder, entry, masterNode, false);
                    currentInput = AddLog(builder, entry, masterNode.SlaveFactory, true);
                }
                else
                {
                    currentOutput = masterNode;
                    currentInput = masterNode.SlaveFactory;
                }

                builder.AddLine(currentOutput, outputNode, null);
                builder.AddLine(currentInput, inputNode, null);
            }
        }
예제 #5
0
        private void AddStateFromEntry(NetGraphBuilder builder, StateGraphEntry entry, BaseNodeFactory inputNode, BaseNodeFactory outputNode, bool clientToServer)
        {
            BaseNodeFactory currentFactory;

            if (entry.Graph != null)
            {
                currentFactory = builder.AddNode(new NetGraphContainerNodeFactory(String.Format("{0} {1}", entry.StateName,
                    GetDirection(clientToServer)), Guid.NewGuid(), entry.Graph.Factory,
                    clientToServer ? NetGraphContainerNode.GraphDirection.ClientToServer : NetGraphContainerNode.GraphDirection.ServerToClient));
                currentFactory.Hidden = true;

                builder.AddLine(inputNode, currentFactory, entry.StateName);
            }
            else
            {
                currentFactory = inputNode;
            }

            if (entry.LogPackets)
            {
                LogPacketNodeFactory log = builder.AddLog(String.Format("{0} Log {1}", entry.StateName, GetDirection(clientToServer)),
                    Guid.NewGuid(), entry.Color, null, false);
                log.Hidden = true;

                builder.AddLine(currentFactory, log, null);

                currentFactory = log;
            }

            builder.AddLine(currentFactory, outputNode, null);
        }
예제 #6
0
        private LogPacketNodeFactory AddLog(NetGraphBuilder builder, StateGraphEntry entry, BaseNodeFactory currentFactory, bool clientToServer)
        {
            LogPacketNodeFactory log = builder.AddLog(String.Format("{0} Log {1}", entry.StateName,
                GetDirection(clientToServer)), Guid.NewGuid(), entry.Color, null, false);
            log.Hidden = true;

            builder.AddLine(currentFactory, log, null);

            return log;
        }
예제 #7
0
        /// <summary>
        /// Implementation of ILinkedeNodeConfig
        /// </summary>
        /// <param name="linkedNode">The linked node</param>
        /// <returns>The created factory</returns>
        BaseNodeFactory ILinkedNodeConfig.CreateFactory(BaseNodeFactory linkedNode)
        {
            NetGraphContainerNodeFactory ret = (NetGraphContainerNodeFactory)LinkedNode.CreateFactory();
            NetGraphContainerNodeFactory link = (NetGraphContainerNodeFactory)linkedNode;

            ret.LinkedNode = link;
            link.LinkedNode = ret;

            return ret;
        }
예제 #8
0
        /// <summary>
        /// Get master factory
        /// </summary>
        /// <param name="linkedNode">The linked node factory</param>
        /// <returns>The factory</returns>
        public BaseNodeFactory CreateFactory(BaseNodeFactory linkedNode)
        {
            LayerSectionSlaveNodeFactory factory = linkedNode as LayerSectionSlaveNodeFactory;

            return factory.MasterFactory;
        }