Exemplo n.º 1
0
        protected void AddSubsystem(ISubSystem subSystem)
        {
            if (subSystem == null)
            {
                return;
            }

            _subsystems.Add(subSystem);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Default constructor for a new connection to the server.
        /// </summary>
        /// <param name="socket">Socket that is connecting</param>
        /// <param name="connectionHost">Server hosting the connection</param>
        public Connection(Socket socket, ISubSystem connectionHost)
        {
            Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);

            this.socket         = socket;
            this.connectionHost = connectionHost;

            ID = Guid.NewGuid().ToString();
            CurrentIPAddress = ((IPEndPoint)socket.RemoteEndPoint).Address;
            Data             = new byte[1];

            //this.Send(IACSLE);
        }
Exemplo n.º 3
0
        public virtual void AddSubSystem(String key, ISubSystem subsystem)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }
            if (subsystem == null)
            {
                throw new ArgumentNullException("facility");
            }

            subsystem.Init(this);
            subsystems[key] = subsystem;
        }
Exemplo n.º 4
0
        /// <summary>Initializes a new instance of the <see cref="Connection"/> class.</summary>
        /// <param name="socket">The socket upon which this connection is to be based.</param>
        /// <param name="connectionHost">The system hosting this connection.</param>
        public Connection(Socket socket, ISubSystem connectionHost)
        {
            Buffer          = new StringBuilder();
            OutputBuffer    = new OutputBuffer();
            Data            = new byte[1];
            TerminalOptions = new TerminalOptions();
            this.socket     = socket;
            var remoteEndPoint = (IPEndPoint)this.socket.RemoteEndPoint;

            CurrentIPAddress = remoteEndPoint.Address;
            ID = Guid.NewGuid().ToString();
            TelnetCodeHandler   = new TelnetCodeHandler(this);
            this.connectionHost = connectionHost;
        }
Exemplo n.º 5
0
        public virtual void AddSubSystem(String name, ISubSystem subsystem)
        {
            if (name == null)
            {
                throw new ArgumentNullException("name");
            }
            if (subsystem == null)
            {
                throw new ArgumentNullException("subsystem");
            }

            subsystem.Init(this);
            subsystems[name] = subsystem;
        }
        /// <summary>
        ///   Get the registered settings sub system
        /// </summary>
        /// <param name="kernel">Current <see cref="IKernelInternal" /> instance</param>
        /// <returns>Settings subsystem</returns>
        public static SettingsSubSystem GetSettingsSubSystem(this IKernelInternal kernel)
        {
            ISubSystem subSystem = kernel.GetSubSystem(SettingsSubSystem.SubSystemKey);

            if (subSystem != null)
            {
                return((SettingsSubSystem)subSystem);
            }

            SettingsSubSystem newSubSystem = new SettingsSubSystem();

            kernel.AddSubSystem(SettingsSubSystem.SubSystemKey, newSubSystem);

            return(newSubSystem);
        }
Exemplo n.º 7
0
 /// <summary>
 /// Initializes a new instance of the Connection class.
 /// </summary>
 /// <param name="socket">The socket upon which this connection is to be based.</param>
 /// <param name="connectionHost">The system hosting this connection.</param>
 public Connection(Socket socket, ISubSystem connectionHost)
 {
     this.Buffer = new StringBuilder();
     this.OutputBuffer = new OutputBuffer();
     this.Data = new byte[1];
     this.Terminal = new Terminal();
     this.socket = socket;
     var remoteEndPoint = (IPEndPoint)this.socket.RemoteEndPoint;
     this.CurrentIPAddress = remoteEndPoint.Address;
     this.ID = Guid.NewGuid().ToString();
     this.TelnetCodeHandler = new TelnetCodeHandler(this);
     // @@@ TODO: Paging row size should be dynamic; this WAS called BufferLength in
     //     discussion: http://www.wheelmud.net/Forums/tabid/59/aft/1600/Default.aspx
     this.PagingRowLimit = 40;
     this.connectionHost = connectionHost;
 }
Exemplo n.º 8
0
        /// <summary>
        /// Initializes a new instance of the Connection class.
        /// </summary>
        /// <param name="socket">The socket upon which this connection is to be based.</param>
        /// <param name="connectionHost">The system hosting this connection.</param>
        public Connection(Socket socket, ISubSystem connectionHost)
        {
            this.Buffer       = new StringBuilder();
            this.OutputBuffer = new OutputBuffer();
            this.Data         = new byte[1];
            this.Terminal     = new Terminal();
            this.socket       = socket;
            var remoteEndPoint = (IPEndPoint)this.socket.RemoteEndPoint;

            this.CurrentIPAddress = remoteEndPoint.Address;
            this.ID = Guid.NewGuid().ToString();
            this.TelnetCodeHandler = new TelnetCodeHandler(this);
            // @@@ TODO: Paging row size should be dynamic; this WAS called BufferLength in
            //     discussion: http://www.wheelmud.net/Forums/tabid/59/aft/1600/Default.aspx
            this.PagingRowLimit = 40;
            this.connectionHost = connectionHost;
        }
