Exemplo n.º 1
0
        private static void ServerPacketsProcessor(AuthenticationServer ui)
        {
            //TODO: make it work for multiple servers, we need a list holding fragments for different servers and logic to manage it.
            Fragmentation fragment = new Fragmentation(8192);

            while (_continueServerProcessing)
            {
                PacketContainer cont;
                if (_queuedServerPackets.TryDequeue(out cont))
                {

                    PacketsProcessor dataProcessor = new PacketsProcessor();
                    dataProcessor.ExtractPackets(cont, ref fragment);
                    foreach (PacketContent p in cont.extractedPackets)
                    {
                        GameServer.Received(ui, p, GetServerByIndex(cont.serverID));
                    }
                }
                else
                {
                    Thread.Sleep(5);
                }
            }
        }
 public AccountsManager(AuthenticationServer form)
 {
     this.form = form;
 }
Exemplo n.º 3
0
 public void SetUI(AuthenticationServer ui)
 {
     this.ui = ui;
 }
Exemplo n.º 4
0
 public static void Received(AuthenticationServer form, PacketContent pc, ServerDetails serverDetails)
 {
     _form = form;
     GameRecvPackets msgType = (GameRecvPackets)pc.GetMsgType();
     switch (msgType)
     {
         case GameRecvPackets.RegisterServer:
             RegisterServer(pc, serverDetails);
             break;
         case GameRecvPackets.UpdatePlayer:
             PreSavePlayer(pc);
             break;
         case GameRecvPackets.PlayerAcknowledged:
             CheckAdmission(pc);
             break;
         case GameRecvPackets.BeginPlayerUpdate:
             updatingPlayers = true;
             break;
         case GameRecvPackets.FinishPlayerUpdate:
             if (updatedPlayerList.Length == 0) return;
             updatedPlayerList = updatedPlayerList.Remove(updatedPlayerList.Length - 2, 2);
             appendLog("Saved accounts & banks for:\n" + updatedPlayerList);
             updatingPlayers = false;
             updatedPlayerList = "";
             SendServer_SaveConfirmation(serverDetails);
             break;
         default:
             break;
     }
 }