StartSpider() private method

private StartSpider ( string str ) : void
str string
return void
Beispiel #1
0
        private bool InterpCommand(string txt)
        {
            string str  = txt.IndexOf(" ") > -1 ? txt.Substring(0, txt.IndexOf(" ")) : txt;
            string cstr = txt.Substring(txt.IndexOf(" ") + 1);
            string name;

            switch (str)
            {
            case "!exp":
                mClient.SendMessage(SendType.Message, "Typpo", "I've gained " + (Globals.ExpGainedTotal + Globals.ExpGained) + " exp");
                return(true);

            case "!ver":
                mClient.SendMessage(SendType.Message, "Typpo", string.Format("Using version {0} beta {1}", Version.Full, Version.Beta));
                return(true);

            case "!die":
                Globals.Terminate = true;
                Quit();
                Application.Exit();
                return(true);

            case "!reconnect":
                Quit();
                int t;
                if (!int.TryParse(cstr, out t))
                {
                    t = 10;
                }
                Thread.Sleep(t * 1000);
                IrcThread();
                return(true);

            case "!id":
                if (mUI.AccountsPanel.Engine.MainAccount == null)
                {
                    name = "RGA " + mUI.Settings.LastUsername;
                }
                else
                {
                    name = string.Format("{0} ({1}); {2}", mUI.AccountsPanel.Engine.MainAccount.Name, mUI.AccountsPanel.Engine.MainAccount.Server, mUI.Settings.LastUsername);
                }
                mClient.SendMessage(SendType.Message, "Typpo", "My name is " + name);
                return(true);

            case "!msg":
                if (txt.Length > 4)
                {
                    MessageBox.Show(cstr, "DCT Notification");
                }
                return(true);

            case "!do":
                if (txt.Length > 3)
                {
                    HandleInput(cstr);
                }
                return(true);

            case "!ping":
                mClient.SendMessage(SendType.Message, "Typpo", "pong");
                return(true);

            case "!debug":
                mUI.DebugVisible = true;
                mClient.SendMessage(SendType.Message, "Typpo", "debug visible");
                return(true);

            case "!nodebug":
                mUI.DebugVisible = false;
                mClient.SendMessage(SendType.Message, "Typpo", "debug hidden");
                return(true);

            case "!spider":
                mUI.StartSpider(cstr);
                mClient.SendMessage(SendType.Message, "Typpo", "spidering");
                return(true);

            case "!exportrooms":
                Pathfinder.ExportRooms();
                mClient.SendMessage(SendType.Message, "Typpo", "exporting rooms");
                return(true);

            case "!exportmobs":
                Pathfinder.ExportMobs();
                mClient.SendMessage(SendType.Message, "Typpo", "exporting mobs");
                return(true);

            case "!cleardb":
                Pathfinder.Rooms.Clear();
                Pathfinder.Mobs.Clear();
                mClient.SendMessage(SendType.Message, "Typpo", "cleared db");
                return(true);

            case "!currentloc":
                name = "null";
                int id = -1;
                if (mUI.AccountsPanel.Engine.MainAccount != null && mUI.AccountsPanel.Engine.MainAccount.Mover.Location != null)
                {
                    name = mUI.AccountsPanel.Engine.MainAccount.Mover.Location.Name;
                    id   = mUI.AccountsPanel.Engine.MainAccount.Mover.Location.Id;
                }
                mClient.SendMessage(SendType.Message, "Typpo", string.Format("Loc: {0} ({1})", name, id));
                return(true);

            case "!processes":
                string    proc      = Process.GetCurrentProcess().ProcessName;
                Process[] processes = Process.GetProcessesByName(proc);
                mClient.SendMessage(SendType.Message, "Typpo", string.Format("{0} dcts running", processes.Length));
                return(true);

            case "!quiet":
                DisableChat();
                return(true);

            case "!call":
                if (cstr == BugReporter.IDENTIFIER)
                {
                    mClient.SendMessage(SendType.Message, "Typpo", "That's me!");
                }
                return(true);
            }
            return(false);
        }