File format check
by Ronald J Nelson · in Torque Game Engine · 09/02/2008 (9:28 pm) · 4 replies
Is there some sort of check I can do that verifies that a png is a valid png file? I am trying to prevent false files from being transferred.
I would really prefer something script based, I figure there is already something there, I am just not aware of it yet.
I would really prefer something script based, I figure there is already something there, I am just not aware of it yet.
#2
09/03/2008 (6:50 am)
Well CRC is good for checking if two files are the same but not really good for seeing if the file is truly a valid file of the type it is claiming to be.
#3
I'm not sure if there is code in the engine to actually validate a png file, without researching it.
09/03/2008 (7:59 am)
I took your question wrong, I thought you were trying to make sure people couldn't change your image assets to gain an advantage. I'm not sure if there is code in the engine to actually validate a png file, without researching it.
#4
09/04/2008 (9:32 am)
Well I figured out a console function to do this, I just checked to make sure the file is either RGB or RGBA. Since I am only using PNG files for this portion of my work, the check works very well and actually worked better than I hoped. You can't even rename another image type's extension without it catching it.
Torque 3D Owner Bruce Wallace