Пример #1
0
        public bool Application()
        {
            var result = false;

            //var quitflag = false;
            try
            {
                //Show new user file
                _bbs.SendFileForTermType("NewUser", true);
                if (!GetUsername())
                {
                    return(false);
                }
                if (!GetPassword())
                {
                    return(false);
                }
                RealName = GetField("Real Name", "~l2~cbEnter your real name.", 0);
                if (RealName == null)
                {
                    return(false);
                }
                Email = GetField("Email", "~l2~cbEnter your email address.", 0);
                if (Email == null)
                {
                    return(false);
                }
                ComputerType = GetField("Computer", "~l2~cbEnter your computer model.", 0);
                if (ComputerType == null)
                {
                    return(false);
                }
                var user = _bbsDataCore.SaveNewUser(Username, Password, RealName, Email, ComputerType, _bbs._remoteAddress, "");
                if (user != null)
                {
                    _bbs.currentUser = user;
                }

                //New User feedback
                _bbs.Write("~l2~cbLeave an introduction message?");
                if (_bbs.YesNo(true, true))
                {
                    var lineEditor = new Line_Editor(_bbs);
                    if (lineEditor.Edit(null))
                    {
                        _bbsDataCore.NewFeedback("New User Feedback", lineEditor.GetMessage(), _bbs.currentUser.Id);
                    }
                }
                //And Done
                result = true;
            }
            catch (Exception e)
            {
                LoggingAPI.LogEntry("Exception in NewUser.Application: " + e.ToString());
            }
            return(result);
        }
Пример #2
0
        public void CMD_Post()
        {
            _bbs.Write("~l1~c1Post Message~l1Anonymous?");
            bool anon = _bbs.YesNo(true, true);

            _bbs.Write("~c1~l1Subject ~c7:~c1");
            string subject = _bbs.Input(true, false, false);

            if (subject != "")
            {
                Line_Editor le = new Line_Editor(_bbs);
                if (le.Edit(null))
                {
                    _bbs.Write("~s1~l1~c1Posting Message...");
                    _bbsDataCore.PostMessage(CurrentMessageBase, subject, anon, _bbs.CurrentUser.Id, le.GetMessage());
                    _bbs.WriteLine("Done.");
                }
            }
        }
Пример #3
0
 public void CMD_Download(string filespec)
 {
     if (int.TryParse(filespec, out int filenum))
     {
         if (filenum <= Current_File_List.Count())
         {
             UDFile selectedItem = Current_File_List[filenum];
             _bbs.WriteLine("~c1Download: ~c7" + selectedItem.Filename + "~c1");
             if (_bbs.YesNo(true, true))
             {
                 //TODO: wire file tranfers back up
                 //FileTransfers ft = new FileTransfers(_bbs.State_Object);
                 //string filepath = Current_Area_List.FirstOrDefault(p => p.Keys["type"].Equals("base") && p.Id.Equals(CurrentUDBase)).Keys["filepath"];
                 //_bbs.WriteLine("~l1~c1Start Download Now.");
                 //ft.Punter_Send(filepath + "\\" + selectedItem.Filename, (selectedItem.FileType == "P"));
             }
         }
     }
 }
Пример #4
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();
                }
            }
        }