/// <summary>
        /// Initializes a new instance of the <see cref="UserConnection" /> class.
        /// </summary>
        /// <param name="player">The player.</param>
        /// <param name="currentConnection">The current connection.</param>
        /// <param name="bufferSize">Size of the buffer.</param>
        internal UserConnection(IPlayer player, Socket currentConnection, int bufferSize, ICommandProcessedEventFactory commandProcessor)
        {
            this.bufferSize       = bufferSize;
            this.buffer           = new byte[this.bufferSize];
            this.currentData      = new List <string>();
            this.lastChunk        = string.Empty;
            this.socket           = currentConnection;
            this.Connection       = socket;
            this.commandProcessor = commandProcessor;

            player.Deleting += this.DisconnectPlayer;
        }
Exemple #2
0
 public CommandRequestData(string commandData, IPlayer target, ICommandProcessedEventFactory commandProcessedFactory)
 {
     this.Target                  = target;
     this.CommandData             = commandData;
     this.CommandProcessorFactory = commandProcessedFactory;
 }
Exemple #3
0
        /// <summary>
        /// Creates the client connection.
        /// </summary>
        /// <param name="player">The player to associate the connection to.</param>
        /// <param name="server">The server that the connection communicates twith.</param>
        /// <returns>Returns an instance of IConnection</returns>
        public IConnection CreateConnection(IPlayer player, StandardServer server, ICommandProcessedEventFactory commandProcessedFactory)
        {
            Socket playerConnection = server.GetSocketForPlayer(player);

            return(new UserConnection(player, playerConnection, server.Configuration.PreferedBufferSize, commandProcessedFactory));
        }
 public CommandRequestedMessage(string commandData, IPlayer target, ICommandProcessedEventFactory commandProcessedFactory)
 {
     base.Content = new CommandRequestData(commandData, target, commandProcessedFactory);
 }