| View previous topic :: View next topic |
| Author |
Message |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Thu Mar 11, 2004 11:58 pm Post subject: Anyway to know if filesize changed by without knowing its or |
|
|
I have files that get corrupted from time to time, and the file size changes to a much smaller size(but unpredictible filesize).
Is there a way to read the corrupted file and find out what its original filesize was?
The file extension is .WDG and is a map for a game.
Thanks for reading this.. |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Fri Mar 12, 2004 12:08 am Post subject: |
|
|
You can use @file() with the "Z" parameter to check a file's size.
| Code: |
if @file(c:\gamefiles\mywidget.wdg)
INFO File size is @file(c:\gamefiles\mywidget.wdg, Z)
end
|
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Fri Mar 12, 2004 12:13 am Post subject: |
|
|
OOPS...
Sorry, I just realized you want the original info after the
file is changed.
The only way I know to do this is write the original file size
to a file or reg key and check the current size against that.
Not sure how accurate any of this will be if the file is
corrupted though.
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Fri Mar 12, 2004 3:05 am Post subject: |
|
|
Yeah, theres 100's of maps too, so I guess I'll have to register each map manually or with the program probably be easier and more acurate, plus It will have to detect what OS since they read a bit differently.
What happens is when the custom homemade map is downloaded in the game menu, some people impatiently cancel the download and the map file is at whatever size downloaded, and is spread to posibly other players.
I was wondering if there was a way to get(or use) the file property tags below somehow to tell if the map file it was corrupted recently:
< File Properties: >
Created:
Modified:
Accessed: |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Fri Mar 12, 2004 4:44 am Post subject: |
|
|
You could append a signature at the end of the file. Your prog
could check for this (with file IO) to validate the file is intact.
This method or a CRC check (I have no clue about CRC) is
prolly the most easy/accurate.
Otherwise you prolly would need a master list to avoid errors
caused by stopping the map downloads. Not sure what the diff
is on different OS file systems, but there's prolly routines for
checking that on the net.
BTW, a text file (.dat or whatever) with each filename|size
can be made fairly easy using the LIST FILELIST command
and a loop. You can use @match() to find the filename, and
then parse the item to get the original size.
__________________________________________________________________________________________________
| Code: |
LIST CREATE, 1
DIRECTORY CHANGE, c:\gamefiles
rem -- NOT using full path loads filenames only (no path) --
LIST FILELIST, 1, *.wdg
%x = 0
REPEAT
%%item = @item(1, %x)
LIST PUT, 1, %%item"|"@file(%%item, Z)
%x = @succ(%x)
UNTIL @equal(%x, @count(1))
LIST SAVEFILE, 1, c:\gamefiles\widgets.dat
|
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Fri Mar 12, 2004 5:19 am Post subject: |
|
|
Yes, I allready have the Filelist loopy, and its more complicated than the one you just posted, because the games MODs and Game updates /etc. are also same file EXT .WDG, and I'm pritty sure the game would reject and CRC added.
I think I'll go with the master log because most stick to 3 or 4 popular maps and if a map wasnt on the master list the program could suggest deleted the un-certified map.
I'll prolly have to Dialog LIST BOX's:
(LEFT window = maps that are OK)
(RIGHT window = map unknown
Thats the main thing to protect the most POPULAR maps, because many people attempt to make maps and they are failures, hehe.
Thanks for helping me with this MAC, appreciate you even reading all this  |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Fri Mar 12, 2004 7:23 am Post subject: |
|
|
You're welcome - let us know if/when/how ya solve the problem.
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
Protected Valued Contributor


Joined: 02 Jan 2001 Posts: 228 Location: Portugal
|
Posted: Fri Mar 12, 2004 9:27 am Post subject: |
|
|
| CRC would be a nice method (I know it works good), even though it might not be worth the work - it would be better if the files didn't get corrupted, to begin with := Are they maps from a game coded by you? Shouldn't you just try to fix the code, if that's the case? |
|
| Back to top |
|
 |
Mac Professional Member

Joined: 08 Jul 2000 Posts: 1585 Location: Oklahoma USA
|
Posted: Fri Mar 12, 2004 10:07 am Post subject: |
|
|
Protected, I think the problem is when users only partially
download some of his files...
| vtol777 wrote: |
What happens is when the custom homemade map is downloaded in the game menu, some people impatiently cancel the download and the map file is at whatever size downloaded, and is spread to posibly other players.
|
Cheers, Mac  _________________ VDSug.dll does file IO, check/disable menu items,
non-VDS dlls, draw functions and more...
Free download (30k dll size) at:
http://www.vdsworld.com/download.php?id=361
 |
|
| Back to top |
|
 |
vtol Valued Contributor


Joined: 05 Feb 2004 Posts: 656 Location: Eastern Indiana
|
Posted: Fri Mar 12, 2004 9:16 pm Post subject: |
|
|
naa, its a popular game (that I had nothing to do with - I just make maps MODs and utilitys for the game.) source code not released.
They went outta business 5 years ago right after game was finished, and it has a bad downloader for maps(don't work so good).
So I can't fix anything, I just have to work around the problem.
Thanks for the help guys, appreciate it. |
|
| Back to top |
|
 |
|