Author Topic: How to identifies f3d file is correct or not  (Read 154 times)

JK @   «   on: July 09, 2012, 02:57:59 AM »
Hi all,  i have changed .txt or any other file to .f3d file manually , And try to load this f3d file, then it shows the error.so, how to check the f3d file is correct or not?  i want to show one alert message to the user those who try to load invalid f3d file.. I know this is not important question, but in my project this is very important.. anyone please help me...... 

Ivan Vodopiviz   «   Reply #1 on: July 10, 2012, 11:25:38 AM »
Hi,

What kind of error does it throw when you try to load an invalid file?

Regards,

JK @   «   Reply #2 on: July 11, 2012, 03:02:58 AM »
Hi Ivan, Thanku for the reply, The error msgs are,

Error: Invalid file format.
at flare.loaders::Flare3DLoader2/loadBytes()[Z:\\projects\\flare3d2\\src\\flare\\loaders\\Flare3DLoader2.as:191]
at flare.loaders::Flare3DLoader2/completeEvent()[Z:\\projects\\flare3d2\\src\\flare\\loaders\\Flare3DLoader2.as:151]

Ivan Vodopiviz   «   Reply #3 on: July 13, 2012, 10:06:56 AM »
Hi,

The problem with this is that the loading routine streams several parts of the model, so throwing specific exceptions at any point is a little hard. One way we found is to avoid the streaming and using a Loader by hand so you can "catch" the error when calling load(). You can find an example here. I tested it with an hex-edited model and seemed to work.

The other thing I can think of is checksumming each file when deploying your app / game and then  checking checksums while loading. If the checksums don't match, the file is corrupted and you shouldn't try to load it.

Hope this helps,

JK @   «   Reply #4 on: July 16, 2012, 07:01:10 AM »
Hi Ivan,
Thank u for the reply. But it doesn't work in my project, Because i am using scene.addChildFromFile( "Test.f3d" ); instead of 
_loader.load();
I have tried the "try catch" method like this,
try
{
    scene.addChildFromFile( objectToLoad );
}
catch( e:Error )
{
    trace( "An error ocurred:", e.message );
}

But still it showing the same Error message...:(

And the second method, i don't know how to checksumming and our application is not focusing on a particular object. so i think second method is not helpful for me.

can you please suggest any other solution?


Ivan Vodopiviz   «   Reply #5 on: July 16, 2012, 11:09:51 AM »
I'm afraid not. Changing the loading routine seems like the easiest way at the moment. Still, I'd like to see if there's something on our side we can do to aleviate this issue, but I can't promise anything.

Cheers,