Beispiel #1
0
        public ITerminalType Detect()
        {
            ITerminalType termtype = new TermType_Default();

            try
            {
                bool detected = false;
                while ((!detected) && Host_System.Connected)
                {
                    Host_System.Write("\x93\x0cHit Delete:");
                    char c = Host_System.GetChar();
                    if ((c == 8))
                    {
                        Host_System.WriteLine("ASCII/ANSI Detected");
                        Host_System.Write("ANSI Color? ");
                        bool b = Host_System.YesNo(true, true);
                        if (b)
                        {
                            termtype = new TermType_ANSI();
                            detected = true;
                        }
                        else
                        {
                            termtype = new TermType_Default();
                            detected = true;
                        }
                    }
                    else
                    {
                        if (c == '\x14')
                        {
                            termtype = new TermType_PETSCII40();
                            Host_System.WriteRaw("\x1cp" + "\x81" + "e\x9et" + "\x99s" + "\x9a" + "c\x9c" + "i\x1ci \x05" + "dETECTED\x02!\x05");
                            detected = true;
                        }
                        else
                        {
                            if (c == 127)
                            {
                                Host_System.WriteRaw("\x1b[1;31mA\x1b[1;32mN\x1b[1;33mS\x1b[1;34mI\x1b[1;37m Detected");
                                termtype = new TermType_ANSI();
                                detected = true;
                            }
                            else
                            {
                                Host_System.WriteLine(((int)c).ToString());
                            }
                        }
                    }
                }
            }
            catch (Exception e)
            {
                LoggingAPI.LogEntry("Exception in TermDetect.Detect: " + e.Message);
            }
            return(termtype);
        }
Beispiel #2
0
        public bool Go()
        {
            if (State_Object != null)
            {
                DoNotDisturb = true;
                DND_Override = false;
                MessageQueue = new List <string>();
                State_Object.AddDisconnectHandler(Disconnect);
                State_Object.AddReceiver(Receive);
                Currentchar = 0x00;
                try
                {
                    Sysop_Identified = false;
                    //Terminal Detection
                    TerminalType = new TermType_Default();
                    TermDetect td = new TermDetect(this);
                    TerminalType = td.Detect();
                    LoggingAPI.SysLogEntry(_remoteAddress + ": " + TerminalType.TerminalTypeName() + " terminal was detected");
                    Write("~s1");
                    //Welcome Screen
                    SendFileForTermType("Welcome", false);
                    if (TerminalType.C64_Color())
                    {
                        AnyKey(true, false);
                        Write("~s2");
                    }
                    else
                    {
                        AnyKey(true, true);
                    }

                    //Login
                    Login li = new Login(this, _dataInterface);
                    CurrentUser = li.LogIn();
                    if (CurrentUser != null)
                    {
                        SlackLogMessage(CurrentUser.Username + " logged on.");
                        LoggingAPI.SysLogEntry(_remoteAddress + ": " + CurrentUser.Username + "(" + CurrentUser.UserId.ToString() + ")" + " logged in.");
                        int CallLogId = _dataInterface.RecordConnection(CurrentUser.UserId);

                        LastTen lt = new LastTen(this, _dataInterface);
                        lt.ShowLast10();
                        AnyKey(true, false);

                        Gw = new GraffitiWall(this, _dataInterface);
                        Gw.DisplayWall();
                        AnyKey(true, false);

                        News ne = new News(this, _dataInterface);
                        ne.DisplayNews();
                        AnyKey(true, false);

                        Main main = new Main(this, _dataInterface);
                        try
                        {
                            MessageQueueTimer.Enabled = true;
                            Thread.Sleep(100);
                            main.MainPrompt();
                            MessageQueueTimer.Enabled = false;
                            Thread.Sleep(100);
                        }
                        catch (Exception e)
                        {
                            //Log this?
                            LoggingAPI.Error(e);
                        }
                        _dataInterface.RecordDisconnection(CallLogId);
                    }
                    //Close Out
                    WriteLine("~l1~c1Logging out~c2...");
                    LoggingAPI.SysLogEntry(_remoteAddress + ": " + CurrentUser.Username + "(" + CurrentUser.UserId.ToString() + ")" + " logged out.");
                    CurrentArea = "Logging out";
                    //Send end screen
                    SendFileForTermType("Goodbye", true);
                    Sysop_Identified = false;
                    //Thread.Sleep(1000 * 3);
                    CurrentArea = "Disconnected.";
                    SlackLogMessage(CurrentUser.Username + " logged off.");
                    HangUp();
                }
                catch (Exception e)
                {
                    LoggingAPI.Error(e);
                }
                return(true);
            }
            else
            {
                return(false);
            }
        }