Ejemplo n.º 1
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));
            }
        }
Ejemplo n.º 2
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();
        }