Example #1
0
        private void LoadSettings(Properties.Settings settings)
        {
            LoginComboBox.Text                 = settings.LastLogin;
            PasswordTextBox.Text               = settings.Password;
            CollectChestsCheckBox.Checked      = settings.CollectChests;
            CollectEventChestsCheckBox.Checked = settings.CollectEventChests;
            ShootNpcsCheckBox.Checked          = settings.ShootNpcs;
            ShootAnimalsCheckBox.Checked       = settings.ShootAnimals;
            AvoidIslandsCheckBox.Checked       = settings.AvoidIslands;
            RepairingWhenTextBox.Text          = settings.RepairingWhen;
            StartFightWhenTextBox.Text         = settings.StartFightWhen;
            FightUntilTextBox.Text             = settings.FightUntil;
            LeftRightCheckBox.Checked          = settings.LeftRight;
            UpDownCheckBox.Checked             = settings.UpDown;
            if (settings.WhenNearBorderOrEveryXMinutes)
            {
                WhenNearBorderRadioButton.Checked = true;
                EveryXMinutesRadioButton.Checked  = false;
            }
            else
            {
                WhenNearBorderRadioButton.Checked = false;
                EveryXMinutesRadioButton.Checked  = true;
            }
            WhenNearBorderRadioButton.Checked = settings.WhenNearBorderOrEveryXMinutes;
            XMinutesTextBox.Text = settings.XMinutes;

            if (settings.LoginList != null)
            {
                foreach (string item in settings.LoginList)
                {
                    if (item != "")
                    {
                        LoginComboBox.Items.Add(item);
                    }
                }
            }
            LoadNpcsDGV(Properties.Settings.Default);
            LoadAnimalsDGV(Properties.Settings.Default);
        }
Example #2
0
        private void SaveSettings(Properties.Settings settings)
        {
            if (settings.LoginList == null)
            {
                settings.LoginList = new List <string>();
            }
            for (int i = 0; i < LoginComboBox.Items.Count; i++)
            {
                if (!settings.LoginList.Contains(LoginComboBox.Items[i].ToString()))
                {
                    settings.LoginList.Add(LoginComboBox.Items[i].ToString());
                }
            }
            settings.Npcs = new List <string[]>();
            for (int i = 0; i < NpcsDataGridView.Rows.Count; i++)
            {
                settings.Npcs.Add(new string[] { (string)NpcsDataGridView.Rows[i].Cells[0].Value, NpcsDataGridView.Rows[i].Cells[1].Value.ToString(), NpcsDataGridView.Rows[i].Cells[2].Value.ToString() });
            }
            settings.Animals = new List <string[]>();
            for (int i = 0; i < AnimalsDataGridView.Rows.Count; i++)
            {
                settings.Animals.Add(new string[] { (string)AnimalsDataGridView.Rows[i].Cells[0].Value, AnimalsDataGridView.Rows[i].Cells[1].Value.ToString(), AnimalsDataGridView.Rows[i].Cells[2].Value.ToString() });
            }
            settings.LastLogin     = LoginComboBox.Text;
            settings.Password      = PasswordTextBox.Text;
            settings.CollectChests = CollectChestsCheckBox.Checked;

            settings.CollectEventChests            = CollectEventChestsCheckBox.Checked;
            settings.ShootNpcs                     = ShootNpcsCheckBox.Checked;
            settings.ShootAnimals                  = ShootAnimalsCheckBox.Checked;
            settings.AvoidIslands                  = AvoidIslandsCheckBox.Checked;
            settings.RepairingWhen                 = RepairingWhenTextBox.Text;
            settings.StartFightWhen                = StartFightWhenTextBox.Text;
            settings.FightUntil                    = FightUntilTextBox.Text;
            settings.LeftRight                     = LeftRightCheckBox.Checked;
            settings.UpDown                        = UpDownCheckBox.Checked;
            settings.WhenNearBorderOrEveryXMinutes = WhenNearBorderRadioButton.Checked;
            settings.XMinutes                      = XMinutesTextBox.Text;
            settings.Save();
        }