If you have it too long with too many bends you will be creating a fire hazzard. You need to be able to clean out that dryer vent. If you have it running 15' one way and 10' another with 90 degree turns, then you might run into fire safty issues. If you can put it up against an outside wall, make your hole there on the second story. This will save you money, reduce fire risk greatly, and you wont have to pay a small fortune to have someone run a 30' snake to clean it every year.
Before you do anything, you must figure out where it goes. It really has to vent outside. If it vents into the attic, you are going to have serious issues, including the potential of mold and rot as the hot, moist air is vented into an unconditioned space. It is (usually) against building codes to vent into the attic for this reason.
If it is venting through a roof or soffit vent, or out a wall, you're probably okay. It's best to keep runs as short as possible and with as few bends as possible. Dryer lint building up in the pipe can pose a fire hazard, so the shorter and straighter it is, the less chance there is to have anything build up, and the easier it is to clean out if needed.
Assuming it's vented properly, then I think boxing it in with drywall is a great way to go, and in fact is exactly what I did (in the corner):
![enter image description here](https://i.stack.imgur.com/V8v70.jpg)
You should also consider an in-line lint trap (I probably would have put one in if I knew about them):
![enter image description here](https://i.stack.imgur.com/qPI79.jpg)
I'd also recommend using straight vent pipe where possible, as it is smooth inside which reduces the opportunity for lint to attach and block the pipe. The rigid stuff you have is alright (way better than the white plastic crap) but it is still ridged inside.
![enter image description here](https://i.stack.imgur.com/L5fPt.jpg)
Best Answer
I can't answer whether it complies with code or not since that depends on where you are, but I doubt it would matter.
It's compressed some, but the volume is the same; it's just a different shape, and only slightly at that. Codes regarding airflow (and water flow) issues are mostly concerned with turns. A 90 degree angle will limit airflow whereas a larger radius bend would not, but the straight runs are rarely if ever a problem.