Example #1
0
        public void MainPrompt()
        {
            bool quitflag = false;

            while ((!quitflag) && _bbs.Connected)
            {
                if (!_bbs.overrideDoNotDisturb)
                {
                    _bbs.doNotDisturb = false;
                }
                //Show Main Prompt
                if (!_bbs.expertMode)
                {
                    if (_bbs.terminalType.Columns() == 40)
                    {
                        _bbs.WriteLine("~l2~c7? ~c1Menu~c2,~c7H~c1elp~c2,~c7B~c1ases~c2,~c7G~c1Files~c2,~c7P~c1Files~c2,~c7Q~c1uit");
                    }
                    else
                    {
                        _bbs.WriteLine("~l2~c7? ~c1Help~c2, ~c7B~c1ases~c2, ~c7U~c1DBases~c2, ~c7G~c1Files~c2, ~c7P~c1Files~c2, ~c7Q~c1uit");
                    }
                }
                else
                {
                    _bbs.WriteLine();
                }
                _bbs.currentArea = "Main Prompt";
                _bbs.Write("~c1Main~c2:~c7");
                string command = _bbs.Input(true, false, false, true, 10);
                if (command.Length > 0)
                {
                    switch (command.ToString().ToUpper())
                    {
                    case "?":
                        _bbs.SendFileForTermType("MainMenu", true);
                        break;

                    case "B":
                        MessageBases mb = new MessageBases(_bbs, _bbsDataCore);
                        mb.Prompt();
                        break;

                    case "DND":
                        CMD_DND();
                        break;

                    case "F":
                        CMD_Feedback();
                        break;

                    case "G":
                        try
                        {
                            GFiles gf = new GFiles(_bbs, _bbsDataCore);
                            gf.Prompt();
                        }
                        catch (Exception e)
                        {
                            LoggingAPI.LogEntry("Exception in Main.MainPrompt: " + e);
                            //Log this?
                        }
                        break;

                    case "P":
                        try
                        {
                            PFiles pf = new PFiles(_bbs, _bbsDataCore);
                            pf.Prompt();
                        }
                        catch (Exception e)
                        {
                            LoggingAPI.LogEntry("Exception in Main.MainPrompt: " + e);
                            //Log this?
                        }
                        break;

                    case "Q!":
                        quitflag = true;
                        break;

                    case "Q":
                        CMD_Feedback();
                        _bbs.Write("~l1~c1Leave one-liner?");
                        if (_bbs.YesNo(true, true))
                        {
                            _bbs.GraffitiWall.AddLine(_bbs.CurrentUser.Id);
                        }
                        quitflag = true;
                        break;

                    case "SY":
                        //If the current user has any groups that would allow sysop access
                        if (_bbs.currentUser.UserAccessGroups.Any(p => p.AccessGroup.AllowSysOp))
                        {
                            _bbs.Write("~l1~c1Password:~c7");
                            string sy = _bbs.Input(true, true, false);
                            if (sy.ToUpper() == _bbsConfig.SysOpMenuPassword.ToUpper())
                            {
                                _bbs.sysopIdentified = true;
                                SysOp sys = new SysOp(_bbs, _bbsDataCore);
                                sys.Prompt();
                            }
                            else
                            {
                                _bbs.WriteLine("~l1~d2Invalid password.  F**k off.~d0~c1");
                            }
                        }
                        else
                        {
                            _bbs.WriteLine("~l1~d2Unknown command.~d0~c1");
                        }
                        break;

                    case "UD":
                    case "U":
                        UDBases ud = new UDBases(_bbs, _bbsDataCore);
                        ud.Prompt();
                        //break;
                        //UDBases ud = new UDBases(bbs);
                        //ud.Prompt();
                        break;


                    case "WHO":
                        CMD_Who();
                        break;

                    case "X":
                        _bbs.expertMode = !_bbs.expertMode;
                        _bbs.WriteLine("~l1~c1Expert mode is ~c7" + (_bbs.expertMode ? "ON" : "OFF") + "~c1.");
                        break;

                    default:
                        //Test multi-part commands
                        if (command.Length > 3 && command.Substring(0, 3).ToUpper() == "OLM")
                        {
                            CMD_OLM(command);
                        }
                        else if (command.Length > 3 && command.Substring(0, 3).ToUpper() == "SLM")
                        {
                            CMD_SLM(command);
                        }
                        else
                        {
                            if (_bbs.SysopIdentified)
                            {
                                CMD_SysOp(command);
                            }
                            else
                            {
                                _bbs.WriteLine("~l1~d2Unknown command.~d0~c1");
                            }
                        }
                        break;
                    }
                }
                if ((!quitflag) && (!_bbs.doNotDisturb))
                {
                    //Show any received OLMs
                    _bbs.FlushOLMQueue();
                }
            }
        }