/// <summary>
        ///     messages
        ///     Writes the recieved data to the console. depending on what kind of data it is. Does it do differnt things
        /// </summary>
        /// <param name="data">object data</param>
        public override void dataReceived(object data)
        {
            if (data is Commands)
            {
                switch ((Commands)data)
                {
                case Commands.AUTHENTICATIONDENIED:
                    loginResponse = LoginResponse.Denied;
                    break;

                case Commands.AUTHENTICATIONINUSE:
                    loginResponse = LoginResponse.AccountAlreadyInUse;
                    break;

                case Commands.AUTHENTICATIONCORRECT:
                    loginResponse = LoginResponse.Accepted;
                    break;

                case Commands.AUTHENTICATIONRIGHTSINCORRECT:
                    loginResponse = LoginResponse.AcountBanned;
                    break;


                case Commands.BREAKCONNECTION:
                    connectionCloseNotifier.Invoke();
                    sendData(Commands.BREAKCONNECTION);
                    break;
                }
            }


            if (data is Message)
            {
                var message = (Message)data;
                switch (message.parameter)
                {
                case Commands.ALLCONNECTED:
                    ConnectionsUpdate.Invoke((List <ClientIdentifier>)message.sendObject);
                    break;

                case Commands.HISTORYSESSIONS:
                    historyNotifier.Invoke((List <HistoryStats>)message.sendObject);
                    break;

                case Commands.AUTHENTICATIONRIGHTSINCORRECT:
                    serverGranted = ((Authentication)message.sendObject).rights;
                    break;
                }
            }


            if (data is TextMessage)
            {
                var message = (TextMessage)data;
                messages.Add(message);
                MessageNotifier.Invoke(filter());
            }
        }
Exemplo n.º 2
0
 public ClientIdentifier(int severId, string name, Authentication.Rights rights)
 {
     serverID    = severId;
     this.name   = name;
     this.rights = rights;
 }
Exemplo n.º 3
0
 public HistoryIdentifier(int severId, string name, Authentication.Rights type) : base(severId, name, type)
 {
 }
Exemplo n.º 4
0
 public static bool checkRights(Commands toExecute, Authentication.Rights rights)
 {
     return(rights <= rightsNeeded[(int)toExecute]);
 }