Example #1
0
 private void b_UnConnect_Click(object sender, EventArgs e)
 {
     client.Disconnect();
     tb_Status.Text     += "\r\nОтключено!\r\n";
     b_UnConnect.Enabled = false;
     b_Connect.Enabled   = true;
 }
Example #2
0
        private void Client_DataReceived(object sender, SimpleTCP.Message e)
        {
            lstatus.Invoke((MethodInvoker) delegate()
            {
                Console.WriteLine(e.MessageString);
                if (e.MessageString.Remove(e.MessageString.Length - 1) == "Server closed")
                {
                    bconnect.Enabled = true;
                    lstatus.Items.Add(string.Format("{0:HH:mm tt}", DateTime.Now) + "||" + "Server is closed");
                    lstatus.Items.Add(string.Format("{0:HH:mm tt}", DateTime.Now) + "||" + "Try Connect to server again");
                    cn = "n";
                    lstatus.SelectedIndex = lstatus.Items.Count - 1;
                    Client.Disconnect();
                }
                else if (Comparestr(e.MessageString.Remove(e.MessageString.Length - 1), "Cmsrv3x"))
                {
                    string rms            = e.MessageString.Remove(e.MessageString.Length - 1);
                    ltest.Text            = rms.Replace("Cmsrv3x", "User online: ");
                    lstatus.SelectedIndex = lstatus.Items.Count - 1;
                }
                else if (secretms(e.MessageString.Remove(e.MessageString.Length - 1), "@") != true)
                {
                    lstatus.Items.Add(string.Format("{0:HH:mm tt}", DateTime.Now) + "||" + e.MessageString.Remove(e.MessageString.Length - 1));
                    lstatus.SelectedIndex = lstatus.Items.Count - 1;
                }
                else if (secretms(e.MessageString.Remove(e.MessageString.Length - 1), "@" + name + ":") | secretms(e.MessageString.Remove(e.MessageString.Length - 1), name + " : "))
                {
                    lstatus.Items.Add(string.Format("{0:HH:mm tt}", DateTime.Now) + "||" + e.MessageString.Remove(e.MessageString.Length - 1));
                    if (secretms(e.MessageString.Remove(e.MessageString.Length - 1), "@" + name + ":"))
                    {
                        player.Play();
                    }
                    else
                    {
                    }

                    lstatus.SelectedIndex = lstatus.Items.Count - 1;
                }
                else
                {
                }
            });
        }