private void SerializeNavigatorPopularRooms(ref ServerMessage reply, KeyValuePair<RoomData, int>[] rooms, int Category) { reply.AppendInt32(rooms.Length); int i = 0; foreach (KeyValuePair<RoomData, int> pair in rooms) { RoomData data = pair.Key; if (data.Category.Equals(Category)) { data.Serialize(reply, false); i++; } else continue; } //Logging.WriteLine("Rooms in this category: " + i); reply.setInt(i, 8 + Category.ToString().Length); reply.AppendBoolean(false); }