Exemplo n.º 1
0
        private void BtnEdit_Click(object sender, EventArgs e)
        {
            try
            {
                if (_SelectedItem == null || _SelectedItem.Tag == null || !(_SelectedItem.Tag is ItemInfo))
                {
                    return;
                }
                var info = _SelectedItem.Tag as ItemInfo;
                var frm  = new AddForm();
                frm.Description        = info.Description;
                frm.Protocol           = info.Protocol;
                frm.LocalAddress       = info.LocalAddress;
                frm.RemoteAddress      = info.RemoteAddress;
                frm.PrintLocalPayload  = info.PrintLocalPayload;
                frm.PrintRemotePayload = info.PrintRemotePayload;
                frm.PrintPayloadAsText = info.PrintPayloadAsText;
                frm.Socks5Address      = info.Socks5Address;
                frm.UseSocks5          = info.UseSocks5Proxy;
                if (frm.ShowDialog() == DialogResult.OK)
                {
                    info.Description        = frm.Description;
                    info.Protocol           = frm.Protocol;
                    info.LocalAddress       = frm.LocalAddress;
                    info.RemoteAddress      = frm.RemoteAddress;
                    info.PrintLocalPayload  = frm.PrintLocalPayload;
                    info.PrintRemotePayload = frm.PrintRemotePayload;
                    info.PrintPayloadAsText = frm.PrintPayloadAsText;
                    info.Socks5Address      = frm.Socks5Address;
                    info.UseSocks5Proxy     = frm.UseSocks5;

                    _SelectedItem.Text             = info.Protocol;
                    _SelectedItem.SubItems[0].Text = info.Description;
                    _SelectedItem.SubItems[1].Text = info.Protocol;
                    _SelectedItem.SubItems[2].Text = info.LocalAddress;
                    _SelectedItem.SubItems[3].Text = info.RemoteAddress;

                    SaveItems();
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }