Exemple #1
0
        public void Prompt()
        {
            bool quitflag = false;

            while ((!quitflag) && _bbs.Connected)
            {
                //Show Main Prompt
                _bbs.Write("~l1~c1SysOp~c2:~c7");
                string command = _bbs.Input(true, false, false);
                if (command.Length == 1)
                {
                    switch (command.Substring(0, 1).ToUpper())
                    {
                    case "H":
                        _bbs.SendFileForTermType("sysop_help", true);
                        break;

                    case "Q":
                        quitflag = true;
                        break;

                    default:
                        _bbs.WriteLine("~l1~d2Unknown command.~d0~c1");
                        break;
                    }
                }
                else
                {
                    if (command.Length >= 2)
                    {
                        switch (command.Substring(0, 2).ToUpper())
                        {
                        case "LG":     //List Access Groups
                            CMD_ListGroups();
                            break;

                        case "AG":     //Add Access Group
                            CMD_ListGroups();
                            break;

                        case "EG":     //Edit Access Group
                            CMD_ListGroups();
                            break;

                        case "RG":     //Remove Access Group
                            CMD_ListGroups();
                            break;

                        default:
                            _bbs.WriteLine("~l1~d2Unknown command.~d0~c1");
                            break;
                        }
                    }
                }
            }
        }
Exemple #2
0
        public void Prompt()
        {
            bool quitflag = false;

            while ((!quitflag) && _bbs.Connected)
            {
                //Show Main Prompt
                _bbs.WriteLine("~l1~c7H~c1elp~c2, ~c7L~c1ist~c2, ~c7Q~c1uit");
                _bbs.Write("~c1PFiles~c2:~c7");
                string command = _bbs.Input(true, false, false);
                if (command.Length > 0)
                {
                    if ("0123456789".Contains(command.Substring(0, 1)))
                    {
                        //Select item.
                        IdAndKeys selectedItem = Current_Area_List.FirstOrDefault(p => p.Keys["listid"].Equals(command));
                        if (selectedItem != null)
                        {
                            if (selectedItem.Keys["type"] == "area")
                            {
                                ChangeToArea(selectedItem.Id);
                            }
                            else
                            {
//Run this file
                                RunPFile(selectedItem.Keys["title"]);
                            }
                        }
                    }
                    else
                    {
                        switch (command.ToUpper()[0])
                        {
                        case 'H':
                            _bbs.SendFileForTermType("pfile_help", true);
                            break;

                        case 'L':
                            CMD_List();
                            break;

                        case '/':
                            if (Current_Pfile_Area > -1)
                            {
                                ChangeToArea(_dataInterface.PFile_ParentArea(Current_Pfile_Area));
                            }
                            break;

                        case 'Q':
                            quitflag = true;
                            break;
                        }
                    }
                }
            }
        }
Exemple #3
0
        public void DisplayNews()
        {
            List <NewsRow> glist = _dataInterface.GetNews(_bbs.CurrentUser.LastDisconnection);

            if (_bbs.FileExistsForTermType("news_top"))
            {
                _bbs.SendFileForTermType("news_top", true);
            }
            else
            {
                _bbs.Write("~l2~d4" + Utils.Center("NEWS", _bbs.TerminalType.Columns()) + "~d0");
            }
            if ((glist != null) && (glist.Count > 0))
            {
                foreach (NewsRow bm in glist)
                {
                    _bbs.WriteLine("~l1");
                    _bbs.WriteLine("~c1Subject: ~c7" + bm.Subject);
                    _bbs.WriteLine("~c1Date: ~c7" + bm.Posted.ToString("yy-MM-dd HH:mm") + "~c2");
                    _bbs.Write(Utils.Repeat('\xc0', _bbs.TerminalType.Columns()));
                    _bbs.Write("~c1");
                    string[] splitarray = { "~\xff~" };
                    string[] lines      = bm.Body.TrimEnd("~\xff".ToCharArray()).Split(splitarray, StringSplitOptions.None);
                    foreach (string s in lines)
                    {
                        if (s != "")
                        {
                            _bbs.WriteLine(s);
                        }
                    }
                    _bbs.Write("~c4");
                }
            }
            else
            {
                _bbs.WriteLine("~c1Nothing Found");
            }
            _bbs.WriteLine("~d4" + Utils.Center("END OF NEWS", _bbs.TerminalType.Columns()) + "~d0");
        }
Exemple #4
0
        public User LogIn()
        {
            _bbs.CurrentArea = "Logging In";
            User u = null;

            try
            {
                string uname    = "";
                string pass     = "";
                int    bigtries = 0;
                while (_bbs.Connected && bigtries < 3)
                {
                    int tries = 0;
                    while (_bbs.Connected && tries < 3)
                    {
                        _bbs.Write("~l2~c1Username~c2: ~c7");
                        uname = _bbs.Input(true, false, false, true, 30);
                        if (uname.ToUpper() == "NEW")
                        {
                            break;
                        }
                        else
                        {
                            _bbs.Write("~l1~c1Password~c2: ~c7");
                            pass = _bbs.Input(true, true, false, false, 30);
                            if ((uname == "") || (pass == ""))
                            {
                                tries++;
                            }
                            else
                            {
                                break;
                            }
                        }
                    }
                    if (tries < 3)
                    {
                        if (uname.ToUpper() == "NEW")
                        {
                            NewUser nu = new NewUser(_bbs, _dataInterface);
                            if (nu.Application())
                            {
                                u = _dataInterface.Login(nu.Username, nu.Password);
                            }
                            break;
                        }
                        else
                        {
                            //Username and pass have been filled in
                            u = _dataInterface.Login(uname, pass);
                            if (u != null)
                            {
                                break;
                            }
                        }
                    }
                    else
                    {
                        BuggerOff();
                    }
                    if (u == null)
                    {
                        bigtries++;
                    }
                }
                if (u != null)
                {
                    _bbs.WriteLine("~l1~c1Welcome, ~c7" + u.Username.ToUpper() + "~c1.~l4");
                }
                else
                {
                    BuggerOff();
                }
            }
            catch (Exception e)
            {
                LoggingAPI.LogEntry("Exception in Login.LogIn: " + e.Message);
            }
            return(u);
        }
Exemple #5
0
        public void Prompt()
        {
            bool quitflag = false;

            while ((!quitflag) && _bbs.Connected)
            {
                //Show Main Prompt
                if (!_bbs.ExpertMode)
                {
                    _bbs.WriteLine("~l1~c7H~c1elp~c2, ~c7L~c1ist~c2, ~c7Q~c1uit");
                }
                else
                {
                    _bbs.WriteLine();
                }
                _bbs.Write("~c1GFiles~c2:~c7");
                string command = _bbs.Input(true, false, false);
                if (command.Length > 0)
                {
                    if ("0123456789".Contains(command.Substring(0, 1)))
                    {
                        //Select item.
                        IdAndKeys selectedItem = Current_Area_List.FirstOrDefault(p => p.Keys["listid"].Equals(command));
                        if (selectedItem != null)
                        {
                            if (selectedItem.Keys["type"] == "area")
                            {
                                ChangeToArea(selectedItem.Id);
                            }
                            else
                            {
                                //Show this file
                                CMD_Read(int.Parse(selectedItem.Keys["gfiledetailid"]));
                            }
                        }
                    }
                    else
                    {
                        switch (command.ToUpper()[0])
                        {
                        case 'H':
                            _bbs.SendFileForTermType("gfile_help", true);
                            break;

                        case 'L':
                            CMD_List();
                            break;

                        case '/':
                            if (Current_Gfile_Area > -1)
                            {
                                ChangeToArea(_dataInterface.GFile_ParentArea(Current_Gfile_Area));
                            }
                            break;

                        case 'Q':
                            quitflag = true;
                            break;

                        default:
                            if (_bbs.Sysop_Identified)
                            {
                                CMD_SysOp(command);
                            }
                            else
                            {
                                _bbs.WriteLine("~l1~d2Unknown command.~d0~c1");
                            }
                            break;
                        }
                    }
                }
            }
        }