Exemple #1
0
        private void EnhancedAgentAddList_Click(object sender, EventArgs e)
        {
            bool   fail    = false;
            string newList = "";

            if (AgentListToAdd.Text == "")
            {
                fail = true;
            }

            if (!Regex.IsMatch(AgentListToAdd.Text, "^[a-zA-Z0-9_]+$"))
            {
                fail = true;
            }

            newList = AgentListToAdd.Text.ToLower();

            switch (m_agentid)
            {
            case 1:
                if (Settings.AutoLoot.ListExists(newList))
                {
                    fail = true;
                }
                break;

            case 2:
                if (Settings.Scavenger.ListExists(newList))
                {
                    fail = true;
                }
                break;

            case 3:
                if (Settings.Organizer.ListExists(newList))
                {
                    fail = true;
                }
                break;

            case 4:
                if (Settings.BuyAgent.ListExists(newList))
                {
                    fail = true;
                }
                break;

            case 5:
                if (Settings.SellAgent.ListExists(newList))
                {
                    fail = true;
                }
                break;

            case 6:
                if (Settings.Dress.ListExists(newList))
                {
                    fail = true;
                }
                break;

            case 7:
                if (Settings.Friend.ListExists(newList))
                {
                    fail = true;
                }
                break;

            case 8:
                if (Settings.Restock.ListExists(newList))
                {
                    fail = true;
                }
                break;

            case 9:
                if (RazorEnhanced.Shard.Exists(newList))
                {
                    fail = true;
                }
                break;
            }


            if (fail)
            {
                MessageBox.Show("Invalid list name!",
                                "Invalid list name!",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
                fail = true;
            }
            else
            {
                switch (m_agentid)
                {
                case 1:
                    AutoLoot.AddList(newList);
                    break;

                case 2:
                    Scavenger.AddList(newList);
                    break;

                case 3:
                    Organizer.AddList(newList);
                    break;

                case 4:
                    BuyAgent.AddList(newList);
                    break;

                case 5:
                    SellAgent.AddList(newList);
                    break;

                case 6:
                    Dress.AddList(newList);
                    HotKey.Init();
                    break;

                case 7:
                    Friend.AddList(newList);
                    break;

                case 8:
                    Restock.AddList(newList);
                    break;

                case 9:
                    RazorEnhanced.Shard.Insert(newList, "Not set", "Not Set", "0.0.0.0", "0", false, false);
                    break;
                }

                Close();
            }
        }