Esempio n. 1
0
        /// <summary>
        /// creates a wrapper around the core Session, which is able to convert the packet data used
        /// in the battlefield 3 protocol into normal bytes
        /// </summary>
        /// <param name="session"></param>
        /// <param name="server"> </param>
        public PacketSession(IRconSession session, Battlefield3Server server)
        {
            Session = session;
            Server = server;
            PacketSerializer = new PacketSerializer();
            PacketSequence = new PacketSequence();
            EventsSent = new List<Packet>();

            // create the hash value for validating crypted password
            HashValue = Guid.NewGuid().ToString().Replace("-", string.Empty);

            this.CommandHandlersList = new CommandHandlersList();
            this.CommandHandlersList.Add(new MapListCommandHandlers());
            this.CommandHandlersList.Add(new BanListCommandHandlers());
            this.CommandHandlersList.Add(new VarsCommandHandlers());
            this.CommandHandlersList.Add(new ReservedSlotsListCommandHandlers());
            this.CommandHandlersList.Add(new AdminCommandHandlers());
            this.CommandHandlersList.Add(new NotAuthenticatedCommandHandlers(server.ServiceLocator));

            this.ClientCommandReceived += CommandHandlersList.OnCommandReceived;
            this.ServerEventResponseReceived += OnServerEventResponseReceived;

            if (session != null)
            {
                Session.DataReceived += OnDataReceived;
                Session.DataSent += OnDataSent;
                Session.Closed += SessionOnClosed;
            }
        }
Esempio n. 2
0
 public ClientEventArgs(IRconSession session)
 {
     this.Session = session;
 }
Esempio n. 3
0
 public SessionEventArgs(IRconSession irConSession)
 {
     this.IrConSession = irConSession;
 }
Esempio n. 4
0
 public bool Equals(IRconSession other)
 {
     if (ReferenceEquals(null, other)) return false;
     if (ReferenceEquals(this, other)) return true;
     return other.Uid.Equals(Uid);
 }
Esempio n. 5
0
        private void InvokeClientConnected(IRconSession irConSession)
        {
            if (ClientConnected == null) return;

            ClientConnected.InvokeAll(this, new ClientEventArgs(irConSession));
        }