Пример #1
0
        public void Prompt()
        {
            bool quitflag = false;

            while ((!quitflag) && _bbs.Connected)
            {
                //Show Main Prompt
                if (!_bbs.expertMode)
                {
                    _bbs.WriteLine("~l1~c7? ~c1Menu, ~c7H~c1elp~c2, ~c7L~c1ist~c2, ~c7Q~c1uit");
                }
                else
                {
                    _bbs.WriteLine();
                }
                if (CurrentUDBase > -1)
                {
                    _bbs.Write("~c1UDBases~c2:~c7");
                }
                else
                {
                    _bbs.Write("~c1UDBases~c2:~c7");
                }
                string command = _bbs.Input(true, false, false);
                if (command.Length > 0)
                {
                    if ("0123456789".Contains(command.Substring(0, 1)))
                    {
                        if (CurrentUDBase == -1)
                        {
                            //Select item.
                            IdAndKeys selectedItem = Current_Area_List.FirstOrDefault(p => p.Keys["listid"].Equals(command));
                            if (selectedItem != null)
                            {
                                if (selectedItem.Keys["type"] == "area")
                                {
                                    _bbs.WriteLine("~l1~c7Changing to Area: " + selectedItem.Keys["title"] + "~p1");
                                    ChangeToArea(selectedItem.Id);
                                }
                                else
                                {
                                    _bbs.WriteLine("~l1~c7Changing to UDBase: " + selectedItem.Keys["title"] + "~p1");
                                    ChangeToUDBase(selectedItem.Id);
                                }
                            }
                        }
                        else
                        {
                            //We're in a udbase \
                            //CMD_DetailsByFileId(int.Parse(command));
                        }
                    }
                    else
                    {
                        switch (command.ToUpper()[0])
                        {
                        case 'H':
                            if (CurrentUDBase == -1)
                            {
                                _bbs.SendFileForTermType("udarea_help", true);
                            }
                            else
                            {
                                _bbs.SendFileForTermType("udbase_help", true);
                            }
                            break;

                        case '?':
                            if (CurrentUDBase == -1)
                            {
                                _bbs.SendFileForTermType("udarea_menu", true);
                            }
                            else
                            {
                                _bbs.SendFileForTermType("udbase_menu", true);
                            }
                            break;

                        case 'L':
                            CMD_List();
                            break;

                        case '/':
                            if (CurrentUDBase > -1)
                            {
                                CurrentUDBase = -1;
                                CMD_List();
                            }
                            else
                            {
                                if (Current_Area > -1)
                                {
                                    CurrentUDBase = -1;
                                    IdAndKeys mba = _bbsDataCore.UDBase_ParentArea(Current_Area);
                                    _bbs.WriteLine("~l1~c7Changing to Area: " + mba.Keys["title"] + "~p1");
                                    ChangeToArea(mba.Id);
                                }
                                else
                                {
                                    _bbs.WriteLine("~l1~d2Already at top level.~d0");
                                }
                            }
                            break;

                        case 'U':
                            if (CurrentUDBase == -1)
                            {
                                _bbs.WriteLine("~l1~d1Select a UD base.~d0");
                            }
                            else
                            {
                                CMD_Upload();
                            }
                            break;

                        case 'Q':
                            quitflag = true;
                            break;

                        case 'D':
                            //Download
                            if (command.Length == 1)
                            {
                                _bbs.Write("~c1File Number~c2:~c7");
                                int i = _bbs.InputNumber(3);
                                if (i > -1)
                                {
                                    CMD_Download(i.ToString());
                                }
                            }
                            else
                            {
                                CMD_Download(command.Substring(1, command.Length - 1));
                            }
                            break;
                        }
                    }
                }
            }
        }