MineViewer.SMPInterface.RespondWorker C# (CSharp) Méthode

RespondWorker() private static méthode

Respond to the incomming stuff.
private static RespondWorker ( ) : void
Résultat void
        private static void RespondWorker()
        {
            byte LastOPCode = 0;
            while (true)
            {

                byte OperationCode = (byte)PacketTypes.KeepAlive;

                if (Connection.Available == 0)
                    continue;
                try
                {
                    OperationCode = Reader.ReadByte();
                }
                catch
                {
                    continue;
                }
                /*
                if(OperationCode != (byte)PacketTypes.KeepAlive &&
                    OperationCode != (byte)PacketTypes.PreChunk &&
                    OperationCode != (byte)PacketTypes.Chunk)
                    SMPInterface.Debug("Packet Opcode: " + OperationCode.ToString("X8") + "\n");
                */
                Action act;
                if (Subscribers.TryGetValue(OperationCode, out act))
                    act.Invoke();
                else
                {
                    int len = PacketTypeLengths[OperationCode];
                    if (len == 0)
                    {
                        byte[] data = Reader.ReadBytes(100);
                        throw new Exception("Unhandeled packet: " + OperationCode.ToString("X8"));
                    }
                    Reader.ReadBytes(len);
                }
                LastOPCode = OperationCode;
            }
        }