Example #1
0
        private void playButton_Click(object sender, EventArgs e)
        {
            RegKeys rg = new RegKeys();

            if (rg.getRegistryKey("Path").Length >= 1)
            {
                if (System.IO.File.Exists(rg.getRegistryKey("Path")))
                {
                    if (nicknameTextBox.TextLength >= 3 && nicknameTextBox.TextLength <= 24) //проверка на длину никнейма
                    {
                        string nickName  = nicknameTextBox.Text;
                        string path      = rg.getRegistryKey("Path");
                        string arguments = $"\"{serversIp[selectedServer]}:{serversPort[selectedServer]}\" \"-n {nickName}\"";
                        if (rg.getRegistryKey("Nickname") != nickName)
                        {
                            rg.updateRegistryKey("Nickname", nickName);
                        }
                        Process.Start(path, arguments);
                    }
                    else
                    {
                        MessageBox.Show("Длина никнейма может быть от 3-24 символов!");
                    }
                }
                else
                {
                    MessageBox.Show("Путь к игре указан неверно!");
                }
            }
            else
            {
                MessageBox.Show("Вы не указали путь к игре!");
            }
        }
Example #2
0
        private void serversComboBox_SelectedIndexChanged(object sender, EventArgs e)
        {
            selectedServer = serversComboBox.SelectedIndex;
            RegKeys rg = new RegKeys();

            rg.updateRegistryKey("SelectedServer", selectedServer.ToString());
            getServerStats(selectedServer, true);
            serverInfoListView.Items.Clear();
            nameServerItem = serverInfoListView.Items.Add("Название: " + serverInfo[2]);
            nameModeItem   = serverInfoListView.Items.Add("Название мода: " + serverInfo[3]);
            playersItem    = serverInfoListView.Items.Add("Игроки: " + serverInfo[0] + "/" + serverInfo[1]);
        }
Example #3
0
        private void pathToGameButton_Click(object sender, EventArgs e)
        {
            OpenFileDialog openFileDialog = new OpenFileDialog();

            openFileDialog.InitialDirectory = "c:\\";
            openFileDialog.Filter           = "SAMP|samp.exe";
            openFileDialog.RestoreDirectory = true;
            if (openFileDialog.ShowDialog() == DialogResult.OK)
            {
                pathToGameTextBox.Text = openFileDialog.FileName;
                RegKeys rg = new RegKeys();
                rg.updateRegistryKey("Path", openFileDialog.FileName);
            }
        }