Public bool readzfsfile (string zfsfile)
{
Try
{
Filestream FS = new filestream (zfsfile, filemode. Open, fileaccess. Read );
Binaryreader r = new binaryreader (FS );
// File Header
R. readbytes (0x1d );
Int mapoffset = R. readint32 ();
R. readint32 ();
Int CNT = R. readint32 ();
Mapoffset + = 23;
For (INT I = 0; I <CNT; I ++)
{
// File table
FS. Seek (mapoffset, seekorigin. Begin );
Int namelen = R. readint32 ();
Char [] Name = R. readchars (namelen );
Int fileoffset = R. readint32 ();
Int filesize = R. readint32 ();
Mapoffset + = namelen + 44;
// File
FS. Seek (fileoffset, seekorigin. Begin );
String file = new string (name );
String dir = path. getdirectoryname (File );
If (dir. length> 0) directory. createdirectory (DIR );
Filestream fw = new filestream (file, filemode. createnew );
Binarywriter W = new binarywriter (FW );
Byte [] con = R. readbytes (filesize );
W. Write (CON );
W. Close ();
FW. Close ();
}
FS. Close ();
Return true;
}
Catch (exception E)
{
MessageBox. Show (E. Message );
Return false;
}
// Usage:
If (readzfsfile ("gameworld_server.pak "))
{
MessageBox. Show ("successful ");
}