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); } }
/// <summary> /// Constructor /// </summary> /// <param name="label">The label of the node</param> /// <param name="uuid">The UUID of the node</param> /// <param name="master">The master node factory</param> public LayerSectionSlaveNodeFactory(string label, Guid uuid, LayerSectionMasterNodeFactory master) : base(label, uuid) { MasterFactory = master; }