Exemplo n.º 9
0
        /// <summary>Initializes a new instance of the <see cref="Connection"/> class.</summary>
        /// <param name="socket">The socket upon which this connection is to be based.</param>
        /// <param name="connectionHost">The system hosting this connection.</param>
        public Connection(Socket socket, ISubSystem connectionHost)
        {
            this.Buffer       = new StringBuilder();
            this.OutputBuffer = new OutputBuffer();
            this.Data         = new byte[1];
            this.Terminal     = new Terminal();
            this.socket       = socket;
            var remoteEndPoint = (IPEndPoint)this.socket.RemoteEndPoint;

            this.CurrentIPAddress = remoteEndPoint.Address;
            this.ID = Guid.NewGuid().ToString();
            this.TelnetCodeHandler = new TelnetCodeHandler(this);

            // TODO: Paging row size should be dynamic from Telnet (NAWS?) or a player-chosen override.
            //       (This used to be called BufferLength in old discussions.)
            this.PagingRowLimit = 40;
            this.connectionHost = connectionHost;
        }
Exemplo n.º 10
0
        public virtual void AddSubSystem(string name, ISubSystem subsystem)
        {
            if (name == null)
            {
                throw new ArgumentNullException(nameof(name));
            }
            if (subsystem == null)
            {
                throw new ArgumentNullException(nameof(subsystem));
            }

            subsystem.Init(this);
            subsystems[name] = subsystem;
            if (name == SubSystemConstants.ConversionManagerKey)
            {
                ConversionSubSystem = (IConversionManager)subsystem;
            }
            else if (name == SubSystemConstants.NamingKey)
            {
                NamingSubSystem = (INamingSubSystem)subsystem;
            }
        }
Exemplo n.º 11
0
 public void AddSubsystem(ISubSystem <ICombatSystem> subSystem)
 {
     base.AddSubsystem(subSystem);
     subSystem.System = this;
 }
Exemplo n.º 12
0
 public void AddSubSystem(ISubSystem subSystem)
 {
     _subSystems.Add(subSystem);
 }
Exemplo n.º 13
0
 /// <summary>Allows the sub system host to receive an update when subscribed to this system.</summary>
 /// <param name="sender">The sender of the update.</param>
 /// <param name="msg">The message to be sent.</param>
 public void UpdateSubSystemHost(ISubSystem sender, string msg)
 {
     this.host.UpdateSystemHost(this, msg);
 }
Exemplo n.º 14
0
 public void RegisterSubsystem(ISubSystem subSystem)
 {
     SubSystems.Add(subSystem);
 }
Exemplo n.º 15
0
 public FacadeBase(ISubSystem subSystem)
 {
     _subSystem = subSystem;
 }
Exemplo n.º 16
0
 /// <summary>
 /// 处理消息
 /// </summary>
 /// <param name="system"></param>
 /// <param name="message"></param>
 public void Handle(ISubSystem system, string message)
 {
     system.Handle(message);
 }
Exemplo n.º 17
0
 public void AddSubSystem(string name, ISubSystem subsystem)
 {
     throw new NotImplementedException();
 }
Exemplo n.º 18
0
 protected void RemoveSubsystem(ISubSystem subSystem)
 {
     _subsystems.Remove(subSystem);
 }
Exemplo n.º 19
0
 public void RemoveSubsystem(ISubSystem <ICombatSystem> subSystem)
 {
     base.RemoveSubsystem(subSystem);
     subSystem.System = default;
 }
Exemplo n.º 20
0
 /// <summary>Allows the sub system host to receive an update when subscribed to this system.</summary>
 /// <param name="sender">The sender of the update.</param>
 /// <param name="message">The message to send to the host.</param>
 public void UpdateSubSystemHost(ISubSystem sender, string message)
 {
 }
Exemplo n.º 21
0
 public FacadeBase(ISubSystem subSystem)
 {
     _subSystem = subSystem;
 }
Exemplo n.º 22
0
 /// <summary>
 /// Allows the sub system host to receive an update when subscribed to this system.
 /// </summary>
 /// <param name="sender">The sender of the update.</param>
 /// <param name="msg">The message to be sent.</param>
 public void UpdateSubSystemHost(ISubSystem sender, string msg)
 {
     this.host.UpdateSystemHost(this, msg);
 }
Exemplo n.º 23
0
 /// <summary>Allows the sub system host to receive an update when subscribed to this system.</summary>
 /// <param name="sender">The sender of the update.</param>
 /// <param name="message">The message to send to the host.</param>
 public void UpdateSubSystemHost(ISubSystem sender, string message)
 {
 }
Exemplo n.º 24
0
 public void RegisterSubSystem(ISubSystem subSystem)
 {
     _internalSystems.Add(subSystem);
     Log.Log("Internal system (subsystem) was registred, name: " + subSystem.SystemName);
 }