Esempio n. 1
0
        public void HandlePaket(PaketType type, byte[] content, int id)
        {
            //Bei einem IsAliveRequest der Timer dieses Threads zurücksetzen
            if(type == PaketType.IsAliveRequest)
            {
                _timeouthandler.HandleMessage(content, id);
                return;
            }

            lock (_modules)
            {
            IModuleHandler module = _modules.Where<IModuleHandler>(x => x.HandleType == type).FirstOrDefault();
            if (module != null)
            {
                lock (module)
                {
                module.HandleMessage(content, id, _socket);
                }
            }
            else
                throw new ModuleNotImplementedException(type.ToString());
            }
        }
Esempio n. 2
0
 public int translateType(PaketType type)
 {
     switch (type)
         {
             case PaketType.ConnectionInfo:
                 return ConnectionInfo;
             case PaketType.NewPlayerInfo:
                 return NewPlayerInfo;
             case PaketType.UserInformInfo:
                 return UserInformInfo;
             case PaketType.IsAliveRequest:
                 return IsAliveRequest;
             case PaketType.FileUpload:
                 return FileUpload;
             case PaketType.TableUpload:
                 return TableUpload;
             case PaketType.Message:
                 return Message;
             case PaketType.PersonalMessage:
                 return PersonalMessage;
             default:
                 throw new TypeNotKnownException("Unbekannter Typ: " + type.ToString());
         }
 }