예제 #1
0
        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);
                }
            }
        }
예제 #2
0
        protected override bool SelectTemplate(object template)
        {
            Type t = template as Type;

            Factory = (INetworkLayerFactory)Activator.CreateInstance(t);

            return(true);
        }
예제 #3
0
        protected override bool SelectTemplate(object template)
        {
            Type t = template as Type;

            Factory = (INetworkLayerFactory)Activator.CreateInstance(t);

            return true;
        }
예제 #4
0
 /// <summary>
 /// Constructor
 /// </summary>
 public FixedProxyTemplate()
 {
     LocalPort = 10000;
     Port      = 12345;
     Host      = "127.0.0.1";
     UdpEnable = false;
     Client    = new IpProxyClientFactory();
     Layers    = new INetworkLayerFactory[0];
 }
예제 #5
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;
 }
예제 #6
0
        private void RefreshLayers()
        {
            foreach (ListViewItem item in listViewLayers.Items)
            {
                INetworkLayerFactory layer = (INetworkLayerFactory)item.Tag;

                item.SubItems[1].Text = layer.Description;
            }
        }
예제 #7
0
        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;
        }
예제 #8
0
        /// <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;
            }
        }
예제 #9
0
        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();
                }
            }
        }
예제 #10
0
        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();
        }
예제 #11
0
        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);
        }
예제 #12
0
 /// <summary>
 /// Add a layer to this service
 /// </summary>
 /// <param name="factory">The factory to add</param>
 public void AddLayer(INetworkLayerFactory factory)
 {
     _layers.Add(factory);
 }
예제 #13
0
 /// <summary>
 /// Remove a layer
 /// </summary>
 /// <param name="factory">The layer to remove</param>
 public void RemoveLayer(INetworkLayerFactory factory)
 {
     _layers.Remove(factory);
 }
예제 #14
0
        protected override bool SelectScript(ScriptDocument document, string className)
        {
            Factory = new ScriptNetworkLayerFactory(document, className);

            return true;
        }
예제 #15
0
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="logger"></param>
 /// <param name="layers"></param>
 public PassThroughProxyServer(Logger logger, INetworkLayerFactory[] layers)
     : base(logger)
 {
     _layers = layers;
 }
예제 #16
0
 /// <summary>
 /// Remove a layer
 /// </summary>
 /// <param name="factory">The layer to remove</param>
 public void RemoveLayer(INetworkLayerFactory factory)
 {
     _layers = RemoveFactory(factory, _layers);
 }
예제 #17
0
 /// <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);
 }
예제 #18
0
 /// <summary>
 /// Constructor
 /// </summary>
 public UnixSocketProxyTemplate()
 {
     ListenPath  = string.Empty;
     ConnectPath = string.Empty;
     Layers      = new INetworkLayerFactory[0];
 }
예제 #19
0
        protected override bool SelectScript(ScriptDocument document, string className)
        {
            Factory = new ScriptNetworkLayerFactory(document, className);

            return(true);
        }
예제 #20
0
 /// <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);
 }
예제 #21
0
 /// <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);
 }
예제 #22
0
 /// <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);
 }
예제 #23
0
 /// <summary>
 /// Remove a layer
 /// </summary>
 /// <param name="factory">The layer to remove</param>
 public void RemoveLayer(INetworkLayerFactory factory)
 {
     _layers = RemoveFactory(factory, _layers);
 }
예제 #24
0
 /// <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);
 }