private void GetServerCommandBytes(ref List <byte> oBytes) { int numCommands = _serverCommands.Count; for (int i = 0; i < numCommands; i++) { ServerCommand command = _serverCommands[i]; if (command == null) { i--; continue; } oBytes.AddRange(BitConverter.GetBytes((int)PacketType.ServerCommand)); byte[] bytes = command.GetBytes(); oBytes.AddRange(BitConverter.GetBytes(bytes.Length)); oBytes.AddRange(bytes); } _serverCommands.RemoveRange(0, numCommands); }