Example #1
0
        public LocalConsoleSession(ILogger logger, string sessionId, IMbbsHost host, ITextVariableService textVariableService) : base(host, sessionId, EnumSessionState.Unauthenticated, textVariableService)
        {
            _logger            = logger;
            _host              = host;
            SendToClientMethod = dataToSend => UnicodeANSIOutput(dataToSend);

            //Timer to trigger btuche() if enabled
            _timer = new Timer(_ =>
            {
                if (EchoEmptyInvokeEnabled && DataToClient.Count == 0)
                {
                    EchoEmptyInvoke = true;
                }
            }, this, TimeSpan.FromMilliseconds(500), TimeSpan.FromMilliseconds(500));

            Console.Clear();

            Console.OutputEncoding = Encoding.Unicode;

            //Detect if we're on Windows and enable VT100 on the current Terminal Window
            if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows))
            {
                new Win32VT100().Enable();
            }

            (_logger as CustomLogger)?.DisableConsoleLogging();

            _consoleInputThreadIsRunning = true;
            _consoleInputThread          = new Thread(InputThread);
            _consoleInputThread.Start();
            _host.AddSession(this);
        }
Example #2
0
 public SocketServer(ILogger logger, IMbbsHost host, AppSettings configuration, ITextVariableService textVariableService, PointerDictionary <SessionBase> channelDictionary)
 {
     _logger              = logger;
     _host                = host;
     _configuration       = configuration;
     _textVariableService = textVariableService;
     _channelDictionary   = channelDictionary;
 }
Example #3
0
        public TestSession(IMbbsHost host, ITextVariableService textVariableService) : base(host, "test", EnumSessionState.EnteringModule, textVariableService)
        {
            SendToClientMethod = Send;
            OutputEnabled      = true;

            CurrentModule = host?.GetModule("MBBSEMU");

            SessionType = EnumSessionType.Test;

            Username = "******";
            Email    = "*****@*****.**";
        }
Example #4
0
        protected SocketSession(IMbbsHost mbbsHost, ILogger logger, Socket socket, ITextVariableService textVariableService) : base(mbbsHost, socket.RemoteEndPoint.ToString(), EnumSessionState.Negotiating, textVariableService)
        {
            _logger = logger;

            _socket = socket;
            _socket.ReceiveTimeout    = (1000 * 60) * 5; //5 Minutes
            _socket.ReceiveBufferSize = _socketReceiveBuffer.Length;
            _socket.SendBufferSize    = 64 * 1024;
            _socket.Blocking          = true;

            _senderThread = new Thread(SendWorker);
            _senderThread.Start();

            SendToClientMethod = Send;
        }
Example #5
0
        internal Galme(IClock clock, ILogger logger, AppSettings configuration, IFileUtility fileUtility, IGlobalCache globalCache, MbbsModule module, PointerDictionary <SessionBase> channelDictionary, ITextVariableService textVariableService) : base(
                clock, logger, configuration, fileUtility, globalCache, module, channelDictionary, textVariableService)
        {
            var txtlenPointer = Module.Memory.AllocateVariable("TXTLEN", 0x2);

            Module.Memory.SetWord(txtlenPointer, 0x400);
        }
Example #6
0
 internal Phapi(IClock clock, ILogger logger, AppSettings configuration, IFileUtility fileUtility, IGlobalCache globalCache, MbbsModule module, PointerDictionary <SessionBase> channelDictionary, ITextVariableService textVariableService) : base(
         clock, logger, configuration, fileUtility, globalCache, module, channelDictionary, textVariableService)
 {
 }
Example #7
0
 public RloginSession(IMbbsHost host, ILogger logger, Socket rloginConnection, PointerDictionary <SessionBase> channelDictionary, AppSettings configuration, ITextVariableService textVariableService, string moduleIdentifier = null) : base(host, logger, rloginConnection, textVariableService)
 {
     ModuleIdentifier   = moduleIdentifier;
     _channelDictionary = channelDictionary;
     _configuration     = configuration;
     SessionType        = EnumSessionType.Rlogin;
     SessionState       = EnumSessionState.Negotiating;
 }
Example #8
0
        public Galgsbl(IClock clock, ILogger logger, AppSettings configuration, IFileUtility fileUtility, IGlobalCache globalCache, MbbsModule module, PointerDictionary <SessionBase> channelDictionary, ITextVariableService textVariableService) : base(
                clock, logger, configuration, fileUtility, globalCache, module, channelDictionary, textVariableService)
        {
            _startDate = clock.Now;
            Module.Memory.AllocateVariable("BTURNO", 9);

            //Check for Module Specific BTURNO #
            var bturno = configuration.GSBLBTURNO;

            if (!string.IsNullOrEmpty(_configuration.GetBTURNO(Module.ModuleIdentifier)))
            {
                bturno = _configuration.GetBTURNO(Module.ModuleIdentifier);
                _logger.Info($"{Module.ModuleIdentifier} Found Module Specific BTURNO # -- Setting BTURNO to: {bturno}");
            }

            //Sanity Check
            if (bturno.Length > 8)
            {
                bturno = bturno.Substring(0, 8);
            }

            Module.Memory.SetArray("BTURNO", Encoding.ASCII.GetBytes($"{bturno}\0"));
            Module.Memory.AllocateVariable("TICKER", 0x02); //ushort increments once per second

            MonitoredChannel2 = 0xFFFF;
            MonitoredChannel  = 0xFFFF;

            TimeSpan timeSpan = TimeSpan.FromSeconds(1);

            _timer = new Timer(OnTimerCallback, this, timeSpan, timeSpan);
        }