示例#1
0
        public Parameter(string[] args) : base(args)
        {
            string[] values;
            Context.IsDebug = GetParameter("D", 0) != null ? true : false;
            IsHelp          = GetParameter("help", 0) != null?true:false;


            //パラメータは、最低1個、最大で二個
            values = base.GetParameter(2, 1);
            Host   = values[0];

            if (values.Count() == 2)
            {
                var ports = values[1].Split(new char[] { '-' });
                if (ports.Length > 1)
                {
                    //指定の開始から指定の終了前
                    Enumerable.Range(int.Parse(ports[0]), int.Parse(ports[1])).All(c => { Port.Add(c); return(true); });
                }
                else
                {
                    //固定のIP
                    Port.Add(int.Parse(ports[0]));
                }
            }
            else
            {
                //1-65535フルスキャン
                Enumerable.Range(1, 65535).All(c => { Port.Add(c); return(true); });
            }
        }
        protected void MakePortRemovable(Port port, Action <int> callback)
        {
            Button removePortButton = new Button(() =>
            {
                int portIndex = inputContainer.IndexOf(port);

                foreach (var edge in port.connections)
                {
                    edge.output.Disconnect(edge);
                    edge.RemoveFromHierarchy();
                }

                port.DisconnectAll();

                inputContainer.RemoveAt(portIndex);

                callback(portIndex);

                RefreshExpandedState();
                RefreshPorts();
            })
            {
                text = "-"
            };

            port.Add(removePortButton);
        }
        private void AddOutputPort()
        {
            Port childPort = InstantiatePort(Orientation.Horizontal, Direction.Output, Port.Capacity.Single,
                                             typeof(BehaviorConnection));

            childPort.portName = "Child";
            outputContainer.Add(childPort);

            if (m_isComposite)
            {
                var removeButton = new Button(() =>
                {
                    if (m_outputEdges.Count > 2)
                    {
                        RemoveOutputPortAndNotify(childPort);
                    }
                })
                {
                    text = "Del"
                };
                childPort.Add(removeButton);
            }

            m_outputEdges.Add(null);
        }
        protected void MakePortRemovable(Port port, Action callback = null)
        {
            port.Add(new Button(() =>
            {
                callback?.Invoke();

                port.RemoveFromHierarchy();

                foreach (var edge in port.connections)
                {
                    if (port.direction == Direction.Input)
                    {
                        edge.output.Disconnect(edge);
                    }
                    else
                    {
                        edge.input.Disconnect(edge);
                    }
                    edge.RemoveFromHierarchy();
                }

                port.DisconnectAll();
            })
            {
                text = "-"
            });
        }
示例#5
0
    private Port[] CreatePortSet(Vector2 _pos, string _title = "port")
    {
        Port  _outPort  = AddOutputPort("out", Port.Capacity.Single);
        Port  _inPort   = AddInputPort("in", Port.Capacity.Multi);
        Label textLabel = new Label(_title);

        _inPort.Add(_outPort);
        _inPort.Add(textLabel);
        subGraphView.contentContainer.Add(_inPort);

        _inPort.SetPosition(new Rect(_pos.x, _pos.y, 85, 50));

        inPorts.Add(_inPort);
        outPorts.Add(_outPort);

        return(new Port[] { _inPort, _outPort });
    }
示例#6
0
        private void buttonX5_Click(object sender, EventArgs e)
        {
            if (saveFileDialog1.ShowDialog() == DialogResult.OK)
            {
                if (radioButton1.Checked)
                {
                    BuffType = Protocol.ALL;
                }
                if (radioButton2.Checked)
                {
                    BuffType = Protocol.TCP;
                }
                if (radioButton3.Checked)
                {
                    BuffType = Protocol.UDP;
                }

                AllIP = radioButton4.Checked;



                if (!radioButton4.Checked)
                {
                    Ipaddress.Clear();

                    foreach (ListViewItem p in listViewEx1.Items)
                    {
                        Ipaddress.Add(p.Text);
                    }
                }


                AllPort = radioButton6.Checked;

                if (!radioButton6.Checked)
                {
                    Port.Clear();
                    foreach (ListViewItem p in listViewEx2.Items)
                    {
                        Port.Add((int)p.Tag);
                    }
                }
                if (this.comboBoxEx1.SelectedItem != null)
                {
                    Encode = this.comboBoxEx1.SelectedItem as Encoding;
                }
                else
                {
                    Encode = Encoding.GetEncoding(this.comboBoxEx1.Text);
                }

                IsOk = true;


                Configsave tmp = new Configsave()
                {
                    BuffType  = BuffType,
                    AllIP     = AllIP,
                    AllPort   = AllPort,
                    Ipaddress = Ipaddress,
                    Port      = Port
                };


                File.WriteAllBytes(saveFileDialog1.FileName, SerializeObject(tmp));
            }
        }
示例#7
0
        private void buttonX1_Click(object sender, EventArgs e)
        {
            if (radioButton1.Checked)
            {
                BuffType = Protocol.ALL;
            }
            if (radioButton2.Checked)
            {
                BuffType = Protocol.TCP;
            }
            if (radioButton3.Checked)
            {
                BuffType = Protocol.UDP;
            }

            AllIP = radioButton4.Checked;



            if (!radioButton4.Checked)
            {
                //Ipaddress = this.ipAddressInput1.Value;

                //if (string.IsNullOrEmpty(Ipaddress))
                //{
                //    MessageBox.Show("请输入IP地址");
                //    return;
                //}

                Ipaddress.Clear();

                foreach (ListViewItem p in listViewEx1.Items)
                {
                    Ipaddress.Add(p.Text);
                }
            }


            AllPort = radioButton6.Checked;

            if (!radioButton6.Checked)
            {
                //   Port = this.integerInput1.Value;

                Port.Clear();
                foreach (ListViewItem p in listViewEx2.Items)
                {
                    Port.Add((int)p.Tag);
                }
            }
            if (this.comboBoxEx1.SelectedItem != null)
            {
                Encode = this.comboBoxEx1.SelectedItem as Encoding;
            }
            else
            {
                Encode = Encoding.GetEncoding(this.comboBoxEx1.Text);
            }



            IsOk = true;
            this.Close();
        }