public int ProcessReceivedPacket(IBitStream stream) { uint val1 = stream.ReadBits(1); if (val1 != 1) { return(1); } uint numberOfEvents = stream.ReadBits(8); uint someVal2 = stream.ReadBits(5); uint action2 = stream.ReadBits(1); uint d = 0; while (numberOfEvents > 0) { try { IGameEvent eventInstance = ReadGameEvent(stream, true); eventInstance.Process(Client); } catch (Exception) { } numberOfEvents--; } return(0); }