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> /// Create the filters /// </summary> /// <returns>An array of filter factories</returns> protected override LayerSectionFilterFactory[] CreateFilterFactories() { LayerSectionFilterFactory filter = new LayerSectionFilterFactory(); filter.GraphFactory = _graph != null ? _graph.Factory : NetGraphBuilder.CreateDefaultProxyGraph(Label); filter.LayerFactories = new INetworkLayerFactory[1]; filter.LayerFactories[0] = new SslNetworkLayerFactory(_config); filter.SelectionPath = SelectionPath; filter.FilterFactory = DataFrameFilterFactory.CreateDummyFactory(); filter.IsolatedGraph = _isolatedGraph; return(new LayerSectionFilterFactory[1] { filter }); }
/// <summary> /// Create the filters /// </summary> /// <returns>An array of filter factories</returns> protected override LayerSectionFilterFactory[] CreateFilterFactories() { LayerSectionFilterFactory filter = new LayerSectionFilterFactory(); filter.GraphFactory = _graph != null ? _graph.Factory : NetGraphBuilder.CreateDefaultProxyGraph(Label); filter.LayerFactories = new INetworkLayerFactory[_layers.Length]; for (int i = 0; i < _layers.Length; ++i) { filter.LayerFactories[i] = _layers[i].Clone(); } filter.SelectionPath = SelectionPath; filter.FilterFactory = DataFrameFilterFactory.CreateDummyFactory(); filter.IsolatedGraph = _isolatedGraph; return(new LayerSectionFilterFactory[1] { filter }); }