void item_Click(object sender, EventArgs e) { ToolStripItem item = sender as ToolStripItem; if (item != null) { try { Type type = (Type)item.Tag; INetworkLayerFactory factory = (INetworkLayerFactory)Activator.CreateInstance(type); factory.Binding = Binding; _layers.Add(factory); UpdateLayers(); listViewLayers.SelectedIndices.Add(_layers.Count - 1); OnLayersUpdated(); } catch (Exception ex) { MessageBox.Show(this, ex.Message, Properties.Resources.MessageBox_ErrorString, MessageBoxButtons.OK, MessageBoxIcon.Error); } } }
protected override bool SelectTemplate(object template) { Type t = template as Type; Factory = (INetworkLayerFactory)Activator.CreateInstance(t); return(true); }
protected override bool SelectTemplate(object template) { Type t = template as Type; Factory = (INetworkLayerFactory)Activator.CreateInstance(t); return true; }
/// <summary> /// Constructor /// </summary> public FixedProxyTemplate() { LocalPort = 10000; Port = 12345; Host = "127.0.0.1"; UdpEnable = false; Client = new IpProxyClientFactory(); Layers = new INetworkLayerFactory[0]; }
/// <summary> /// Constructor /// </summary> /// <param name="filter">The filter which checks for a match</param> /// <param name="factory">The graph factory to create on match</param> /// <param name="layers">The binding layers for the graph</param> /// <param name="selectionPath">Selection path to act as a discriminator</param> /// <param name="isolatedGraph">Whether to isolate the graph, only sharing global meta</param> /// <param name="filterId">The ID of the filter</param> public LayerSectionFilter(IDataFrameFilter filter, NetGraphFactory factory, INetworkLayerFactory[] layers, string selectionPath, bool isolatedGraph, Guid filterId) { Filter = filter; Factory = factory; Layers = layers; SelectionPath = selectionPath; FilterId = filterId; IsolatedGraph = isolatedGraph; }
private void RefreshLayers() { foreach (ListViewItem item in listViewLayers.Items) { INetworkLayerFactory layer = (INetworkLayerFactory)item.Tag; item.SubItems[1].Text = layer.Description; } }
private void SetupFilter() { textBoxHost.Text = Filter.Address; checkBoxRegex.Checked = Filter.IsRegex; numFilterPort.Value = (decimal)Filter.Port; if (Filter.Layers != null) { List <INetworkLayerFactory> layers = new List <INetworkLayerFactory>(); foreach (INetworkLayerFactory factory in Filter.Layers) { INetworkLayerFactory cloned = factory.Clone(); layers.Add(cloned); } layerEditorControl.Layers = layers.ToArray(); } if (Filter.Graph != null) { foreach (NetGraphDocument doc in comboBoxNetgraph.Items) { if (doc == Filter.Graph) { comboBoxNetgraph.SelectedItem = doc; } } if (comboBoxNetgraph.SelectedItem == null) { Filter.Graph = null; } } if (!String.IsNullOrWhiteSpace(Filter.RedirectAddress) || (Filter.RedirectPort > 0)) { checkBoxRedirect.Checked = true; textBoxRedirectHost.Text = Filter.RedirectAddress; numRedirectPort.Value = Filter.RedirectPort; } if (Filter.Client != null) { checkBoxClient.Checked = true; proxyClientControl.Client = Filter.Client; } checkBoxBlock.Checked = Filter.Block; checkBoxEnabled.Checked = !Filter.Disabled; }
/// <summary> /// /// </summary> /// <param name="logger"></param> /// <param name="hostName"></param> /// <param name="port"></param> /// <param name="clientType"></param> /// <param name="ipv6"></param> /// <param name="layers"></param> public FixedProxyServer(Logger logger, string hostName, int port, IpProxyToken.IpClientType clientType, bool ipv6, INetworkLayerFactory[] layers) : base(logger) { _hostName = hostName; _port = port; _clientType = clientType; _ipv6 = ipv6; _layers = layers; if (!IPAddress.TryParse(_hostName, out _address)) { _address = null; } }
private void btnAdd_Click(object sender, EventArgs e) { using (SelectLayerForm frm = new SelectLayerForm()) { if (frm.ShowDialog(this) == DialogResult.OK) { INetworkLayerFactory layer = frm.Factory; layer.Binding = Binding; _layers.Add(layer); UpdateLayers(); listViewLayers.SelectedIndices.Add(_layers.Count - 1); OnLayersUpdated(); } } }
private void buttonFilterDown_Click(object sender, EventArgs e) { if ((listViewLayers.SelectedIndices.Count > 0) && (_layers.Count > 1)) { int idx = listViewLayers.SelectedIndices[0]; if (idx < (_layers.Count - 1)) { INetworkLayerFactory factory = _layers[idx]; _layers[idx] = _layers[idx + 1]; _layers[idx + 1] = factory; UpdateLayers(); listViewLayers.SelectedIndices.Add(idx + 1); OnLayersUpdated(); } } listViewLayers.Focus(); }
public override object EditValue(ITypeDescriptorContext context, IServiceProvider provider, object value) { if ((provider != null) && (value is SslNetworkLayerConfig)) { IWindowsFormsEditorService service = provider.GetService(typeof(IWindowsFormsEditorService)) as IWindowsFormsEditorService; if (service != null) { NetworkLayerBinding binding = NetworkLayerBinding.ClientAndServer; INetworkLayerFactory layerFactory = context.Instance as INetworkLayerFactory; if ((layerFactory != null) && (layerFactory.Binding != NetworkLayerBinding.Default)) { binding = layerFactory.Binding; } using (SslConfigControl sslControl = new SslConfigControl()) { sslControl.Config = (SslNetworkLayerConfig)value; sslControl.LayerBinding = binding; service.DropDownControl(sslControl); value = sslControl.Config; } //using (SslConfigForm frm = new SslConfigForm((SslNetworkLayerConfig)value, binding)) //{ // if (service.ShowDialog(frm) == DialogResult.OK) // { // value = frm.Config; // } //} } } return(value); }
/// <summary> /// Add a layer to this service /// </summary> /// <param name="factory">The factory to add</param> public void AddLayer(INetworkLayerFactory factory) { _layers.Add(factory); }
/// <summary> /// Remove a layer /// </summary> /// <param name="factory">The layer to remove</param> public void RemoveLayer(INetworkLayerFactory factory) { _layers.Remove(factory); }
protected override bool SelectScript(ScriptDocument document, string className) { Factory = new ScriptNetworkLayerFactory(document, className); return true; }
/// <summary> /// Constructor /// </summary> /// <param name="logger"></param> /// <param name="layers"></param> public PassThroughProxyServer(Logger logger, INetworkLayerFactory[] layers) : base(logger) { _layers = layers; }
/// <summary> /// Remove a layer /// </summary> /// <param name="factory">The layer to remove</param> public void RemoveLayer(INetworkLayerFactory factory) { _layers = RemoveFactory(factory, _layers); }
/// <summary> /// Insert a layer into this factory /// </summary> /// <param name="factory">The factory to insert</param> /// <param name="index">The index of the factory</param> public void InsertLayer(int index, INetworkLayerFactory factory) { _layers = InsertFactory(index, factory, _layers); }
/// <summary> /// Constructor /// </summary> public UnixSocketProxyTemplate() { ListenPath = string.Empty; ConnectPath = string.Empty; Layers = new INetworkLayerFactory[0]; }
protected override bool SelectScript(ScriptDocument document, string className) { Factory = new ScriptNetworkLayerFactory(document, className); return(true); }
/// <summary> /// Insert a layer into this factory /// </summary> /// <param name="factory">The factory to insert</param> /// <param name="index">The index of the factory</param> public void InsertLayer(int index, INetworkLayerFactory factory) { _layers.Insert(index, factory); }
/// <summary> /// Add a layer to this service /// </summary> /// <param name="factory">The factory to add</param> public void AddLayer(INetworkLayerFactory factory) { _layers = AddFactory(factory, _layers); }