コード例 #1
0
        private void boton_opciones_guardar_Click(object sender, EventArgs e)
        {
            if (!IPAddress.TryParse(textBox_ip_servidor.Text, out IPAddress ip))
            {
                textBox_ip_servidor.BackColor = Color.Red;
                return;
            }

            if (!short.TryParse(textBox_puerto_servidor.Text, out short puerto))
            {
                textBox_puerto_servidor.BackColor = Color.Red;
                return;
            }

            if (!int.TryParse(textBox_peso_core.Text, out int peso_core))
            {
                textBox_peso_core.BackColor = Color.Red;
                return;
            }

            if (!int.TryParse(textBox_peso_loader.Text, out int peso_loader))
            {
                textBox_peso_loader.BackColor = Color.Red;
                return;
            }

            GlobalConf.mostrar_mensajes_debug = checkBox_mensajes_debug.Checked;
            GlobalConf.ip_conexion            = ip.ToString();
            GlobalConf.puerto_conexion        = puerto;
            GlobalConf.peso_core             = peso_core;
            GlobalConf.peso_loader           = peso_loader;
            GlobalConf.password_encriptacion = textBox_encriptacion.Text;
            GlobalConf.guardar();
            Close();
        }
コード例 #2
0
ファイル: GestionCuentas.cs プロジェクト: Leandre3Lu/FreeBot
        private void boton_Agregar_Cuenta_Click(object sender, EventArgs e)
        {
            if (GlobalConf.get_Cuenta(textBox_Nombre_Cuenta.Text) != null)
            {
                MessageBox.Show("Ya existe una cuenta con el nombre de cuenta", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            bool tiene_errores = false;

            tableLayoutPanel6.Controls.OfType <TableLayoutPanel>().ToList().ForEach(panel =>
            {
                panel.Controls.OfType <TextBox>().ToList().ForEach(textbox =>
                {
                    if (string.IsNullOrEmpty(textbox.Text) || textbox.Text.Split(new char[0]).Length > 1)
                    {
                        textbox.BackColor = Color.Red;
                        tiene_errores     = true;
                    }
                    else
                    {
                        textbox.BackColor = Color.White;
                    }
                });
            });

            if (!tiene_errores)
            {
                GlobalConf.agregar_Cuenta(textBox_Nombre_Cuenta.Text, textBox_Password.Text, comboBox_Servidor.SelectedItem.ToString(), textBox_nombre_personaje.Text);
                cargar_Cuentas_Lista();

                textBox_Nombre_Cuenta.Clear();
                textBox_Password.Clear();
                textBox_nombre_personaje.Clear();

                if (checkBox_Agregar_Retroceder.Checked)
                {
                    tabControlPrincipalCuentas.SelectedIndex = 0;
                }

                GlobalConf.guardar();
            }
        }
コード例 #3
0
ファイル: GestionCuentas.cs プロジェクト: Leandre3Lu/FreeBot
        private void modificar_Cuenta(object sender, EventArgs e)
        {
            if (listViewCuentas.SelectedItems.Count == 1 && listViewCuentas.FocusedItem != null)
            {
                CuentaConf cuenta = GlobalConf.get_Cuenta(listViewCuentas.SelectedItems[0].Index);

                if (cuenta == null)
                {
                    return;
                }

                switch (sender.ToString())
                {
                case "Cuenta":
                    string nueva_cuenta = Interaction.InputBox($"Ingresa la nueva cuenta", "Modificar cuenta", cuenta.nombre_cuenta);

                    if (!string.IsNullOrEmpty(nueva_cuenta) || nueva_cuenta.Split(new char[0]).Length == 0)
                    {
                        cuenta.nombre_cuenta = nueva_cuenta;
                    }
                    break;

                case "Contraseña":
                    string nueva_password = Interaction.InputBox($"Ingresa la nueva contraseña", "Modificar contraseña", cuenta.password);

                    if (!string.IsNullOrEmpty(nueva_password) || nueva_password.Split(new char[0]).Length == 0)
                    {
                        cuenta.password = nueva_password;
                    }
                    break;

                default:
                    string nuevo_personaje = Interaction.InputBox($"Ingresa el nombre del nuevo personaje", "Modificar nombre de personaje", cuenta.nombre_personaje);
                    cuenta.nombre_personaje = nuevo_personaje;
                    break;
                }

                GlobalConf.guardar();
                cargar_Cuentas_Lista();
            }
        }
コード例 #4
0
ファイル: GestionCuentas.cs プロジェクト: Leandre3Lu/FreeBot
        private void eliminarToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (listViewCuentas.FocusedItem == null || listViewCuentas.SelectedItems.Count <= 0)
            {
                return;
            }

            foreach (ListViewItem item in listViewCuentas.SelectedItems)
            {
                CuentaConf cuenta_conf = GlobalConf.get_Cuenta(item.Text);

                if (cuenta_conf == null)
                {
                    continue;
                }

                GlobalConf.eliminar_Cuenta(cuenta_conf);
                item.Remove();
            }

            GlobalConf.guardar();
            cargar_Cuentas_Lista();
        }